mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 19:22:53 +01:00
Auto-sort when saving word to user dic
This commit is contained in:
parent
1881e3d8c9
commit
2502774fb3
@ -2002,9 +2002,23 @@ namespace Nikse.SubtitleEdit.Logic
|
|||||||
else
|
else
|
||||||
userWords.LoadXml("<words />");
|
userWords.LoadXml("<words />");
|
||||||
|
|
||||||
|
var words = new List<string>();
|
||||||
|
foreach (XmlNode node in userWords.DocumentElement.SelectNodes("word"))
|
||||||
|
{
|
||||||
|
string w = node.InnerText.Trim();
|
||||||
|
if (w.Length > 0)
|
||||||
|
words.Add(w);
|
||||||
|
}
|
||||||
|
words.Add(word);
|
||||||
|
words.Sort();
|
||||||
|
|
||||||
|
userWords.DocumentElement.RemoveAll();
|
||||||
|
foreach (string w in words)
|
||||||
|
{
|
||||||
XmlNode node = userWords.CreateElement("word");
|
XmlNode node = userWords.CreateElement("word");
|
||||||
node.InnerText = word;
|
node.InnerText = w;
|
||||||
userWords.DocumentElement.AppendChild(node);
|
userWords.DocumentElement.AppendChild(node);
|
||||||
|
}
|
||||||
userWords.Save(userWordsXmlFileName);
|
userWords.Save(userWordsXmlFileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user