mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DatFIle] Fix odd bucketing behavior
This commit is contained in:
@@ -1457,18 +1457,22 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// Get the unsorted current list
|
// Get the unsorted current list
|
||||||
List<DatItem> roms = this[key];
|
List<DatItem> roms = this[key];
|
||||||
|
|
||||||
// Now add each of the roms to their respective games
|
// Now add each of the roms to their respective keys
|
||||||
foreach (DatItem rom in roms)
|
for (int i = 0; i < roms.Count; i++)
|
||||||
{
|
{
|
||||||
|
DatItem rom = roms[i];
|
||||||
|
|
||||||
// We want to get the key most appropriate for the given sorting type
|
// We want to get the key most appropriate for the given sorting type
|
||||||
string newkey = GetKey(rom, bucketBy, lower, norename);
|
string newkey = GetKey(rom, bucketBy, lower, norename);
|
||||||
|
|
||||||
// Add the DatItem to the dictionary
|
// If the key is different, move the item to the new key
|
||||||
|
if (newkey != key)
|
||||||
|
{
|
||||||
Add(newkey, rom);
|
Add(newkey, rom);
|
||||||
|
Remove(key, rom);
|
||||||
|
i--; // This make sure that the pointer stays on the correct since one was removed
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finally, remove the entire original key
|
|
||||||
Remove(key);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3371,7 +3375,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
key = item.Type.ToString();
|
key = item.Type.ToString();
|
||||||
break;
|
break;
|
||||||
case ItemType.Disk:
|
case ItemType.Disk:
|
||||||
key = ((Disk)item).MD5;
|
key = ((Disk)item).MD5 ?? ((Disk)item).SHA1;
|
||||||
break;
|
break;
|
||||||
case ItemType.Rom:
|
case ItemType.Rom:
|
||||||
key = ((Rom)item).Size + "-" + ((Rom)item).CRC;
|
key = ((Rom)item).Size + "-" + ((Rom)item).CRC;
|
||||||
|
|||||||
Reference in New Issue
Block a user