mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[SabreTools, Flags, DatFiles/, Utilities] Add depreciated flag
This commit is contained in:
@@ -5726,6 +5726,10 @@ namespace SabreTools.Library.DatFiles
|
||||
{
|
||||
outfileNames.Add(DatFormat.Logiqx, CreateOutfileNamesHelper(outDir, ".xml", overwrite));
|
||||
}
|
||||
if ((DatFormat & DatFormat.LogiqxDepreciated) != 0)
|
||||
{
|
||||
outfileNames.Add(DatFormat.LogiqxDepreciated, CreateOutfileNamesHelper(outDir, ".xml", overwrite));
|
||||
}
|
||||
|
||||
// Missfile
|
||||
if ((DatFormat & DatFormat.MissFile) != 0
|
||||
@@ -5742,6 +5746,7 @@ namespace SabreTools.Library.DatFiles
|
||||
// OfflineList
|
||||
if (((DatFormat & DatFormat.OfflineList) != 0)
|
||||
&& (DatFormat & DatFormat.Logiqx) == 0
|
||||
&& (DatFormat & DatFormat.LogiqxDepreciated) == 0
|
||||
&& (DatFormat & DatFormat.SabreDat) == 0
|
||||
&& (DatFormat & DatFormat.SoftwareList) == 0)
|
||||
{
|
||||
@@ -5749,6 +5754,7 @@ namespace SabreTools.Library.DatFiles
|
||||
}
|
||||
if (((DatFormat & DatFormat.OfflineList) != 0
|
||||
&& ((DatFormat & DatFormat.Logiqx) != 0
|
||||
|| (DatFormat & DatFormat.LogiqxDepreciated) != 0
|
||||
|| (DatFormat & DatFormat.SabreDat) != 0
|
||||
|| (DatFormat & DatFormat.SoftwareList) != 0)))
|
||||
{
|
||||
@@ -5792,11 +5798,11 @@ namespace SabreTools.Library.DatFiles
|
||||
};
|
||||
|
||||
// SabreDAT
|
||||
if ((DatFormat & DatFormat.SabreDat) != 0 && (DatFormat & DatFormat.Logiqx) == 0)
|
||||
if ((DatFormat & DatFormat.SabreDat) != 0 && ((DatFormat & DatFormat.Logiqx) == 0 || (DatFormat & DatFormat.LogiqxDepreciated) == 0))
|
||||
{
|
||||
outfileNames.Add(DatFormat.SabreDat, CreateOutfileNamesHelper(outDir, ".xml", overwrite));
|
||||
};
|
||||
if ((DatFormat & DatFormat.SabreDat) != 0 && (DatFormat & DatFormat.Logiqx) != 0)
|
||||
if ((DatFormat & DatFormat.SabreDat) != 0 && ((DatFormat & DatFormat.Logiqx) != 0 || (DatFormat & DatFormat.LogiqxDepreciated) != 0))
|
||||
{
|
||||
outfileNames.Add(DatFormat.SabreDat, CreateOutfileNamesHelper(outDir, ".sd.xml", overwrite));
|
||||
};
|
||||
@@ -5804,12 +5810,14 @@ namespace SabreTools.Library.DatFiles
|
||||
// Software List
|
||||
if ((DatFormat & DatFormat.SoftwareList) != 0
|
||||
&& (DatFormat & DatFormat.Logiqx) == 0
|
||||
&& (DatFormat & DatFormat.LogiqxDepreciated) == 0
|
||||
&& (DatFormat & DatFormat.SabreDat) == 0)
|
||||
{
|
||||
outfileNames.Add(DatFormat.SoftwareList, CreateOutfileNamesHelper(outDir, ".xml", overwrite));
|
||||
}
|
||||
if ((DatFormat & DatFormat.SoftwareList) != 0
|
||||
&& ((DatFormat & DatFormat.Logiqx) != 0
|
||||
|| (DatFormat & DatFormat.LogiqxDepreciated) != 0
|
||||
|| (DatFormat & DatFormat.SabreDat) != 0))
|
||||
{
|
||||
outfileNames.Add(DatFormat.SoftwareList, CreateOutfileNamesHelper(outDir, ".sl.xml", overwrite));
|
||||
|
||||
@@ -27,13 +27,18 @@ namespace SabreTools.Library.DatFiles
|
||||
/// </summary>
|
||||
internal class Logiqx : DatFile
|
||||
{
|
||||
// Private instance variables specific to Logiqx DATs
|
||||
bool _depreciated;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor designed for casting a base DatFile
|
||||
/// </summary>
|
||||
/// <param name="datFile">Parent DatFile to copy from</param>
|
||||
public Logiqx(DatFile datFile)
|
||||
/// <param name="depreciated">True if the output uses "game", false if the output uses "machine"</param>
|
||||
public Logiqx(DatFile datFile, bool depreciated)
|
||||
: base(datFile, cloneHeader: false)
|
||||
{
|
||||
_depreciated = depreciated;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1214,7 +1219,7 @@ namespace SabreTools.Library.DatFiles
|
||||
rom.MachineName = rom.MachineName.Substring(1);
|
||||
}
|
||||
|
||||
string state = "\t<machine name=\"" + HttpUtility.HtmlEncode(rom.MachineName) + "\"" +
|
||||
string state = "\t<" + (_depreciated ? "game" : "machine") + " name=\"" + HttpUtility.HtmlEncode(rom.MachineName) + "\"" +
|
||||
(ExcludeOf ? "" :
|
||||
(rom.MachineType == MachineType.Bios ? " isbios=\"yes\"" : "") +
|
||||
(rom.MachineType == MachineType.Device ? " isdevice=\"yes\"" : "") +
|
||||
@@ -1257,7 +1262,7 @@ namespace SabreTools.Library.DatFiles
|
||||
{
|
||||
try
|
||||
{
|
||||
string state = "\t</machine>\n";
|
||||
string state = "\t</" + (_depreciated ? "game" : "machine") + ">\n";
|
||||
|
||||
sw.Write(state);
|
||||
sw.Flush();
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace SabreTools.Library.DatFiles
|
||||
bool remUnicode)
|
||||
{
|
||||
// All XML-derived DATs share a lot in common so it just calls one implementation
|
||||
new Logiqx(this).ParseFile(filename, sysid, srcid, keep, clean, remUnicode);
|
||||
new Logiqx(this, false).ParseFile(filename, sysid, srcid, keep, clean, remUnicode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace SabreTools.Library.DatFiles
|
||||
bool remUnicode)
|
||||
{
|
||||
// All XML-derived DATs share a lot in common so it just calls one implementation
|
||||
new Logiqx(this).ParseFile(filename, sysid, srcid, keep, clean, remUnicode);
|
||||
new Logiqx(this, false).ParseFile(filename, sysid, srcid, keep, clean, remUnicode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace SabreTools.Library.DatFiles
|
||||
bool remUnicode)
|
||||
{
|
||||
// All XML-derived DATs share a lot in common so it just calls one implementation
|
||||
new Logiqx(this).ParseFile(filename, sysid, srcid, keep, clean, remUnicode);
|
||||
new Logiqx(this, false).ParseFile(filename, sysid, srcid, keep, clean, remUnicode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -194,7 +194,8 @@ namespace SabreTools.Library.Data
|
||||
{
|
||||
// XML Formats
|
||||
Logiqx = 0x01,
|
||||
SoftwareList = Logiqx << 1,
|
||||
LogiqxDepreciated = Logiqx << 1,
|
||||
SoftwareList = LogiqxDepreciated << 1, // Special internal type for "game" instead of "machine"
|
||||
OfflineList = SoftwareList << 1,
|
||||
SabreDat = OfflineList << 1,
|
||||
|
||||
|
||||
@@ -263,9 +263,14 @@ Options:
|
||||
-otsv, --output-tsv Output in Tab-Separated Value format
|
||||
Add outputting the created DAT to standardized TSV format
|
||||
|
||||
-ox, -output-xml Output in Logiqx XML format (default)
|
||||
-ox, --output-xml Output in Logiqx XML format (default)
|
||||
Add outputting the created DAT to Logiqx XML format
|
||||
|
||||
-dpc, --depreciated Output 'game' instead of 'machine'
|
||||
By default, XML DATs output with the more modern "machine" tag
|
||||
for each set. This flag allows users to output the older "game"
|
||||
tag instead, for compatibility reasons.
|
||||
|
||||
-ro, --romba Read files from a Romba input
|
||||
Allow for reading of GZipped files as if they were from a Romba
|
||||
depot. This implies that the files will be in the TorrentGZ format
|
||||
@@ -477,9 +482,14 @@ Options:
|
||||
-otsv, --output-tsv Output in Tab-Separated Value format
|
||||
Add outputting the created DAT to standardized TSV format
|
||||
|
||||
-ox, -output-xml Output in Logiqx XML format
|
||||
-ox, --output-xml Output in Logiqx XML format
|
||||
Add outputting the created DAT to Logiqx XML format
|
||||
|
||||
-dpc, --depreciated Output 'game' instead of 'machine'
|
||||
By default, XML DATs output with the more modern "machine" tag
|
||||
for each set. This flag allows users to output the older "game"
|
||||
tag instead, for compatibility reasons.
|
||||
|
||||
-out=, --output-dir= Set the name of the output directory
|
||||
This sets an output folder to be used when the files are created. If
|
||||
a path is not defined, the application directory is used instead.
|
||||
@@ -975,9 +985,14 @@ Options:
|
||||
-q, --quotes Put double-quotes around each item
|
||||
This quotes only the item and not the prefix and postfix
|
||||
|
||||
-ox, -output-xml Output in Logiqx XML format
|
||||
-ox, --output-xml Output in Logiqx XML format
|
||||
Add outputting the created DAT to Logiqx XML format
|
||||
|
||||
-dpc, --depreciated Output 'game' instead of 'machine'
|
||||
By default, XML DATs output with the more modern "machine" tag
|
||||
for each set. This flag allows users to output the older "game"
|
||||
tag instead, for compatibility reasons.
|
||||
|
||||
-f=, --filename= Set the external name of the DAT
|
||||
Set the base filename for the output DAT(s)
|
||||
|
||||
|
||||
@@ -596,7 +596,9 @@ namespace SabreTools.Library.Tools
|
||||
case DatFormat.Listrom:
|
||||
return new Listrom(baseDat);
|
||||
case DatFormat.Logiqx:
|
||||
return new Logiqx(baseDat);
|
||||
return new Logiqx(baseDat, false);
|
||||
case DatFormat.LogiqxDepreciated:
|
||||
return new Logiqx(baseDat, true);
|
||||
case DatFormat.MissFile:
|
||||
return new Missfile(baseDat);
|
||||
case DatFormat.OfflineList:
|
||||
|
||||
@@ -240,6 +240,17 @@ namespace SabreTools
|
||||
null);
|
||||
}
|
||||
}
|
||||
private static Feature depreciatedFlag
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
new List<string>() { "-dpc", "--depreciated" },
|
||||
"Output 'game' instead of 'machine'",
|
||||
FeatureType.Flag,
|
||||
null);
|
||||
}
|
||||
}
|
||||
private static Feature descriptionAsNameFlag
|
||||
{
|
||||
get
|
||||
@@ -2006,6 +2017,7 @@ namespace SabreTools
|
||||
datFromDir.AddFeature("output-ssv", outputSsvFlag);
|
||||
datFromDir.AddFeature("output-tsv", outputTsvFlag);
|
||||
datFromDir.AddFeature("output-xml", outputXmlFlag);
|
||||
datFromDir["output-xml"].AddFeature("depreciated", depreciatedFlag);
|
||||
datFromDir.AddFeature("romba", rombaFlag);
|
||||
datFromDir.AddFeature("skip-archives", skipArchivesFlag);
|
||||
datFromDir.AddFeature("skip-files", skipFilesFlag);
|
||||
@@ -2132,6 +2144,7 @@ namespace SabreTools
|
||||
split.AddFeature("output-ssv", outputSsvFlag);
|
||||
split.AddFeature("output-tsv", outputTsvFlag);
|
||||
split.AddFeature("output-xml", outputXmlFlag);
|
||||
split["output-xml"].AddFeature("depreciated", depreciatedFlag);
|
||||
split.AddFeature("output-dir", outputDirStringInput);
|
||||
split.AddFeature("inplace", inplaceFlag);
|
||||
split.AddFeature("extension", extensionFlag);
|
||||
@@ -2231,6 +2244,7 @@ namespace SabreTools
|
||||
update["output-tsv"].AddFeature("postfix", postfixStringInput);
|
||||
update["output-tsv"].AddFeature("quotes", quotesFlag);
|
||||
update.AddFeature("output-xml", outputXmlFlag);
|
||||
update["output-xml"].AddFeature("depreciated", depreciatedFlag);
|
||||
update.AddFeature("filename", filenameStringInput);
|
||||
update.AddFeature("name", nameStringInput);
|
||||
update.AddFeature("description", descriptionStringInput);
|
||||
|
||||
@@ -246,6 +246,14 @@ namespace SabreTools
|
||||
case "depot":
|
||||
depot = true;
|
||||
break;
|
||||
case "depreciated":
|
||||
// Remove the Logiqx standard output if this is included
|
||||
if ((datHeader.DatFormat & DatFormat.Logiqx) != 0)
|
||||
{
|
||||
datHeader.DatFormat &= ~DatFormat.Logiqx;
|
||||
}
|
||||
datHeader.DatFormat |= DatFormat.LogiqxDepreciated;
|
||||
break;
|
||||
case "description-as-name":
|
||||
descAsName = true;
|
||||
break;
|
||||
@@ -373,7 +381,11 @@ namespace SabreTools
|
||||
datHeader.DatFormat |= DatFormat.TSV;
|
||||
break;
|
||||
case "output-xml":
|
||||
datHeader.DatFormat |= DatFormat.Logiqx;
|
||||
// Only set this flag if the depreciated flag is not already
|
||||
if ((datHeader.DatFormat & DatFormat.LogiqxDepreciated) == 0)
|
||||
{
|
||||
datHeader.DatFormat |= DatFormat.Logiqx;
|
||||
}
|
||||
break;
|
||||
case "quick":
|
||||
quickScan = true;
|
||||
|
||||
Reference in New Issue
Block a user