mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[SabreTools] Consolodate diffing flags, add exclude of tag
This commit is contained in:
@@ -131,6 +131,7 @@ namespace SabreTools.Helper
|
||||
helptext.Add(" -v=, --version= Set the version of the DAT");
|
||||
helptext.Add(" -au=, --author= Set the author of the DAT");
|
||||
helptext.Add(" -sd, --superdat Enable SuperDAT creation");
|
||||
helptext.Add(" -xof, --exclude-of Exclude romof, cloneof, sampleof tags");
|
||||
helptext.Add(" -ab, --add-blank Output blank files for folders");
|
||||
helptext.Add(" -ad, --add-date Output dates for each file parsed");
|
||||
helptext.Add(" -cf, --copy-files Copy files to the temp directory before parsing");
|
||||
@@ -205,6 +206,7 @@ namespace SabreTools.Helper
|
||||
helptext.Add(" -fp=, --forcepack= Set force packing");
|
||||
helptext.Add(" Supported values are:");
|
||||
helptext.Add(" None, Zip, Unzip");
|
||||
helptext.Add(" -xof, --exclude-of Exclude romof, cloneof, sampleof tags");
|
||||
helptext.Add(" -clean Clean game names according to WoD standards");
|
||||
helptext.Add(" -sl, --softlist Use Software List name instead of description");
|
||||
helptext.Add(" -trim Trim file names to fit NTFS length");
|
||||
|
||||
@@ -8,10 +8,15 @@ namespace SabreTools.Helper
|
||||
[Flags]
|
||||
public enum DiffMode
|
||||
{
|
||||
// Standard diffs
|
||||
Dupes = 0x01,
|
||||
NoDupes = 0x02,
|
||||
Individuals = 0x04,
|
||||
All = Dupes | NoDupes | Individuals,
|
||||
|
||||
// Cascaded diffs
|
||||
Cascade = 0x08,
|
||||
ReverseCascade = 0x10,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -34,6 +34,7 @@ namespace SabreTools.Helper
|
||||
private ForceNodump _forceNodump;
|
||||
private ForcePacking _forcePacking;
|
||||
private OutputFormat _outputFormat;
|
||||
private bool _excludeOf;
|
||||
private bool _mergeRoms;
|
||||
private SortedDictionary<string, List<DatItem>> _files;
|
||||
|
||||
@@ -154,6 +155,11 @@ namespace SabreTools.Helper
|
||||
get { return _outputFormat; }
|
||||
set { _outputFormat = value; }
|
||||
}
|
||||
public bool ExcludeOf
|
||||
{
|
||||
get { return _excludeOf; }
|
||||
set { _excludeOf = value; }
|
||||
}
|
||||
public bool MergeRoms
|
||||
{
|
||||
get { return _mergeRoms; }
|
||||
@@ -567,7 +573,6 @@ namespace SabreTools.Helper
|
||||
/// <param name="outDir">Optional param for output directory</param>
|
||||
/// <param name="merge">True if input files should be merged into a single file, false otherwise</param>
|
||||
/// <param name="diff">Non-zero flag for diffing mode, zero otherwise</param>
|
||||
/// <param name="cascade">True if the diffed files should be cascade diffed, false if diffed files should be reverse cascaded, null 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>
|
||||
@@ -588,7 +593,7 @@ namespace SabreTools.Helper
|
||||
/// <param name="root">String representing root directory to compare against for length calculation</param>
|
||||
/// <param name="maxDegreeOfParallelism">Integer representing the maximum amount of parallelization to be used</param>
|
||||
/// <param name="logger">Logging object for console and file output</param>
|
||||
public void Update(List<string> inputFileNames, string outDir, bool merge, DiffMode diff, bool? cascade, bool inplace, bool skip,
|
||||
public void Update(List<string> inputFileNames, string outDir, bool merge, DiffMode diff, 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, ItemStatus itemStatus, bool trim, bool single, string root, int maxDegreeOfParallelism, Logger logger)
|
||||
{
|
||||
@@ -636,7 +641,7 @@ namespace SabreTools.Helper
|
||||
}
|
||||
|
||||
// If we're in inverse cascade, reverse the list
|
||||
if (cascade == false)
|
||||
if ((diff & DiffMode.ReverseCascade) != 0)
|
||||
{
|
||||
newInputFileNames.Reverse();
|
||||
}
|
||||
@@ -647,12 +652,12 @@ namespace SabreTools.Helper
|
||||
crc, md5, sha1, itemStatus, trim, single, root, maxDegreeOfParallelism, logger);
|
||||
|
||||
// Modify the Dictionary if necessary and output the results
|
||||
if (diff != 0 && cascade == null)
|
||||
if (diff != 0 && diff < DiffMode.Cascade)
|
||||
{
|
||||
DiffNoCascade(diff, outDir, newInputFileNames, logger);
|
||||
}
|
||||
// If we're in cascade and diff, output only cascaded diffs
|
||||
else if (diff != 0 && cascade != null)
|
||||
else if (diff != 0 && diff >= DiffMode.Cascade)
|
||||
{
|
||||
DiffCascade(outDir, inplace, newInputFileNames, datHeaders, skip, logger);
|
||||
}
|
||||
@@ -3777,8 +3782,11 @@ namespace SabreTools.Helper
|
||||
{
|
||||
case OutputFormat.ClrMamePro:
|
||||
state += "game (\n\tname \"" + rom.MachineName + "\"\n" +
|
||||
(String.IsNullOrEmpty(rom.RomOf) ? "" : "\tromof \"" + rom.RomOf + "\"\n") +
|
||||
(String.IsNullOrEmpty(rom.CloneOf) ? "" : "\tcloneof \"" + rom.CloneOf + "\"\n") +
|
||||
(ExcludeOf ? "" :
|
||||
(String.IsNullOrEmpty(rom.RomOf) ? "" : "\tromof \"" + rom.RomOf + "\"\n") +
|
||||
(String.IsNullOrEmpty(rom.CloneOf) ? "" : "\tcloneof \"" + rom.CloneOf + "\"\n") +
|
||||
(String.IsNullOrEmpty(rom.SampleOf) ? "" : "\tsampleof \"" + rom.SampleOf + "\"\n")
|
||||
) +
|
||||
"\tdescription \"" + (String.IsNullOrEmpty(rom.MachineDescription) ? rom.MachineName : rom.MachineDescription) + "\"\n" +
|
||||
(String.IsNullOrEmpty(rom.Year) ? "" : "\tyear " + rom.Year + "\n") +
|
||||
(String.IsNullOrEmpty(rom.Manufacturer) ? "" : "\tmanufacturer \"" + rom.Manufacturer + "\"\n");
|
||||
@@ -3789,15 +3797,17 @@ namespace SabreTools.Helper
|
||||
case OutputFormat.Logiqx:
|
||||
state += "\t<machine name=\"" + HttpUtility.HtmlEncode(rom.MachineName) + "\"" +
|
||||
(rom.IsBios ? " isbios=\"yes\"" : "") +
|
||||
(String.IsNullOrEmpty(rom.CloneOf) || (rom.MachineName.ToLowerInvariant() == rom.CloneOf.ToLowerInvariant())
|
||||
? ""
|
||||
: " cloneof=\"" + HttpUtility.HtmlEncode(rom.CloneOf) + "\"") +
|
||||
(String.IsNullOrEmpty(rom.RomOf) || (rom.MachineName.ToLowerInvariant() == rom.RomOf.ToLowerInvariant())
|
||||
? ""
|
||||
: " romof=\"" + HttpUtility.HtmlEncode(rom.RomOf) + "\"") +
|
||||
(String.IsNullOrEmpty(rom.SampleOf) || (rom.MachineName.ToLowerInvariant() == rom.SampleOf.ToLowerInvariant())
|
||||
? ""
|
||||
: " sampleof=\"" + HttpUtility.HtmlEncode(rom.SampleOf) + "\"") +
|
||||
(ExcludeOf ? "" :
|
||||
(String.IsNullOrEmpty(rom.CloneOf) || (rom.MachineName.ToLowerInvariant() == rom.CloneOf.ToLowerInvariant())
|
||||
? ""
|
||||
: " cloneof=\"" + HttpUtility.HtmlEncode(rom.CloneOf) + "\"") +
|
||||
(String.IsNullOrEmpty(rom.RomOf) || (rom.MachineName.ToLowerInvariant() == rom.RomOf.ToLowerInvariant())
|
||||
? ""
|
||||
: " romof=\"" + HttpUtility.HtmlEncode(rom.RomOf) + "\"") +
|
||||
(String.IsNullOrEmpty(rom.SampleOf) || (rom.MachineName.ToLowerInvariant() == rom.SampleOf.ToLowerInvariant())
|
||||
? ""
|
||||
: " sampleof=\"" + HttpUtility.HtmlEncode(rom.SampleOf) + "\"")
|
||||
) +
|
||||
">\n" +
|
||||
(String.IsNullOrEmpty(rom.Comment) ? "" : "\t\t<comment>" + HttpUtility.HtmlEncode(rom.Comment) + "</comment>\n") +
|
||||
"\t\t<description>" + HttpUtility.HtmlEncode((String.IsNullOrEmpty(rom.MachineDescription) ? rom.MachineName : rom.MachineDescription)) + "</description>\n" +
|
||||
|
||||
@@ -227,6 +227,10 @@ Options:
|
||||
Set the type flag to "SuperDAT" for the output DAT as well as preserving the
|
||||
directory structure of the inputted folder, if applicable
|
||||
|
||||
-xof, --exclude-of Exclude romof, cloneof, sampleof tags
|
||||
If this flag is enabled, then the romof, cloneof, and sampleof tags will be
|
||||
omitted from the outputted DAT or DATs.
|
||||
|
||||
-ab, --add-blank Output blank files for folders
|
||||
If this flag is set, then blank entries will be created for each of the empty
|
||||
directories in the source. This is useful for tools that require all folders
|
||||
@@ -509,6 +513,10 @@ Options:
|
||||
-fp=, --forcepack= Set force packing
|
||||
Set the forcepacking flag to one of the supported values:
|
||||
None, Zip, Unzip
|
||||
|
||||
-xof, --exclude-of Exclude romof, cloneof, sampleof tags
|
||||
If this flag is enabled, then the romof, cloneof, and sampleof tags will be
|
||||
omitted from the outputted DAT or DATs.
|
||||
|
||||
-clean Clean game names according to WoD standards
|
||||
Game names will be santitized to remove what the original WoD standards
|
||||
|
||||
Reference in New Issue
Block a user