[DatFile] Add a lock and some comments

This commit is contained in:
Matt Nadareski
2017-03-01 20:00:21 -08:00
parent 7a26f5a6fe
commit e4b6e8307d

View File

@@ -56,6 +56,7 @@ namespace SabreTools.Helper.Dats
{ {
string newkey = ""; string newkey = "";
// We want to get the key most appropriate for the given sorting type
switch (bucketBy) switch (bucketBy)
{ {
case SortedBy.CRC: case SortedBy.CRC:
@@ -113,12 +114,16 @@ namespace SabreTools.Helper.Dats
break; break;
} }
// Add the DatItem to the temp dictionary
lock (sortable)
{
if (!sortable.ContainsKey(newkey)) if (!sortable.ContainsKey(newkey))
{ {
sortable.Add(newkey, new List<DatItem>()); sortable.Add(newkey, new List<DatItem>());
} }
sortable[newkey].Add(rom); sortable[newkey].Add(rom);
} }
}
}); });
// Now go through and sort all of the individual lists // Now go through and sort all of the individual lists