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
|
-b, --bare Don't include date in automatic name
|
||||||
-c, --cascade Enable cascaded diffing
|
-c, --cascade Enable cascaded diffing
|
||||||
-ip, --inplace Enable inplace, cascaded diff
|
-ip, --inplace Enable inplace, cascaded diff
|
||||||
|
-sf, --skip Skip output of first DAT
|
||||||
-gn=, --game-name= Filter by game name
|
-gn=, --game-name= Filter by game name
|
||||||
-rn=, --rom-name= Filter by rom name
|
-rn=, --rom-name= Filter by rom name
|
||||||
-rt=, --rom-type= Filter by rom type
|
-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="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="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="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="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="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>
|
/// <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="root">String representing root directory to compare against for length calculation</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(List<string> inputFileNames, Dat datdata, string outputDirectory, bool merge, bool diff, bool cascade, bool inplace,
|
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,
|
bool skip, bool bare, bool clean, bool softlist, string gamename, string romname, string romtype, long sgt, long slt, long seq, string crc,
|
||||||
string sha1, bool? nodump, bool trim, bool single, string root, Logger logger)
|
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 we're in merging or diffing mode, use the full list of inputs
|
||||||
if (merge || diff)
|
if (merge || diff)
|
||||||
@@ -1601,7 +1602,7 @@ namespace SabreTools.Helper
|
|||||||
// If we're in cascade and diff, output only cascaded diffs
|
// If we're in cascade and diff, output only cascaded diffs
|
||||||
else if (diff && cascade)
|
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
|
// Output all entries with user-defined merge
|
||||||
else
|
else
|
||||||
@@ -2049,8 +2050,9 @@ namespace SabreTools.Helper
|
|||||||
/// <param name="userData">Main DatData to draw information from</param>
|
/// <param name="userData">Main DatData to draw information from</param>
|
||||||
/// <param name="inputs">List of inputs to write out from</param>
|
/// <param name="inputs">List of inputs to write out from</param>
|
||||||
/// <param name="datHeaders">Dat headers used optionally</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>
|
/// <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 = "";
|
string post = "";
|
||||||
|
|
||||||
@@ -2085,6 +2087,7 @@ namespace SabreTools.Helper
|
|||||||
start = DateTime.Now;
|
start = DateTime.Now;
|
||||||
logger.User("Populating all output DATs");
|
logger.User("Populating all output DATs");
|
||||||
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<Rom> roms = RomTools.Merge(userData.Roms[key], logger);
|
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
|
// Finally, loop through and output each of the DATs
|
||||||
start = DateTime.Now;
|
start = DateTime.Now;
|
||||||
logger.User("Outputting all created DATs");
|
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
|
// If we have an output directory set, replace the path
|
||||||
string 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="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="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="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="bare">True if the date should not be appended to the default name, false otherwise [OBSOLETE]</param>
|
||||||
/// /* Filtering info */
|
/// /* Filtering info */
|
||||||
/// <param name="gamename">Name of the game to match (can use asterisk-partials)</param>
|
/// <param name="gamename">Name of the game to match (can use asterisk-partials)</param>
|
||||||
@@ -175,6 +176,7 @@ namespace SabreTools
|
|||||||
bool diff,
|
bool diff,
|
||||||
bool cascade,
|
bool cascade,
|
||||||
bool inplace,
|
bool inplace,
|
||||||
|
bool skip,
|
||||||
bool bare,
|
bool bare,
|
||||||
|
|
||||||
/* Filtering info */
|
/* Filtering info */
|
||||||
@@ -319,31 +321,31 @@ namespace SabreTools
|
|||||||
if (outputCMP)
|
if (outputCMP)
|
||||||
{
|
{
|
||||||
userInputDat.OutputFormat = OutputFormat.ClrMamePro;
|
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);
|
gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, _logger);
|
||||||
}
|
}
|
||||||
if (outputMiss)
|
if (outputMiss)
|
||||||
{
|
{
|
||||||
userInputDat.OutputFormat = OutputFormat.MissFile;
|
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);
|
gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, _logger);
|
||||||
}
|
}
|
||||||
if (outputRC)
|
if (outputRC)
|
||||||
{
|
{
|
||||||
userInputDat.OutputFormat = OutputFormat.RomCenter;
|
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);
|
gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, _logger);
|
||||||
}
|
}
|
||||||
if (outputSD)
|
if (outputSD)
|
||||||
{
|
{
|
||||||
userInputDat.OutputFormat = OutputFormat.SabreDat;
|
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);
|
gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, _logger);
|
||||||
}
|
}
|
||||||
if (outputXML)
|
if (outputXML)
|
||||||
{
|
{
|
||||||
userInputDat.OutputFormat = OutputFormat.Xml;
|
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);
|
gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, _logger);
|
||||||
}
|
}
|
||||||
if (!outputCMP && !outputMiss && !outputRC && !outputSD && !outputXML)
|
if (!outputCMP && !outputMiss && !outputRC && !outputSD && !outputXML)
|
||||||
@@ -352,7 +354,7 @@ namespace SabreTools
|
|||||||
{
|
{
|
||||||
userInputDat.OutputFormat = OutputFormat.Xml;
|
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);
|
gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, _logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -347,6 +347,10 @@ namespace SabreTools
|
|||||||
case "--superdat":
|
case "--superdat":
|
||||||
superdat = true;
|
superdat = true;
|
||||||
break;
|
break;
|
||||||
|
case "-sf":
|
||||||
|
case "--skip":
|
||||||
|
skip = true;
|
||||||
|
break;
|
||||||
case "-si":
|
case "-si":
|
||||||
case "--single":
|
case "--single":
|
||||||
single = true;
|
single = true;
|
||||||
@@ -359,9 +363,6 @@ namespace SabreTools
|
|||||||
case "--stats":
|
case "--stats":
|
||||||
stats = true;
|
stats = true;
|
||||||
break;
|
break;
|
||||||
case "--skip":
|
|
||||||
skip = true;
|
|
||||||
break;
|
|
||||||
case "-trim":
|
case "-trim":
|
||||||
trim = true;
|
trim = true;
|
||||||
break;
|
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 is set, show the help screen
|
||||||
if (help)
|
if (help)
|
||||||
{
|
{
|
||||||
@@ -647,7 +642,7 @@ namespace SabreTools
|
|||||||
{
|
{
|
||||||
InitUpdate(inputs, filename, name, description, rootdir, category, version, date, author, email, homepage, url, comment, header,
|
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,
|
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);
|
romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, outdir, clean, softlist, dedup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user