diff --git a/SabreTools.Helper/Tools/DatTools.cs b/SabreTools.Helper/Tools/DatTools.cs
index de433d67..4c29b269 100644
--- a/SabreTools.Helper/Tools/DatTools.cs
+++ b/SabreTools.Helper/Tools/DatTools.cs
@@ -1657,230 +1657,6 @@ namespace SabreTools.Helper
#region Converting and Updating
- ///
- /// Convert, update, and filter a DAT file
- ///
- /// Names of the input files and/or folders
- /// User specified inputs contained in a DatData object
- /// Optional param for output directory
- /// True if input files should be merged into a single file, false otherwise
- /// Non-zero flag for diffing mode, zero otherwise
- /// True if the diffed files should be cascade diffed, false if diffed files should be reverse cascaded, null otherwise
- /// True if the cascade-diffed files should overwrite their inputs, false otherwise
- /// True if the first cascaded diff file should be skipped on output, false otherwise
- /// True if the date should not be appended to the default name, false otherwise [OBSOLETE]
- /// True to clean the game names to WoD standard, false otherwise (default)
- /// True to allow SL DATs to have game names used instead of descriptions, false otherwise (default)
- /// Name of the game to match (can use asterisk-partials)
- /// Name of the rom to match (can use asterisk-partials)
- /// Type of the rom to match
- /// Find roms greater than or equal to this size
- /// Find roms less than or equal to this size
- /// Find roms equal to this size
- /// CRC of the rom to match (can use asterisk-partials)
- /// MD5 of the rom to match (can use asterisk-partials)
- /// SHA-1 of the rom to match (can use asterisk-partials)
- /// Select roms with nodump status as follows: null (match all), true (match Nodump only), false (exclude Nodump)
- /// True if we are supposed to trim names to NTFS length, false otherwise
- /// True if all games should be replaced by '!', false otherwise
- /// String representing root directory to compare against for length calculation
- /// Logging object for console and file output
- public static void Update(List inputFileNames, Dat datdata, string outputDirectory, bool merge, DiffMode diff, bool? cascade, bool inplace,
- bool skip, bool bare, bool clean, bool softlist, string gamename, string romname, string romtype, long sgt, long slt, long seq, string crc,
- string md5, string sha1, bool? nodump, bool trim, bool single, string root, Logger logger)
- {
- // If we're in merging or diffing mode, use the full list of inputs
- if (merge || diff != 0)
- {
- // Make sure there are no folders in inputs
- List newInputFileNames = new List();
- foreach (string input in inputFileNames)
- {
- if (Directory.Exists(input))
- {
- foreach (string file in Directory.EnumerateFiles(input, "*", SearchOption.AllDirectories))
- {
- try
- {
- newInputFileNames.Add(Path.GetFullPath(file) + "¬" + Path.GetFullPath(input));
- }
- catch (PathTooLongException)
- {
- logger.Warning("The path for " + file + " was too long");
- }
- catch (Exception ex)
- {
- logger.Error(ex.ToString());
- }
- }
- }
- else if (File.Exists(input))
- {
- try
- {
- newInputFileNames.Add(Path.GetFullPath(input) + "¬" + Path.GetDirectoryName(Path.GetFullPath(input)));
- }
- catch (PathTooLongException)
- {
- logger.Warning("The path for " + input + " was too long");
- }
- catch (Exception ex)
- {
- logger.Error(ex.ToString());
- }
- }
- }
-
- // If we're in inverse cascade, reverse the list
- if (cascade == false)
- {
- newInputFileNames.Reverse();
- }
-
- // Create a dictionary of all ROMs from the input DATs
- Dat userData;
- List datHeaders = PopulateUserData(newInputFileNames, inplace, clean, softlist,
- outputDirectory, datdata, out userData, gamename, romname, romtype, sgt, slt, seq,
- crc, md5, sha1, nodump, trim, single, root, logger);
-
- // Modify the Dictionary if necessary and output the results
- if (diff != 0 && cascade == null)
- {
- DiffNoCascade(diff, outputDirectory, userData, newInputFileNames, logger);
- }
- // If we're in cascade and diff, output only cascaded diffs
- else if (diff != 0 && cascade != null)
- {
- DiffCascade(outputDirectory, inplace, userData, newInputFileNames, datHeaders, skip, logger);
- }
- // Output all entries with user-defined merge
- else
- {
- MergeNoDiff(outputDirectory, userData, newInputFileNames, datHeaders, logger);
- }
- }
- // Otherwise, loop through all of the inputs individually
- else
- {
- for (int i = 0; i < inputFileNames.Count; i++)
- {
- string inputFileName = inputFileNames[i];
-
- // Clean the input string
- if (inputFileName != "")
- {
- inputFileName = Path.GetFullPath(inputFileName);
- }
-
- if (File.Exists(inputFileName))
- {
- Dat innerDatdata = (Dat)datdata.CloneHeader();
- logger.User("Processing \"" + Path.GetFileName(inputFileName) + "\"");
- innerDatdata = Parse(inputFileName, 0, 0, innerDatdata, gamename, romname,
- romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single,
- root, logger, true, clean, softlist, keepext:(innerDatdata.XSV != null));
-
- // If we have roms, output them
- if (innerDatdata.Files.Count != 0)
- {
- WriteDatfile(innerDatdata, (outputDirectory == "" ? Path.GetDirectoryName(inputFileName) : outputDirectory), logger, overwrite: (outputDirectory != ""));
- }
- }
- else if (Directory.Exists(inputFileName))
- {
- inputFileName = Path.GetFullPath(inputFileName) + Path.DirectorySeparatorChar;
-
- foreach (string file in Directory.EnumerateFiles(inputFileName, "*", SearchOption.AllDirectories))
- {
- logger.User("Processing \"" + Path.GetFullPath(file).Remove(0, inputFileName.Length) + "\"");
- Dat innerDatdata = (Dat)datdata.Clone();
- innerDatdata.Files = null;
- innerDatdata = Parse(file, 0, 0, innerDatdata, gamename, romname, romtype, sgt,
- slt, seq, crc, md5, sha1, nodump, trim, single, root, logger, true, clean, keepext:(datdata.XSV != null));
-
- // If we have roms, output them
- if (innerDatdata.Files != null && innerDatdata.Files.Count != 0)
- {
- WriteDatfile(innerDatdata, (outputDirectory == "" ? Path.GetDirectoryName(file) : outputDirectory + Path.GetDirectoryName(file).Remove(0, inputFileName.Length - 1)), logger, overwrite: (outputDirectory != ""));
- }
- }
- }
- else
- {
- logger.Error("I'm sorry but " + inputFileName + " doesn't exist!");
- }
- }
- }
- return;
- }
-
- ///
- /// Populate the user DatData object from the input files
- ///
- /// Output user DatData object to output
- /// Name of the game to match (can use asterisk-partials)
- /// Name of the rom to match (can use asterisk-partials)
- /// Type of the rom to match
- /// Find roms greater than or equal to this size
- /// Find roms less than or equal to this size
- /// Find roms equal to this size
- /// CRC of the rom to match (can use asterisk-partials)
- /// MD5 of the rom to match (can use asterisk-partials)
- /// SHA-1 of the rom to match (can use asterisk-partials)
- /// Select roms with nodump status as follows: null (match all), true (match Nodump only), false (exclude Nodump)
- /// True if we are supposed to trim names to NTFS length, false otherwise
- /// True if all games should be replaced by '!', false otherwise
- /// String representing root directory to compare against for length calculation
- /// Logging object for console and file output
- /// List of DatData objects representing headers
- private static List PopulateUserData(List inputs, bool inplace, bool clean, bool softlist, string outdir,
- Dat inputDat, out Dat userData, string gamename, string romname, string romtype, long sgt, long slt, long seq, string crc,
- string md5, string sha1, bool? nodump, bool trim, bool single, string root, Logger logger)
- {
- List datHeaders = new List();
- DateTime start = DateTime.Now;
- logger.User("Populating internal DAT");
-
- int i = 0;
- userData = new Dat
- {
- OutputFormat = (inputDat.OutputFormat != 0 ? inputDat.OutputFormat : 0),
- Files = new Dictionary>(),
- MergeRoms = inputDat.MergeRoms,
- };
- foreach (string input in inputs)
- {
- logger.User("Adding DAT: " + input.Split('¬')[0]);
- userData = Parse(input.Split('¬')[0], i, 0, userData, gamename, romname, romtype, sgt, slt, seq,
- crc, md5, sha1, nodump, trim, single, root, logger, true, clean, softlist);
- i++;
-
- // If we are in inplace mode or redirecting output, save the DAT data
- if (inplace || !String.IsNullOrEmpty(outdir))
- {
- datHeaders.Add((Dat)userData.CloneHeader());
-
- // Reset the header values so the next can be captured
- Dictionary> temp = userData.Files;
- userData = new Dat
- {
- OutputFormat = (inputDat.OutputFormat != 0 ? inputDat.OutputFormat : 0),
- Files = temp,
- MergeRoms = inputDat.MergeRoms,
- };
- }
- }
-
- // Set the output values
- Dictionary> roms = userData.Files;
- userData = (Dat)inputDat.CloneHeader();
- userData.Files = roms;
-
- logger.User("Populating complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
-
- return datHeaders;
- }
-
///
/// Determine if a rom should be included based on filters
///
@@ -2441,7 +2217,7 @@ namespace SabreTools.Helper
/// String representing root directory to compare against for length calculation
/// Integer representing the maximum amount of parallelization to be used
/// Logging object for console and file output
- public static void UpdateParallel(List inputFileNames, Dat datdata, OutputFormat outputFormat, string outputDirectory, bool merge,
+ public static void Update(List inputFileNames, Dat datdata, OutputFormat outputFormat, string outputDirectory, bool merge,
DiffMode diff, bool? cascade, bool inplace, bool skip, bool bare, bool clean, bool softlist, string gamename, string romname, string romtype,
long sgt, long slt, long seq, string crc, string md5, string sha1, bool? nodump, bool trim, bool single, string root, int maxDegreeOfParallelism,
Logger logger)
@@ -2496,7 +2272,7 @@ namespace SabreTools.Helper
// Create a dictionary of all ROMs from the input DATs
Dat userData;
- List datHeaders = PopulateUserDataParallel(newInputFileNames, inplace, clean, softlist,
+ List datHeaders = PopulateUserData(newInputFileNames, inplace, clean, softlist,
outputDirectory, datdata, out userData, gamename, romname, romtype, sgt, slt, seq,
crc, md5, sha1, nodump, trim, single, root, maxDegreeOfParallelism, logger);
@@ -2593,7 +2369,7 @@ namespace SabreTools.Helper
/// Integer representing the maximum amount of parallelization to be used
/// Logging object for console and file output
/// List of DatData objects representing headers
- private static List PopulateUserDataParallel(List inputs, bool inplace, bool clean, bool softlist, string outdir,
+ private static List PopulateUserData(List inputs, bool inplace, bool clean, bool softlist, string outdir,
Dat inputDat, out Dat userData, string gamename, string romname, string romtype, long sgt, long slt, long seq, string crc,
string md5, string sha1, bool? nodump, bool trim, bool single, string root, int maxDegreeOfParallelism, Logger logger)
{
diff --git a/SabreTools/Partials/SabreTools_Inits.cs b/SabreTools/Partials/SabreTools_Inits.cs
index 420dd4f1..ed325f51 100644
--- a/SabreTools/Partials/SabreTools_Inits.cs
+++ b/SabreTools/Partials/SabreTools_Inits.cs
@@ -319,7 +319,7 @@ namespace SabreTools
XSV = tsv,
};
- DatTools.UpdateParallel(inputs, userInputDat, outputFormat, outdir, merge, diffMode, cascade, inplace, skip, bare, clean, softlist,
+ DatTools.Update(inputs, userInputDat, outputFormat, outdir, merge, diffMode, cascade, inplace, skip, bare, clean, softlist,
gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, maxDegreeOfParallelism, _logger);
}