mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DatTools] Add skip for first cascade diff output
Flag enables first output DAT to skip output for instances where the first DAT is always known or is very large
This commit is contained in:
@@ -175,6 +175,7 @@ Options:
|
||||
-b, --bare Don't include date in automatic name
|
||||
-c, --cascade Enable cascaded diffing
|
||||
-ip, --inplace Enable inplace, cascaded diff
|
||||
-sf, --skip Skip output of first DAT
|
||||
-gn=, --game-name= Filter by game name
|
||||
-rn=, --rom-name= Filter by rom name
|
||||
-rt=, --rom-type= Filter by rom type
|
||||
|
||||
@@ -1522,6 +1522,7 @@ namespace SabreTools.Helper
|
||||
/// <param name="diff">True if the input files should be diffed with each other, false otherwise</param>
|
||||
/// <param name="cascade">True if the diffed files should be cascade diffed, false otherwise</param>
|
||||
/// <param name="inplace">True if the cascade-diffed files should overwrite their inputs, false otherwise</param>
|
||||
/// <param name="skip">True if the first cascaded diff file should be skipped on output, false otherwise</param>
|
||||
/// <param name="bare">True if the date should not be appended to the default name, false otherwise [OBSOLETE]</param>
|
||||
/// <param name="clean">True to clean the game names to WoD standard, false otherwise (default)</param>
|
||||
/// <param name="softlist">True to allow SL DATs to have game names used instead of descriptions, false otherwise (default)</param>
|
||||
@@ -1540,8 +1541,8 @@ namespace SabreTools.Helper
|
||||
/// <param name="root">String representing root directory to compare against for length calculation</param>
|
||||
/// <param name="logger">Logging object for console and file output</param>
|
||||
public static void Update(List<string> inputFileNames, Dat datdata, string outputDirectory, bool merge, bool diff, bool cascade, bool inplace,
|
||||
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)
|
||||
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)
|
||||
@@ -1601,7 +1602,7 @@ namespace SabreTools.Helper
|
||||
// If we're in cascade and diff, output only cascaded diffs
|
||||
else if (diff && cascade)
|
||||
{
|
||||
DiffCascade(outputDirectory, inplace, userData, newInputFileNames, datHeaders, logger);
|
||||
DiffCascade(outputDirectory, inplace, userData, newInputFileNames, datHeaders, skip, logger);
|
||||
}
|
||||
// Output all entries with user-defined merge
|
||||
else
|
||||
@@ -2049,8 +2050,9 @@ namespace SabreTools.Helper
|
||||
/// <param name="userData">Main DatData to draw information from</param>
|
||||
/// <param name="inputs">List of inputs to write out from</param>
|
||||
/// <param name="datHeaders">Dat headers used optionally</param>
|
||||
/// <param name="skip">True if the first cascaded diff file should be skipped on output, false otherwise</param>
|
||||
/// <param name="logger">Logging object for console and file output</param>
|
||||
public static void DiffCascade(string outdir, bool inplace, Dat userData, List<string> inputs, List<Dat> datHeaders, Logger logger)
|
||||
public static void DiffCascade(string outdir, bool inplace, Dat userData, List<string> inputs, List<Dat> datHeaders, bool skip, Logger logger)
|
||||
{
|
||||
string post = "";
|
||||
|
||||
@@ -2085,6 +2087,7 @@ namespace SabreTools.Helper
|
||||
start = DateTime.Now;
|
||||
logger.User("Populating all output DATs");
|
||||
List<string> keys = userData.Roms.Keys.ToList();
|
||||
|
||||
foreach (string key in keys)
|
||||
{
|
||||
List<Rom> roms = RomTools.Merge(userData.Roms[key], logger);
|
||||
@@ -2111,7 +2114,7 @@ namespace SabreTools.Helper
|
||||
// Finally, loop through and output each of the DATs
|
||||
start = DateTime.Now;
|
||||
logger.User("Outputting all created DATs");
|
||||
for (int j = 0; j < inputs.Count; j++)
|
||||
for (int j = (skip ? 1 : 0); j < inputs.Count; j++)
|
||||
{
|
||||
// If we have an output directory set, replace the path
|
||||
string path = "";
|
||||
|
||||
@@ -113,6 +113,7 @@ namespace SabreTools
|
||||
/// <param name="diff">True if the input files should be diffed with each other, false otherwise</param>
|
||||
/// <param name="cascade">True if the diffed files should be cascade diffed, false otherwise</param>
|
||||
/// <param name="inplace">True if the cascade-diffed files should overwrite their inputs, false otherwise</param>
|
||||
/// <param name="skip">True if the first cascaded diff file should be skipped on output, false otherwise</param>
|
||||
/// <param name="bare">True if the date should not be appended to the default name, false otherwise [OBSOLETE]</param>
|
||||
/// /* Filtering info */
|
||||
/// <param name="gamename">Name of the game to match (can use asterisk-partials)</param>
|
||||
@@ -175,6 +176,7 @@ namespace SabreTools
|
||||
bool diff,
|
||||
bool cascade,
|
||||
bool inplace,
|
||||
bool skip,
|
||||
bool bare,
|
||||
|
||||
/* Filtering info */
|
||||
@@ -319,31 +321,31 @@ namespace SabreTools
|
||||
if (outputCMP)
|
||||
{
|
||||
userInputDat.OutputFormat = OutputFormat.ClrMamePro;
|
||||
DatTools.Update(inputs, userInputDat, outdir, merge, diff, cascade, inplace, bare, clean, softlist,
|
||||
DatTools.Update(inputs, userInputDat, outdir, merge, diff, cascade, inplace, skip, bare, clean, softlist,
|
||||
gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, _logger);
|
||||
}
|
||||
if (outputMiss)
|
||||
{
|
||||
userInputDat.OutputFormat = OutputFormat.MissFile;
|
||||
DatTools.Update(inputs, userInputDat, outdir, merge, diff, cascade, inplace, bare, clean, softlist,
|
||||
DatTools.Update(inputs, userInputDat, outdir, merge, diff, cascade, inplace, skip, bare, clean, softlist,
|
||||
gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, _logger);
|
||||
}
|
||||
if (outputRC)
|
||||
{
|
||||
userInputDat.OutputFormat = OutputFormat.RomCenter;
|
||||
DatTools.Update(inputs, userInputDat, outdir, merge, diff, cascade, inplace, bare, clean, softlist,
|
||||
DatTools.Update(inputs, userInputDat, outdir, merge, diff, cascade, inplace, skip, bare, clean, softlist,
|
||||
gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, _logger);
|
||||
}
|
||||
if (outputSD)
|
||||
{
|
||||
userInputDat.OutputFormat = OutputFormat.SabreDat;
|
||||
DatTools.Update(inputs, userInputDat, outdir, merge, diff, cascade, inplace, bare, clean, softlist,
|
||||
DatTools.Update(inputs, userInputDat, outdir, merge, diff, cascade, inplace, skip, bare, clean, softlist,
|
||||
gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, _logger);
|
||||
}
|
||||
if (outputXML)
|
||||
{
|
||||
userInputDat.OutputFormat = OutputFormat.Xml;
|
||||
DatTools.Update(inputs, userInputDat, outdir, merge, diff, cascade, inplace, bare, clean, softlist,
|
||||
DatTools.Update(inputs, userInputDat, outdir, merge, diff, cascade, inplace, skip, bare, clean, softlist,
|
||||
gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, _logger);
|
||||
}
|
||||
if (!outputCMP && !outputMiss && !outputRC && !outputSD && !outputXML)
|
||||
@@ -352,7 +354,7 @@ namespace SabreTools
|
||||
{
|
||||
userInputDat.OutputFormat = OutputFormat.Xml;
|
||||
}
|
||||
DatTools.Update(inputs, userInputDat, outdir, merge, diff, cascade, inplace, bare, clean, softlist,
|
||||
DatTools.Update(inputs, userInputDat, outdir, merge, diff, cascade, inplace, skip, bare, clean, softlist,
|
||||
gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, _logger);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -347,6 +347,10 @@ namespace SabreTools
|
||||
case "--superdat":
|
||||
superdat = true;
|
||||
break;
|
||||
case "-sf":
|
||||
case "--skip":
|
||||
skip = true;
|
||||
break;
|
||||
case "-si":
|
||||
case "--single":
|
||||
single = true;
|
||||
@@ -359,9 +363,6 @@ namespace SabreTools
|
||||
case "--stats":
|
||||
stats = true;
|
||||
break;
|
||||
case "--skip":
|
||||
skip = true;
|
||||
break;
|
||||
case "-trim":
|
||||
trim = true;
|
||||
break;
|
||||
@@ -573,12 +574,6 @@ namespace SabreTools
|
||||
}
|
||||
}
|
||||
|
||||
// If skip is set, it's being called from the UI so we just exit
|
||||
if (skip)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// If help is set, show the help screen
|
||||
if (help)
|
||||
{
|
||||
@@ -647,7 +642,7 @@ namespace SabreTools
|
||||
{
|
||||
InitUpdate(inputs, filename, name, description, rootdir, category, version, date, author, email, homepage, url, comment, header,
|
||||
superdat, forcemerge, forcend, forcepack, outputCMP, outputMiss, outputRC, outputSD, outputXML, usegame, prefix,
|
||||
postfix, quotes, repext, addext, datprefix, romba, tsv, merge, diff, cascade, inplace, bare, gamename, romname,
|
||||
postfix, quotes, repext, addext, datprefix, romba, tsv, merge, diff, cascade, inplace, skip, bare, gamename, romname,
|
||||
romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, outdir, clean, softlist, dedup);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user