[ALL] RomData becomes Rom, DatData becomes Dat

This commit is contained in:
Matt Nadareski
2016-06-16 18:57:34 -07:00
parent 1b086e56b4
commit e07258a970
18 changed files with 260 additions and 249 deletions

3
.gitignore vendored
View File

@@ -1,4 +1,7 @@
/.vs /.vs
/CommandVault/obj
/CommandVault/obj/Debug
/CommandVault/obj/Release
/Deheader/obj /Deheader/obj
/Deheader/obj/Debug /Deheader/obj/Debug
/Deheader/obj/Release /Deheader/obj/Release

View File

@@ -157,7 +157,7 @@ namespace SabreTools
logger.User("Unheadered file created!"); logger.User("Unheadered file created!");
// Now add the information to the database if it's not already there // Now add the information to the database if it's not already there
RomData rom = RomTools.GetSingleFileInfo(file + ".new"); Rom rom = RomTools.GetSingleFileInfo(file + ".new");
AddHeaderToDatabase(hstr, rom.SHA1, type); AddHeaderToDatabase(hstr, rom.SHA1, type);
} }
} }
@@ -209,7 +209,7 @@ namespace SabreTools
private static void ReplaceHeader(string file) private static void ReplaceHeader(string file)
{ {
// First, get the SHA-1 hash of the file // First, get the SHA-1 hash of the file
RomData rom = RomTools.GetSingleFileInfo(file); Rom rom = RomTools.GetSingleFileInfo(file);
// Then try to pull the corresponding headers from the database // Then try to pull the corresponding headers from the database
string header = ""; string header = "";

View File

@@ -6,7 +6,7 @@ namespace SabreTools.Helper
/// <summary> /// <summary>
/// Intermediate struct for holding and processing rom data /// Intermediate struct for holding and processing rom data
/// </summary> /// </summary>
public struct RomData : IComparable, IEquatable<RomData> public struct Rom : IComparable, IEquatable<Rom>
{ {
public string Game; public string Game;
public string Name; public string Name;
@@ -24,7 +24,7 @@ namespace SabreTools.Helper
{ {
try try
{ {
RomData comp = (RomData)obj; Rom comp = (Rom)obj;
if (this.Game == comp.Game) if (this.Game == comp.Game)
{ {
@@ -42,7 +42,7 @@ namespace SabreTools.Helper
} }
} }
public bool Equals(RomData other) public bool Equals(Rom other)
{ {
return (this.Game == other.Game && return (this.Game == other.Game &&
this.Name == other.Name && this.Name == other.Name &&
@@ -64,7 +64,7 @@ namespace SabreTools.Helper
/// <summary> /// <summary>
/// Intermediate struct for holding DAT information /// Intermediate struct for holding DAT information
/// </summary> /// </summary>
public struct DatData : ICloneable public struct Dat : ICloneable
{ {
// Data common to most DAT types // Data common to most DAT types
public string FileName; public string FileName;
@@ -85,7 +85,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<RomData>> Roms; public Dictionary<string, List<Rom>> Roms;
// Data specific to the Miss DAT type // Data specific to the Miss DAT type
public bool UseGame; public bool UseGame;
@@ -109,7 +109,7 @@ namespace SabreTools.Helper
public object Clone() public object Clone()
{ {
return new DatData return new Dat
{ {
FileName = this.FileName, FileName = this.FileName,
Name = this.Name, Name = this.Name,

View File

@@ -18,7 +18,7 @@ namespace SabreTools.Helper
/// <param name="input">Input filename to be moved</param> /// <param name="input">Input filename to be moved</param>
/// <param name="output">Output directory to build to</param> /// <param name="output">Output directory to build to</param>
/// <param name="rom">RomData representing the new information</param> /// <param name="rom">RomData representing the new information</param>
public static void WriteToArchive(string input, string output, RomData rom) public static void WriteToArchive(string input, string output, Rom rom)
{ {
string archiveFileName = output + Path.DirectorySeparatorChar + rom.Game + ".zip"; string archiveFileName = output + Path.DirectorySeparatorChar + rom.Game + ".zip";
@@ -311,9 +311,9 @@ namespace SabreTools.Helper
/// <param name="input">Input file to get data from</param> /// <param name="input">Input file to get data from</param>
/// <param name="logger">Logger object for file and console output</param> /// <param name="logger">Logger object for file and console output</param>
/// <returns>List of RomData objects representing the found data</returns> /// <returns>List of RomData objects representing the found data</returns>
public static List<RomData> GetArchiveFileInfo(string input, Logger logger) public static List<Rom> GetArchiveFileInfo(string input, Logger logger)
{ {
List<RomData> roms = new List<RomData>(); List<Rom> roms = new List<Rom>();
string gamename = Path.GetFileNameWithoutExtension(input); string gamename = Path.GetFileNameWithoutExtension(input);
// First get the archive type // First get the archive type
@@ -339,7 +339,7 @@ namespace SabreTools.Helper
{ {
logger.Log("Entry found: '" + reader.Entry.Key + "': " + reader.Entry.Size + ", " + reader.Entry.Crc.ToString("X").ToLowerInvariant()); logger.Log("Entry found: '" + reader.Entry.Key + "': " + reader.Entry.Size + ", " + reader.Entry.Crc.ToString("X").ToLowerInvariant());
roms.Add(new RomData roms.Add(new Rom
{ {
Type = "rom", Type = "rom",
Name = reader.Entry.Key, Name = reader.Entry.Key,
@@ -369,7 +369,7 @@ namespace SabreTools.Helper
/// <param name="input">Filename to get information from</param> /// <param name="input">Filename to get information from</param>
/// <param name="logger">Logger object for file and console output</param> /// <param name="logger">Logger object for file and console output</param>
/// <returns>Populated RomData object if success, empty one on error</returns> /// <returns>Populated RomData object if success, empty one on error</returns>
public static RomData GetTorrentGZFileInfo(string input, Logger logger) public static Rom GetTorrentGZFileInfo(string input, Logger logger)
{ {
string datum = Path.GetFileName(input).ToLowerInvariant(); string datum = Path.GetFileName(input).ToLowerInvariant();
long filesize = new FileInfo(input).Length; long filesize = new FileInfo(input).Length;
@@ -378,14 +378,14 @@ namespace SabreTools.Helper
if (!Regex.IsMatch(datum, @"^[0-9a-f]{40}\.gz")) if (!Regex.IsMatch(datum, @"^[0-9a-f]{40}\.gz"))
{ {
logger.Warning("Non SHA-1 filename found, skipping: '" + datum + "'"); logger.Warning("Non SHA-1 filename found, skipping: '" + datum + "'");
return new RomData(); return new Rom();
} }
// Check if the file is at least the minimum length // Check if the file is at least the minimum length
if (filesize < 32 /* bytes */) if (filesize < 32 /* bytes */)
{ {
logger.Warning("Possibly corrupt file '" + input + "' with size " + Style.GetBytesReadable(filesize)); logger.Warning("Possibly corrupt file '" + input + "' with size " + Style.GetBytesReadable(filesize));
return new RomData(); return new Rom();
} }
// Get the Romba-specific header data // Get the Romba-specific header data
@@ -430,7 +430,7 @@ namespace SabreTools.Helper
} }
} }
RomData rom = new RomData Rom rom = new Rom
{ {
Type = "rom", Type = "rom",
Game = Path.GetFileNameWithoutExtension(input), Game = Path.GetFileNameWithoutExtension(input),

View File

@@ -77,7 +77,7 @@ namespace SabreTools.Helper
/// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param> /// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param>
/// <param name="clean">True if game names are sanitized, false otherwise (default)</param> /// <param name="clean">True if game names are sanitized, false otherwise (default)</param>
/// <returns>DatData object representing the read-in data</returns> /// <returns>DatData object representing the read-in data</returns>
public static DatData Parse(string filename, int sysid, int srcid, DatData datdata, Logger logger, bool keep = false, bool clean = false) public static Dat Parse(string filename, int sysid, int srcid, Dat datdata, Logger logger, bool keep = false, bool clean = false)
{ {
// If the output filename isn't set already, get the internal filename // If the output filename isn't set already, get the internal filename
if (String.IsNullOrEmpty(datdata.FileName)) if (String.IsNullOrEmpty(datdata.FileName))
@@ -94,7 +94,7 @@ namespace SabreTools.Helper
// Make sure there's a dictionary to read to // Make sure there's a dictionary to read to
if (datdata.Roms == null) if (datdata.Roms == null)
{ {
datdata.Roms = new Dictionary<string, List<RomData>>(); datdata.Roms = new Dictionary<string, List<Rom>>();
} }
// Now parse the correct type of DAT // Now parse the correct type of DAT
@@ -123,7 +123,7 @@ namespace SabreTools.Helper
/// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param> /// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param>
/// <param name="clean">True if game names are sanitized, false otherwise (default)</param> /// <param name="clean">True if game names are sanitized, false otherwise (default)</param>
/// <returns>DatData object representing the read-in data</returns> /// <returns>DatData object representing the read-in data</returns>
public static DatData ParseCMP(string filename, int sysid, int srcid, DatData datdata, Logger logger, bool keep, bool clean) public static Dat ParseCMP(string filename, int sysid, int srcid, Dat datdata, Logger logger, bool keep, bool clean)
{ {
// Read the input file, if possible // Read the input file, if possible
logger.Log("Attempting to read file: \"" + filename + "\""); logger.Log("Attempting to read file: \"" + filename + "\"");
@@ -169,7 +169,7 @@ namespace SabreTools.Helper
// If we're in cleaning mode, sanitize the game name // If we're in cleaning mode, sanitize the game name
gamename = (clean ? Style.CleanGameName(gamename) : gamename); gamename = (clean ? Style.CleanGameName(gamename) : gamename);
RomData rom = new RomData Rom rom = new Rom
{ {
Game = gamename, Game = gamename,
Type = (line.Trim().StartsWith("disk (") ? "disk" : "rom"), Type = (line.Trim().StartsWith("disk (") ? "disk" : "rom"),
@@ -339,7 +339,7 @@ namespace SabreTools.Helper
} }
else else
{ {
List<RomData> templist = new List<RomData>(); List<Rom> templist = new List<Rom>();
templist.Add(rom); templist.Add(rom);
datdata.Roms.Add(key, templist); datdata.Roms.Add(key, templist);
} }
@@ -455,7 +455,7 @@ namespace SabreTools.Helper
/// <param name="logger">Logger object for console and/or file output</param> /// <param name="logger">Logger object for console and/or file output</param>
/// <param name="clean">True if game names are sanitized, false otherwise (default)</param> /// <param name="clean">True if game names are sanitized, false otherwise (default)</param>
/// <returns>DatData object representing the read-in data</returns> /// <returns>DatData object representing the read-in data</returns>
public static DatData ParseRC(string filename, int sysid, int srcid, DatData datdata, Logger logger, bool clean) public static Dat ParseRC(string filename, int sysid, int srcid, Dat datdata, Logger logger, bool clean)
{ {
// Read the input file, if possible // Read the input file, if possible
logger.Log("Attempting to read file: \"" + filename + "\""); logger.Log("Attempting to read file: \"" + filename + "\"");
@@ -570,7 +570,7 @@ namespace SabreTools.Helper
// If we're in cleaning mode, sanitize the game name // If we're in cleaning mode, sanitize the game name
rominfo[3] = (clean ? Style.CleanGameName(rominfo[3]) : rominfo[3]); rominfo[3] = (clean ? Style.CleanGameName(rominfo[3]) : rominfo[3]);
RomData rom = new RomData Rom rom = new Rom
{ {
Game = rominfo[3], Game = rominfo[3],
Name = rominfo[5], Name = rominfo[5],
@@ -640,7 +640,7 @@ namespace SabreTools.Helper
} }
else else
{ {
List<RomData> templist = new List<RomData>(); List<Rom> templist = new List<Rom>();
templist.Add(rom); templist.Add(rom);
datdata.Roms.Add(key, templist); datdata.Roms.Add(key, templist);
} }
@@ -674,7 +674,7 @@ namespace SabreTools.Helper
/// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param> /// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param>
/// <param name="clean">True if game names are sanitized, false otherwise (default)</param> /// <param name="clean">True if game names are sanitized, false otherwise (default)</param>
/// <returns>DatData object representing the read-in data</returns> /// <returns>DatData object representing the read-in data</returns>
public static DatData ParseXML(string filename, int sysid, int srcid, DatData datdata, Logger logger, bool keep, bool clean) public static Dat ParseXML(string filename, int sysid, int srcid, Dat datdata, Logger logger, bool keep, bool clean)
{ {
// Prepare all internal variables // Prepare all internal variables
XmlReader subreader, headreader, flagreader; XmlReader subreader, headreader, flagreader;
@@ -700,7 +700,7 @@ namespace SabreTools.Helper
// If we're in cleaning mode, sanitize the game name // If we're in cleaning mode, sanitize the game name
tempgame = (clean ? Style.CleanGameName(tempgame) : tempgame); tempgame = (clean ? Style.CleanGameName(tempgame) : tempgame);
RomData rom = new RomData Rom rom = new Rom
{ {
Type = "rom", Type = "rom",
Name = "null", Name = "null",
@@ -718,7 +718,7 @@ namespace SabreTools.Helper
} }
else else
{ {
List<RomData> temp = new List<RomData>(); List<Rom> temp = new List<Rom>();
temp.Add(rom); temp.Add(rom);
datdata.Roms.Add(key, temp); datdata.Roms.Add(key, temp);
} }
@@ -1090,7 +1090,7 @@ namespace SabreTools.Helper
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.Roms[key].Count() - 1;
RomData lastrom = datdata.Roms[key][index]; Rom lastrom = datdata.Roms[key][index];
lastrom.Size += size; lastrom.Size += size;
datdata.Roms[key].RemoveAt(index); datdata.Roms[key].RemoveAt(index);
datdata.Roms[key].Add(lastrom); datdata.Roms[key].Add(lastrom);
@@ -1145,7 +1145,7 @@ namespace SabreTools.Helper
// Get the new values to add // Get the new values to add
key = size + "-" + crc; key = size + "-" + crc;
RomData rom = new RomData Rom rom = new Rom
{ {
Game = tempname, Game = tempname,
Name = subreader.GetAttribute("name"), Name = subreader.GetAttribute("name"),
@@ -1165,7 +1165,7 @@ namespace SabreTools.Helper
} }
else else
{ {
List<RomData> newvalue = new List<RomData>(); List<Rom> newvalue = new List<Rom>();
newvalue.Add(rom); newvalue.Add(rom);
datdata.Roms.Add(key, newvalue); datdata.Roms.Add(key, newvalue);
} }
@@ -1197,7 +1197,7 @@ namespace SabreTools.Helper
// If we're in cleaning mode, sanitize the game name // If we're in cleaning mode, sanitize the game name
tempname = (clean ? Style.CleanGameName(tempname.Split(Path.DirectorySeparatorChar)) : tempname); tempname = (clean ? Style.CleanGameName(tempname.Split(Path.DirectorySeparatorChar)) : tempname);
RomData rom = new RomData Rom rom = new Rom
{ {
Type = "rom", Type = "rom",
Name = "null", Name = "null",
@@ -1215,7 +1215,7 @@ namespace SabreTools.Helper
} }
else else
{ {
List<RomData> temp = new List<RomData>(); List<Rom> temp = new List<Rom>();
temp.Add(rom); temp.Add(rom);
datdata.Roms.Add(key, temp); datdata.Roms.Add(key, temp);
} }
@@ -1316,7 +1316,7 @@ namespace SabreTools.Helper
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.Roms[key].Count() - 1;
RomData lastrom = datdata.Roms[key][index]; Rom lastrom = datdata.Roms[key][index];
lastrom.Size += size; lastrom.Size += size;
datdata.Roms[key].RemoveAt(index); datdata.Roms[key].RemoveAt(index);
datdata.Roms[key].Add(lastrom); datdata.Roms[key].Add(lastrom);
@@ -1380,7 +1380,7 @@ namespace SabreTools.Helper
// Get the new values to add // Get the new values to add
key = size + "-" + crc; key = size + "-" + crc;
RomData rom = new RomData Rom rom = new Rom
{ {
Game = tempname, Game = tempname,
Name = xtr.GetAttribute("name"), Name = xtr.GetAttribute("name"),
@@ -1400,7 +1400,7 @@ namespace SabreTools.Helper
} }
else else
{ {
List<RomData> newvalue = new List<RomData>(); List<Rom> newvalue = new List<Rom>();
newvalue.Add(rom); newvalue.Add(rom);
datdata.Roms.Add(key, newvalue); datdata.Roms.Add(key, newvalue);
} }
@@ -1438,9 +1438,9 @@ namespace SabreTools.Helper
/// <param name="logger">Logger object for file and console output</param> /// <param name="logger">Logger object for file and console output</param>
/// <param name="output">True if the number of hashes counted is to be output (default), false otherwise</param> /// <param name="output">True if the number of hashes counted is to be output (default), false otherwise</param>
/// <returns>SortedDictionary bucketed by game name</returns> /// <returns>SortedDictionary bucketed by game name</returns>
public static SortedDictionary<string, List<RomData>> BucketByGame(List<RomData> list, bool mergeroms, bool norename, Logger logger, bool output = true) public static SortedDictionary<string, List<Rom>> BucketByGame(List<Rom> list, bool mergeroms, bool norename, Logger logger, bool output = true)
{ {
Dictionary<string, List<RomData>> dict = new Dictionary<string, List<RomData>>(); Dictionary<string, List<Rom>> dict = new Dictionary<string, List<Rom>>();
dict.Add("key", list); dict.Add("key", list);
return BucketByGame(dict, mergeroms, norename, logger, output); return BucketByGame(dict, mergeroms, norename, logger, output);
} }
@@ -1454,9 +1454,9 @@ namespace SabreTools.Helper
/// <param name="logger">Logger object for file and console output</param> /// <param name="logger">Logger object for file and console output</param>
/// <param name="output">True if the number of hashes counted is to be output (default), false otherwise</param> /// <param name="output">True if the number of hashes counted is to be output (default), false otherwise</param>
/// <returns>SortedDictionary bucketed by game name</returns> /// <returns>SortedDictionary bucketed by game name</returns>
public static SortedDictionary<string, List<RomData>> BucketByGame(IDictionary<string, List<RomData>> dict, bool mergeroms, bool norename, Logger logger, bool output = true) public static SortedDictionary<string, List<Rom>> BucketByGame(IDictionary<string, List<Rom>> dict, bool mergeroms, bool norename, Logger logger, bool output = true)
{ {
SortedDictionary<string, List<RomData>> sortable = new SortedDictionary<string, List<RomData>>(); SortedDictionary<string, List<Rom>> sortable = new SortedDictionary<string, List<Rom>>();
long count = 0; long count = 0;
// If we have a null dict or an empty one, output a new dictionary // If we have a null dict or an empty one, output a new dictionary
@@ -1466,15 +1466,15 @@ namespace SabreTools.Helper
} }
// Process each all of the roms // Process each all of the roms
foreach (List<RomData> roms in dict.Values) foreach (List<Rom> roms in dict.Values)
{ {
List<RomData> newroms = roms; List<Rom> newroms = roms;
if (mergeroms) if (mergeroms)
{ {
newroms = RomTools.Merge(newroms, logger); newroms = RomTools.Merge(newroms, logger);
} }
foreach (RomData rom in newroms) foreach (Rom rom in newroms)
{ {
count++; count++;
string key = (norename ? "" : rom.Metadata.SystemID.ToString().PadLeft(10, '0') + "-" + rom.Metadata.SourceID.ToString().PadLeft(10, '0') + "-") + rom.Game.ToLowerInvariant(); string key = (norename ? "" : rom.Metadata.SystemID.ToString().PadLeft(10, '0') + "-" + rom.Metadata.SourceID.ToString().PadLeft(10, '0') + "-") + rom.Game.ToLowerInvariant();
@@ -1484,7 +1484,7 @@ namespace SabreTools.Helper
} }
else else
{ {
List<RomData> temp = new List<RomData>(); List<Rom> temp = new List<Rom>();
temp.Add(rom); temp.Add(rom);
sortable.Add(key, temp); sortable.Add(key, temp);
} }
@@ -1509,9 +1509,9 @@ namespace SabreTools.Helper
/// <param name="logger">Logger object for file and console output</param> /// <param name="logger">Logger object for file and console output</param>
/// <param name="output">True if the number of hashes counted is to be output (default), false otherwise</param> /// <param name="output">True if the number of hashes counted is to be output (default), false otherwise</param>
/// <returns>SortedDictionary bucketed by size and hash</returns> /// <returns>SortedDictionary bucketed by size and hash</returns>
public static SortedDictionary<string, List<RomData>> BucketByHashSize(List<RomData> list, bool mergeroms, bool norename, Logger logger, bool output = true) public static SortedDictionary<string, List<Rom>> BucketByHashSize(List<Rom> list, bool mergeroms, bool norename, Logger logger, bool output = true)
{ {
Dictionary<string, List<RomData>> dict = new Dictionary<string, List<RomData>>(); Dictionary<string, List<Rom>> dict = new Dictionary<string, List<Rom>>();
dict.Add("key", list); dict.Add("key", list);
return BucketByHashSize(dict, mergeroms, norename, logger, output); return BucketByHashSize(dict, mergeroms, norename, logger, output);
} }
@@ -1525,9 +1525,9 @@ namespace SabreTools.Helper
/// <param name="logger">Logger object for file and console output</param> /// <param name="logger">Logger object for file and console output</param>
/// <param name="output">True if the number of hashes counted is to be output (default), false otherwise</param> /// <param name="output">True if the number of hashes counted is to be output (default), false otherwise</param>
/// <returns>SortedDictionary bucketed by size and hash</returns> /// <returns>SortedDictionary bucketed by size and hash</returns>
public static SortedDictionary<string, List<RomData>> BucketByHashSize(IDictionary<string, List<RomData>> dict, bool mergeroms, bool norename, Logger logger, bool output = true) public static SortedDictionary<string, List<Rom>> BucketByHashSize(IDictionary<string, List<Rom>> dict, bool mergeroms, bool norename, Logger logger, bool output = true)
{ {
SortedDictionary<string, List<RomData>> sortable = new SortedDictionary<string, List<RomData>>(); SortedDictionary<string, List<Rom>> sortable = new SortedDictionary<string, List<Rom>>();
long count = 0; long count = 0;
// If we have a null dict or an empty one, output a new dictionary // If we have a null dict or an empty one, output a new dictionary
@@ -1537,15 +1537,15 @@ namespace SabreTools.Helper
} }
// Process each all of the roms // Process each all of the roms
foreach (List<RomData> roms in dict.Values) foreach (List<Rom> roms in dict.Values)
{ {
List<RomData> newroms = roms; List<Rom> newroms = roms;
if (mergeroms) if (mergeroms)
{ {
newroms = RomTools.Merge(newroms, logger); newroms = RomTools.Merge(newroms, logger);
} }
foreach (RomData rom in newroms) foreach (Rom rom in newroms)
{ {
count++; count++;
string key = rom.Size + "-" + rom.CRC; ; string key = rom.Size + "-" + rom.CRC; ;
@@ -1555,7 +1555,7 @@ namespace SabreTools.Helper
} }
else else
{ {
List<RomData> temp = new List<RomData>(); List<Rom> temp = new List<Rom>();
temp.Add(rom); temp.Add(rom);
sortable.Add(key, temp); sortable.Add(key, temp);
} }
@@ -1589,7 +1589,7 @@ namespace SabreTools.Helper
/// <param name="sha1">SHA-1 of the rom to match (can use asterisk-partials)</param> /// <param name="sha1">SHA-1 of the rom to match (can use asterisk-partials)</param>
/// <param name="nodump">Select roms with nodump status as follows: null (match all), true (match Nodump only), false (exclude Nodump)</param> /// <param name="nodump">Select roms with nodump status as follows: null (match all), true (match Nodump only), false (exclude Nodump)</param>
/// <param name="logger">Logging object for console and file output</param> /// <param name="logger">Logging object for console and file output</param>
public static void Update(string inputFileName, DatData datdata, string outputDirectory, bool clean, string gamename, string romname, public static void Update(string inputFileName, Dat datdata, string outputDirectory, bool clean, string gamename, string romname,
string romtype, long sgt, long slt, long seq, string crc, string md5, string sha1, bool? nodump, Logger logger) string romtype, long sgt, long slt, long seq, string crc, string md5, string sha1, bool? nodump, Logger logger)
{ {
// Clean the input string // Clean the input string
@@ -1620,7 +1620,7 @@ namespace SabreTools.Helper
foreach (string file in Directory.EnumerateFiles(inputFileName, "*", SearchOption.AllDirectories)) foreach (string file in Directory.EnumerateFiles(inputFileName, "*", SearchOption.AllDirectories))
{ {
logger.User("Processing \"" + Path.GetFullPath(file).Remove(0, inputFileName.Length) + "\""); logger.User("Processing \"" + Path.GetFullPath(file).Remove(0, inputFileName.Length) + "\"");
DatData innerDatdata = (DatData)datdata.Clone(); Dat innerDatdata = (Dat)datdata.Clone();
innerDatdata.Roms = null; innerDatdata.Roms = null;
innerDatdata = Parse(file, 0, 0, innerDatdata, logger, true, clean); innerDatdata = Parse(file, 0, 0, innerDatdata, logger, true, clean);
innerDatdata = Filter(innerDatdata, gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, logger); innerDatdata = Filter(innerDatdata, gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, logger);
@@ -1658,16 +1658,16 @@ namespace SabreTools.Helper
/// <param name="nodump">Select roms with nodump status as follows: null (match all), true (match Nodump only), false (exclude Nodump)</param> /// <param name="nodump">Select roms with nodump status as follows: null (match all), true (match Nodump only), false (exclude Nodump)</param>
/// <param name="logger">Logging object for console and file output</param> /// <param name="logger">Logging object for console and file output</param>
/// <returns>Returns filtered DatData object</returns> /// <returns>Returns filtered DatData object</returns>
public static DatData Filter(DatData datdata, string gamename, string romname, string romtype, long sgt, public static Dat Filter(Dat datdata, string gamename, string romname, string romtype, long sgt,
long slt, long seq, string crc, string md5, string sha1, bool? nodump, Logger logger) long slt, long seq, string crc, string md5, string sha1, bool? nodump, Logger logger)
{ {
// 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<RomData>> dict = new Dictionary<string, List<RomData>>(); Dictionary<string, List<Rom>> dict = new Dictionary<string, List<Rom>>();
List<string> keys = datdata.Roms.Keys.ToList(); List<string> keys = datdata.Roms.Keys.ToList();
foreach (string key in keys) foreach (string key in keys)
{ {
List<RomData> roms = datdata.Roms[key]; List<Rom> roms = datdata.Roms[key];
foreach (RomData rom in roms) foreach (Rom rom in roms)
{ {
// Filter on nodump status // Filter on nodump status
if (nodump == true && !rom.Nodump) if (nodump == true && !rom.Nodump)
@@ -1794,7 +1794,7 @@ namespace SabreTools.Helper
} }
else else
{ {
List<RomData> temp = new List<RomData>(); List<Rom> temp = new List<Rom>();
temp.Add(rom); temp.Add(rom);
dict.Add(key, temp); dict.Add(key, temp);
} }

View File

@@ -23,7 +23,7 @@ namespace SabreTools.Helper
/// - Have the ability to strip special (non-ASCII) characters from rom information /// - Have the ability to strip special (non-ASCII) characters from rom information
/// - Add a flag for ignoring roms with blank sizes /// - Add a flag for ignoring roms with blank sizes
/// </remarks> /// </remarks>
public static bool WriteDatfile(DatData datdata, string outDir, Logger logger, bool norename = true, bool stats = false) public static bool WriteDatfile(Dat datdata, string outDir, Logger logger, bool norename = true, bool stats = false)
{ {
// Output initial statistics, for kicks // Output initial statistics, for kicks
if (stats) if (stats)
@@ -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<RomData>> sortable = DatTools.BucketByGame(datdata.Roms, datdata.MergeRoms, norename, logger); SortedDictionary<string, List<Rom>> sortable = DatTools.BucketByGame(datdata.Roms, 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
@@ -61,11 +61,11 @@ namespace SabreTools.Helper
int depth = 2, last = -1; int depth = 2, last = -1;
string lastgame = null; string lastgame = null;
List<string> splitpath = new List<string>(); List<string> splitpath = new List<string>();
foreach (List<RomData> roms in sortable.Values) foreach (List<Rom> roms in sortable.Values)
{ {
for (int index = 0; index < roms.Count; index++) for (int index = 0; index < roms.Count; index++)
{ {
RomData rom = roms[index]; Rom rom = roms[index];
List<string> newsplit = rom.Game.Split('\\').ToList(); List<string> newsplit = rom.Game.Split('\\').ToList();
// If we have a different game and we're not at the start of the list, output the end of last item // If we have a different game and we're not at the start of the list, output the end of last item
@@ -136,7 +136,7 @@ namespace SabreTools.Helper
/// <param name="datdata">DatData object representing DAT information</param> /// <param name="datdata">DatData object representing DAT information</param>
/// <param name="logger">Logger object for file and console output</param> /// <param name="logger">Logger object for file and console output</param>
/// <returns>True if the data was written, false on error</returns> /// <returns>True if the data was written, false on error</returns>
public static bool WriteHeader(StreamWriter sw, DatData datdata, Logger logger) public static bool WriteHeader(StreamWriter sw, Dat datdata, Logger logger)
{ {
try try
{ {
@@ -244,7 +244,7 @@ namespace SabreTools.Helper
/// <param name="last">Last known depth to cycle back from (SabreDAT only)</param> /// <param name="last">Last known depth to cycle back from (SabreDAT only)</param>
/// <param name="logger">Logger object for file and console output</param> /// <param name="logger">Logger object for file and console output</param>
/// <returns>The new depth of the tag</returns> /// <returns>The new depth of the tag</returns>
public static int WriteStartGame(StreamWriter sw, RomData rom, List<string> newsplit, string lastgame, DatData datdata, int depth, int last, Logger logger) public static int WriteStartGame(StreamWriter sw, Rom rom, List<string> newsplit, string lastgame, Dat datdata, int depth, int last, Logger logger)
{ {
try try
{ {
@@ -303,7 +303,7 @@ namespace SabreTools.Helper
/// <param name="last">Last known depth to cycle back from (SabreDAT only)</param> /// <param name="last">Last known depth to cycle back from (SabreDAT only)</param>
/// <param name="logger">Logger object for file and console output</param> /// <param name="logger">Logger object for file and console output</param>
/// <returns>The new depth of the tag</returns> /// <returns>The new depth of the tag</returns>
public static int WriteEndGame(StreamWriter sw, RomData rom, List<string> splitpath, List<string> newsplit, string lastgame, DatData datdata, int depth, out int last, Logger logger) public static int WriteEndGame(StreamWriter sw, Rom rom, List<string> splitpath, List<string> newsplit, string lastgame, Dat datdata, int depth, out int last, Logger logger)
{ {
last = 0; last = 0;
@@ -372,7 +372,7 @@ namespace SabreTools.Helper
/// <param name="depth">Current depth to output file at (SabreDAT only)</param> /// <param name="depth">Current depth to output file at (SabreDAT only)</param>
/// <param name="logger">Logger object for file and console output</param> /// <param name="logger">Logger object for file and console output</param>
/// <returns>True if the data was written, false on error</returns> /// <returns>True if the data was written, false on error</returns>
public static bool WriteRomData(StreamWriter sw, RomData rom, string lastgame, DatData datdata, int depth, Logger logger) public static bool WriteRomData(StreamWriter sw, Rom rom, string lastgame, Dat datdata, int depth, Logger logger)
{ {
try try
{ {
@@ -505,7 +505,7 @@ namespace SabreTools.Helper
/// /// <param name="depth">Current depth to output file at (SabreDAT only)</param> /// /// <param name="depth">Current depth to output file at (SabreDAT only)</param>
/// <param name="logger">Logger object for file and console output</param> /// <param name="logger">Logger object for file and console output</param>
/// <returns>True if the data was written, false on error</returns> /// <returns>True if the data was written, false on error</returns>
public static bool WriteFooter(StreamWriter sw, DatData datdata, int depth, Logger logger) public static bool WriteFooter(StreamWriter sw, Dat datdata, int depth, Logger logger)
{ {
try try
{ {

View File

@@ -17,9 +17,9 @@ namespace SabreTools.Helper
/// <param name="noSHA1">True if SHA-1 hashes should not be calcluated, false otherwise</param> /// <param name="noSHA1">True if SHA-1 hashes should not be calcluated, false otherwise</param>
/// <returns>Populated RomData object if success, empty one on error</returns> /// <returns>Populated RomData object if success, empty one on error</returns>
/// <remarks>Add read-offset for hash info</remarks> /// <remarks>Add read-offset for hash info</remarks>
public static RomData GetSingleFileInfo(string input, bool noMD5 = false, bool noSHA1 = false, long offset = 0) public static Rom GetSingleFileInfo(string input, bool noMD5 = false, bool noSHA1 = false, long offset = 0)
{ {
RomData rom = new RomData Rom rom = new Rom
{ {
Name = Path.GetFileName(input), Name = Path.GetFileName(input),
Type = "rom", Type = "rom",
@@ -74,7 +74,7 @@ namespace SabreTools.Helper
} }
catch (IOException) catch (IOException)
{ {
return new RomData(); return new Rom();
} }
return rom; return rom;
@@ -144,19 +144,19 @@ namespace SabreTools.Helper
/// <param name="inroms">List of RomData objects representing the roms to be merged</param> /// <param name="inroms">List of RomData objects representing the roms to be merged</param>
/// <param name="logger">Logger object for console and/or file output</param> /// <param name="logger">Logger object for console and/or file output</param>
/// <returns>A List of RomData objects representing the merged roms</returns> /// <returns>A List of RomData objects representing the merged roms</returns>
public static List<RomData> Merge(List<RomData> inroms, Logger logger) public static List<Rom> Merge(List<Rom> inroms, Logger logger)
{ {
// Check for null or blank roms first // Check for null or blank roms first
if (inroms == null || inroms.Count == 0) if (inroms == null || inroms.Count == 0)
{ {
return new List<RomData>(); return new List<Rom>();
} }
// Create output list // Create output list
List<RomData> outroms = new List<RomData>(); List<Rom> outroms = new List<Rom>();
// Then deduplicate them by checking to see if data matches previous saved roms // Then deduplicate them by checking to see if data matches previous saved roms
foreach (RomData rom in inroms) foreach (Rom rom in inroms)
{ {
// If it's a nodump, add and skip // If it's a nodump, add and skip
if (rom.Nodump) if (rom.Nodump)
@@ -170,11 +170,11 @@ namespace SabreTools.Helper
{ {
// Check if the rom is a duplicate // Check if the rom is a duplicate
DupeType dupetype = DupeType.None; DupeType dupetype = DupeType.None;
RomData savedrom = new RomData(); Rom savedrom = new Rom();
int pos = -1; int pos = -1;
for (int i = 0; i < outroms.Count; i++) for (int i = 0; i < outroms.Count; i++)
{ {
RomData lastrom = outroms[i]; Rom lastrom = outroms[i];
// Get the duplicate status // Get the duplicate status
dupetype = GetDuplicateStatus(rom, lastrom); dupetype = GetDuplicateStatus(rom, lastrom);
@@ -240,9 +240,9 @@ namespace SabreTools.Helper
/// <param name="lastrom">Rom to use as a base</param> /// <param name="lastrom">Rom to use as a base</param>
/// <param name="datdata">DAT to match against</param> /// <param name="datdata">DAT to match against</param>
/// <returns>List of matched RomData objects</returns> /// <returns>List of matched RomData objects</returns>
public static List<RomData> GetDuplicates(RomData lastrom, DatData datdata) public static List<Rom> GetDuplicates(Rom lastrom, Dat datdata)
{ {
List<RomData> output = new List<RomData>(); List<Rom> output = new List<Rom>();
// Check for an empty rom list first // Check for an empty rom list first
if (datdata.Roms == null || datdata.Roms.Count == 0) if (datdata.Roms == null || datdata.Roms.Count == 0)
@@ -251,9 +251,9 @@ namespace SabreTools.Helper
} }
// Try to find duplicates // Try to find duplicates
foreach (List<RomData> roms in datdata.Roms.Values) foreach (List<Rom> roms in datdata.Roms.Values)
{ {
foreach (RomData rom in roms) foreach (Rom rom in roms)
{ {
if (IsDuplicate(rom, lastrom)) if (IsDuplicate(rom, lastrom))
{ {
@@ -271,7 +271,7 @@ namespace SabreTools.Helper
/// <param name="rom">Rom to check for duplicate status</param> /// <param name="rom">Rom to check for duplicate status</param>
/// <param name="lastrom">Rom to use as a baseline</param> /// <param name="lastrom">Rom to use as a baseline</param>
/// <returns>True if the roms are duplicates, false otherwise</returns> /// <returns>True if the roms are duplicates, false otherwise</returns>
public static bool IsDuplicate(RomData rom, RomData lastrom) public static bool IsDuplicate(Rom rom, Rom lastrom)
{ {
bool dupefound = false; bool dupefound = false;
@@ -305,7 +305,7 @@ namespace SabreTools.Helper
/// <param name="rom">Current rom to check</param> /// <param name="rom">Current rom to check</param>
/// <param name="lastrom">Last rom to check against</param> /// <param name="lastrom">Last rom to check against</param>
/// <returns>The DupeType corresponding to the relationship between the two</returns> /// <returns>The DupeType corresponding to the relationship between the two</returns>
public static DupeType GetDuplicateStatus(RomData rom, RomData lastrom) public static DupeType GetDuplicateStatus(Rom rom, Rom lastrom)
{ {
DupeType output = DupeType.None; DupeType output = DupeType.None;
@@ -350,9 +350,9 @@ namespace SabreTools.Helper
/// <param name="roms">List of RomData objects representing the roms to be sorted</param> /// <param name="roms">List of RomData objects representing the roms to be sorted</param>
/// <param name="norename">True if files are not renamed, false otherwise</param> /// <param name="norename">True if files are not renamed, false otherwise</param>
/// <returns>True if it sorted correctly, false otherwise</returns> /// <returns>True if it sorted correctly, false otherwise</returns>
public static bool Sort(List<RomData> roms, bool norename) public static bool Sort(List<Rom> roms, bool norename)
{ {
roms.Sort(delegate (RomData x, RomData y) roms.Sort(delegate (Rom x, Rom y)
{ {
if (x.Metadata.SystemID == y.Metadata.SystemID) if (x.Metadata.SystemID == y.Metadata.SystemID)
{ {

View File

@@ -47,9 +47,9 @@ namespace SabreTools.Helper
{ {
_logger.User("Beginning stat collection for '" + filename + "'"); _logger.User("Beginning stat collection for '" + filename + "'");
List<String> games = new List<String>(); List<String> games = new List<String>();
DatData datdata = new DatData(); Dat datdata = new Dat();
datdata = DatTools.Parse(filename, 0, 0, datdata, _logger); datdata = DatTools.Parse(filename, 0, 0, datdata, _logger);
SortedDictionary<string, List<RomData>> newroms = DatTools.BucketByGame(datdata.Roms, false, true, _logger, false); SortedDictionary<string, List<Rom>> newroms = DatTools.BucketByGame(datdata.Roms, false, true, _logger, false);
// Output single DAT stats (if asked) // Output single DAT stats (if asked)
if (_single) if (_single)
@@ -76,7 +76,7 @@ namespace SabreTools.Helper
// Output total DAT stats // Output total DAT stats
if (!_single) { _logger.User(""); } if (!_single) { _logger.User(""); }
DatData totaldata = new DatData Dat totaldata = new Dat
{ {
TotalSize = totalSize, TotalSize = totalSize,
RomCount = totalRom, RomCount = totalRom,
@@ -102,7 +102,7 @@ Please check the log folder if the stats scrolled offscreen");
/// <param name="logger">Logger object for file and console writing</param> /// <param name="logger">Logger object for file and console writing</param>
/// <param name="recalculate">True if numbers should be recalculated for the DAT, false otherwise (default)</param> /// <param name="recalculate">True if numbers should be recalculated for the DAT, false otherwise (default)</param>
/// <param name="game">Number of games to use, -1 means recalculate games (default)</param> /// <param name="game">Number of games to use, -1 means recalculate games (default)</param>
public static void OutputStats(DatData datdata, Logger logger, bool recalculate = false, long game = -1) public static void OutputStats(Dat datdata, Logger logger, bool recalculate = false, long game = -1)
{ {
if (recalculate) if (recalculate)
{ {
@@ -116,9 +116,9 @@ 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<RomData> roms in datdata.Roms.Values) foreach (List<Rom> roms in datdata.Roms.Values)
{ {
foreach (RomData rom in roms) foreach (Rom rom in roms)
{ {
datdata.RomCount += (rom.Type == "rom" ? 1 : 0); datdata.RomCount += (rom.Type == "rom" ? 1 : 0);
datdata.DiskCount += (rom.Type == "disk" ? 1 : 0); datdata.DiskCount += (rom.Type == "disk" ? 1 : 0);
@@ -131,7 +131,7 @@ Please check the log folder if the stats scrolled offscreen");
} }
} }
SortedDictionary<string, List<RomData>> newroms = DatTools.BucketByGame(datdata.Roms, false, true, logger); SortedDictionary<string, List<Rom>> newroms = DatTools.BucketByGame(datdata.Roms, false, true, logger);
logger.User(@" Uncompressed size: " + Style.GetBytesReadable(datdata.TotalSize) + @" logger.User(@" Uncompressed size: " + Style.GetBytesReadable(datdata.TotalSize) + @"
Games found: " + (game == -1 ? newroms.Count : game) + @" Games found: " + (game == -1 ? newroms.Count : game) + @"
Roms found: " + datdata.RomCount + @" Roms found: " + datdata.RomCount + @"

View File

@@ -144,7 +144,7 @@ namespace SabreTools.Helper
/// <param name="outDir">Output directory</param> /// <param name="outDir">Output directory</param>
/// <param name="datdata">DAT information</param> /// <param name="datdata">DAT information</param>
/// <returns>String representing the proper name</returns> /// <returns>String representing the proper name</returns>
public static string CreateOutfileName(string outDir, DatData datdata) public static string CreateOutfileName(string outDir, Dat datdata)
{ {
// Double check the outdir for the end delim // Double check the outdir for the end delim
if (!outDir.EndsWith(Path.DirectorySeparatorChar.ToString())) if (!outDir.EndsWith(Path.DirectorySeparatorChar.ToString()))

View File

@@ -58,6 +58,14 @@ Global
{7668FFA4-19AF-4F5D-8463-C7EF5B080FA4}.Release|Any CPU.Build.0 = Release|Any CPU {7668FFA4-19AF-4F5D-8463-C7EF5B080FA4}.Release|Any CPU.Build.0 = Release|Any CPU
{7668FFA4-19AF-4F5D-8463-C7EF5B080FA4}.Release|x64.ActiveCfg = Release|x64 {7668FFA4-19AF-4F5D-8463-C7EF5B080FA4}.Release|x64.ActiveCfg = Release|x64
{7668FFA4-19AF-4F5D-8463-C7EF5B080FA4}.Release|x64.Build.0 = Release|x64 {7668FFA4-19AF-4F5D-8463-C7EF5B080FA4}.Release|x64.Build.0 = Release|x64
{9B0BF92E-C347-4DB5-BF60-C34AEACD3FB5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9B0BF92E-C347-4DB5-BF60-C34AEACD3FB5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9B0BF92E-C347-4DB5-BF60-C34AEACD3FB5}.Debug|x64.ActiveCfg = Debug|Any CPU
{9B0BF92E-C347-4DB5-BF60-C34AEACD3FB5}.Debug|x64.Build.0 = Debug|Any CPU
{9B0BF92E-C347-4DB5-BF60-C34AEACD3FB5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9B0BF92E-C347-4DB5-BF60-C34AEACD3FB5}.Release|Any CPU.Build.0 = Release|Any CPU
{9B0BF92E-C347-4DB5-BF60-C34AEACD3FB5}.Release|x64.ActiveCfg = Release|Any CPU
{9B0BF92E-C347-4DB5-BF60-C34AEACD3FB5}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@@ -18,7 +18,7 @@ namespace SabreTools
// User specified inputs // User specified inputs
private List<String> _inputs; private List<String> _inputs;
private DatData _datdata; private Dat _datdata;
private bool _noMD5; private bool _noMD5;
private bool _noSHA1; private bool _noSHA1;
private bool _bare; private bool _bare;
@@ -40,7 +40,7 @@ namespace SabreTools
/// <param name="enableGzip">True if GZIP archives should be treated as files, false otherwise</param>> /// <param name="enableGzip">True if GZIP archives should be treated as files, false otherwise</param>>
/// <param name="logger">Logger object for console and file output</param> /// <param name="logger">Logger object for console and file output</param>
/// <param name="tempDir">Name of the directory to create a temp folder in (blank is current directory)</param> /// <param name="tempDir">Name of the directory to create a temp folder in (blank is current directory)</param>
public DATFromDir(List<String> inputs, DatData datdata, bool noMD5, bool noSHA1, bool bare, bool archivesAsFiles, bool enableGzip, string tempDir, Logger logger) public DATFromDir(List<String> inputs, Dat datdata, bool noMD5, bool noSHA1, bool bare, bool archivesAsFiles, bool enableGzip, string tempDir, Logger logger)
{ {
_inputs = inputs; _inputs = inputs;
_datdata = datdata; _datdata = datdata;
@@ -152,7 +152,7 @@ namespace SabreTools
if (!items) if (!items)
{ {
string actualroot = item.Remove(0, basePathBackup.Length); string actualroot = item.Remove(0, basePathBackup.Length);
RomData rom = new RomData Rom rom = new Rom
{ {
Name = "null", Name = "null",
Game = (_datdata.Type == "SuperDAT" ? Game = (_datdata.Type == "SuperDAT" ?
@@ -173,7 +173,7 @@ namespace SabreTools
} }
else else
{ {
List<RomData> temp = new List<RomData>(); List<Rom> temp = new List<Rom>();
temp.Add(rom); temp.Add(rom);
_datdata.Roms.Add(key, temp); _datdata.Roms.Add(key, temp);
} }
@@ -185,7 +185,7 @@ namespace SabreTools
if (Directory.EnumerateFiles(subdir, "*", SearchOption.AllDirectories).Count() == 0) if (Directory.EnumerateFiles(subdir, "*", SearchOption.AllDirectories).Count() == 0)
{ {
string actualroot = subdir.Remove(0, basePathBackup.Length); string actualroot = subdir.Remove(0, basePathBackup.Length);
RomData rom = new RomData Rom rom = new Rom
{ {
Name = "null", Name = "null",
Game = (_datdata.Type == "SuperDAT" ? Game = (_datdata.Type == "SuperDAT" ?
@@ -206,7 +206,7 @@ namespace SabreTools
} }
else else
{ {
List<RomData> temp = new List<RomData>(); List<Rom> temp = new List<Rom>();
temp.Add(rom); temp.Add(rom);
_datdata.Roms.Add(key, temp); _datdata.Roms.Add(key, temp);
} }
@@ -226,11 +226,11 @@ 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)
{ {
foreach (List<RomData> roms in _datdata.Roms.Values) foreach (List<Rom> roms in _datdata.Roms.Values)
{ {
for (int i = 0; i < roms.Count; i++) for (int i = 0; i < roms.Count; i++)
{ {
RomData rom = roms[i]; Rom rom = roms[i];
// If we're in a mode that doesn't allow for actual empty folders, add the blank info // If we're in a mode that doesn't allow for actual empty folders, add the blank info
if (_datdata.OutputFormat != OutputFormat.SabreDat && _datdata.OutputFormat != OutputFormat.MissFile) if (_datdata.OutputFormat != OutputFormat.SabreDat && _datdata.OutputFormat != OutputFormat.MissFile)
@@ -269,7 +269,7 @@ 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.Roms.Count == 0)
{ {
_datdata.Roms.Add("temp", new List<RomData>()); _datdata.Roms.Add("temp", new List<Rom>());
} }
} }
@@ -297,7 +297,7 @@ namespace SabreTools
// Special case for if we are in Romba mode (all names are supposed to be SHA-1 hashes) // Special case for if we are in Romba mode (all names are supposed to be SHA-1 hashes)
if (_datdata.Romba) if (_datdata.Romba)
{ {
RomData rom = ArchiveTools.GetTorrentGZFileInfo(item, _logger); Rom rom = ArchiveTools.GetTorrentGZFileInfo(item, _logger);
// If the rom is valid, write it out // If the rom is valid, write it out
if (rom.Name != null) if (rom.Name != null)
@@ -360,10 +360,10 @@ namespace SabreTools
/// <param name="datdata">DatData object with output information</param> /// <param name="datdata">DatData object with output information</param>
/// <param name="lastparent">Last known parent game name</param> /// <param name="lastparent">Last known parent game name</param>
/// <returns>New last known parent game name</returns> /// <returns>New last known parent game name</returns>
private string ProcessFile(string item, StreamWriter sw, string basepath, string parent, DatData datdata, string lastparent) private string ProcessFile(string item, StreamWriter sw, string basepath, string parent, Dat datdata, string lastparent)
{ {
_logger.Log(Path.GetFileName(item) + " treated like a file"); _logger.Log(Path.GetFileName(item) + " treated like a file");
RomData rom = RomTools.GetSingleFileInfo(item, _noMD5, _noSHA1); Rom rom = RomTools.GetSingleFileInfo(item, _noMD5, _noSHA1);
try try
{ {

View File

@@ -144,7 +144,7 @@ namespace SabreTools
} }
// Create the output DatData object // Create the output DatData object
DatData datdata = new DatData Dat datdata = new Dat
{ {
FileName = description, FileName = description,
Name = name, Name = name,
@@ -188,11 +188,11 @@ namespace SabreTools
List<string> keys = datdata.Roms.Keys.ToList(); List<string> keys = datdata.Roms.Keys.ToList();
foreach (string key in keys) foreach (string key in keys)
{ {
List<RomData> temp = new List<RomData>(); List<Rom> temp = new List<Rom>();
List<RomData> newroms = datdata.Roms[key]; List<Rom> newroms = datdata.Roms[key];
for (int i = 0; i < newroms.Count; i++) for (int i = 0; i < newroms.Count; i++)
{ {
RomData rom = newroms[i]; Rom rom = newroms[i];
// In the case that the RomData is incomplete, skip it // In the case that the RomData is incomplete, skip it
if (rom.Name == null || rom.Game == null) if (rom.Name == null || rom.Game == null)

View File

@@ -114,8 +114,8 @@ namespace SabreTools
} }
// Create a dictionary of all ROMs from the input DATs // Create a dictionary of all ROMs from the input DATs
DatData userData; Dat userData;
List<DatData> datHeaders = PopulateUserData(out userData); List<Dat> datHeaders = PopulateUserData(out userData);
// Modify the Dictionary if necessary and output the results // Modify the Dictionary if necessary and output the results
if (_diff && !_cascade) if (_diff && !_cascade)
@@ -141,14 +141,14 @@ namespace SabreTools
/// </summary> /// </summary>
/// <param name="userData">Output user DatData object to output</param> /// <param name="userData">Output user DatData object to output</param>
/// <returns>List of DatData objects representing headers</returns> /// <returns>List of DatData objects representing headers</returns>
private List<DatData> PopulateUserData(out DatData userData) private List<Dat> PopulateUserData(out Dat userData)
{ {
List<DatData> datHeaders = new List<DatData>(); List<Dat> datHeaders = new List<Dat>();
int i = 0; int i = 0;
userData = new DatData userData = new Dat
{ {
Roms = new Dictionary<string, List<RomData>>(), Roms = new Dictionary<string, List<Rom>>(),
MergeRoms = _dedup, MergeRoms = _dedup,
}; };
foreach (string input in _inputs) foreach (string input in _inputs)
@@ -160,7 +160,7 @@ namespace SabreTools
// If we are in inplace mode or redirecting output, save the DAT data // If we are in inplace mode or redirecting output, save the DAT data
if (_inplace || !String.IsNullOrEmpty(_outdir)) if (_inplace || !String.IsNullOrEmpty(_outdir))
{ {
datHeaders.Add(new DatData datHeaders.Add(new Dat
{ {
FileName = userData.FileName, FileName = userData.FileName,
Name = userData.Name, Name = userData.Name,
@@ -208,14 +208,14 @@ namespace SabreTools
/// </summary> /// </summary>
/// <param name="userData">Main DatData to draw information from</param> /// <param name="userData">Main DatData to draw information from</param>
/// <param name="datHeaders">Dat headers used optionally</param> /// <param name="datHeaders">Dat headers used optionally</param>
private void DiffNoCascade(DatData userData, List<DatData> datHeaders) private void DiffNoCascade(Dat userData, List<Dat> datHeaders)
{ {
DateTime start = DateTime.Now; DateTime start = DateTime.Now;
_logger.User("Initializing all output DATs"); _logger.User("Initializing all output DATs");
// Don't have External dupes // Don't have External dupes
string post = " (No Duplicates)"; string post = " (No Duplicates)";
DatData outerDiffData = new DatData Dat outerDiffData = new Dat
{ {
FileName = _desc + post, FileName = _desc + post,
Name = _name + post, Name = _name + post,
@@ -227,11 +227,11 @@ namespace SabreTools
ForcePacking = (_forceunpack ? ForcePacking.Unzip : ForcePacking.None), ForcePacking = (_forceunpack ? ForcePacking.Unzip : ForcePacking.None),
OutputFormat = (_old ? OutputFormat.ClrMamePro : OutputFormat.Xml), OutputFormat = (_old ? OutputFormat.ClrMamePro : OutputFormat.Xml),
MergeRoms = _dedup, MergeRoms = _dedup,
Roms = new Dictionary<string, List<RomData>>(), Roms = new Dictionary<string, List<Rom>>(),
}; };
// Have External dupes // Have External dupes
post = " (Duplicates)"; post = " (Duplicates)";
DatData dupeData = new DatData Dat dupeData = new Dat
{ {
FileName = _desc + post, FileName = _desc + post,
Name = _name + post, Name = _name + post,
@@ -243,17 +243,17 @@ namespace SabreTools
ForcePacking = (_forceunpack ? ForcePacking.Unzip : ForcePacking.None), ForcePacking = (_forceunpack ? ForcePacking.Unzip : ForcePacking.None),
OutputFormat = (_old ? OutputFormat.ClrMamePro : OutputFormat.Xml), OutputFormat = (_old ? OutputFormat.ClrMamePro : OutputFormat.Xml),
MergeRoms = _dedup, MergeRoms = _dedup,
Roms = new Dictionary<string, List<RomData>>(), Roms = new Dictionary<string, List<Rom>>(),
}; };
// Create a list of DatData objects representing individual output files // Create a list of DatData objects representing individual output files
List<DatData> outDats = new List<DatData>(); List<Dat> outDats = new List<Dat>();
// Loop through each of the inputs and get or create a new DatData object // Loop through each of the inputs and get or create a new DatData object
for (int j = 0; j < _inputs.Count; j++) for (int j = 0; j < _inputs.Count; j++)
{ {
post = " (" + Path.GetFileNameWithoutExtension(_inputs[j].Split('¬')[0]) + " Only)"; post = " (" + Path.GetFileNameWithoutExtension(_inputs[j].Split('¬')[0]) + " Only)";
DatData diffData = new DatData Dat diffData = new Dat
{ {
FileName = _desc + post, FileName = _desc + post,
Name = _name + post, Name = _name + post,
@@ -265,7 +265,7 @@ namespace SabreTools
ForcePacking = (_forceunpack ? ForcePacking.Unzip : ForcePacking.None), ForcePacking = (_forceunpack ? ForcePacking.Unzip : ForcePacking.None),
OutputFormat = (_old ? OutputFormat.ClrMamePro : OutputFormat.Xml), OutputFormat = (_old ? OutputFormat.ClrMamePro : OutputFormat.Xml),
MergeRoms = _dedup, MergeRoms = _dedup,
Roms = new Dictionary<string, List<RomData>>(), Roms = new Dictionary<string, List<Rom>>(),
}; };
outDats.Add(diffData); outDats.Add(diffData);
} }
@@ -277,11 +277,11 @@ namespace SabreTools
List<string> keys = userData.Roms.Keys.ToList(); List<string> keys = userData.Roms.Keys.ToList();
foreach (string key in keys) foreach (string key in keys)
{ {
List<RomData> roms = RomTools.Merge(userData.Roms[key], _logger); List<Rom> roms = RomTools.Merge(userData.Roms[key], _logger);
if (roms != null && roms.Count > 0) if (roms != null && roms.Count > 0)
{ {
foreach (RomData rom in roms) foreach (Rom rom in roms)
{ {
// No duplicates // No duplicates
if (rom.Dupe < DupeType.ExternalHash) if (rom.Dupe < DupeType.ExternalHash)
@@ -293,13 +293,13 @@ namespace SabreTools
} }
else else
{ {
List<RomData> tl = new List<RomData>(); List<Rom> tl = new List<Rom>();
tl.Add(rom); tl.Add(rom);
outDats[rom.Metadata.SystemID].Roms.Add(key, tl); outDats[rom.Metadata.SystemID].Roms.Add(key, tl);
} }
// Merged no-duplicates DAT // Merged no-duplicates DAT
RomData newrom = rom; Rom newrom = rom;
newrom.Game += " (" + Path.GetFileNameWithoutExtension(_inputs[newrom.Metadata.SystemID].Split('¬')[0]) + ")"; newrom.Game += " (" + Path.GetFileNameWithoutExtension(_inputs[newrom.Metadata.SystemID].Split('¬')[0]) + ")";
if (outerDiffData.Roms.ContainsKey(key)) if (outerDiffData.Roms.ContainsKey(key))
@@ -308,7 +308,7 @@ namespace SabreTools
} }
else else
{ {
List<RomData> tl = new List<RomData>(); List<Rom> tl = new List<Rom>();
tl.Add(rom); tl.Add(rom);
outerDiffData.Roms.Add(key, tl); outerDiffData.Roms.Add(key, tl);
} }
@@ -317,7 +317,7 @@ namespace SabreTools
// Duplicates only // Duplicates only
if (rom.Dupe >= DupeType.ExternalHash) if (rom.Dupe >= DupeType.ExternalHash)
{ {
RomData newrom = rom; Rom newrom = rom;
newrom.Game += " (" + Path.GetFileNameWithoutExtension(_inputs[newrom.Metadata.SystemID].Split('¬')[0]) + ")"; newrom.Game += " (" + Path.GetFileNameWithoutExtension(_inputs[newrom.Metadata.SystemID].Split('¬')[0]) + ")";
if (dupeData.Roms.ContainsKey(key)) if (dupeData.Roms.ContainsKey(key))
@@ -326,7 +326,7 @@ namespace SabreTools
} }
else else
{ {
List<RomData> tl = new List<RomData>(); List<Rom> tl = new List<Rom>();
tl.Add(rom); tl.Add(rom);
dupeData.Roms.Add(key, tl); dupeData.Roms.Add(key, tl);
} }
@@ -366,12 +366,12 @@ namespace SabreTools
/// </summary> /// </summary>
/// <param name="userData">Main DatData to draw information from</param> /// <param name="userData">Main DatData to draw information from</param>
/// <param name="datHeaders">Dat headers used optionally</param> /// <param name="datHeaders">Dat headers used optionally</param>
private void DiffCascade(DatData userData, List<DatData> datHeaders) private void DiffCascade(Dat userData, List<Dat> datHeaders)
{ {
string post = ""; string post = "";
// Create a list of DatData objects representing output files // Create a list of DatData objects representing output files
List<DatData> outDats = new List<DatData>(); List<Dat> outDats = new List<Dat>();
// Loop through each of the inputs and get or create a new DatData object // Loop through each of the inputs and get or create a new DatData object
DateTime start = DateTime.Now; DateTime start = DateTime.Now;
@@ -379,7 +379,7 @@ namespace SabreTools
for (int j = 0; j < _inputs.Count; j++) for (int j = 0; j < _inputs.Count; j++)
{ {
post = " (" + Path.GetFileNameWithoutExtension(_inputs[j].Split('¬')[0]) + " Only)"; post = " (" + Path.GetFileNameWithoutExtension(_inputs[j].Split('¬')[0]) + " Only)";
DatData diffData; Dat diffData;
// If we're in inplace mode, take the appropriate DatData object already stored // If we're in inplace mode, take the appropriate DatData object already stored
if (_inplace || !String.IsNullOrEmpty(_outdir)) if (_inplace || !String.IsNullOrEmpty(_outdir))
@@ -388,7 +388,7 @@ namespace SabreTools
} }
else else
{ {
diffData = new DatData diffData = new Dat
{ {
FileName = _desc + post, FileName = _desc + post,
Name = _name + post, Name = _name + post,
@@ -403,7 +403,7 @@ namespace SabreTools
}; };
} }
diffData.Roms = new Dictionary<string, List<RomData>>(); diffData.Roms = new Dictionary<string, List<Rom>>();
outDats.Add(diffData); outDats.Add(diffData);
} }
_logger.User("Initializing complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff")); _logger.User("Initializing complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
@@ -414,11 +414,11 @@ namespace SabreTools
List<string> keys = userData.Roms.Keys.ToList(); List<string> keys = userData.Roms.Keys.ToList();
foreach (string key in keys) foreach (string key in keys)
{ {
List<RomData> roms = RomTools.Merge(userData.Roms[key], _logger); List<Rom> roms = RomTools.Merge(userData.Roms[key], _logger);
if (roms != null && roms.Count > 0) if (roms != null && roms.Count > 0)
{ {
foreach (RomData rom in roms) foreach (Rom rom in roms)
{ {
if (outDats[rom.Metadata.SystemID].Roms.ContainsKey(key)) if (outDats[rom.Metadata.SystemID].Roms.ContainsKey(key))
{ {
@@ -426,7 +426,7 @@ namespace SabreTools
} }
else else
{ {
List<RomData> tl = new List<RomData>(); List<Rom> tl = new List<Rom>();
tl.Add(rom); tl.Add(rom);
outDats[rom.Metadata.SystemID].Roms.Add(key, tl); outDats[rom.Metadata.SystemID].Roms.Add(key, tl);
} }
@@ -465,7 +465,7 @@ namespace SabreTools
/// </summary> /// </summary>
/// <param name="userData">Main DatData to draw information from</param> /// <param name="userData">Main DatData to draw information from</param>
/// <param name="datHeaders">Dat headers used optionally</param> /// <param name="datHeaders">Dat headers used optionally</param>
private void MergeNoDiff(DatData userData, List<DatData> datHeaders) private void MergeNoDiff(Dat userData, List<Dat> datHeaders)
{ {
// 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 (_superdat) if (_superdat)
@@ -473,10 +473,10 @@ namespace SabreTools
List<string> keys = userData.Roms.Keys.ToList(); List<string> keys = userData.Roms.Keys.ToList();
foreach (string key in keys) foreach (string key in keys)
{ {
List<RomData> newroms = new List<RomData>(); List<Rom> newroms = new List<Rom>();
foreach (RomData rom in userData.Roms[key]) foreach (Rom rom in userData.Roms[key])
{ {
RomData newrom = rom; Rom newrom = rom;
string filename = _inputs[newrom.Metadata.SystemID].Split('¬')[0]; string filename = _inputs[newrom.Metadata.SystemID].Split('¬')[0];
string rootpath = _inputs[newrom.Metadata.SystemID].Split('¬')[1]; string rootpath = _inputs[newrom.Metadata.SystemID].Split('¬')[1];

View File

@@ -57,17 +57,17 @@ namespace SabreTools
{ {
// First get the combination Dictionary of currentAllMerged and currentNewMerged // First get the combination Dictionary of currentAllMerged and currentNewMerged
_logger.User("Adding Current and New Merged DATs to the dictionary"); _logger.User("Adding Current and New Merged DATs to the dictionary");
DatData completeDats = new DatData(); Dat completeDats = new Dat();
completeDats = DatTools.Parse(_currentAllMerged, 0, 0, completeDats, _logger); completeDats = DatTools.Parse(_currentAllMerged, 0, 0, completeDats, _logger);
completeDats = DatTools.Parse(_currentNewMerged, 0, 0, completeDats, _logger); completeDats = DatTools.Parse(_currentNewMerged, 0, 0, completeDats, _logger);
// 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<RomData>> netNew = new Dictionary<string, List<RomData>>(); Dictionary<string, List<Rom>> netNew = new Dictionary<string, List<Rom>>();
foreach (string key in completeDats.Roms.Keys) foreach (string key in completeDats.Roms.Keys)
{ {
List<RomData> templist = RomTools.Merge(completeDats.Roms[key], _logger); List<Rom> templist = RomTools.Merge(completeDats.Roms[key], _logger);
foreach (RomData rom in templist) foreach (Rom rom in templist)
{ {
if (rom.Dupe == DupeType.None && rom.Metadata.System == _currentNewMerged) if (rom.Dupe == DupeType.None && rom.Metadata.System == _currentNewMerged)
{ {
@@ -77,7 +77,7 @@ namespace SabreTools
} }
else else
{ {
List<RomData> temp = new List<RomData>(); List<Rom> temp = new List<Rom>();
temp.Add(rom); temp.Add(rom);
netNew.Add(key, temp); netNew.Add(key, temp);
} }
@@ -87,11 +87,11 @@ 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<RomData>> unneeded = new Dictionary<string, List<RomData>>(); Dictionary<string, List<Rom>> unneeded = new Dictionary<string, List<Rom>>();
foreach (string key in completeDats.Roms.Keys) foreach (string key in completeDats.Roms.Keys)
{ {
List<RomData> templist = RomTools.Merge(completeDats.Roms[key], _logger); List<Rom> templist = RomTools.Merge(completeDats.Roms[key], _logger);
foreach (RomData rom in templist) foreach (Rom rom in templist)
{ {
if (rom.Dupe == DupeType.None && rom.Metadata.System == _currentAllMerged) if (rom.Dupe == DupeType.None && rom.Metadata.System == _currentAllMerged)
{ {
@@ -101,7 +101,7 @@ namespace SabreTools
} }
else else
{ {
List<RomData> temp = new List<RomData>(); List<Rom> temp = new List<Rom>();
temp.Add(rom); temp.Add(rom);
unneeded.Add(key, temp); unneeded.Add(key, temp);
} }
@@ -111,7 +111,7 @@ namespace SabreTools
// Now create the New Missing dictionary [(Net New)+(currentMissingMerged-(Unneeded))] // Now create the New Missing dictionary [(Net New)+(currentMissingMerged-(Unneeded))]
_logger.User("Creating and populating New Missing dictionary"); _logger.User("Creating and populating New Missing dictionary");
DatData midMissing = new DatData(); Dat midMissing = new Dat();
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)
{ {
@@ -124,11 +124,11 @@ namespace SabreTools
midMissing.Roms.Add(key, unneeded[key]); midMissing.Roms.Add(key, unneeded[key]);
} }
} }
Dictionary<string, List<RomData>> newMissing = new Dictionary<string, List<RomData>>(); Dictionary<string, List<Rom>> newMissing = new Dictionary<string, List<Rom>>();
foreach (string key in midMissing.Roms.Keys) foreach (string key in midMissing.Roms.Keys)
{ {
List<RomData> templist = RomTools.Merge(midMissing.Roms[key], _logger); List<Rom> templist = RomTools.Merge(midMissing.Roms[key], _logger);
foreach (RomData rom in templist) foreach (Rom rom in templist)
{ {
if (rom.Dupe == DupeType.None && rom.Metadata.System == _currentMissingMerged) if (rom.Dupe == DupeType.None && rom.Metadata.System == _currentMissingMerged)
{ {
@@ -138,7 +138,7 @@ namespace SabreTools
} }
else else
{ {
List<RomData> temp = new List<RomData>(); List<Rom> temp = new List<Rom>();
temp.Add(rom); temp.Add(rom);
newMissing.Add(key, temp); newMissing.Add(key, temp);
} }
@@ -159,7 +159,7 @@ namespace SabreTools
// Now create the Have dictionary [(currentNewMerged)-(c)] // Now create the Have dictionary [(currentNewMerged)-(c)]
_logger.User("Creating and populating Have dictionary"); _logger.User("Creating and populating Have dictionary");
Dictionary<string, List<RomData>> midHave = new Dictionary<string, List<RomData>>(); Dictionary<string, List<Rom>> midHave = new Dictionary<string, List<Rom>>();
foreach (string key in newMissing.Keys) foreach (string key in newMissing.Keys)
{ {
if (midHave.ContainsKey(key)) if (midHave.ContainsKey(key))
@@ -175,7 +175,7 @@ namespace SabreTools
{ {
if (midHave.ContainsKey(key)) if (midHave.ContainsKey(key))
{ {
foreach (RomData rom in completeDats.Roms[key]) foreach (Rom rom in completeDats.Roms[key])
{ {
if (rom.Metadata.System == _currentNewMerged) if (rom.Metadata.System == _currentNewMerged)
{ {
@@ -185,8 +185,8 @@ namespace SabreTools
} }
else else
{ {
List<RomData> roms = new List<RomData>(); List<Rom> roms = new List<Rom>();
foreach (RomData rom in completeDats.Roms[key]) foreach (Rom rom in completeDats.Roms[key])
{ {
if (rom.Metadata.System == _currentNewMerged) if (rom.Metadata.System == _currentNewMerged)
{ {
@@ -196,11 +196,11 @@ namespace SabreTools
midHave.Add(key, roms); midHave.Add(key, roms);
} }
} }
Dictionary<string, List<RomData>> have = new Dictionary<string, List<RomData>>(); Dictionary<string, List<Rom>> have = new Dictionary<string, List<Rom>>();
foreach (string key in midHave.Keys) foreach (string key in midHave.Keys)
{ {
List<RomData> templist = RomTools.Merge(midHave[key], _logger); List<Rom> templist = RomTools.Merge(midHave[key], _logger);
foreach (RomData rom in templist) foreach (Rom rom in templist)
{ {
if (rom.Dupe == DupeType.None && rom.Metadata.System == _currentNewMerged) if (rom.Dupe == DupeType.None && rom.Metadata.System == _currentNewMerged)
{ {
@@ -210,7 +210,7 @@ namespace SabreTools
} }
else else
{ {
List<RomData> temp = new List<RomData>(); List<Rom> temp = new List<Rom>();
temp.Add(rom); temp.Add(rom);
have.Add(key, temp); have.Add(key, temp);
} }
@@ -225,11 +225,11 @@ namespace SabreTools
List<string> keys = netNew.Keys.ToList(); List<string> keys = netNew.Keys.ToList();
foreach (string key in keys) foreach (string key in keys)
{ {
List<RomData> temp = new List<RomData>(); List<Rom> temp = new List<Rom>();
List<RomData> roms = netNew[key]; List<Rom> roms = netNew[key];
for (int i = 0; i < roms.Count; i++) for (int i = 0; i < roms.Count; i++)
{ {
RomData rom = roms[i]; Rom rom = roms[i];
rom.Size = Constants.SizeZero; rom.Size = Constants.SizeZero;
rom.CRC = Constants.CRCZero; rom.CRC = Constants.CRCZero;
rom.MD5 = Constants.MD5Zero; rom.MD5 = Constants.MD5Zero;
@@ -243,11 +243,11 @@ namespace SabreTools
keys = unneeded.Keys.ToList(); keys = unneeded.Keys.ToList();
foreach (string key in keys) foreach (string key in keys)
{ {
List<RomData> temp = new List<RomData>(); List<Rom> temp = new List<Rom>();
List<RomData> roms = unneeded[key]; List<Rom> roms = unneeded[key];
for (int i = 0; i < roms.Count; i++) for (int i = 0; i < roms.Count; i++)
{ {
RomData rom = roms[i]; Rom rom = roms[i];
rom.Size = Constants.SizeZero; rom.Size = Constants.SizeZero;
rom.CRC = Constants.CRCZero; rom.CRC = Constants.CRCZero;
rom.MD5 = Constants.MD5Zero; rom.MD5 = Constants.MD5Zero;
@@ -261,11 +261,11 @@ namespace SabreTools
keys = newMissing.Keys.ToList(); keys = newMissing.Keys.ToList();
foreach (string key in keys) foreach (string key in keys)
{ {
List<RomData> temp = new List<RomData>(); List<Rom> temp = new List<Rom>();
List<RomData> roms = newMissing[key]; List<Rom> roms = newMissing[key];
for (int i = 0; i < roms.Count; i++) for (int i = 0; i < roms.Count; i++)
{ {
RomData rom = roms[i]; Rom rom = roms[i];
rom.Size = Constants.SizeZero; rom.Size = Constants.SizeZero;
rom.CRC = Constants.CRCZero; rom.CRC = Constants.CRCZero;
rom.MD5 = Constants.MD5Zero; rom.MD5 = Constants.MD5Zero;
@@ -279,11 +279,11 @@ namespace SabreTools
keys = have.Keys.ToList(); keys = have.Keys.ToList();
foreach (string key in keys) foreach (string key in keys)
{ {
List<RomData> temp = new List<RomData>(); List<Rom> temp = new List<Rom>();
List<RomData> roms = have[key]; List<Rom> roms = have[key];
for (int i = 0; i < roms.Count; i++) for (int i = 0; i < roms.Count; i++)
{ {
RomData rom = roms[i]; Rom rom = roms[i];
rom.Size = Constants.SizeZero; rom.Size = Constants.SizeZero;
rom.CRC = Constants.CRCZero; rom.CRC = Constants.CRCZero;
rom.MD5 = Constants.MD5Zero; rom.MD5 = Constants.MD5Zero;
@@ -295,7 +295,7 @@ namespace SabreTools
} }
// Finally, output all of the files // Finally, output all of the files
DatData netNewData = new DatData Dat netNewData = new Dat
{ {
Name = "Net New", Name = "Net New",
Description = "Net New", Description = "Net New",
@@ -308,7 +308,7 @@ namespace SabreTools
MergeRoms = true, MergeRoms = true,
Roms = netNew, Roms = netNew,
}; };
DatData unneededData = new DatData Dat unneededData = new Dat
{ {
Name = "Unneeded", Name = "Unneeded",
Description = "Unneeded", Description = "Unneeded",
@@ -321,7 +321,7 @@ namespace SabreTools
MergeRoms = true, MergeRoms = true,
Roms = unneeded, Roms = unneeded,
}; };
DatData newMissingData = new DatData Dat newMissingData = new Dat
{ {
Name = "New Missing", Name = "New Missing",
Description = "New Missing", Description = "New Missing",
@@ -334,7 +334,7 @@ namespace SabreTools
MergeRoms = true, MergeRoms = true,
Roms = newMissing, Roms = newMissing,
}; };
DatData haveData = new DatData Dat haveData = new Dat
{ {
Name = "Have", Name = "Have",
Description = "Have", Description = "Have",
@@ -361,14 +361,14 @@ namespace SabreTools
{ {
// Now create the Have dictionary [(currentAllMerged)-(currentMissingMerged)] // Now create the Have dictionary [(currentAllMerged)-(currentMissingMerged)]
_logger.User("Creating and populating Have dictionary"); _logger.User("Creating and populating Have dictionary");
DatData midHave = new DatData(); Dat midHave = new Dat();
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<RomData>> have = new Dictionary<string, List<RomData>>(); Dictionary<string, List<Rom>> have = new Dictionary<string, List<Rom>>();
foreach (string key in midHave.Roms.Keys) foreach (string key in midHave.Roms.Keys)
{ {
List<RomData> templist = RomTools.Merge(midHave.Roms[key], _logger); List<Rom> templist = RomTools.Merge(midHave.Roms[key], _logger);
foreach (RomData rom in templist) foreach (Rom rom in templist)
{ {
if (rom.Dupe == DupeType.None && rom.Metadata.System == _currentAllMerged) if (rom.Dupe == DupeType.None && rom.Metadata.System == _currentAllMerged)
{ {
@@ -378,7 +378,7 @@ namespace SabreTools
} }
else else
{ {
List<RomData> temp = new List<RomData>(); List<Rom> temp = new List<Rom>();
temp.Add(rom); temp.Add(rom);
have.Add(key, temp); have.Add(key, temp);
} }
@@ -393,11 +393,11 @@ namespace SabreTools
List<string> keys = have.Keys.ToList(); List<string> keys = have.Keys.ToList();
foreach (string key in keys) foreach (string key in keys)
{ {
List<RomData> temp = new List<RomData>(); List<Rom> temp = new List<Rom>();
List<RomData> roms = have[key]; List<Rom> roms = have[key];
for (int i = 0; i < roms.Count; i++) for (int i = 0; i < roms.Count; i++)
{ {
RomData rom = roms[i]; Rom rom = roms[i];
rom.Size = Constants.SizeZero; rom.Size = Constants.SizeZero;
rom.CRC = Constants.CRCZero; rom.CRC = Constants.CRCZero;
rom.MD5 = Constants.MD5Zero; rom.MD5 = Constants.MD5Zero;
@@ -408,7 +408,7 @@ namespace SabreTools
} }
} }
DatData haveData = new DatData Dat haveData = new Dat
{ {
Name = "Have", Name = "Have",
Description = "Have", Description = "Have",
@@ -431,14 +431,14 @@ namespace SabreTools
{ {
// Now create the Have dictionary [(currentNewMerged)-(currentMissingMerged)] // Now create the Have dictionary [(currentNewMerged)-(currentMissingMerged)]
_logger.User("Creating and populating Have dictionary"); _logger.User("Creating and populating Have dictionary");
DatData midHave = new DatData(); Dat midHave = new Dat();
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<RomData>> have = new Dictionary<string, List<RomData>>(); Dictionary<string, List<Rom>> have = new Dictionary<string, List<Rom>>();
foreach (string key in midHave.Roms.Keys) foreach (string key in midHave.Roms.Keys)
{ {
List<RomData> templist = RomTools.Merge(midHave.Roms[key], _logger); List<Rom> templist = RomTools.Merge(midHave.Roms[key], _logger);
foreach (RomData rom in templist) foreach (Rom rom in templist)
{ {
if (rom.Dupe == DupeType.None && rom.Metadata.System == _currentNewMerged) if (rom.Dupe == DupeType.None && rom.Metadata.System == _currentNewMerged)
{ {
@@ -448,7 +448,7 @@ namespace SabreTools
} }
else else
{ {
List<RomData> temp = new List<RomData>(); List<Rom> temp = new List<Rom>();
temp.Add(rom); temp.Add(rom);
have.Add(key, temp); have.Add(key, temp);
} }
@@ -463,11 +463,11 @@ namespace SabreTools
List<string> keys = have.Keys.ToList(); List<string> keys = have.Keys.ToList();
foreach (string key in keys) foreach (string key in keys)
{ {
List<RomData> temp = new List<RomData>(); List<Rom> temp = new List<Rom>();
List<RomData> roms = have[key]; List<Rom> roms = have[key];
for (int i = 0; i < roms.Count; i++) for (int i = 0; i < roms.Count; i++)
{ {
RomData rom = roms[i]; Rom rom = roms[i];
rom.Size = Constants.SizeZero; rom.Size = Constants.SizeZero;
rom.CRC = Constants.CRCZero; rom.CRC = Constants.CRCZero;
rom.MD5 = Constants.MD5Zero; rom.MD5 = Constants.MD5Zero;
@@ -478,7 +478,7 @@ namespace SabreTools
} }
} }
DatData haveData = new DatData Dat haveData = new Dat
{ {
Name = "Have", Name = "Have",
Description = "Have", Description = "Have",

View File

@@ -228,7 +228,7 @@ namespace SabreTools
repext = (repext == "" || repext.StartsWith(".") ? repext : "." + repext); repext = (repext == "" || repext.StartsWith(".") ? repext : "." + repext);
// Populate the DatData object // Populate the DatData object
DatData userInputDat = new DatData Dat userInputDat = new Dat
{ {
FileName = filename, FileName = filename,
Name = name, Name = name,
@@ -329,7 +329,7 @@ namespace SabreTools
string tempDir) string tempDir)
{ {
// Create a new DATFromDir object and process the inputs // Create a new DATFromDir object and process the inputs
DatData datdata = new DatData Dat datdata = new Dat
{ {
FileName = description, FileName = description,
Name = name, Name = name,
@@ -342,7 +342,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<RomData>>(), Roms = new Dictionary<string, List<Rom>>(),
}; };
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

@@ -130,12 +130,12 @@ namespace SabreTools
// Get the file data to be split // Get the file data to be split
OutputFormat outputFormat = DatTools.GetOutputFormat(filename); OutputFormat outputFormat = DatTools.GetOutputFormat(filename);
DatData datdata = new DatData(); Dat datdata = new Dat();
datdata = DatTools.Parse(filename, 0, 0, datdata, _logger, true); datdata = DatTools.Parse(filename, 0, 0, datdata, _logger, true);
// Create each of the respective output DATs // Create each of the respective output DATs
_logger.User("Creating and populating new DATs"); _logger.User("Creating and populating new DATs");
DatData nodump = new DatData Dat nodump = new Dat
{ {
FileName = datdata.FileName + " (Nodump)", FileName = datdata.FileName + " (Nodump)",
Name = datdata.Name + " (Nodump)", Name = datdata.Name + " (Nodump)",
@@ -155,9 +155,9 @@ namespace SabreTools
ForcePacking = datdata.ForcePacking, ForcePacking = datdata.ForcePacking,
OutputFormat = outputFormat, OutputFormat = outputFormat,
MergeRoms = datdata.MergeRoms, MergeRoms = datdata.MergeRoms,
Roms = new Dictionary<string, List<RomData>>(), Roms = new Dictionary<string, List<Rom>>(),
}; };
DatData sha1 = new DatData Dat sha1 = new Dat
{ {
FileName = datdata.FileName + " (SHA-1)", FileName = datdata.FileName + " (SHA-1)",
Name = datdata.Name + " (SHA-1)", Name = datdata.Name + " (SHA-1)",
@@ -177,9 +177,9 @@ namespace SabreTools
ForcePacking = datdata.ForcePacking, ForcePacking = datdata.ForcePacking,
OutputFormat = outputFormat, OutputFormat = outputFormat,
MergeRoms = datdata.MergeRoms, MergeRoms = datdata.MergeRoms,
Roms = new Dictionary<string, List<RomData>>(), Roms = new Dictionary<string, List<Rom>>(),
}; };
DatData md5 = new DatData Dat md5 = new Dat
{ {
FileName = datdata.FileName + " (MD5)", FileName = datdata.FileName + " (MD5)",
Name = datdata.Name + " (MD5)", Name = datdata.Name + " (MD5)",
@@ -199,9 +199,9 @@ namespace SabreTools
ForcePacking = datdata.ForcePacking, ForcePacking = datdata.ForcePacking,
OutputFormat = outputFormat, OutputFormat = outputFormat,
MergeRoms = datdata.MergeRoms, MergeRoms = datdata.MergeRoms,
Roms = new Dictionary<string, List<RomData>>(), Roms = new Dictionary<string, List<Rom>>(),
}; };
DatData crc = new DatData Dat crc = new Dat
{ {
FileName = datdata.FileName + " (CRC)", FileName = datdata.FileName + " (CRC)",
Name = datdata.Name + " (CRC)", Name = datdata.Name + " (CRC)",
@@ -221,15 +221,15 @@ namespace SabreTools
ForcePacking = datdata.ForcePacking, ForcePacking = datdata.ForcePacking,
OutputFormat = outputFormat, OutputFormat = outputFormat,
MergeRoms = datdata.MergeRoms, MergeRoms = datdata.MergeRoms,
Roms = new Dictionary<string, List<RomData>>(), Roms = new Dictionary<string, List<Rom>>(),
}; };
// 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.Roms.Keys.ToList();
foreach (string key in keys) foreach (string key in keys)
{ {
List<RomData> roms = datdata.Roms[key]; List<Rom> roms = datdata.Roms[key];
foreach (RomData rom in roms) foreach (Rom rom in roms)
{ {
// If the file is a nodump // If the file is a nodump
if (rom.Nodump) if (rom.Nodump)
@@ -240,7 +240,7 @@ namespace SabreTools
} }
else else
{ {
List<RomData> temp = new List<RomData>(); List<Rom> temp = new List<Rom>();
temp.Add(rom); temp.Add(rom);
nodump.Roms.Add(key, temp); nodump.Roms.Add(key, temp);
} }
@@ -254,7 +254,7 @@ namespace SabreTools
} }
else else
{ {
List<RomData> temp = new List<RomData>(); List<Rom> temp = new List<Rom>();
temp.Add(rom); temp.Add(rom);
sha1.Roms.Add(key, temp); sha1.Roms.Add(key, temp);
} }
@@ -268,7 +268,7 @@ namespace SabreTools
} }
else else
{ {
List<RomData> temp = new List<RomData>(); List<Rom> temp = new List<Rom>();
temp.Add(rom); temp.Add(rom);
md5.Roms.Add(key, temp); md5.Roms.Add(key, temp);
} }
@@ -282,7 +282,7 @@ namespace SabreTools
} }
else else
{ {
List<RomData> temp = new List<RomData>(); List<Rom> temp = new List<Rom>();
temp.Add(rom); temp.Add(rom);
crc.Roms.Add(key, temp); crc.Roms.Add(key, temp);
} }
@@ -333,12 +333,12 @@ namespace SabreTools
private bool SplitByExt(string filename, string basepath) private bool SplitByExt(string filename, string basepath)
{ {
// Load the current DAT to be processed // Load the current DAT to be processed
DatData datdata = new DatData(); Dat datdata = new Dat();
datdata = DatTools.Parse(filename, 0, 0, datdata, _logger); datdata = DatTools.Parse(filename, 0, 0, datdata, _logger);
// Set all of the appropriate outputs for each of the subsets // Set all of the appropriate outputs for each of the subsets
OutputFormat outputFormat = DatTools.GetOutputFormat(filename); OutputFormat outputFormat = DatTools.GetOutputFormat(filename);
DatData datdataA = new DatData Dat datdataA = new Dat
{ {
FileName = datdata.FileName + " (" + String.Join(",", _extA) + ")", FileName = datdata.FileName + " (" + String.Join(",", _extA) + ")",
Name = datdata.Name + " (" + String.Join(",", _extA) + ")", Name = datdata.Name + " (" + String.Join(",", _extA) + ")",
@@ -351,10 +351,10 @@ 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<RomData>>(), Roms = new Dictionary<string, List<Rom>>(),
OutputFormat = outputFormat, OutputFormat = outputFormat,
}; };
DatData datdataB = new DatData Dat datdataB = new Dat
{ {
FileName = datdata.FileName + " (" + String.Join(",", _extB) + ")", FileName = datdata.FileName + " (" + String.Join(",", _extB) + ")",
Name = datdata.Name + " (" + String.Join(",", _extB) + ")", Name = datdata.Name + " (" + String.Join(",", _extB) + ")",
@@ -367,7 +367,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<RomData>>(), Roms = new Dictionary<string, List<Rom>>(),
OutputFormat = outputFormat, OutputFormat = outputFormat,
}; };
@@ -380,7 +380,7 @@ namespace SabreTools
// Now separate the roms accordingly // Now separate the roms accordingly
foreach (string key in datdata.Roms.Keys) foreach (string key in datdata.Roms.Keys)
{ {
foreach (RomData rom in datdata.Roms[key]) foreach (Rom rom in datdata.Roms[key])
{ {
if (_extA.Contains(Path.GetExtension(rom.Name.ToUpperInvariant()))) if (_extA.Contains(Path.GetExtension(rom.Name.ToUpperInvariant())))
{ {
@@ -390,7 +390,7 @@ namespace SabreTools
} }
else else
{ {
List<RomData> temp = new List<RomData>(); List<Rom> temp = new List<Rom>();
temp.Add(rom); temp.Add(rom);
datdataA.Roms.Add(key, temp); datdataA.Roms.Add(key, temp);
} }
@@ -403,7 +403,7 @@ namespace SabreTools
} }
else else
{ {
List<RomData> temp = new List<RomData>(); List<Rom> temp = new List<Rom>();
temp.Add(rom); temp.Add(rom);
datdataB.Roms.Add(key, temp); datdataB.Roms.Add(key, temp);
} }
@@ -416,7 +416,7 @@ namespace SabreTools
} }
else else
{ {
List<RomData> temp = new List<RomData>(); List<Rom> temp = new List<Rom>();
temp.Add(rom); temp.Add(rom);
datdataA.Roms.Add(key, temp); datdataA.Roms.Add(key, temp);
} }
@@ -426,7 +426,7 @@ namespace SabreTools
} }
else else
{ {
List<RomData> temp = new List<RomData>(); List<Rom> temp = new List<Rom>();
temp.Add(rom); temp.Add(rom);
datdataB.Roms.Add(key, temp); datdataB.Roms.Add(key, temp);
} }

View File

@@ -82,7 +82,7 @@ namespace SabreTools
/// <param name="rename">True if roms are to be renamed</param> /// <param name="rename">True if roms are to be renamed</param>
private void ProcessDAT(string filename, string path, bool rename) private void ProcessDAT(string filename, string path, bool rename)
{ {
DatData datdata = new DatData Dat datdata = new Dat
{ {
ForcePacking = (_forceunpack ? ForcePacking.Unzip : ForcePacking.None), ForcePacking = (_forceunpack ? ForcePacking.Unzip : ForcePacking.None),
OutputFormat = DatTools.GetOutputFormat(filename), OutputFormat = DatTools.GetOutputFormat(filename),
@@ -93,10 +93,10 @@ namespace SabreTools
List<string> keys = datdata.Roms.Keys.ToList(); List<string> keys = datdata.Roms.Keys.ToList();
foreach (string key in keys) foreach (string key in keys)
{ {
List<RomData> newroms = new List<RomData>(); List<Rom> newroms = new List<Rom>();
foreach (RomData rom in datdata.Roms[key]) foreach (Rom rom in datdata.Roms[key])
{ {
RomData newrom = rom; Rom newrom = rom;
// If we are in single game mode, rename all games // If we are in single game mode, rename all games
if (rename) if (rename)

View File

@@ -10,7 +10,7 @@ namespace SabreTools
public class SimpleSort public class SimpleSort
{ {
// Private instance variables // Private instance variables
private DatData _datdata; private Dat _datdata;
private List<string> _inputs; private List<string> _inputs;
private string _outdir; private string _outdir;
private string _tempdir; private string _tempdir;
@@ -34,7 +34,7 @@ namespace SabreTools
/// <param name="rar">Integer representing the archive handling level for RAR</param> /// <param name="rar">Integer representing the archive handling level for RAR</param>
/// <param name="zip">Integer representing the archive handling level for Zip</param> /// <param name="zip">Integer representing the archive handling level for Zip</param>
/// <param name="logger">Logger object for file and console output</param> /// <param name="logger">Logger object for file and console output</param>
public SimpleSort(DatData datdata, List<string> inputs, string outdir, string tempdir, public SimpleSort(Dat datdata, List<string> inputs, string outdir, string tempdir,
bool externalScan, int sevenzip, int gz, int rar, int zip, Logger logger) bool externalScan, int sevenzip, int gz, int rar, int zip, Logger logger)
{ {
_datdata = datdata; _datdata = datdata;
@@ -239,7 +239,7 @@ namespace SabreTools
bool externalScan, int sevenzip, int gz, int rar, int zip, Logger logger) bool externalScan, int sevenzip, int gz, int rar, int zip, Logger logger)
{ {
// Add all of the input DATs into one huge internal DAT // Add all of the input DATs into one huge internal DAT
DatData datdata = new DatData(); Dat datdata = new Dat();
foreach (string datfile in datfiles) foreach (string datfile in datfiles)
{ {
datdata = DatTools.Parse(datfile, 0, 0, datdata, logger); datdata = DatTools.Parse(datfile, 0, 0, datdata, logger);
@@ -359,7 +359,7 @@ namespace SabreTools
// Hash and match the external files // Hash and match the external files
if (shouldscan) if (shouldscan)
{ {
RomData rom = RomTools.GetSingleFileInfo(input); Rom rom = RomTools.GetSingleFileInfo(input);
// If we have a blank RomData, it's an error // If we have a blank RomData, it's an error
if (rom.Name == null) if (rom.Name == null)
@@ -368,9 +368,9 @@ namespace SabreTools
} }
// Try to find the matches to the file that was found // Try to find the matches to the file that was found
List<RomData> foundroms = RomTools.GetDuplicates(rom, _datdata); List<Rom> foundroms = RomTools.GetDuplicates(rom, _datdata);
_logger.User("File '" + input + "' had " + foundroms.Count + " matches in the DAT!"); _logger.User("File '" + input + "' had " + foundroms.Count + " matches in the DAT!");
foreach (RomData found in foundroms) foreach (Rom found in foundroms)
{ {
_logger.Log("Matched name: " + found.Name); _logger.Log("Matched name: " + found.Name);
ArchiveTools.WriteToArchive(input, _outdir, found); ArchiveTools.WriteToArchive(input, _outdir, found);
@@ -384,7 +384,7 @@ namespace SabreTools
string newinput = input + ".new"; string newinput = input + ".new";
_logger.Log("Creating unheadered file: '" + newinput + "'"); _logger.Log("Creating unheadered file: '" + newinput + "'");
Output.RemoveBytesFromFile(input, newinput, hs, 0); Output.RemoveBytesFromFile(input, newinput, hs, 0);
RomData drom = RomTools.GetSingleFileInfo(newinput); Rom drom = RomTools.GetSingleFileInfo(newinput);
// If we have a blank RomData, it's an error // If we have a blank RomData, it's an error
if (drom.Name == null) if (drom.Name == null)
@@ -393,16 +393,16 @@ namespace SabreTools
} }
// Try to find the matches to the file that was found // Try to find the matches to the file that was found
List<RomData> founddroms = RomTools.GetDuplicates(drom, _datdata); List<Rom> founddroms = RomTools.GetDuplicates(drom, _datdata);
_logger.User("File '" + newinput + "' had " + founddroms.Count + " matches in the DAT!"); _logger.User("File '" + newinput + "' had " + founddroms.Count + " matches in the DAT!");
foreach (RomData found in founddroms) foreach (Rom found in founddroms)
{ {
// First output the headerless rom // First output the headerless rom
_logger.Log("Matched name: " + found.Name); _logger.Log("Matched name: " + found.Name);
ArchiveTools.WriteToArchive(newinput, _outdir, found); ArchiveTools.WriteToArchive(newinput, _outdir, found);
// Then output the headered rom (renamed) // Then output the headered rom (renamed)
RomData newfound = found; Rom newfound = found;
newfound.Name = Path.GetFileNameWithoutExtension(newfound.Name) + " (" + rom.CRC + ")" + Path.GetExtension(newfound.Name); newfound.Name = Path.GetFileNameWithoutExtension(newfound.Name) + " (" + rom.CRC + ")" + Path.GetExtension(newfound.Name);
_logger.Log("Matched name: " + newfound.Name); _logger.Log("Matched name: " + newfound.Name);
@@ -425,18 +425,18 @@ namespace SabreTools
if (_externalScan) if (_externalScan)
{ {
_logger.Log("Beginning quick scan of contents from '" + input + "'"); _logger.Log("Beginning quick scan of contents from '" + input + "'");
List<RomData> internalRomData = ArchiveTools.GetArchiveFileInfo(input, _logger); List<Rom> internalRomData = ArchiveTools.GetArchiveFileInfo(input, _logger);
_logger.Log(internalRomData.Count + " entries found in '" + input + "'"); _logger.Log(internalRomData.Count + " entries found in '" + input + "'");
// If the list is populated, then the file was a filled archive // If the list is populated, then the file was a filled archive
if (internalRomData.Count > 0) if (internalRomData.Count > 0)
{ {
foreach (RomData rom in internalRomData) foreach (Rom rom in internalRomData)
{ {
// Try to find the matches to the file that was found // Try to find the matches to the file that was found
List<RomData> foundroms = RomTools.GetDuplicates(rom, _datdata); List<Rom> foundroms = RomTools.GetDuplicates(rom, _datdata);
_logger.User("File '" + rom.Name + "' had " + foundroms.Count + " matches in the DAT!"); _logger.User("File '" + rom.Name + "' had " + foundroms.Count + " matches in the DAT!");
foreach (RomData found in foundroms) foreach (Rom found in foundroms)
{ {
_logger.Log("Matched name: " + found.Name); _logger.Log("Matched name: " + found.Name);
string newinput = ArchiveTools.ExtractSingleItemFromArchive(input, rom.Name, _tempdir, _logger); string newinput = ArchiveTools.ExtractSingleItemFromArchive(input, rom.Name, _tempdir, _logger);
@@ -530,7 +530,7 @@ namespace SabreTools
*/ */
// Sort the input set(s) by game // Sort the input set(s) by game
SortedDictionary<string, List<RomData>> sortedByGame = DatTools.BucketByGame(_datdata.Roms, false, true, _logger); SortedDictionary<string, List<Rom>> sortedByGame = DatTools.BucketByGame(_datdata.Roms, false, true, _logger);
// Assuming archived sets, move all toplevel folders to temp // Assuming archived sets, move all toplevel folders to temp
foreach (string directory in Directory.EnumerateDirectories(_outdir, "*", SearchOption.TopDirectoryOnly)) foreach (string directory in Directory.EnumerateDirectories(_outdir, "*", SearchOption.TopDirectoryOnly))
@@ -554,7 +554,7 @@ namespace SabreTools
// Finally, if it's an archive and exists properly, we check the insides // Finally, if it's an archive and exists properly, we check the insides
else else
{ {
List<RomData> roms = new List<RomData>(); List<Rom> roms = new List<Rom>();
// If we are in quickscan, get the list of roms that way // If we are in quickscan, get the list of roms that way
if (_externalScan) if (_externalScan)
@@ -582,9 +582,9 @@ namespace SabreTools
We have to check if it's an exact duplicate or a hash-duplicate We have to check if it's an exact duplicate or a hash-duplicate
Which is better: traversing the "should have" list or the "do have" list? Which is better: traversing the "should have" list or the "do have" list?
*/ */
List<RomData> fromDat = sortedByGame[Path.GetFileNameWithoutExtension(archive)]; List<Rom> fromDat = sortedByGame[Path.GetFileNameWithoutExtension(archive)];
List<RomData> toRemove = new List<RomData>(); List<Rom> toRemove = new List<Rom>();
foreach (RomData rom in roms) foreach (Rom rom in roms)
{ {
// If it's not in at all or needs renaming, mark for removal // If it's not in at all or needs renaming, mark for removal
if (!fromDat.Contains(rom)) if (!fromDat.Contains(rom))