[SimpleSort] Make sorting more traditional

This commit is contained in:
Matt Nadareski
2016-09-17 18:23:15 -07:00
parent 25e521d50d
commit 92330940f7

View File

@@ -419,7 +419,7 @@ namespace SabreTools.Helper
} }
/// <summary> /// <summary>
/// Wrap adding a file to the dictionary in custom DFD /// Wrap adding a file to the dictionary in custom DFD, files that matched a skipper a prefixed with "HEAD::"
/// </summary> /// </summary>
/// <param name="file">Name of the file to attempt to add</param> /// <param name="file">Name of the file to attempt to add</param>
/// <param name="matchdat">Reference to the Dat to add to</param> /// <param name="matchdat">Reference to the Dat to add to</param>
@@ -438,15 +438,16 @@ namespace SabreTools.Helper
rom.Machine.Name = Path.GetDirectoryName(Path.GetFullPath(file)); rom.Machine.Name = Path.GetDirectoryName(Path.GetFullPath(file));
// Add the rom information to the Dat // Add the rom information to the Dat
if (matchdat.Files.ContainsKey(rom.Machine.Name.ToLowerInvariant())) string key = rom.HashData.Size + "-" + rom.HashData.CRC;
if (matchdat.Files.ContainsKey(key))
{ {
matchdat.Files[rom.Machine.Name.ToLowerInvariant()].Add(rom); matchdat.Files[key].Add(rom);
} }
else else
{ {
List<Rom> temp = new List<Rom>(); List<Rom> temp = new List<Rom>();
temp.Add(rom); temp.Add(rom);
matchdat.Files.Add(rom.Machine.Name.ToLowerInvariant(), temp); matchdat.Files.Add(key, temp);
} }
// Now attempt to see if the file has a header // Now attempt to see if the file has a header
@@ -463,15 +464,16 @@ namespace SabreTools.Helper
romNH.Machine.Name = rom.Machine.Name; romNH.Machine.Name = rom.Machine.Name;
// Add the rom information to the Dat // Add the rom information to the Dat
if (matchdat.Files.ContainsKey(romNH.Machine.Name.ToLowerInvariant())) key = romNH.HashData.Size + "-" + romNH.HashData.CRC;
if (matchdat.Files.ContainsKey(key))
{ {
matchdat.Files[romNH.Machine.Name.ToLowerInvariant()].Add(romNH); matchdat.Files[key].Add(romNH);
} }
else else
{ {
List<Rom> temp = new List<Rom>(); List<Rom> temp = new List<Rom>();
temp.Add(romNH); temp.Add(romNH);
matchdat.Files.Add(romNH.Machine.Name.ToLowerInvariant(), temp); matchdat.Files.Add(key, temp);
} }
} }