From d03f7739e83d9f6fd34b7ac3c7935d0bc4015592 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Mon, 30 Oct 2017 21:49:55 -0700 Subject: [PATCH] [DatFiles/, DatItem, ArchiveTools, FileTools] Notes and tweaks --- SabreTools.Library/DatFiles/AttractMode.cs | 2 +- SabreTools.Library/DatFiles/ClrMamePro.cs | 12 +++---- SabreTools.Library/DatFiles/DatFile.cs | 35 +++++++++--------- SabreTools.Library/DatFiles/DosCenter.cs | 12 +++---- SabreTools.Library/DatFiles/Hashfile.cs | 8 ++--- SabreTools.Library/DatFiles/Listroms.cs | 10 +++--- SabreTools.Library/DatFiles/Logiqx.cs | 10 +++--- SabreTools.Library/DatFiles/Missfile.cs | 8 ++--- SabreTools.Library/DatFiles/OfflineList.cs | 8 ++--- SabreTools.Library/DatFiles/RomCenter.cs | 8 ++--- SabreTools.Library/DatFiles/SabreDat.cs | 10 +++--- SabreTools.Library/DatFiles/SeparatedValue.cs | 8 ++--- SabreTools.Library/DatFiles/SoftwareList.cs | 10 +++--- SabreTools.Library/Items/DatItem.cs | 4 +-- SabreTools.Library/Tools/ArchiveTools.cs | 36 +++++++++---------- SabreTools.Library/Tools/FileTools.cs | 7 ++-- 16 files changed, 97 insertions(+), 91 deletions(-) diff --git a/SabreTools.Library/DatFiles/AttractMode.cs b/SabreTools.Library/DatFiles/AttractMode.cs index 6b32976f..427795f3 100644 --- a/SabreTools.Library/DatFiles/AttractMode.cs +++ b/SabreTools.Library/DatFiles/AttractMode.cs @@ -231,7 +231,7 @@ namespace SabreTools.Library.DatFiles /// Write out Game start using the supplied StreamWriter /// /// StreamWriter to output to - /// RomData object to be output + /// DatItem object to be output /// True if the data was written, false on error private bool WriteStartGame(StreamWriter sw, DatItem rom) { diff --git a/SabreTools.Library/DatFiles/ClrMamePro.cs b/SabreTools.Library/DatFiles/ClrMamePro.cs index c641c858..9191fe9b 100644 --- a/SabreTools.Library/DatFiles/ClrMamePro.cs +++ b/SabreTools.Library/DatFiles/ClrMamePro.cs @@ -706,7 +706,7 @@ namespace SabreTools.Library.DatFiles } // Now, output the rom data - WriteRomData(sw, rom, ignoreblanks); + WriteDatItem(sw, rom, ignoreblanks); // Set the new data to compare against lastgame = rom.MachineName; @@ -774,7 +774,7 @@ namespace SabreTools.Library.DatFiles /// Write out Game start using the supplied StreamWriter /// /// StreamWriter to output to - /// RomData object to be output + /// DatItem object to be output /// True if the data was written, false on error private bool WriteStartGame(StreamWriter sw, DatItem rom) { @@ -812,7 +812,7 @@ namespace SabreTools.Library.DatFiles /// Write out Game end using the supplied StreamWriter /// /// StreamWriter to output to - /// RomData object to be output + /// DatItem object to be output /// True if the data was written, false on error private bool WriteEndGame(StreamWriter sw, DatItem rom) { @@ -833,14 +833,14 @@ namespace SabreTools.Library.DatFiles } /// - /// Write out RomData using the supplied StreamWriter + /// Write out DatItem using the supplied StreamWriter /// /// DatFile to write out from /// StreamWriter to output to - /// RomData object to be output + /// DatItem object to be output /// True if blank roms should be skipped on output, false otherwise (default) /// True if the data was written, false on error - private bool WriteRomData(StreamWriter sw, DatItem rom, bool ignoreblanks = false) + private bool WriteDatItem(StreamWriter sw, DatItem rom, bool ignoreblanks = false) { // If we are in ignore blanks mode AND we have a blank (0-size) rom, skip if (ignoreblanks diff --git a/SabreTools.Library/DatFiles/DatFile.cs b/SabreTools.Library/DatFiles/DatFile.cs index 1aa30ab2..3e9f4b6a 100644 --- a/SabreTools.Library/DatFiles/DatFile.cs +++ b/SabreTools.Library/DatFiles/DatFile.cs @@ -4211,8 +4211,8 @@ namespace SabreTools.Library.DatFiles if (shouldExternalProcess) { // TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually - Rom rom = FileTools.GetFileInfo(file, omitFromScan: (quickScan ? Hash.SecureHashes : Hash.DeepHashes), header: headerToCheckAgainst); - usedExternally = RebuildIndividualFile(rom, file, outDir, tempSubDir, date, inverse, outputFormat, + Rom fileinfo = FileTools.GetFileInfo(file, omitFromScan: (quickScan ? Hash.SecureHashes : Hash.DeepHashes), header: headerToCheckAgainst); + usedExternally = RebuildIndividualFile(fileinfo, file, outDir, tempSubDir, date, inverse, outputFormat, romba, updateDat, null /* isZip */, headerToCheckAgainst); } @@ -4242,8 +4242,8 @@ namespace SabreTools.Library.DatFiles if (entries == null && File.Exists(file)) { // TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually - Rom rom = FileTools.GetFileInfo(file, omitFromScan: (quickScan ? Hash.SecureHashes : Hash.DeepHashes)); - usedExternally = RebuildIndividualFile(rom, file, outDir, tempSubDir, date, inverse, outputFormat, + Rom fileinfo = FileTools.GetFileInfo(file, omitFromScan: (quickScan ? Hash.SecureHashes : Hash.DeepHashes)); + usedExternally = RebuildIndividualFile(fileinfo, file, outDir, tempSubDir, date, inverse, outputFormat, romba, updateDat, null /* isZip */, headerToCheckAgainst); } // Otherwise, loop through the entries and try to match @@ -4270,7 +4270,7 @@ namespace SabreTools.Library.DatFiles /// /// Find duplicates and rebuild individual files to output /// - /// Information for the current file to rebuild from + /// Information for the current file to rebuild from /// Name of the file to process /// Output directory to use to build to /// Temporary directory for archive extraction @@ -4282,20 +4282,23 @@ namespace SabreTools.Library.DatFiles /// True if the input file is an archive, false if the file is TGZ, null otherwise /// Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise /// True if the file was able to be rebuilt, false otherwise - private bool RebuildIndividualFile(Rom rom, string file, string outDir, string tempDir, bool date, + private bool RebuildIndividualFile(DatItem datItem, string file, string outDir, string tempDir, bool date, bool inverse, OutputFormat outputFormat, bool romba, bool updateDat, bool? isZip, string headerToCheckAgainst) { + // TODO: Don't assume this is a Rom once Disk parsing is created + Rom rom = (Rom)datItem; + // Set the output value bool rebuilt = false; // Find if the file has duplicates in the DAT - bool hasDuplicates = rom.HasDuplicates(this); + bool hasDuplicates = datItem.HasDuplicates(this); // If it has duplicates and we're not filtering, rebuild it if (hasDuplicates && !inverse) { // Get the list of duplicates to rebuild to - List dupes = rom.GetDuplicates(this, remove: updateDat); + List dupes = datItem.GetDuplicates(this, remove: updateDat); // If we don't have any duplicates, continue if (dupes.Count == 0) @@ -4340,7 +4343,7 @@ namespace SabreTools.Library.DatFiles if (isZip != null) { string realName = null; - (fileStream, realName) = ArchiveTools.ExtractStream(file, rom.Name); + (fileStream, realName) = ArchiveTools.ExtractStream(file, datItem.Name); } // Otherwise, just open the filestream else @@ -4357,7 +4360,7 @@ namespace SabreTools.Library.DatFiles // Seek to the beginning of the stream fileStream.Seek(0, SeekOrigin.Begin); - Globals.Logger.User("Matches found for '{0}', rebuilding accordingly...", Style.GetFileName(rom.Name)); + Globals.Logger.User("Matches found for '{0}', rebuilding accordingly...", Style.GetFileName(datItem.Name)); rebuilt = true; // Now loop through the list and rebuild accordingly @@ -4436,7 +4439,7 @@ namespace SabreTools.Library.DatFiles if (isZip != null) { string realName = null; - (fileStream, realName) = ArchiveTools.ExtractStream(file, rom.Name); + (fileStream, realName) = ArchiveTools.ExtractStream(file, datItem.Name); } // Otherwise, just open the filestream else @@ -4462,7 +4465,7 @@ namespace SabreTools.Library.DatFiles item.MachineDescription = machinename; } - Globals.Logger.User("No matches found for '{0}', rebuilding accordingly from inverse flag...", Style.GetFileName(rom.Name)); + Globals.Logger.User("No matches found for '{0}', rebuilding accordingly from inverse flag...", Style.GetFileName(datItem.Name)); // Now rebuild to the output file switch (outputFormat) @@ -4537,7 +4540,7 @@ namespace SabreTools.Library.DatFiles if (isZip != null) { string realName = null; - (fileStream, realName) = ArchiveTools.ExtractStream(file, rom.Name); + (fileStream, realName) = ArchiveTools.ExtractStream(file, datItem.Name); } // Otherwise, just open the filestream else @@ -4579,15 +4582,15 @@ namespace SabreTools.Library.DatFiles return rebuilt; } - Globals.Logger.User("Headerless matches found for '{0}', rebuilding accordingly...", Style.GetFileName(rom.Name)); + Globals.Logger.User("Headerless matches found for '{0}', rebuilding accordingly...", Style.GetFileName(datItem.Name)); rebuilt = true; // Now loop through the list and rebuild accordingly foreach (Rom item in dupes) { // Create a headered item to use as well - rom.CopyMachineInformation(item); - rom.Name += "_" + rom.CRC; + datItem.CopyMachineInformation(item); + datItem.Name += "_" + rom.CRC; // If either copy succeeds, then we want to set rebuilt to true bool eitherSuccess = false; diff --git a/SabreTools.Library/DatFiles/DosCenter.cs b/SabreTools.Library/DatFiles/DosCenter.cs index eedc50b2..74ac390d 100644 --- a/SabreTools.Library/DatFiles/DosCenter.cs +++ b/SabreTools.Library/DatFiles/DosCenter.cs @@ -143,7 +143,7 @@ namespace SabreTools.Library.DatFiles } // Now, output the rom data - WriteRomData(sw, rom, ignoreblanks); + WriteDatItem(sw, rom, ignoreblanks); // Set the new data to compare against lastgame = rom.MachineName; @@ -202,7 +202,7 @@ namespace SabreTools.Library.DatFiles /// Write out Game start using the supplied StreamWriter /// /// StreamWriter to output to - /// RomData object to be output + /// DatItem object to be output /// True if the data was written, false on error private bool WriteStartGame(StreamWriter sw, DatItem rom) { @@ -232,7 +232,7 @@ namespace SabreTools.Library.DatFiles /// Write out Game end using the supplied StreamWriter /// /// StreamWriter to output to - /// RomData object to be output + /// DatItem object to be output /// True if the data was written, false on error private bool WriteEndGame(StreamWriter sw, DatItem rom) { @@ -253,13 +253,13 @@ namespace SabreTools.Library.DatFiles } /// - /// Write out RomData using the supplied StreamWriter + /// Write out DatItem using the supplied StreamWriter /// /// StreamWriter to output to - /// RomData object to be output + /// DatItem object to be output /// True if blank roms should be skipped on output, false otherwise (default) /// True if the data was written, false on error - private bool WriteRomData(StreamWriter sw, DatItem rom, bool ignoreblanks = false) + private bool WriteDatItem(StreamWriter sw, DatItem rom, bool ignoreblanks = false) { // If we are in ignore blanks mode AND we have a blank (0-size) rom, skip if (ignoreblanks diff --git a/SabreTools.Library/DatFiles/Hashfile.cs b/SabreTools.Library/DatFiles/Hashfile.cs index 664ef9a3..32676907 100644 --- a/SabreTools.Library/DatFiles/Hashfile.cs +++ b/SabreTools.Library/DatFiles/Hashfile.cs @@ -164,7 +164,7 @@ namespace SabreTools.Library.DatFiles } // Now, output the rom data - WriteRomData( sw, hash, rom, ignoreblanks); + WriteDatItem( sw, hash, rom, ignoreblanks); } } @@ -182,14 +182,14 @@ namespace SabreTools.Library.DatFiles } /// - /// Write out RomData using the supplied StreamWriter + /// Write out DatItem using the supplied StreamWriter /// /// StreamWriter to output to /// Hash that should be written out - /// RomData object to be output + /// DatItem object to be output /// True if blank roms should be skipped on output, false otherwise (default) /// True if the data was written, false on error - private bool WriteRomData(StreamWriter sw, Hash hash, DatItem rom, bool ignoreblanks = false) + private bool WriteDatItem(StreamWriter sw, Hash hash, DatItem rom, bool ignoreblanks = false) { // If we are in ignore blanks mode AND we have a blank (0-size) rom, skip if (ignoreblanks diff --git a/SabreTools.Library/DatFiles/Listroms.cs b/SabreTools.Library/DatFiles/Listroms.cs index 5aeb18be..a16a399d 100644 --- a/SabreTools.Library/DatFiles/Listroms.cs +++ b/SabreTools.Library/DatFiles/Listroms.cs @@ -318,7 +318,7 @@ namespace SabreTools.Library.DatFiles } // Now, output the rom data - WriteRomData(sw, rom, ignoreblanks); + WriteDatItem(sw, rom, ignoreblanks); // Set the new data to compare against lastgame = rom.MachineName; @@ -342,7 +342,7 @@ namespace SabreTools.Library.DatFiles /// Write out Game start using the supplied StreamWriter /// /// StreamWriter to output to - /// RomData object to be output + /// DatItem object to be output /// True if the data was written, false on error private bool WriteStartGame(StreamWriter sw, DatItem rom) { @@ -393,13 +393,13 @@ namespace SabreTools.Library.DatFiles } /// - /// Write out RomData using the supplied StreamWriter + /// Write out DatItem using the supplied StreamWriter /// /// StreamWriter to output to - /// RomData object to be output + /// DatItem object to be output /// True if blank roms should be skipped on output, false otherwise (default) /// True if the data was written, false on error - private bool WriteRomData(StreamWriter sw, DatItem rom, bool ignoreblanks = false) + private bool WriteDatItem(StreamWriter sw, DatItem rom, bool ignoreblanks = false) { // If we are in ignore blanks mode AND we have a blank (0-size) rom, skip if (ignoreblanks diff --git a/SabreTools.Library/DatFiles/Logiqx.cs b/SabreTools.Library/DatFiles/Logiqx.cs index e594726b..32a7aa0a 100644 --- a/SabreTools.Library/DatFiles/Logiqx.cs +++ b/SabreTools.Library/DatFiles/Logiqx.cs @@ -1250,7 +1250,7 @@ namespace SabreTools.Library.DatFiles } // Now, output the rom data - WriteRomData(sw, rom, ignoreblanks); + WriteDatItem(sw, rom, ignoreblanks); // Set the new data to compare against lastgame = rom.MachineName; @@ -1330,7 +1330,7 @@ namespace SabreTools.Library.DatFiles /// Write out Game start using the supplied StreamWriter /// /// StreamWriter to output to - /// RomData object to be output + /// DatItem object to be output /// True if the data was written, false on error private bool WriteStartGame(StreamWriter sw, DatItem rom) { @@ -1400,13 +1400,13 @@ namespace SabreTools.Library.DatFiles } /// - /// Write out RomData using the supplied StreamWriter + /// Write out DatItem using the supplied StreamWriter /// /// StreamWriter to output to - /// RomData object to be output + /// DatItem object to be output /// True if blank roms should be skipped on output, false otherwise (default) /// True if the data was written, false on error - private bool WriteRomData(StreamWriter sw, DatItem rom, bool ignoreblanks = false) + private bool WriteDatItem(StreamWriter sw, DatItem rom, bool ignoreblanks = false) { // If we are in ignore blanks mode AND we have a blank (0-size) rom, skip if (ignoreblanks diff --git a/SabreTools.Library/DatFiles/Missfile.cs b/SabreTools.Library/DatFiles/Missfile.cs index 720f2413..04ab8c6f 100644 --- a/SabreTools.Library/DatFiles/Missfile.cs +++ b/SabreTools.Library/DatFiles/Missfile.cs @@ -120,7 +120,7 @@ namespace SabreTools.Library.DatFiles } // Now, output the rom data - WriteRomData(sw, rom, lastgame, ignoreblanks); + WriteDatItem(sw, rom, lastgame, ignoreblanks); // Set the new data to compare against lastgame = rom.MachineName; @@ -141,14 +141,14 @@ namespace SabreTools.Library.DatFiles } /// - /// Write out RomData using the supplied StreamWriter + /// Write out DatItem using the supplied StreamWriter /// /// StreamWriter to output to - /// RomData object to be output + /// DatItem object to be output /// The name of the last game to be output /// True if blank roms should be skipped on output, false otherwise (default) /// True if the data was written, false on error - private bool WriteRomData(StreamWriter sw, DatItem rom, string lastgame, bool ignoreblanks = false) + private bool WriteDatItem(StreamWriter sw, DatItem rom, string lastgame, bool ignoreblanks = false) { // If we are in ignore blanks mode AND we have a blank (0-size) rom, skip if (ignoreblanks diff --git a/SabreTools.Library/DatFiles/OfflineList.cs b/SabreTools.Library/DatFiles/OfflineList.cs index 92cfdbc1..f8895c1d 100644 --- a/SabreTools.Library/DatFiles/OfflineList.cs +++ b/SabreTools.Library/DatFiles/OfflineList.cs @@ -137,7 +137,7 @@ namespace SabreTools.Library.DatFiles } // Now, output the rom data - WriteRomData(sw, rom, ignoreblanks); + WriteDatItem(sw, rom, ignoreblanks); // Set the new data to compare against lastgame = rom.MachineName; @@ -249,13 +249,13 @@ namespace SabreTools.Library.DatFiles } /// - /// Write out RomData using the supplied StreamWriter + /// Write out DatItem using the supplied StreamWriter /// /// StreamWriter to output to - /// RomData object to be output + /// DatItem object to be output /// True if blank roms should be skipped on output, false otherwise (default) /// True if the data was written, false on error - private bool WriteRomData(StreamWriter sw, DatItem rom, bool ignoreblanks = false) + private bool WriteDatItem(StreamWriter sw, DatItem rom, bool ignoreblanks = false) { // If we are in ignore blanks mode AND we have a blank (0-size) rom, skip if (ignoreblanks diff --git a/SabreTools.Library/DatFiles/RomCenter.cs b/SabreTools.Library/DatFiles/RomCenter.cs index 0d150aa4..6c770c2d 100644 --- a/SabreTools.Library/DatFiles/RomCenter.cs +++ b/SabreTools.Library/DatFiles/RomCenter.cs @@ -266,7 +266,7 @@ namespace SabreTools.Library.DatFiles } // Now, output the rom data - WriteRomData(sw, rom, ignoreblanks); + WriteDatItem(sw, rom, ignoreblanks); // Set the new data to compare against lastgame = rom.MachineName; @@ -322,13 +322,13 @@ namespace SabreTools.Library.DatFiles } /// - /// Write out RomData using the supplied StreamWriter + /// Write out DatItem using the supplied StreamWriter /// /// StreamWriter to output to - /// RomData object to be output + /// DatItem object to be output /// True if blank roms should be skipped on output, false otherwise (default) /// True if the data was written, false on error - private bool WriteRomData(StreamWriter sw, DatItem rom, bool ignoreblanks = false) + private bool WriteDatItem(StreamWriter sw, DatItem rom, bool ignoreblanks = false) { // If we are in ignore blanks mode AND we have a blank (0-size) rom, skip if (ignoreblanks diff --git a/SabreTools.Library/DatFiles/SabreDat.cs b/SabreTools.Library/DatFiles/SabreDat.cs index 1266b2f2..5f17f109 100644 --- a/SabreTools.Library/DatFiles/SabreDat.cs +++ b/SabreTools.Library/DatFiles/SabreDat.cs @@ -142,7 +142,7 @@ namespace SabreTools.Library.DatFiles } // Now, output the rom data - WriteRomData(sw, rom, depth, ignoreblanks); + WriteDatItem(sw, rom, depth, ignoreblanks); // Set the new data to compare against splitpath = newsplit; @@ -221,7 +221,7 @@ namespace SabreTools.Library.DatFiles /// Write out Game start using the supplied StreamWriter /// /// StreamWriter to output to - /// RomData object to be output + /// DatItem object to be output /// Split path representing the parent game (SabreDAT only) /// The name of the last game to be output /// Current depth to output file at (SabreDAT only) @@ -319,14 +319,14 @@ namespace SabreTools.Library.DatFiles } /// - /// Write out RomData using the supplied StreamWriter + /// Write out DatItem using the supplied StreamWriter /// /// StreamWriter to output to - /// RomData object to be output + /// DatItem object to be output /// Current depth to output file at (SabreDAT only) /// True if blank roms should be skipped on output, false otherwise (default) /// True if the data was written, false on error - private bool WriteRomData(StreamWriter sw, DatItem rom, int depth, bool ignoreblanks = false) + private bool WriteDatItem(StreamWriter sw, DatItem rom, int depth, bool ignoreblanks = false) { // If we are in ignore blanks mode AND we have a blank (0-size) rom, skip if (ignoreblanks diff --git a/SabreTools.Library/DatFiles/SeparatedValue.cs b/SabreTools.Library/DatFiles/SeparatedValue.cs index 8d1c4c8d..6222ba83 100644 --- a/SabreTools.Library/DatFiles/SeparatedValue.cs +++ b/SabreTools.Library/DatFiles/SeparatedValue.cs @@ -422,7 +422,7 @@ namespace SabreTools.Library.DatFiles } // Now, output the rom data - WriteRomData(sw, delim, rom, ignoreblanks); + WriteDatItem(sw, delim, rom, ignoreblanks); } } @@ -466,14 +466,14 @@ namespace SabreTools.Library.DatFiles } /// - /// Write out RomData using the supplied StreamWriter + /// Write out DatItem using the supplied StreamWriter /// /// StreamWriter to output to /// Delimiter for parsing individual lines - /// RomData object to be output + /// DatItem object to be output /// True if blank roms should be skipped on output, false otherwise (default) /// True if the data was written, false on error - private bool WriteRomData(StreamWriter sw, char delim, DatItem rom, bool ignoreblanks = false) + private bool WriteDatItem(StreamWriter sw, char delim, DatItem rom, bool ignoreblanks = false) { // If we are in ignore blanks mode AND we have a blank (0-size) rom, skip if (ignoreblanks diff --git a/SabreTools.Library/DatFiles/SoftwareList.cs b/SabreTools.Library/DatFiles/SoftwareList.cs index b26eac74..7d852e64 100644 --- a/SabreTools.Library/DatFiles/SoftwareList.cs +++ b/SabreTools.Library/DatFiles/SoftwareList.cs @@ -139,7 +139,7 @@ namespace SabreTools.Library.DatFiles } // Now, output the rom data - WriteRomData(sw, rom, ignoreblanks); + WriteDatItem(sw, rom, ignoreblanks); // Set the new data to compare against lastgame = rom.MachineName; @@ -203,7 +203,7 @@ namespace SabreTools.Library.DatFiles /// Write out Game start using the supplied StreamWriter /// /// StreamWriter to output to - /// RomData object to be output + /// DatItem object to be output /// True if the data was written, false on error private bool WriteStartGame(StreamWriter sw, DatItem rom) { @@ -273,13 +273,13 @@ namespace SabreTools.Library.DatFiles } /// - /// Write out RomData using the supplied StreamWriter + /// Write out DatItem using the supplied StreamWriter /// /// StreamWriter to output to - /// RomData object to be output + /// DatItem object to be output /// True if blank roms should be skipped on output, false otherwise (default) /// True if the data was written, false on error - private bool WriteRomData(StreamWriter sw, DatItem rom, bool ignoreblanks = false) + private bool WriteDatItem(StreamWriter sw, DatItem rom, bool ignoreblanks = false) { // If we are in ignore blanks mode AND we have a blank (0-size) rom, skip if (ignoreblanks diff --git a/SabreTools.Library/Items/DatItem.cs b/SabreTools.Library/Items/DatItem.cs index 1ed424ba..36a63427 100644 --- a/SabreTools.Library/Items/DatItem.cs +++ b/SabreTools.Library/Items/DatItem.cs @@ -821,7 +821,7 @@ namespace SabreTools.Library.Items /// Merge an arbitrary set of ROMs based on the supplied information /// /// List of File objects representing the roms to be merged - /// A List of RomData objects representing the merged roms + /// A List of DatItem objects representing the merged roms public static List Merge(List infiles) { // Check for null or blank roms first @@ -948,7 +948,7 @@ namespace SabreTools.Library.Items /// Resolve name duplicates in an arbitrary set of ROMs based on the supplied information /// /// List of File objects representing the roms to be merged - /// A List of RomData objects representing the renamed roms + /// A List of DatItem objects representing the renamed roms public static List ResolveNames(List infiles) { // Create the output list diff --git a/SabreTools.Library/Tools/ArchiveTools.cs b/SabreTools.Library/Tools/ArchiveTools.cs index d9c65864..15022e15 100644 --- a/SabreTools.Library/Tools/ArchiveTools.cs +++ b/SabreTools.Library/Tools/ArchiveTools.cs @@ -426,11 +426,11 @@ namespace SabreTools.Library.Tools #region Information /// - /// Generate a list of RomData objects from the header values in an archive + /// Generate a list of DatItem objects from the header values in an archive /// /// Input file to get data from /// True if entry dates should be included, false otherwise (default) - /// List of RomData objects representing the found data + /// List of DatItem objects representing the found data public static List GetArchiveFileInfo(string input, bool date = false) { return GetExtendedArchiveFileInfo(input, Hash.SecureHashes, date: date); @@ -581,12 +581,12 @@ namespace SabreTools.Library.Tools } /// - /// Generate a list of RomData objects from the header values in an archive + /// Generate a list of DatItem objects from the header values in an archive /// /// Input file to get data from /// Hash representing the hashes that should be skipped /// True if entry dates should be included, false otherwise (default) - /// List of RomData objects representing the found data + /// List of DatItem objects representing the found data /// TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually public static List GetExtendedArchiveFileInfo(string input, Hash omitFromScan = Hash.DeepHashes, bool date = false) { @@ -831,7 +831,7 @@ namespace SabreTools.Library.Tools /// Retrieve file information for a single torrent GZ file /// /// Filename to get information from - /// Populated RomData object if success, empty one on error + /// Populated DatItem object if success, empty one on error public static Rom GetTorrentGZFileInfo(string input) { // Check for the file existing first @@ -1369,7 +1369,7 @@ namespace SabreTools.Library.Tools /// /// Input filename to be moved /// Output directory to build to - /// RomData representing the new information + /// DatItem representing the new information /// True if the date from the DAT should be used if available, false otherwise (default) /// True if we should overwrite the file if it exists, false otherwise /// True if the file was written properly, false otherwise @@ -1451,7 +1451,7 @@ namespace SabreTools.Library.Tools /// /// Input filename to be moved /// Output directory to build to - /// RomData representing the new information + /// DatItem representing the new information /// True if the date from the DAT should be used if available, false otherwise (default) /// True if the archive was written properly, false otherwise public static bool WriteTAR(string inputFile, string outDir, Rom rom, bool date = false) @@ -1465,7 +1465,7 @@ namespace SabreTools.Library.Tools /// /// Input stream to be moved /// Output directory to build to - /// RomData representing the new information + /// DatItem representing the new information /// True if the date from the DAT should be used if available, false otherwise (default) /// True if the archive was written properly, false otherwise public static bool WriteTAR(Stream inputStream, string outDir, Rom rom, bool date = false) @@ -1767,7 +1767,7 @@ namespace SabreTools.Library.Tools /// /// Input filename to be moved /// Output directory to build to - /// RomData representing the new information + /// DatItem representing the new information /// True if the date from the DAT should be used if available, false otherwise (default) /// True if the archive was written properly, false otherwise public static bool WriteTorrent7Zip(string inputFile, string outDir, Rom rom, bool date = false) @@ -1781,7 +1781,7 @@ namespace SabreTools.Library.Tools /// /// Input stream to be moved /// Output directory to build to - /// RomData representing the new information + /// DatItem representing the new information /// True if the date from the DAT should be used if available, false otherwise (default) /// True if the archive was written properly, false otherwise public static bool WriteTorrent7Zip(Stream inputStream, string outDir, Rom rom, bool date = false) @@ -2286,7 +2286,7 @@ namespace SabreTools.Library.Tools /// /// Input filename to be moved /// Output directory to build to - /// RomData representing the new information + /// DatItem representing the new information /// True if the date from the DAT should be used if available, false otherwise (default) /// True if the archive was written properly, false otherwise public static bool WriteTorrentLRZ(string inputFile, string outDir, Rom rom, bool date = false) @@ -2300,7 +2300,7 @@ namespace SabreTools.Library.Tools /// /// Input stream to be moved /// Output directory to build to - /// RomData representing the new information + /// DatItem representing the new information /// True if the date from the DAT should be used if available, false otherwise (default) /// True if the archive was written properly, false otherwise public static bool WriteTorrentLRZ(Stream inputStream, string outDir, Rom rom, bool date = false) @@ -2313,7 +2313,7 @@ namespace SabreTools.Library.Tools /// /// Input filename to be moved /// Output directory to build to - /// RomData representing the new information + /// DatItem representing the new information /// True if the date from the DAT should be used if available, false otherwise (default) /// True if the archive was written properly, false otherwise public static bool WriteTorrentRAR(string inputFile, string outDir, Rom rom, bool date = false) @@ -2327,7 +2327,7 @@ namespace SabreTools.Library.Tools /// /// Input stream to be moved /// Output directory to build to - /// RomData representing the new information + /// DatItem representing the new information /// True if the date from the DAT should be used if available, false otherwise (default) /// True if the archive was written properly, false otherwise public static bool WriteTorrentRAR(Stream inputStream, string outDir, Rom rom, bool date = false) @@ -2340,7 +2340,7 @@ namespace SabreTools.Library.Tools /// /// Input filename to be moved /// Output directory to build to - /// RomData representing the new information + /// DatItem representing the new information /// True if the date from the DAT should be used if available, false otherwise (default) /// True if the archive was written properly, false otherwise public static bool WriteTorrentXZ(string inputFile, string outDir, Rom rom, bool date = false) @@ -2354,7 +2354,7 @@ namespace SabreTools.Library.Tools /// /// Input stream to be moved /// Output directory to build to - /// RomData representing the new information + /// DatItem representing the new information /// True if the date from the DAT should be used if available, false otherwise (default) /// True if the archive was written properly, false otherwise public static bool WriteTorrentXZ(Stream inputStream, string outDir, Rom rom, bool date = false) @@ -2747,7 +2747,7 @@ namespace SabreTools.Library.Tools /// /// Input filename to be moved /// Output directory to build to - /// RomData representing the new information + /// DatItem representing the new information /// True if the date from the DAT should be used if available, false otherwise (default) /// True if the archive was written properly, false otherwise public static bool WriteTorrentZip(string inputFile, string outDir, Rom rom, bool date = false) @@ -2761,7 +2761,7 @@ namespace SabreTools.Library.Tools /// /// Input filename to be moved /// Output directory to build to - /// RomData representing the new information + /// DatItem representing the new information /// True if the date from the DAT should be used if available, false otherwise (default) /// True if the archive was written properly, false otherwise public static bool WriteTorrentZip(Stream inputStream, string outDir, Rom rom, bool date = false) diff --git a/SabreTools.Library/Tools/FileTools.cs b/SabreTools.Library/Tools/FileTools.cs index 707f645f..55d1cff5 100644 --- a/SabreTools.Library/Tools/FileTools.cs +++ b/SabreTools.Library/Tools/FileTools.cs @@ -212,7 +212,10 @@ namespace SabreTools.Library.Tools /// Set a >0 number for getting hash for part of the file, 0 otherwise (default) /// True if the file Date should be included, false otherwise (default) /// Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise - /// Populated RomData object if success, empty one on error + /// Populated DatItem object if success, empty one on error + /// + /// TODO: Add CHD parsing logic here to get internal hash data + /// public static Rom GetFileInfo(string input, Hash omitFromScan = 0x0, long offset = 0, bool date = false, string header = null) { @@ -729,7 +732,7 @@ namespace SabreTools.Library.Tools /// Hash flag saying what hashes should not be calculated (defaults to none) /// Set a >0 number for getting hash for part of the file, 0 otherwise (default) /// True if the underlying read stream should be kept open, false otherwise - /// Populated RomData object if success, empty one on error + /// Populated DatItem object if success, empty one on error public static Rom GetStreamInfo(Stream input, long size, Hash omitFromScan = 0x0, long offset = 0, bool keepReadOpen = false) {