mirror of
https://github.com/greenshot/greenshot
synced 2025-07-16 10:03:44 -07:00
always sort entries alphabetically by key when saving (for better comparability of xml output)
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2018 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
08cff30e61
commit
079d460a33
1 changed files with 8 additions and 4 deletions
|
@ -262,7 +262,10 @@ namespace GreenshotLanguageEditor {
|
|||
|
||||
ICollectionView view = (ICollectionView)LanguageGrid.ItemsSource;
|
||||
IList<LanguageEntry> entries = (IList<LanguageEntry>)view.SourceCollection;
|
||||
|
||||
|
||||
List<LanguageEntry> sortList = new List<LanguageEntry>(entries);
|
||||
sortList.Sort(compareEntryKeys);
|
||||
|
||||
using (XmlTextWriter xmlWriter = new XmlTextWriter(savePath, Encoding.UTF8)) {
|
||||
xmlWriter.Formatting = Formatting.Indented;
|
||||
xmlWriter.Indentation = 1;
|
||||
|
@ -274,7 +277,7 @@ namespace GreenshotLanguageEditor {
|
|||
xmlWriter.WriteAttributeString("version", langfile.Version);
|
||||
xmlWriter.WriteAttributeString("languagegroup", langfile.Languagegroup);
|
||||
xmlWriter.WriteStartElement("resources");
|
||||
foreach(LanguageEntry entry in entries) {
|
||||
foreach(LanguageEntry entry in sortList) {
|
||||
string entryValue = (targetColumn == 1) ? entry.Entry1 : entry.Entry2;
|
||||
if(!String.IsNullOrWhiteSpace(entryValue) && !String.IsNullOrWhiteSpace(entry.Key)) {
|
||||
xmlWriter.WriteStartElement("resource");
|
||||
|
@ -289,8 +292,9 @@ namespace GreenshotLanguageEditor {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private int compareEntryKeys(LanguageEntry a, LanguageEntry b) {
|
||||
return a.Key.CompareTo(b.Key);
|
||||
}
|
||||
}
|
||||
|
||||
public class LanguageEntry : IEditableObject, INotifyPropertyChanged {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue