[Structs] Rename Dat "Roms" dict to "Files"

This commit is contained in:
Matt Nadareski
2016-08-29 13:52:13 -07:00
parent 4d621debcf
commit be89b8649e
11 changed files with 179 additions and 179 deletions

View File

@@ -153,7 +153,7 @@ namespace SabreTools.Helper
public ForcePacking ForcePacking; public ForcePacking ForcePacking;
public OutputFormat OutputFormat; public OutputFormat OutputFormat;
public bool MergeRoms; public bool MergeRoms;
public Dictionary<string, List<File>> Roms; public Dictionary<string, List<File>> Files;
// Data specific to the Miss DAT type // Data specific to the Miss DAT type
public bool UseGame; public bool UseGame;
@@ -198,7 +198,7 @@ namespace SabreTools.Helper
ForcePacking = this.ForcePacking, ForcePacking = this.ForcePacking,
OutputFormat = this.OutputFormat, OutputFormat = this.OutputFormat,
MergeRoms = this.MergeRoms, MergeRoms = this.MergeRoms,
Roms = this.Roms, Files = this.Files,
UseGame = this.UseGame, UseGame = this.UseGame,
Prefix = this.Prefix, Prefix = this.Prefix,
Postfix = this.Postfix, Postfix = this.Postfix,
@@ -241,7 +241,7 @@ namespace SabreTools.Helper
ForcePacking = this.ForcePacking, ForcePacking = this.ForcePacking,
OutputFormat = this.OutputFormat, OutputFormat = this.OutputFormat,
MergeRoms = this.MergeRoms, MergeRoms = this.MergeRoms,
Roms = new Dictionary<string, List<File>>(), Files = new Dictionary<string, List<File>>(),
UseGame = this.UseGame, UseGame = this.UseGame,
Prefix = this.Prefix, Prefix = this.Prefix,
Postfix = this.Postfix, Postfix = this.Postfix,

View File

@@ -93,9 +93,9 @@ namespace SabreTools.Helper
datdata.OutputFormat = (datdata.OutputFormat == OutputFormat.None ? GetOutputFormat(filename) : datdata.OutputFormat); datdata.OutputFormat = (datdata.OutputFormat == OutputFormat.None ? GetOutputFormat(filename) : datdata.OutputFormat);
// Make sure there's a dictionary to read to // Make sure there's a dictionary to read to
if (datdata.Roms == null) if (datdata.Files == null)
{ {
datdata.Roms = new Dictionary<string, List<File>>(); datdata.Files = new Dictionary<string, List<File>>();
} }
// Now parse the correct type of DAT // Now parse the correct type of DAT
@@ -322,15 +322,15 @@ namespace SabreTools.Helper
// Now add the rom to the dictionary // Now add the rom to the dictionary
string key = rom.HashData.Size + "-" + rom.HashData.CRC; string key = rom.HashData.Size + "-" + rom.HashData.CRC;
if (datdata.Roms.ContainsKey(key)) if (datdata.Files.ContainsKey(key))
{ {
datdata.Roms[key].Add(rom); datdata.Files[key].Add(rom);
} }
else else
{ {
List<File> templist = new List<File>(); List<File> templist = new List<File>();
templist.Add(rom); templist.Add(rom);
datdata.Roms.Add(key, templist); datdata.Files.Add(key, templist);
} }
// Add statistical data // Add statistical data
@@ -610,15 +610,15 @@ namespace SabreTools.Helper
// Add the new rom // Add the new rom
string key = rom.HashData.Size + "-" + rom.HashData.CRC; string key = rom.HashData.Size + "-" + rom.HashData.CRC;
if (datdata.Roms.ContainsKey(key)) if (datdata.Files.ContainsKey(key))
{ {
datdata.Roms[key].Add(rom); datdata.Files[key].Add(rom);
} }
else else
{ {
List<File> templist = new List<File>(); List<File> templist = new List<File>();
templist.Add(rom); templist.Add(rom);
datdata.Roms.Add(key, templist); datdata.Files.Add(key, templist);
} }
// Add statistical data // Add statistical data
@@ -696,15 +696,15 @@ namespace SabreTools.Helper
}; };
key = rom.HashData.Size + "-" + rom.HashData.CRC; key = rom.HashData.Size + "-" + rom.HashData.CRC;
if (datdata.Roms.ContainsKey(key)) if (datdata.Files.ContainsKey(key))
{ {
datdata.Roms[key].Add(rom); datdata.Files[key].Add(rom);
} }
else else
{ {
List<File> temp = new List<File>(); List<File> temp = new List<File>();
temp.Add(rom); temp.Add(rom);
datdata.Roms.Add(key, temp); datdata.Files.Add(key, temp);
} }
// Add statistical data // Add statistical data
@@ -1080,11 +1080,11 @@ namespace SabreTools.Helper
// If the rom is continue or ignore, add the size to the previous rom // If the rom is continue or ignore, add the size to the previous rom
if (subreader.GetAttribute("loadflag") == "continue" || subreader.GetAttribute("loadflag") == "ignore") if (subreader.GetAttribute("loadflag") == "continue" || subreader.GetAttribute("loadflag") == "ignore")
{ {
int index = datdata.Roms[key].Count() - 1; int index = datdata.Files[key].Count() - 1;
File lastrom = datdata.Roms[key][index]; File lastrom = datdata.Files[key][index];
lastrom.HashData.Size += size; lastrom.HashData.Size += size;
datdata.Roms[key].RemoveAt(index); datdata.Files[key].RemoveAt(index);
datdata.Roms[key].Add(lastrom); datdata.Files[key].Add(lastrom);
continue; continue;
} }
@@ -1148,15 +1148,15 @@ namespace SabreTools.Helper
Metadata = new SourceMetadata { SystemID = sysid, System = filename, SourceID = srcid }, Metadata = new SourceMetadata { SystemID = sysid, System = filename, SourceID = srcid },
}; };
if (datdata.Roms.ContainsKey(key)) if (datdata.Files.ContainsKey(key))
{ {
datdata.Roms[key].Add(rom); datdata.Files[key].Add(rom);
} }
else else
{ {
List<File> newvalue = new List<File>(); List<File> newvalue = new List<File>();
newvalue.Add(rom); newvalue.Add(rom);
datdata.Roms.Add(key, newvalue); datdata.Files.Add(key, newvalue);
} }
// Add statistical data // Add statistical data
@@ -1205,15 +1205,15 @@ namespace SabreTools.Helper
}; };
key = rom.HashData.Size + "-" + rom.HashData.CRC; key = rom.HashData.Size + "-" + rom.HashData.CRC;
if (datdata.Roms.ContainsKey(key)) if (datdata.Files.ContainsKey(key))
{ {
datdata.Roms[key].Add(rom); datdata.Files[key].Add(rom);
} }
else else
{ {
List<File> temp = new List<File>(); List<File> temp = new List<File>();
temp.Add(rom); temp.Add(rom);
datdata.Roms.Add(key, temp); datdata.Files.Add(key, temp);
} }
// Add statistical data // Add statistical data
@@ -1311,11 +1311,11 @@ namespace SabreTools.Helper
// If the rom is continue or ignore, add the size to the previous rom // If the rom is continue or ignore, add the size to the previous rom
if (xtr.GetAttribute("loadflag") == "continue" || xtr.GetAttribute("loadflag") == "ignore") if (xtr.GetAttribute("loadflag") == "continue" || xtr.GetAttribute("loadflag") == "ignore")
{ {
int index = datdata.Roms[key].Count() - 1; int index = datdata.Files[key].Count() - 1;
File lastrom = datdata.Roms[key][index]; File lastrom = datdata.Files[key][index];
lastrom.HashData.Size += size; lastrom.HashData.Size += size;
datdata.Roms[key].RemoveAt(index); datdata.Files[key].RemoveAt(index);
datdata.Roms[key].Add(lastrom); datdata.Files[key].Add(lastrom);
continue; continue;
} }
@@ -1387,15 +1387,15 @@ namespace SabreTools.Helper
Metadata = new SourceMetadata { SystemID = sysid, System = filename, SourceID = srcid }, Metadata = new SourceMetadata { SystemID = sysid, System = filename, SourceID = srcid },
}; };
if (datdata.Roms.ContainsKey(key)) if (datdata.Files.ContainsKey(key))
{ {
datdata.Roms[key].Add(rom); datdata.Files[key].Add(rom);
} }
else else
{ {
List<File> newvalue = new List<File>(); List<File> newvalue = new List<File>();
newvalue.Add(rom); newvalue.Add(rom);
datdata.Roms.Add(key, newvalue); datdata.Files.Add(key, newvalue);
} }
// Add statistical data // Add statistical data
@@ -1701,7 +1701,7 @@ namespace SabreTools.Helper
} }
// If we have roms, output them // If we have roms, output them
if (datdata.Roms.Count != 0) if (datdata.Files.Count != 0)
{ {
Output.WriteDatfile(datdata, (outputDirectory == "" ? Path.GetDirectoryName(inputFileName) : outputDirectory), logger); Output.WriteDatfile(datdata, (outputDirectory == "" ? Path.GetDirectoryName(inputFileName) : outputDirectory), logger);
} }
@@ -1714,7 +1714,7 @@ namespace SabreTools.Helper
{ {
logger.User("Processing \"" + Path.GetFullPath(file).Remove(0, inputFileName.Length) + "\""); logger.User("Processing \"" + Path.GetFullPath(file).Remove(0, inputFileName.Length) + "\"");
Dat innerDatdata = (Dat)datdata.Clone(); Dat innerDatdata = (Dat)datdata.Clone();
innerDatdata.Roms = null; innerDatdata.Files = null;
innerDatdata = Parse(file, 0, 0, innerDatdata, logger, true, clean, keepext:(datdata.TSV != null)); innerDatdata = Parse(file, 0, 0, innerDatdata, logger, true, clean, keepext:(datdata.TSV != null));
innerDatdata = Filter(innerDatdata, gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, logger); innerDatdata = Filter(innerDatdata, gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, logger);
@@ -1727,7 +1727,7 @@ namespace SabreTools.Helper
// If we have roms, output them // If we have roms, output them
if (innerDatdata.Roms.Count != 0) if (innerDatdata.Files.Count != 0)
{ {
Output.WriteDatfile(innerDatdata, (outputDirectory == "" ? Path.GetDirectoryName(file) : outputDirectory + Path.GetDirectoryName(file).Remove(0, inputFileName.Length - 1)), logger); Output.WriteDatfile(innerDatdata, (outputDirectory == "" ? Path.GetDirectoryName(file) : outputDirectory + Path.GetDirectoryName(file).Remove(0, inputFileName.Length - 1)), logger);
} }
@@ -1756,7 +1756,7 @@ namespace SabreTools.Helper
int i = 0; int i = 0;
userData = new Dat userData = new Dat
{ {
Roms = new Dictionary<string, List<File>>(), Files = new Dictionary<string, List<File>>(),
MergeRoms = inputDat.MergeRoms, MergeRoms = inputDat.MergeRoms,
}; };
foreach (string input in inputs) foreach (string input in inputs)
@@ -1771,16 +1771,16 @@ namespace SabreTools.Helper
datHeaders.Add((Dat)userData.CloneHeader()); datHeaders.Add((Dat)userData.CloneHeader());
// Reset the header values so the next can be captured // Reset the header values so the next can be captured
Dictionary<string, List<File>> temp = userData.Roms; Dictionary<string, List<File>> temp = userData.Files;
userData = new Dat(); userData = new Dat();
userData.Roms = temp; userData.Files = temp;
} }
} }
// Set the output values // Set the output values
Dictionary<string, List<File>> roms = userData.Roms; Dictionary<string, List<File>> roms = userData.Files;
userData = (Dat)inputDat.CloneHeader(); userData = (Dat)inputDat.CloneHeader();
userData.Roms = roms; userData.Files = roms;
logger.User("Populating complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff")); logger.User("Populating complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
@@ -1811,10 +1811,10 @@ namespace SabreTools.Helper
{ {
// Now loop through and create a new Rom dictionary using filtered values // Now loop through and create a new Rom dictionary using filtered values
Dictionary<string, List<File>> dict = new Dictionary<string, List<File>>(); Dictionary<string, List<File>> dict = new Dictionary<string, List<File>>();
List<string> keys = datdata.Roms.Keys.ToList(); List<string> keys = datdata.Files.Keys.ToList();
foreach (string key in keys) foreach (string key in keys)
{ {
List<File> roms = datdata.Roms[key]; List<File> roms = datdata.Files[key];
for (int i = 0; i < roms.Count; i++) for (int i = 0; i < roms.Count; i++)
{ {
File rom = roms[i]; File rom = roms[i];
@@ -1970,11 +1970,11 @@ namespace SabreTools.Helper
} }
// Now clean up by removing the old list // Now clean up by removing the old list
datdata.Roms[key] = null; datdata.Files[key] = null;
} }
// Resassign the new dictionary to the DatData object // Resassign the new dictionary to the DatData object
datdata.Roms = dict; datdata.Files = dict;
return datdata; return datdata;
} }
@@ -2038,10 +2038,10 @@ namespace SabreTools.Helper
// Now, loop through the dictionary and populate the correct DATs // Now, loop through the dictionary and populate the correct DATs
start = DateTime.Now; start = DateTime.Now;
logger.User("Populating all output DATs"); logger.User("Populating all output DATs");
List<string> keys = userData.Roms.Keys.ToList(); List<string> keys = userData.Files.Keys.ToList();
foreach (string key in keys) foreach (string key in keys)
{ {
List<File> roms = RomTools.Merge(userData.Roms[key], logger); List<File> roms = RomTools.Merge(userData.Files[key], logger);
if (roms != null && roms.Count > 0) if (roms != null && roms.Count > 0)
{ {
@@ -2055,15 +2055,15 @@ namespace SabreTools.Helper
// Individual DATs that are output // Individual DATs that are output
if ((diff & DiffMode.Individuals) != 0) if ((diff & DiffMode.Individuals) != 0)
{ {
if (outDats[rom.Metadata.SystemID].Roms.ContainsKey(key)) if (outDats[rom.Metadata.SystemID].Files.ContainsKey(key))
{ {
outDats[rom.Metadata.SystemID].Roms[key].Add(rom); outDats[rom.Metadata.SystemID].Files[key].Add(rom);
} }
else else
{ {
List<File> tl = new List<File>(); List<File> tl = new List<File>();
tl.Add(rom); tl.Add(rom);
outDats[rom.Metadata.SystemID].Roms.Add(key, tl); outDats[rom.Metadata.SystemID].Files.Add(key, tl);
} }
} }
@@ -2073,15 +2073,15 @@ namespace SabreTools.Helper
File newrom = rom; File newrom = rom;
newrom.Machine.Name += " (" + Path.GetFileNameWithoutExtension(inputs[newrom.Metadata.SystemID].Split('¬')[0]) + ")"; newrom.Machine.Name += " (" + Path.GetFileNameWithoutExtension(inputs[newrom.Metadata.SystemID].Split('¬')[0]) + ")";
if (outerDiffData.Roms.ContainsKey(key)) if (outerDiffData.Files.ContainsKey(key))
{ {
outerDiffData.Roms[key].Add(newrom); outerDiffData.Files[key].Add(newrom);
} }
else else
{ {
List<File> tl = new List<File>(); List<File> tl = new List<File>();
tl.Add(rom); tl.Add(rom);
outerDiffData.Roms.Add(key, tl); outerDiffData.Files.Add(key, tl);
} }
} }
} }
@@ -2095,15 +2095,15 @@ namespace SabreTools.Helper
File newrom = rom; File newrom = rom;
newrom.Machine.Name += " (" + Path.GetFileNameWithoutExtension(inputs[newrom.Metadata.SystemID].Split('¬')[0]) + ")"; newrom.Machine.Name += " (" + Path.GetFileNameWithoutExtension(inputs[newrom.Metadata.SystemID].Split('¬')[0]) + ")";
if (dupeData.Roms.ContainsKey(key)) if (dupeData.Files.ContainsKey(key))
{ {
dupeData.Roms[key].Add(newrom); dupeData.Files[key].Add(newrom);
} }
else else
{ {
List<File> tl = new List<File>(); List<File> tl = new List<File>();
tl.Add(rom); tl.Add(rom);
dupeData.Roms.Add(key, tl); dupeData.Files.Add(key, tl);
} }
} }
} }
@@ -2137,7 +2137,7 @@ namespace SabreTools.Helper
string path = outdir + (Path.GetDirectoryName(inputs[j].Split('¬')[0]).Remove(0, inputs[j].Split('¬')[1].Length)); string path = outdir + (Path.GetDirectoryName(inputs[j].Split('¬')[0]).Remove(0, inputs[j].Split('¬')[1].Length));
// If we have more than 0 roms, output // If we have more than 0 roms, output
if (outDats[j].Roms.Count > 0) if (outDats[j].Files.Count > 0)
{ {
Output.WriteDatfile(outDats[j], path, logger); Output.WriteDatfile(outDats[j], path, logger);
} }
@@ -2190,25 +2190,25 @@ namespace SabreTools.Helper
// Now, loop through the dictionary and populate the correct DATs // Now, loop through the dictionary and populate the correct DATs
start = DateTime.Now; start = DateTime.Now;
logger.User("Populating all output DATs"); logger.User("Populating all output DATs");
List<string> keys = userData.Roms.Keys.ToList(); List<string> keys = userData.Files.Keys.ToList();
foreach (string key in keys) foreach (string key in keys)
{ {
List<File> roms = RomTools.Merge(userData.Roms[key], logger); List<File> roms = RomTools.Merge(userData.Files[key], logger);
if (roms != null && roms.Count > 0) if (roms != null && roms.Count > 0)
{ {
foreach (File rom in roms) foreach (File rom in roms)
{ {
if (outDats[rom.Metadata.SystemID].Roms.ContainsKey(key)) if (outDats[rom.Metadata.SystemID].Files.ContainsKey(key))
{ {
outDats[rom.Metadata.SystemID].Roms[key].Add(rom); outDats[rom.Metadata.SystemID].Files[key].Add(rom);
} }
else else
{ {
List<File> tl = new List<File>(); List<File> tl = new List<File>();
tl.Add(rom); tl.Add(rom);
outDats[rom.Metadata.SystemID].Roms.Add(key, tl); outDats[rom.Metadata.SystemID].Files.Add(key, tl);
} }
} }
} }
@@ -2232,7 +2232,7 @@ namespace SabreTools.Helper
} }
// If we have more than 0 roms, output // If we have more than 0 roms, output
if (outDats[j].Roms.Count > 0) if (outDats[j].Files.Count > 0)
{ {
Output.WriteDatfile(outDats[j], path, logger); Output.WriteDatfile(outDats[j], path, logger);
} }
@@ -2253,11 +2253,11 @@ namespace SabreTools.Helper
// If we're in SuperDAT mode, prefix all games with their respective DATs // If we're in SuperDAT mode, prefix all games with their respective DATs
if (userData.Type == "SuperDAT") if (userData.Type == "SuperDAT")
{ {
List<string> keys = userData.Roms.Keys.ToList(); List<string> keys = userData.Files.Keys.ToList();
foreach (string key in keys) foreach (string key in keys)
{ {
List<File> newroms = new List<File>(); List<File> newroms = new List<File>();
foreach (File rom in userData.Roms[key]) foreach (File rom in userData.Files[key])
{ {
File newrom = rom; File newrom = rom;
string filename = inputs[newrom.Metadata.SystemID].Split('¬')[0]; string filename = inputs[newrom.Metadata.SystemID].Split('¬')[0];
@@ -2270,12 +2270,12 @@ namespace SabreTools.Helper
+ newrom.Machine.Name; + newrom.Machine.Name;
newroms.Add(newrom); newroms.Add(newrom);
} }
userData.Roms[key] = newroms; userData.Files[key] = newroms;
} }
} }
// Output a DAT only if there are roms // Output a DAT only if there are roms
if (userData.Roms.Count != 0) if (userData.Files.Count != 0)
{ {
Output.WriteDatfile(userData, outdir, logger); Output.WriteDatfile(userData, outdir, logger);
} }

View File

@@ -32,7 +32,7 @@ namespace SabreTools.Helper
} }
// Bucket roms by game name and optionally dedupe // Bucket roms by game name and optionally dedupe
SortedDictionary<string, List<File>> sortable = DatTools.BucketByGame(datdata.Roms, datdata.MergeRoms, norename, logger); SortedDictionary<string, List<File>> sortable = DatTools.BucketByGame(datdata.Files, datdata.MergeRoms, norename, logger);
// Now write out to file // Now write out to file
// If it's empty, use the current folder // If it's empty, use the current folder
@@ -560,7 +560,7 @@ namespace SabreTools.Helper
string footer = ""; string footer = "";
// If we have roms, output the full footer // If we have roms, output the full footer
if (datdata.Roms != null && datdata.Roms.Count > 0) if (datdata.Files != null && datdata.Files.Count > 0)
{ {
switch (datdata.OutputFormat) switch (datdata.OutputFormat)
{ {

View File

@@ -199,16 +199,16 @@ namespace SabreTools.Helper
List<File> output = new List<File>(); List<File> output = new List<File>();
// Check for an empty rom list first // Check for an empty rom list first
if (datdata.Roms == null || datdata.Roms.Count == 0) if (datdata.Files == null || datdata.Files.Count == 0)
{ {
return output; return output;
} }
// Try to find duplicates // Try to find duplicates
List<string> keys = datdata.Roms.Keys.ToList(); List<string> keys = datdata.Files.Keys.ToList();
foreach (string key in keys) foreach (string key in keys)
{ {
List<File> roms = datdata.Roms[key]; List<File> roms = datdata.Files[key];
List<File> left = new List<File>(); List<File> left = new List<File>();
foreach (File rom in roms) foreach (File rom in roms)
{ {
@@ -225,7 +225,7 @@ namespace SabreTools.Helper
// If we're in removal mode, replace the list with the new one // If we're in removal mode, replace the list with the new one
if (remove) if (remove)
{ {
datdata.Roms[key] = left; datdata.Files[key] = left;
} }
} }

View File

@@ -49,7 +49,7 @@ namespace SabreTools.Helper
List<String> games = new List<String>(); List<String> games = new List<String>();
Dat datdata = new Dat(); Dat datdata = new Dat();
datdata = DatTools.Parse(filename, 0, 0, datdata, _logger); datdata = DatTools.Parse(filename, 0, 0, datdata, _logger);
SortedDictionary<string, List<File>> newroms = DatTools.BucketByGame(datdata.Roms, false, true, _logger, false); SortedDictionary<string, List<File>> newroms = DatTools.BucketByGame(datdata.Files, false, true, _logger, false);
// Output single DAT stats (if asked) // Output single DAT stats (if asked)
if (_single) if (_single)
@@ -116,7 +116,7 @@ Please check the log folder if the stats scrolled offscreen");
datdata.NodumpCount = 0; datdata.NodumpCount = 0;
// Loop through and add // Loop through and add
foreach (List<File> roms in datdata.Roms.Values) foreach (List<File> roms in datdata.Files.Values)
{ {
foreach (File rom in roms) foreach (File rom in roms)
{ {
@@ -131,7 +131,7 @@ Please check the log folder if the stats scrolled offscreen");
} }
} }
SortedDictionary<string, List<File>> newroms = DatTools.BucketByGame(datdata.Roms, false, true, logger, false); SortedDictionary<string, List<File>> newroms = DatTools.BucketByGame(datdata.Files, false, true, logger, false);
if (datdata.TotalSize < 0) if (datdata.TotalSize < 0)
{ {
datdata.TotalSize = Int64.MaxValue + datdata.TotalSize; datdata.TotalSize = Int64.MaxValue + datdata.TotalSize;

View File

@@ -191,15 +191,15 @@ namespace SabreTools
}; };
string key = rom.HashData.Size + "-" + rom.HashData.CRC; string key = rom.HashData.Size + "-" + rom.HashData.CRC;
if (_datdata.Roms.ContainsKey(key)) if (_datdata.Files.ContainsKey(key))
{ {
_datdata.Roms[key].Add(rom); _datdata.Files[key].Add(rom);
} }
else else
{ {
List<Helper.File> temp = new List<Helper.File>(); List<Helper.File> temp = new List<Helper.File>();
temp.Add(rom); temp.Add(rom);
_datdata.Roms.Add(key, temp); _datdata.Files.Add(key, temp);
} }
} }
@@ -230,15 +230,15 @@ namespace SabreTools
}; };
string key = rom.HashData.Size + "-" + rom.HashData.CRC; string key = rom.HashData.Size + "-" + rom.HashData.CRC;
if (_datdata.Roms.ContainsKey(key)) if (_datdata.Files.ContainsKey(key))
{ {
_datdata.Roms[key].Add(rom); _datdata.Files[key].Add(rom);
} }
else else
{ {
List<Helper.File> temp = new List<Helper.File>(); List<Helper.File> temp = new List<Helper.File>();
temp.Add(rom); temp.Add(rom);
_datdata.Roms.Add(key, temp); _datdata.Files.Add(key, temp);
} }
} }
} }
@@ -256,10 +256,10 @@ namespace SabreTools
// Now output any empties to the stream (if not in Romba mode) // Now output any empties to the stream (if not in Romba mode)
if (!_datdata.Romba) if (!_datdata.Romba)
{ {
List<string> keys = _datdata.Roms.Keys.ToList(); List<string> keys = _datdata.Files.Keys.ToList();
foreach (string key in keys) foreach (string key in keys)
{ {
List<Helper.File> roms = _datdata.Roms[key]; List<Helper.File> roms = _datdata.Files[key];
for (int i = 0; i < roms.Count; i++) for (int i = 0; i < roms.Count; i++)
{ {
Helper.File rom = roms[i]; Helper.File rom = roms[i];
@@ -278,15 +278,15 @@ namespace SabreTools
if (_nowrite) if (_nowrite)
{ {
string inkey = rom.HashData.Size + "-" + rom.HashData.CRC; string inkey = rom.HashData.Size + "-" + rom.HashData.CRC;
if (_datdata.Roms.ContainsKey(inkey)) if (_datdata.Files.ContainsKey(inkey))
{ {
_datdata.Roms[inkey].Add(rom); _datdata.Files[inkey].Add(rom);
} }
else else
{ {
List<Helper.File> temp = new List<Helper.File>(); List<Helper.File> temp = new List<Helper.File>();
temp.Add(rom); temp.Add(rom);
_datdata.Roms.Add(inkey, temp); _datdata.Files.Add(inkey, temp);
} }
} }
else else
@@ -316,9 +316,9 @@ namespace SabreTools
} }
// If we had roms but not blanks (and not in Romba mode), create an artifical rom for the purposes of outputting // If we had roms but not blanks (and not in Romba mode), create an artifical rom for the purposes of outputting
if (lastparent != null && _datdata.Roms.Count == 0) if (lastparent != null && _datdata.Files.Count == 0)
{ {
_datdata.Roms.Add("temp", new List<Helper.File>()); _datdata.Files.Add("temp", new List<Helper.File>());
} }
} }
@@ -356,15 +356,15 @@ namespace SabreTools
if (_nowrite) if (_nowrite)
{ {
string key = rom.HashData.Size + "-" + rom.HashData.CRC; string key = rom.HashData.Size + "-" + rom.HashData.CRC;
if (_datdata.Roms.ContainsKey(key)) if (_datdata.Files.ContainsKey(key))
{ {
_datdata.Roms[key].Add(rom); _datdata.Files[key].Add(rom);
} }
else else
{ {
List<Helper.File> temp = new List<Helper.File>(); List<Helper.File> temp = new List<Helper.File>();
temp.Add(rom); temp.Add(rom);
_datdata.Roms.Add(key, temp); _datdata.Files.Add(key, temp);
} }
} }
else else
@@ -531,15 +531,15 @@ namespace SabreTools
if (_nowrite) if (_nowrite)
{ {
string key = rom.HashData.Size + "-" + rom.HashData.CRC; string key = rom.HashData.Size + "-" + rom.HashData.CRC;
if (_datdata.Roms.ContainsKey(key)) if (_datdata.Files.ContainsKey(key))
{ {
_datdata.Roms[key].Add(rom); _datdata.Files[key].Add(rom);
} }
else else
{ {
List<Helper.File> temp = new List<Helper.File>(); List<Helper.File> temp = new List<Helper.File>();
temp.Add(rom); temp.Add(rom);
_datdata.Roms.Add(key, temp); _datdata.Files.Add(key, temp);
} }
} }
else else

View File

@@ -177,7 +177,7 @@ namespace SabreTools
} }
// If the dictionary is empty for any reason, tell the user and exit // If the dictionary is empty for any reason, tell the user and exit
if (datdata.Roms.Keys.Count == 0 || datdata.Roms.Count == 0) if (datdata.Files.Keys.Count == 0 || datdata.Files.Count == 0)
{ {
_logger.Log("No roms found for system ID " + _systemid); _logger.Log("No roms found for system ID " + _systemid);
return false; return false;
@@ -185,11 +185,11 @@ namespace SabreTools
// Now process all of the roms // Now process all of the roms
_logger.User("Cleaning rom data"); _logger.User("Cleaning rom data");
List<string> keys = datdata.Roms.Keys.ToList(); List<string> keys = datdata.Files.Keys.ToList();
foreach (string key in keys) foreach (string key in keys)
{ {
List<Helper.File> temp = new List<Helper.File>(); List<Helper.File> temp = new List<Helper.File>();
List<Helper.File> newroms = datdata.Roms[key]; List<Helper.File> newroms = datdata.Files[key];
for (int i = 0; i < newroms.Count; i++) for (int i = 0; i < newroms.Count; i++)
{ {
Helper.File rom = newroms[i]; Helper.File rom = newroms[i];
@@ -234,7 +234,7 @@ namespace SabreTools
temp.Add(rom); temp.Add(rom);
} }
datdata.Roms[key] = temp; datdata.Files[key] = temp;
} }
// Then write out the file // Then write out the file

View File

@@ -64,9 +64,9 @@ namespace SabreTools
// Now get Net New output dictionary [(currentNewMerged)-(currentAllMerged)] // Now get Net New output dictionary [(currentNewMerged)-(currentAllMerged)]
_logger.User("Creating and populating Net New dictionary"); _logger.User("Creating and populating Net New dictionary");
Dictionary<string, List<Helper.File>> netNew = new Dictionary<string, List<Helper.File>>(); Dictionary<string, List<Helper.File>> netNew = new Dictionary<string, List<Helper.File>>();
foreach (string key in completeDats.Roms.Keys) foreach (string key in completeDats.Files.Keys)
{ {
List<Helper.File> templist = RomTools.Merge(completeDats.Roms[key], _logger); List<Helper.File> templist = RomTools.Merge(completeDats.Files[key], _logger);
foreach (Helper.File rom in templist) foreach (Helper.File rom in templist)
{ {
if (rom.Dupe == DupeType.None && rom.Metadata.System == _currentNewMerged) if (rom.Dupe == DupeType.None && rom.Metadata.System == _currentNewMerged)
@@ -88,9 +88,9 @@ namespace SabreTools
// Now create the Unneeded dictionary [(currentAllMerged)-(currentNewMerged)] // Now create the Unneeded dictionary [(currentAllMerged)-(currentNewMerged)]
_logger.User("Creating and populating Uneeded dictionary"); _logger.User("Creating and populating Uneeded dictionary");
Dictionary<string, List<Helper.File>> unneeded = new Dictionary<string, List<Helper.File>>(); Dictionary<string, List<Helper.File>> unneeded = new Dictionary<string, List<Helper.File>>();
foreach (string key in completeDats.Roms.Keys) foreach (string key in completeDats.Files.Keys)
{ {
List<Helper.File> templist = RomTools.Merge(completeDats.Roms[key], _logger); List<Helper.File> templist = RomTools.Merge(completeDats.Files[key], _logger);
foreach (Helper.File rom in templist) foreach (Helper.File rom in templist)
{ {
if (rom.Dupe == DupeType.None && rom.Metadata.System == _currentAllMerged) if (rom.Dupe == DupeType.None && rom.Metadata.System == _currentAllMerged)
@@ -115,19 +115,19 @@ namespace SabreTools
midMissing = DatTools.Parse(_currentMissingMerged, 0, 0, midMissing, _logger); midMissing = DatTools.Parse(_currentMissingMerged, 0, 0, midMissing, _logger);
foreach (string key in unneeded.Keys) foreach (string key in unneeded.Keys)
{ {
if (midMissing.Roms.ContainsKey(key)) if (midMissing.Files.ContainsKey(key))
{ {
midMissing.Roms[key].AddRange(unneeded[key]); midMissing.Files[key].AddRange(unneeded[key]);
} }
else else
{ {
midMissing.Roms.Add(key, unneeded[key]); midMissing.Files.Add(key, unneeded[key]);
} }
} }
Dictionary<string, List<Helper.File>> newMissing = new Dictionary<string, List<Helper.File>>(); Dictionary<string, List<Helper.File>> newMissing = new Dictionary<string, List<Helper.File>>();
foreach (string key in midMissing.Roms.Keys) foreach (string key in midMissing.Files.Keys)
{ {
List<Helper.File> templist = RomTools.Merge(midMissing.Roms[key], _logger); List<Helper.File> templist = RomTools.Merge(midMissing.Files[key], _logger);
foreach (Helper.File rom in templist) foreach (Helper.File rom in templist)
{ {
if (rom.Dupe == DupeType.None && rom.Metadata.System == _currentMissingMerged) if (rom.Dupe == DupeType.None && rom.Metadata.System == _currentMissingMerged)
@@ -171,11 +171,11 @@ namespace SabreTools
midHave.Add(key, newMissing[key]); midHave.Add(key, newMissing[key]);
} }
} }
foreach (string key in completeDats.Roms.Keys) foreach (string key in completeDats.Files.Keys)
{ {
if (midHave.ContainsKey(key)) if (midHave.ContainsKey(key))
{ {
foreach (Helper.File rom in completeDats.Roms[key]) foreach (Helper.File rom in completeDats.Files[key])
{ {
if (rom.Metadata.System == _currentNewMerged) if (rom.Metadata.System == _currentNewMerged)
{ {
@@ -186,7 +186,7 @@ namespace SabreTools
else else
{ {
List<Helper.File> roms = new List<Helper.File>(); List<Helper.File> roms = new List<Helper.File>();
foreach (Helper.File rom in completeDats.Roms[key]) foreach (Helper.File rom in completeDats.Files[key])
{ {
if (rom.Metadata.System == _currentNewMerged) if (rom.Metadata.System == _currentNewMerged)
{ {
@@ -306,7 +306,7 @@ namespace SabreTools
ForcePacking = ForcePacking.None, ForcePacking = ForcePacking.None,
OutputFormat = OutputFormat.Xml, OutputFormat = OutputFormat.Xml,
MergeRoms = true, MergeRoms = true,
Roms = netNew, Files = netNew,
}; };
Dat unneededData = new Dat Dat unneededData = new Dat
{ {
@@ -319,7 +319,7 @@ namespace SabreTools
ForcePacking = ForcePacking.None, ForcePacking = ForcePacking.None,
OutputFormat = OutputFormat.Xml, OutputFormat = OutputFormat.Xml,
MergeRoms = true, MergeRoms = true,
Roms = unneeded, Files = unneeded,
}; };
Dat newMissingData = new Dat Dat newMissingData = new Dat
{ {
@@ -332,7 +332,7 @@ namespace SabreTools
ForcePacking = ForcePacking.None, ForcePacking = ForcePacking.None,
OutputFormat = OutputFormat.Xml, OutputFormat = OutputFormat.Xml,
MergeRoms = true, MergeRoms = true,
Roms = newMissing, Files = newMissing,
}; };
Dat haveData = new Dat Dat haveData = new Dat
{ {
@@ -345,7 +345,7 @@ namespace SabreTools
ForcePacking = ForcePacking.None, ForcePacking = ForcePacking.None,
OutputFormat = OutputFormat.Xml, OutputFormat = OutputFormat.Xml,
MergeRoms = true, MergeRoms = true,
Roms = have, Files = have,
}; };
Output.WriteDatfile(netNewData, "", _logger); Output.WriteDatfile(netNewData, "", _logger);
@@ -365,9 +365,9 @@ namespace SabreTools
midHave = DatTools.Parse(_currentMissingMerged, 0, 0, midHave, _logger); midHave = DatTools.Parse(_currentMissingMerged, 0, 0, midHave, _logger);
midHave = DatTools.Parse(_currentAllMerged, 0, 0, midHave, _logger); midHave = DatTools.Parse(_currentAllMerged, 0, 0, midHave, _logger);
Dictionary<string, List<Helper.File>> have = new Dictionary<string, List<Helper.File>>(); Dictionary<string, List<Helper.File>> have = new Dictionary<string, List<Helper.File>>();
foreach (string key in midHave.Roms.Keys) foreach (string key in midHave.Files.Keys)
{ {
List<Helper.File> templist = RomTools.Merge(midHave.Roms[key], _logger); List<Helper.File> templist = RomTools.Merge(midHave.Files[key], _logger);
foreach (Helper.File rom in templist) foreach (Helper.File rom in templist)
{ {
if (rom.Dupe == DupeType.None && rom.Metadata.System == _currentAllMerged) if (rom.Dupe == DupeType.None && rom.Metadata.System == _currentAllMerged)
@@ -419,7 +419,7 @@ namespace SabreTools
ForcePacking = ForcePacking.None, ForcePacking = ForcePacking.None,
OutputFormat = OutputFormat.Xml, OutputFormat = OutputFormat.Xml,
MergeRoms = true, MergeRoms = true,
Roms = have, Files = have,
}; };
Output.WriteDatfile(haveData, "", _logger); Output.WriteDatfile(haveData, "", _logger);
@@ -435,9 +435,9 @@ namespace SabreTools
midHave = DatTools.Parse(_currentMissingMerged, 0, 0, midHave, _logger); midHave = DatTools.Parse(_currentMissingMerged, 0, 0, midHave, _logger);
midHave = DatTools.Parse(_currentNewMerged, 0, 0, midHave, _logger); midHave = DatTools.Parse(_currentNewMerged, 0, 0, midHave, _logger);
Dictionary<string, List<Helper.File>> have = new Dictionary<string, List<Helper.File>>(); Dictionary<string, List<Helper.File>> have = new Dictionary<string, List<Helper.File>>();
foreach (string key in midHave.Roms.Keys) foreach (string key in midHave.Files.Keys)
{ {
List<Helper.File> templist = RomTools.Merge(midHave.Roms[key], _logger); List<Helper.File> templist = RomTools.Merge(midHave.Files[key], _logger);
foreach (Helper.File rom in templist) foreach (Helper.File rom in templist)
{ {
if (rom.Dupe == DupeType.None && rom.Metadata.System == _currentNewMerged) if (rom.Dupe == DupeType.None && rom.Metadata.System == _currentNewMerged)
@@ -489,7 +489,7 @@ namespace SabreTools
ForcePacking = ForcePacking.None, ForcePacking = ForcePacking.None,
OutputFormat = OutputFormat.Xml, OutputFormat = OutputFormat.Xml,
MergeRoms = true, MergeRoms = true,
Roms = have, Files = have,
}; };
Output.WriteDatfile(haveData, "", _logger); Output.WriteDatfile(haveData, "", _logger);

View File

@@ -411,7 +411,7 @@ namespace SabreTools
OutputFormat = (old ? OutputFormat.ClrMamePro : OutputFormat.Xml), OutputFormat = (old ? OutputFormat.ClrMamePro : OutputFormat.Xml),
Romba = romba, Romba = romba,
Type = (superdat ? "SuperDAT" : ""), Type = (superdat ? "SuperDAT" : ""),
Roms = new Dictionary<string, List<Helper.File>>(), Files = new Dictionary<string, List<Helper.File>>(),
}; };
DATFromDir dfd = new DATFromDir(inputs, datdata, noMD5, noSHA1, bare, archivesAsFiles, enableGzip, tempDir, _logger); DATFromDir dfd = new DATFromDir(inputs, datdata, noMD5, noSHA1, bare, archivesAsFiles, enableGzip, tempDir, _logger);
bool success = dfd.Start(); bool success = dfd.Start();

View File

@@ -155,7 +155,7 @@ namespace SabreTools
ForcePacking = datdata.ForcePacking, ForcePacking = datdata.ForcePacking,
OutputFormat = outputFormat, OutputFormat = outputFormat,
MergeRoms = datdata.MergeRoms, MergeRoms = datdata.MergeRoms,
Roms = new Dictionary<string, List<Helper.File>>(), Files = new Dictionary<string, List<Helper.File>>(),
}; };
Dat sha1 = new Dat Dat sha1 = new Dat
{ {
@@ -177,7 +177,7 @@ namespace SabreTools
ForcePacking = datdata.ForcePacking, ForcePacking = datdata.ForcePacking,
OutputFormat = outputFormat, OutputFormat = outputFormat,
MergeRoms = datdata.MergeRoms, MergeRoms = datdata.MergeRoms,
Roms = new Dictionary<string, List<Helper.File>>(), Files = new Dictionary<string, List<Helper.File>>(),
}; };
Dat md5 = new Dat Dat md5 = new Dat
{ {
@@ -199,7 +199,7 @@ namespace SabreTools
ForcePacking = datdata.ForcePacking, ForcePacking = datdata.ForcePacking,
OutputFormat = outputFormat, OutputFormat = outputFormat,
MergeRoms = datdata.MergeRoms, MergeRoms = datdata.MergeRoms,
Roms = new Dictionary<string, List<Helper.File>>(), Files = new Dictionary<string, List<Helper.File>>(),
}; };
Dat crc = new Dat Dat crc = new Dat
{ {
@@ -221,70 +221,70 @@ namespace SabreTools
ForcePacking = datdata.ForcePacking, ForcePacking = datdata.ForcePacking,
OutputFormat = outputFormat, OutputFormat = outputFormat,
MergeRoms = datdata.MergeRoms, MergeRoms = datdata.MergeRoms,
Roms = new Dictionary<string, List<Helper.File>>(), Files = new Dictionary<string, List<Helper.File>>(),
}; };
// Now populate each of the DAT objects in turn // Now populate each of the DAT objects in turn
List<string> keys = datdata.Roms.Keys.ToList(); List<string> keys = datdata.Files.Keys.ToList();
foreach (string key in keys) foreach (string key in keys)
{ {
List<Helper.File> roms = datdata.Roms[key]; List<Helper.File> roms = datdata.Files[key];
foreach (Helper.File rom in roms) foreach (Helper.File rom in roms)
{ {
// If the file is a nodump // If the file is a nodump
if (rom.Nodump) if (rom.Nodump)
{ {
if (nodump.Roms.ContainsKey(key)) if (nodump.Files.ContainsKey(key))
{ {
nodump.Roms[key].Add(rom); nodump.Files[key].Add(rom);
} }
else else
{ {
List<Helper.File> temp = new List<Helper.File>(); List<Helper.File> temp = new List<Helper.File>();
temp.Add(rom); temp.Add(rom);
nodump.Roms.Add(key, temp); nodump.Files.Add(key, temp);
} }
} }
// If the file has a SHA-1 // If the file has a SHA-1
else if (rom.HashData.SHA1 != null && rom.HashData.SHA1 != "") else if (rom.HashData.SHA1 != null && rom.HashData.SHA1 != "")
{ {
if (sha1.Roms.ContainsKey(key)) if (sha1.Files.ContainsKey(key))
{ {
sha1.Roms[key].Add(rom); sha1.Files[key].Add(rom);
} }
else else
{ {
List<Helper.File> temp = new List<Helper.File>(); List<Helper.File> temp = new List<Helper.File>();
temp.Add(rom); temp.Add(rom);
sha1.Roms.Add(key, temp); sha1.Files.Add(key, temp);
} }
} }
// If the file has no SHA-1 but has an MD5 // If the file has no SHA-1 but has an MD5
else if (rom.HashData.MD5 != null && rom.HashData.MD5 != "") else if (rom.HashData.MD5 != null && rom.HashData.MD5 != "")
{ {
if (md5.Roms.ContainsKey(key)) if (md5.Files.ContainsKey(key))
{ {
md5.Roms[key].Add(rom); md5.Files[key].Add(rom);
} }
else else
{ {
List<Helper.File> temp = new List<Helper.File>(); List<Helper.File> temp = new List<Helper.File>();
temp.Add(rom); temp.Add(rom);
md5.Roms.Add(key, temp); md5.Files.Add(key, temp);
} }
} }
// All other cases // All other cases
else else
{ {
if (crc.Roms.ContainsKey(key)) if (crc.Files.ContainsKey(key))
{ {
crc.Roms[key].Add(rom); crc.Files[key].Add(rom);
} }
else else
{ {
List<Helper.File> temp = new List<Helper.File>(); List<Helper.File> temp = new List<Helper.File>();
temp.Add(rom); temp.Add(rom);
crc.Roms.Add(key, temp); crc.Files.Add(key, temp);
} }
} }
} }
@@ -304,19 +304,19 @@ namespace SabreTools
// Now, output all of the files to the output directory // Now, output all of the files to the output directory
_logger.User("DAT information created, outputting new files"); _logger.User("DAT information created, outputting new files");
bool success = true; bool success = true;
if (nodump.Roms.Count > 0) if (nodump.Files.Count > 0)
{ {
success &= Output.WriteDatfile(nodump, outdir, _logger); success &= Output.WriteDatfile(nodump, outdir, _logger);
} }
if (sha1.Roms.Count > 0) if (sha1.Files.Count > 0)
{ {
success &= Output.WriteDatfile(sha1, outdir, _logger); success &= Output.WriteDatfile(sha1, outdir, _logger);
} }
if (md5.Roms.Count > 0) if (md5.Files.Count > 0)
{ {
success &= Output.WriteDatfile(md5, outdir, _logger); success &= Output.WriteDatfile(md5, outdir, _logger);
} }
if (crc.Roms.Count > 0) if (crc.Files.Count > 0)
{ {
success &= Output.WriteDatfile(crc, outdir, _logger); success &= Output.WriteDatfile(crc, outdir, _logger);
} }
@@ -351,7 +351,7 @@ namespace SabreTools
Homepage = datdata.Homepage, Homepage = datdata.Homepage,
Url = datdata.Url, Url = datdata.Url,
Comment = datdata.Comment, Comment = datdata.Comment,
Roms = new Dictionary<string, List<Helper.File>>(), Files = new Dictionary<string, List<Helper.File>>(),
OutputFormat = outputFormat, OutputFormat = outputFormat,
}; };
Dat datdataB = new Dat Dat datdataB = new Dat
@@ -367,68 +367,68 @@ namespace SabreTools
Homepage = datdata.Homepage, Homepage = datdata.Homepage,
Url = datdata.Url, Url = datdata.Url,
Comment = datdata.Comment, Comment = datdata.Comment,
Roms = new Dictionary<string, List<Helper.File>>(), Files = new Dictionary<string, List<Helper.File>>(),
OutputFormat = outputFormat, OutputFormat = outputFormat,
}; };
// If roms is empty, return false // If roms is empty, return false
if (datdata.Roms.Count == 0) if (datdata.Files.Count == 0)
{ {
return false; return false;
} }
// Now separate the roms accordingly // Now separate the roms accordingly
foreach (string key in datdata.Roms.Keys) foreach (string key in datdata.Files.Keys)
{ {
foreach (Helper.File rom in datdata.Roms[key]) foreach (Helper.File rom in datdata.Files[key])
{ {
if (_extA.Contains(Path.GetExtension(rom.Name.ToUpperInvariant()))) if (_extA.Contains(Path.GetExtension(rom.Name.ToUpperInvariant())))
{ {
if (datdataA.Roms.ContainsKey(key)) if (datdataA.Files.ContainsKey(key))
{ {
datdataA.Roms[key].Add(rom); datdataA.Files[key].Add(rom);
} }
else else
{ {
List<Helper.File> temp = new List<Helper.File>(); List<Helper.File> temp = new List<Helper.File>();
temp.Add(rom); temp.Add(rom);
datdataA.Roms.Add(key, temp); datdataA.Files.Add(key, temp);
} }
} }
else if (_extB.Contains(Path.GetExtension(rom.Name.ToUpperInvariant()))) else if (_extB.Contains(Path.GetExtension(rom.Name.ToUpperInvariant())))
{ {
if (datdataB.Roms.ContainsKey(key)) if (datdataB.Files.ContainsKey(key))
{ {
datdataB.Roms[key].Add(rom); datdataB.Files[key].Add(rom);
} }
else else
{ {
List<Helper.File> temp = new List<Helper.File>(); List<Helper.File> temp = new List<Helper.File>();
temp.Add(rom); temp.Add(rom);
datdataB.Roms.Add(key, temp); datdataB.Files.Add(key, temp);
} }
} }
else else
{ {
if (datdataA.Roms.ContainsKey(key)) if (datdataA.Files.ContainsKey(key))
{ {
datdataA.Roms[key].Add(rom); datdataA.Files[key].Add(rom);
} }
else else
{ {
List<Helper.File> temp = new List<Helper.File>(); List<Helper.File> temp = new List<Helper.File>();
temp.Add(rom); temp.Add(rom);
datdataA.Roms.Add(key, temp); datdataA.Files.Add(key, temp);
} }
if (datdataB.Roms.ContainsKey(key)) if (datdataB.Files.ContainsKey(key))
{ {
datdataB.Roms[key].Add(rom); datdataB.Files[key].Add(rom);
} }
else else
{ {
List<Helper.File> temp = new List<Helper.File>(); List<Helper.File> temp = new List<Helper.File>();
temp.Add(rom); temp.Add(rom);
datdataB.Roms.Add(key, temp); datdataB.Files.Add(key, temp);
} }
} }
} }

View File

@@ -69,7 +69,7 @@ namespace SabreTools
_cursorLeft = Console.CursorLeft; _cursorLeft = Console.CursorLeft;
_matched = new Dat _matched = new Dat
{ {
Roms = new Dictionary<string, List<Helper.File>>(), Files = new Dictionary<string, List<Helper.File>>(),
}; };
} }
@@ -358,7 +358,7 @@ namespace SabreTools
// Setup the fixdat // Setup the fixdat
_matched = (Dat)_datdata.CloneHeader(); _matched = (Dat)_datdata.CloneHeader();
_matched.Roms = new Dictionary<string, List<Helper.File>>(); _matched.Files = new Dictionary<string, List<Helper.File>>();
_matched.FileName = "fixDat_" + _matched.FileName; _matched.FileName = "fixDat_" + _matched.FileName;
_matched.Name = "fixDat_" + _matched.Name; _matched.Name = "fixDat_" + _matched.Name;
_matched.Description = "fixDat_" + _matched.Description; _matched.Description = "fixDat_" + _matched.Description;
@@ -366,7 +366,7 @@ namespace SabreTools
// Now that all files are parsed, get only files found in directory // Now that all files are parsed, get only files found in directory
bool found = false; bool found = false;
foreach (List<Helper.File> roms in _datdata.Roms.Values) foreach (List<Helper.File> roms in _datdata.Files.Values)
{ {
List<Helper.File> newroms = RomTools.Merge(roms, _logger); List<Helper.File> newroms = RomTools.Merge(roms, _logger);
foreach (Helper.File rom in newroms) foreach (Helper.File rom in newroms)
@@ -375,15 +375,15 @@ namespace SabreTools
{ {
found = true; found = true;
string key = rom.HashData.Size + "-" + rom.HashData.CRC; string key = rom.HashData.Size + "-" + rom.HashData.CRC;
if (_matched.Roms.ContainsKey(key)) if (_matched.Files.ContainsKey(key))
{ {
_matched.Roms[key].Add(rom); _matched.Files[key].Add(rom);
} }
else else
{ {
List<Helper.File> temp = new List<Helper.File>(); List<Helper.File> temp = new List<Helper.File>();
temp.Add(rom); temp.Add(rom);
_matched.Roms.Add(key, temp); _matched.Files.Add(key, temp);
} }
} }
} }
@@ -509,15 +509,15 @@ namespace SabreTools
// Add rom to the matched list // Add rom to the matched list
string key = found.HashData.Size + "-" + found.HashData.CRC; string key = found.HashData.Size + "-" + found.HashData.CRC;
if(_matched.Roms.ContainsKey(key)) if(_matched.Files.ContainsKey(key))
{ {
_matched.Roms[key].Add(found); _matched.Files[key].Add(found);
} }
else else
{ {
List<Helper.File> temp = new List<Helper.File>(); List<Helper.File> temp = new List<Helper.File>();
temp.Add(found); temp.Add(found);
_matched.Roms.Add(key, temp); _matched.Files.Add(key, temp);
} }
if (_toFolder) if (_toFolder)
@@ -573,15 +573,15 @@ namespace SabreTools
{ {
// Add rom to the matched list // Add rom to the matched list
string key = found.HashData.Size + "-" + found.HashData.CRC; string key = found.HashData.Size + "-" + found.HashData.CRC;
if (_matched.Roms.ContainsKey(key)) if (_matched.Files.ContainsKey(key))
{ {
_matched.Roms[key].Add(found); _matched.Files[key].Add(found);
} }
else else
{ {
List<Helper.File> temp = new List<Helper.File>(); List<Helper.File> temp = new List<Helper.File>();
temp.Add(found); temp.Add(found);
_matched.Roms.Add(key, temp); _matched.Files.Add(key, temp);
} }
// First output the headerless rom // First output the headerless rom
@@ -621,15 +621,15 @@ namespace SabreTools
// Add rom to the matched list // Add rom to the matched list
key = newfound.HashData.Size + "-" + newfound.HashData.CRC; key = newfound.HashData.Size + "-" + newfound.HashData.CRC;
if (_matched.Roms.ContainsKey(key)) if (_matched.Files.ContainsKey(key))
{ {
_matched.Roms[key].Add(newfound); _matched.Files[key].Add(newfound);
} }
else else
{ {
List<Helper.File> temp = new List<Helper.File>(); List<Helper.File> temp = new List<Helper.File>();
temp.Add(newfound); temp.Add(newfound);
_matched.Roms.Add(key, temp); _matched.Files.Add(key, temp);
} }
if (_toFolder) if (_toFolder)
@@ -696,15 +696,15 @@ namespace SabreTools
{ {
// Add rom to the matched list // Add rom to the matched list
string key = found.HashData.Size + "-" + found.HashData.CRC; string key = found.HashData.Size + "-" + found.HashData.CRC;
if (_matched.Roms.ContainsKey(key)) if (_matched.Files.ContainsKey(key))
{ {
_matched.Roms[key].Add(found); _matched.Files[key].Add(found);
} }
else else
{ {
List<Helper.File> temp = new List<Helper.File>(); List<Helper.File> temp = new List<Helper.File>();
temp.Add(found); temp.Add(found);
_matched.Roms.Add(key, temp); _matched.Files.Add(key, temp);
} }
if (_toFolder) if (_toFolder)
@@ -876,7 +876,7 @@ namespace SabreTools
foreach (string key in scanned.Keys) foreach (string key in scanned.Keys)
{ {
// If the key doesn't even exist in the DAT, then mark the entire key for removal // If the key doesn't even exist in the DAT, then mark the entire key for removal
if (!_datdata.Roms.ContainsKey(key)) if (!_datdata.Files.ContainsKey(key))
{ {
if (remove.ContainsKey(key)) if (remove.ContainsKey(key))
{ {
@@ -890,7 +890,7 @@ namespace SabreTools
// Otherwise check each of the values individually // Otherwise check each of the values individually
else else
{ {
List<Helper.File> romsList = _datdata.Roms[key]; List<Helper.File> romsList = _datdata.Files[key];
List<Helper.File> scannedList = scanned[key]; List<Helper.File> scannedList = scanned[key];
foreach (Helper.File rom in scannedList) foreach (Helper.File rom in scannedList)
{ {