[DatFIle] Fix bucketing

This commit is contained in:
Matt Nadareski
2017-12-21 16:10:18 -08:00
parent 417aafe746
commit 81886d23ba

View File

@@ -1312,7 +1312,7 @@ namespace SabreTools.Library.DatFiles
} }
/// <summary> /// <summary>
/// Remove a value from the file dictionary if it exists /// Remove the first instance of a value from the file dictionary if it exists
/// </summary> /// </summary>
/// <param name="key">Key in the dictionary to remove from</param> /// <param name="key">Key in the dictionary to remove from</param>
/// <param name="value">Value to remove from the dictionary</param> /// <param name="value">Value to remove from the dictionary</param>
@@ -1330,7 +1330,7 @@ namespace SabreTools.Library.DatFiles
lock (_items) lock (_items)
{ {
// While the key is in the dictionary and the item is there, remove it // While the key is in the dictionary and the item is there, remove it
while (_items.ContainsKey(key) && _items[key].Contains(value)) if (_items.ContainsKey(key) && _items[key].Contains(value))
{ {
// Remove the statistics first // Remove the statistics first
_datStats.RemoveItem(value); _datStats.RemoveItem(value);
@@ -1416,7 +1416,6 @@ namespace SabreTools.Library.DatFiles
// Get the unsorted current list // Get the unsorted current list
List<DatItem> roms = this[key]; List<DatItem> roms = this[key];
bool currentkey = false;
// Now add each of the roms to their respective keys // Now add each of the roms to their respective keys
for (int i = 0; i < roms.Count; i++) for (int i = 0; i < roms.Count; i++)
@@ -1429,7 +1428,6 @@ namespace SabreTools.Library.DatFiles
// If the key is different, move the item to the new key // If the key is different, move the item to the new key
if (newkey != key) if (newkey != key)
{ {
currentkey = true;
Add(newkey, rom); Add(newkey, rom);
Remove(key, rom); Remove(key, rom);
i--; // This make sure that the pointer stays on the correct since one was removed i--; // This make sure that the pointer stays on the correct since one was removed