Create and use SortedKeys

This commit is contained in:
Matt Nadareski
2020-07-26 21:00:30 -07:00
parent 0112821a72
commit efc90457e5
18 changed files with 49 additions and 83 deletions

View File

@@ -239,6 +239,20 @@ namespace SabreTools.Library.DatFiles
DatHeader.Type = type;
}
/// <summary>
/// Get the keys in sorted order from the file dictionary
/// </summary>
/// <returns>List of the keys in sorted order</returns>
public List<string> SortedKeys
{
get
{
var keys = Items.Keys.ToList();
keys.Sort(new NaturalComparer());
return keys;
}
}
/// <summary>
/// Ensure the key exists in the items dictionary
/// </summary>
@@ -1335,8 +1349,8 @@ namespace SabreTools.Library.DatFiles
// Now, loop through the dictionary and populate the correct DATs
watch.Start("Populating all output DATs");
List<string> keys = Keys;
List<string> keys = Keys;
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
{
List<DatItem> items = DatItem.Merge(this[key]);