[Structs] Rename File to Rom again

I'm reverting this because there might be cases where System.IO.File and SabreTools.Helper.File could be in conflict
This commit is contained in:
Matt Nadareski
2016-08-29 13:57:46 -07:00
parent 3f463a1cf5
commit b9abd54944
13 changed files with 210 additions and 210 deletions

View File

@@ -19,7 +19,7 @@ namespace SabreTools.Helper
/// <param name="input">Input filename to be moved</param>
/// <param name="output">Output directory to build to</param>
/// <param name="rom">RomData representing the new information</param>
public static void WriteToArchive(string input, string output, File rom)
public static void WriteToArchive(string input, string output, Rom rom)
{
string archiveFileName = Path.Combine(output, rom.Machine + ".zip");
@@ -69,7 +69,7 @@ namespace SabreTools.Helper
/// <param name="input">Input filename to be moved</param>
/// <param name="output">Output directory to build to</param>
/// <param name="rom">RomData representing the new information</param>
public static void WriteToManagedArchive(string input, string output, File rom)
public static void WriteToManagedArchive(string input, string output, Rom rom)
{
string archiveFileName = Path.Combine(output, rom.Machine + ".zip");
@@ -474,9 +474,9 @@ namespace SabreTools.Helper
/// <param name="input">Input file to get data from</param>
/// <param name="logger">Logger object for file and console output</param>
/// <returns>List of RomData objects representing the found data</returns>
public static List<File> GetArchiveFileInfo(string input, Logger logger)
public static List<Rom> GetArchiveFileInfo(string input, Logger logger)
{
List<File> roms = new List<File>();
List<Rom> roms = new List<Rom>();
string gamename = Path.GetFileNameWithoutExtension(input);
// First get the archive type
@@ -491,7 +491,7 @@ namespace SabreTools.Helper
// If we got back GZip, try to get TGZ info first
else if (at == ArchiveType.GZip)
{
File possibleTgz = GetTorrentGZFileInfo(input, logger);
Rom possibleTgz = GetTorrentGZFileInfo(input, logger);
// If it was, then add it to the outputs and continue
if (possibleTgz.Name != null)
@@ -534,7 +534,7 @@ namespace SabreTools.Helper
+ (size == 0 ? reader.Entry.Size : size) + ", "
+ (crc == "" ? reader.Entry.Crc.ToString("X").ToLowerInvariant() : crc));
roms.Add(new File
roms.Add(new Rom
{
Type = ItemType.Rom,
Name = reader.Entry.Key,
@@ -570,7 +570,7 @@ namespace SabreTools.Helper
/// <param name="input">Filename to get information from</param>
/// <param name="logger">Logger object for file and console output</param>
/// <returns>Populated RomData object if success, empty one on error</returns>
public static File GetTorrentGZFileInfo(string input, Logger logger)
public static Rom GetTorrentGZFileInfo(string input, Logger logger)
{
string datum = Path.GetFileName(input).ToLowerInvariant();
long filesize = new FileInfo(input).Length;
@@ -579,14 +579,14 @@ namespace SabreTools.Helper
if (!Regex.IsMatch(datum, @"^[0-9a-f]{40}\.gz"))
{
logger.Warning("Non SHA-1 filename found, skipping: '" + datum + "'");
return new File();
return new Rom();
}
// Check if the file is at least the minimum length
if (filesize < 40 /* bytes */)
{
logger.Warning("Possibly corrupt file '" + input + "' with size " + Style.GetBytesReadable(filesize));
return new File();
return new Rom();
}
// Get the Romba-specific header data
@@ -610,7 +610,7 @@ namespace SabreTools.Helper
}
if (!correct)
{
return new File();
return new Rom();
}
// Now convert the data and get the right position
@@ -618,7 +618,7 @@ namespace SabreTools.Helper
string gzcrc = BitConverter.ToString(headercrc).Replace("-", string.Empty);
long extractedsize = (long)BitConverter.ToUInt64(headersz.Reverse().ToArray(), 0);
File rom = new File
Rom rom = new Rom
{
Type = ItemType.Rom,
Machine = new Machine
@@ -665,7 +665,7 @@ namespace SabreTools.Helper
outdir = Path.GetFullPath(outdir);
// Now get the Rom info for the file so we have hashes and size
File rom = RomTools.GetSingleFileInfo(input);
Rom rom = RomTools.GetSingleFileInfo(input);
// If it doesn't exist, create the output file and then write
string outfile = Path.Combine(outdir, rom.HashData.SHA1 + ".gz");

View File

@@ -95,7 +95,7 @@ namespace SabreTools.Helper
// Make sure there's a dictionary to read to
if (datdata.Files == null)
{
datdata.Files = new Dictionary<string, List<File>>();
datdata.Files = new Dictionary<string, List<Rom>>();
}
// Now parse the correct type of DAT
@@ -170,7 +170,7 @@ namespace SabreTools.Helper
// If we're in cleaning mode, sanitize the game name
gamename = (clean ? Style.CleanGameName(gamename) : gamename);
File rom = new File
Rom rom = new Rom
{
Machine = new Machine
{
@@ -328,7 +328,7 @@ namespace SabreTools.Helper
}
else
{
List<File> templist = new List<File>();
List<Rom> templist = new List<Rom>();
templist.Add(rom);
datdata.Files.Add(key, templist);
}
@@ -566,7 +566,7 @@ namespace SabreTools.Helper
// If we're in cleaning mode, sanitize the game name
rominfo[3] = (clean ? Style.CleanGameName(rominfo[3]) : rominfo[3]);
File rom = new File
Rom rom = new Rom
{
Machine = new Machine
{
@@ -616,7 +616,7 @@ namespace SabreTools.Helper
}
else
{
List<File> templist = new List<File>();
List<Rom> templist = new List<Rom>();
templist.Add(rom);
datdata.Files.Add(key, templist);
}
@@ -677,7 +677,7 @@ namespace SabreTools.Helper
// If we're in cleaning mode, sanitize the game name
tempgame = (clean ? Style.CleanGameName(tempgame) : tempgame);
File rom = new File
Rom rom = new Rom
{
Type = ItemType.Rom,
Name = "null",
@@ -702,7 +702,7 @@ namespace SabreTools.Helper
}
else
{
List<File> temp = new List<File>();
List<Rom> temp = new List<Rom>();
temp.Add(rom);
datdata.Files.Add(key, temp);
}
@@ -1081,7 +1081,7 @@ namespace SabreTools.Helper
if (subreader.GetAttribute("loadflag") == "continue" || subreader.GetAttribute("loadflag") == "ignore")
{
int index = datdata.Files[key].Count() - 1;
File lastrom = datdata.Files[key][index];
Rom lastrom = datdata.Files[key][index];
lastrom.HashData.Size += size;
datdata.Files[key].RemoveAt(index);
datdata.Files[key].Add(lastrom);
@@ -1127,7 +1127,7 @@ namespace SabreTools.Helper
// Get the new values to add
key = size + "-" + crc;
File rom = new File
Rom rom = new Rom
{
Machine = new Machine
{
@@ -1154,7 +1154,7 @@ namespace SabreTools.Helper
}
else
{
List<File> newvalue = new List<File>();
List<Rom> newvalue = new List<Rom>();
newvalue.Add(rom);
datdata.Files.Add(key, newvalue);
}
@@ -1186,7 +1186,7 @@ namespace SabreTools.Helper
// If we're in cleaning mode, sanitize the game name
tempname = (clean ? Style.CleanGameName(tempname.Split(Path.DirectorySeparatorChar)) : tempname);
File rom = new File
Rom rom = new Rom
{
Type = ItemType.Rom,
Name = "null",
@@ -1211,7 +1211,7 @@ namespace SabreTools.Helper
}
else
{
List<File> temp = new List<File>();
List<Rom> temp = new List<Rom>();
temp.Add(rom);
datdata.Files.Add(key, temp);
}
@@ -1312,7 +1312,7 @@ namespace SabreTools.Helper
if (xtr.GetAttribute("loadflag") == "continue" || xtr.GetAttribute("loadflag") == "ignore")
{
int index = datdata.Files[key].Count() - 1;
File lastrom = datdata.Files[key][index];
Rom lastrom = datdata.Files[key][index];
lastrom.HashData.Size += size;
datdata.Files[key].RemoveAt(index);
datdata.Files[key].Add(lastrom);
@@ -1367,7 +1367,7 @@ namespace SabreTools.Helper
// Get the new values to add
key = size + "-" + crc;
File rom = new File
Rom rom = new Rom
{
Machine = new Machine
{
@@ -1393,7 +1393,7 @@ namespace SabreTools.Helper
}
else
{
List<File> newvalue = new List<File>();
List<Rom> newvalue = new List<Rom>();
newvalue.Add(rom);
datdata.Files.Add(key, newvalue);
}
@@ -1431,9 +1431,9 @@ namespace SabreTools.Helper
/// <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>
/// <returns>SortedDictionary bucketed by game name</returns>
public static SortedDictionary<string, List<File>> BucketByGame(List<File> 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<File>> dict = new Dictionary<string, List<File>>();
Dictionary<string, List<Rom>> dict = new Dictionary<string, List<Rom>>();
dict.Add("key", list);
return BucketByGame(dict, mergeroms, norename, logger, output);
}
@@ -1447,9 +1447,9 @@ namespace SabreTools.Helper
/// <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>
/// <returns>SortedDictionary bucketed by game name</returns>
public static SortedDictionary<string, List<File>> BucketByGame(IDictionary<string, List<File>> 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<File>> sortable = new SortedDictionary<string, List<File>>();
SortedDictionary<string, List<Rom>> sortable = new SortedDictionary<string, List<Rom>>();
long count = 0;
// If we have a null dict or an empty one, output a new dictionary
@@ -1461,13 +1461,13 @@ namespace SabreTools.Helper
// Process each all of the roms
foreach (string key in dict.Keys)
{
List<File> roms = dict[key];
List<Rom> roms = dict[key];
if (mergeroms)
{
roms = RomTools.Merge(roms, logger);
}
foreach (File rom in roms)
foreach (Rom rom in roms)
{
count++;
string newkey = (norename ? ""
@@ -1483,7 +1483,7 @@ namespace SabreTools.Helper
}
else
{
List<File> temp = new List<File>();
List<Rom> temp = new List<Rom>();
temp.Add(rom);
sortable.Add(newkey, temp);
}
@@ -1508,9 +1508,9 @@ namespace SabreTools.Helper
/// <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>
/// <returns>SortedDictionary bucketed by size and hash</returns>
public static SortedDictionary<string, List<File>> BucketByHashSize(List<File> 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<File>> dict = new Dictionary<string, List<File>>();
Dictionary<string, List<Rom>> dict = new Dictionary<string, List<Rom>>();
dict.Add("key", list);
return BucketByHashSize(dict, mergeroms, norename, logger, output);
}
@@ -1524,9 +1524,9 @@ namespace SabreTools.Helper
/// <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>
/// <returns>SortedDictionary bucketed by size and hash</returns>
public static SortedDictionary<string, List<File>> BucketByHashSize(IDictionary<string, List<File>> 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<File>> sortable = new SortedDictionary<string, List<File>>();
SortedDictionary<string, List<Rom>> sortable = new SortedDictionary<string, List<Rom>>();
long count = 0;
// If we have a null dict or an empty one, output a new dictionary
@@ -1536,15 +1536,15 @@ namespace SabreTools.Helper
}
// Process each all of the roms
foreach (List<File> roms in dict.Values)
foreach (List<Rom> roms in dict.Values)
{
List<File> newroms = roms;
List<Rom> newroms = roms;
if (mergeroms)
{
newroms = RomTools.Merge(newroms, logger);
}
foreach (File rom in newroms)
foreach (Rom rom in newroms)
{
count++;
string key = rom.HashData.Size + "-" + rom.HashData.CRC;
@@ -1554,7 +1554,7 @@ namespace SabreTools.Helper
}
else
{
List<File> temp = new List<File>();
List<Rom> temp = new List<Rom>();
temp.Add(rom);
sortable.Add(key, temp);
}
@@ -1756,7 +1756,7 @@ namespace SabreTools.Helper
int i = 0;
userData = new Dat
{
Files = new Dictionary<string, List<File>>(),
Files = new Dictionary<string, List<Rom>>(),
MergeRoms = inputDat.MergeRoms,
};
foreach (string input in inputs)
@@ -1771,14 +1771,14 @@ namespace SabreTools.Helper
datHeaders.Add((Dat)userData.CloneHeader());
// Reset the header values so the next can be captured
Dictionary<string, List<File>> temp = userData.Files;
Dictionary<string, List<Rom>> temp = userData.Files;
userData = new Dat();
userData.Files = temp;
}
}
// Set the output values
Dictionary<string, List<File>> roms = userData.Files;
Dictionary<string, List<Rom>> roms = userData.Files;
userData = (Dat)inputDat.CloneHeader();
userData.Files = roms;
@@ -1810,14 +1810,14 @@ namespace SabreTools.Helper
long slt, long seq, string crc, string md5, string sha1, bool? nodump, bool trim, bool single, string root, Logger logger)
{
// Now loop through and create a new Rom dictionary using filtered values
Dictionary<string, List<File>> dict = new Dictionary<string, List<File>>();
Dictionary<string, List<Rom>> dict = new Dictionary<string, List<Rom>>();
List<string> keys = datdata.Files.Keys.ToList();
foreach (string key in keys)
{
List<File> roms = datdata.Files[key];
List<Rom> roms = datdata.Files[key];
for (int i = 0; i < roms.Count; i++)
{
File rom = roms[i];
Rom rom = roms[i];
// Filter on nodump status
if (nodump == true && !rom.Nodump)
@@ -1963,7 +1963,7 @@ namespace SabreTools.Helper
}
else
{
List<File> temp = new List<File>();
List<Rom> temp = new List<Rom>();
temp.Add(rom);
dict.Add(key, temp);
}
@@ -2041,11 +2041,11 @@ namespace SabreTools.Helper
List<string> keys = userData.Files.Keys.ToList();
foreach (string key in keys)
{
List<File> roms = RomTools.Merge(userData.Files[key], logger);
List<Rom> roms = RomTools.Merge(userData.Files[key], logger);
if (roms != null && roms.Count > 0)
{
foreach (File rom in roms)
foreach (Rom rom in roms)
{
// No duplicates
if ((diff & DiffMode.NoDupes) != 0 || (diff & DiffMode.Individuals) != 0)
@@ -2061,7 +2061,7 @@ namespace SabreTools.Helper
}
else
{
List<File> tl = new List<File>();
List<Rom> tl = new List<Rom>();
tl.Add(rom);
outDats[rom.Metadata.SystemID].Files.Add(key, tl);
}
@@ -2070,7 +2070,7 @@ namespace SabreTools.Helper
// Merged no-duplicates DAT
if ((diff & DiffMode.NoDupes) != 0)
{
File newrom = rom;
Rom newrom = rom;
newrom.Machine.Name += " (" + Path.GetFileNameWithoutExtension(inputs[newrom.Metadata.SystemID].Split('¬')[0]) + ")";
if (outerDiffData.Files.ContainsKey(key))
@@ -2079,7 +2079,7 @@ namespace SabreTools.Helper
}
else
{
List<File> tl = new List<File>();
List<Rom> tl = new List<Rom>();
tl.Add(rom);
outerDiffData.Files.Add(key, tl);
}
@@ -2092,7 +2092,7 @@ namespace SabreTools.Helper
{
if (rom.Dupe >= DupeType.ExternalHash)
{
File newrom = rom;
Rom newrom = rom;
newrom.Machine.Name += " (" + Path.GetFileNameWithoutExtension(inputs[newrom.Metadata.SystemID].Split('¬')[0]) + ")";
if (dupeData.Files.ContainsKey(key))
@@ -2101,7 +2101,7 @@ namespace SabreTools.Helper
}
else
{
List<File> tl = new List<File>();
List<Rom> tl = new List<Rom>();
tl.Add(rom);
dupeData.Files.Add(key, tl);
}
@@ -2194,11 +2194,11 @@ namespace SabreTools.Helper
foreach (string key in keys)
{
List<File> roms = RomTools.Merge(userData.Files[key], logger);
List<Rom> roms = RomTools.Merge(userData.Files[key], logger);
if (roms != null && roms.Count > 0)
{
foreach (File rom in roms)
foreach (Rom rom in roms)
{
if (outDats[rom.Metadata.SystemID].Files.ContainsKey(key))
{
@@ -2206,7 +2206,7 @@ namespace SabreTools.Helper
}
else
{
List<File> tl = new List<File>();
List<Rom> tl = new List<Rom>();
tl.Add(rom);
outDats[rom.Metadata.SystemID].Files.Add(key, tl);
}
@@ -2256,10 +2256,10 @@ namespace SabreTools.Helper
List<string> keys = userData.Files.Keys.ToList();
foreach (string key in keys)
{
List<File> newroms = new List<File>();
foreach (File rom in userData.Files[key])
List<Rom> newroms = new List<Rom>();
foreach (Rom rom in userData.Files[key])
{
File newrom = rom;
Rom newrom = rom;
string filename = inputs[newrom.Metadata.SystemID].Split('¬')[0];
string rootpath = inputs[newrom.Metadata.SystemID].Split('¬')[1];

View File

@@ -32,7 +32,7 @@ namespace SabreTools.Helper
}
// Bucket roms by game name and optionally dedupe
SortedDictionary<string, List<File>> sortable = DatTools.BucketByGame(datdata.Files, datdata.MergeRoms, norename, logger);
SortedDictionary<string, List<Rom>> sortable = DatTools.BucketByGame(datdata.Files, datdata.MergeRoms, norename, logger);
// Now write out to file
// If it's empty, use the current folder
@@ -95,11 +95,11 @@ namespace SabreTools.Helper
int depth = 2, last = -1;
string lastgame = null;
List<string> splitpath = new List<string>();
foreach (List<File> roms in sortable.Values)
foreach (List<Rom> roms in sortable.Values)
{
for (int index = 0; index < roms.Count; index++)
{
File rom = roms[index];
Rom rom = roms[index];
List<string> newsplit = rom.Machine.Name.Split('\\').ToList();
// If we have a different game and we're not at the start of the list, output the end of last item
@@ -285,7 +285,7 @@ namespace SabreTools.Helper
/// <param name="last">Last known depth to cycle back from (SabreDAT only)</param>
/// <param name="logger">Logger object for file and console output</param>
/// <returns>The new depth of the tag</returns>
public static int WriteStartGame(StreamWriter sw, File rom, List<string> newsplit, string lastgame, Dat 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
{
@@ -344,7 +344,7 @@ namespace SabreTools.Helper
/// <param name="last">Last known depth to cycle back from (SabreDAT only)</param>
/// <param name="logger">Logger object for file and console output</param>
/// <returns>The new depth of the tag</returns>
public static int WriteEndGame(StreamWriter sw, File rom, List<string> splitpath, List<string> newsplit, string lastgame, Dat 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;
@@ -413,7 +413,7 @@ namespace SabreTools.Helper
/// <param name="depth">Current depth to output file at (SabreDAT only)</param>
/// <param name="logger">Logger object for file and console output</param>
/// <returns>True if the data was written, false on error</returns>
public static bool WriteRomData(StreamWriter sw, File rom, string lastgame, Dat datdata, int depth, Logger logger)
public static bool WriteRomData(StreamWriter sw, Rom rom, string lastgame, Dat datdata, int depth, Logger logger)
{
try
{

View File

@@ -18,15 +18,15 @@ namespace SabreTools.Helper
/// <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>
/// <remarks>Add read-offset for hash info</remarks>
public static File 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)
{
// Add safeguard if file doesn't exist
if (!System.IO.File.Exists(input))
{
return new File();
return new Rom();
}
File rom = new File
Rom rom = new Rom
{
Name = Path.GetFileName(input),
Type = ItemType.Rom,
@@ -84,7 +84,7 @@ namespace SabreTools.Helper
}
catch (IOException)
{
return new File();
return new Rom();
}
return rom;
@@ -96,19 +96,19 @@ namespace SabreTools.Helper
/// <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>
/// <returns>A List of RomData objects representing the merged roms</returns>
public static List<File> Merge(List<File> inroms, Logger logger)
public static List<Rom> Merge(List<Rom> inroms, Logger logger)
{
// Check for null or blank roms first
if (inroms == null || inroms.Count == 0)
{
return new List<File>();
return new List<Rom>();
}
// Create output list
List<File> outroms = new List<File>();
List<Rom> outroms = new List<Rom>();
// Then deduplicate them by checking to see if data matches previous saved roms
foreach (File rom in inroms)
foreach (Rom rom in inroms)
{
// If it's a nodump, add and skip
if (rom.Nodump)
@@ -122,11 +122,11 @@ namespace SabreTools.Helper
{
// Check if the rom is a duplicate
DupeType dupetype = DupeType.None;
File savedrom = new File();
Rom savedrom = new Rom();
int pos = -1;
for (int i = 0; i < outroms.Count; i++)
{
File lastrom = outroms[i];
Rom lastrom = outroms[i];
// Get the duplicate status
dupetype = GetDuplicateStatus(rom, lastrom, logger);
@@ -194,9 +194,9 @@ namespace SabreTools.Helper
/// <param name="logger">Logger object for console and/or file output</param>
/// <param name="remove">True to remove matched roms from the input, false otherwise (default)</param>
/// <returns>List of matched RomData objects</returns>
public static List<File> GetDuplicates(File lastrom, Dat datdata, Logger logger, bool remove = false)
public static List<Rom> GetDuplicates(Rom lastrom, Dat datdata, Logger logger, bool remove = false)
{
List<File> output = new List<File>();
List<Rom> output = new List<Rom>();
// Check for an empty rom list first
if (datdata.Files == null || datdata.Files.Count == 0)
@@ -208,9 +208,9 @@ namespace SabreTools.Helper
List<string> keys = datdata.Files.Keys.ToList();
foreach (string key in keys)
{
List<File> roms = datdata.Files[key];
List<File> left = new List<File>();
foreach (File rom in roms)
List<Rom> roms = datdata.Files[key];
List<Rom> left = new List<Rom>();
foreach (Rom rom in roms)
{
if (IsDuplicate(rom, lastrom, logger))
{
@@ -239,7 +239,7 @@ namespace SabreTools.Helper
/// <param name="lastrom">Rom to use as a baseline</param>
/// <param name="logger">Logger object for console and/or file output</param>
/// <returns>True if the roms are duplicates, false otherwise</returns>
public static bool IsDuplicate(File rom, File lastrom, Logger logger)
public static bool IsDuplicate(Rom rom, Rom lastrom, Logger logger)
{
bool dupefound = false;
@@ -274,7 +274,7 @@ namespace SabreTools.Helper
/// <param name="lastrom">Last rom to check against</param>
/// <param name="logger">Logger object for console and/or file output</param>
/// <returns>The DupeType corresponding to the relationship between the two</returns>
public static DupeType GetDuplicateStatus(File rom, File lastrom, Logger logger)
public static DupeType GetDuplicateStatus(Rom rom, Rom lastrom, Logger logger)
{
DupeType output = DupeType.None;
@@ -319,9 +319,9 @@ namespace SabreTools.Helper
/// <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>
/// <returns>True if it sorted correctly, false otherwise</returns>
public static bool Sort(List<File> roms, bool norename)
public static bool Sort(List<Rom> roms, bool norename)
{
roms.Sort(delegate (File x, File y)
roms.Sort(delegate (Rom x, Rom y)
{
if (x.Metadata.SystemID == y.Metadata.SystemID)
{

View File

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