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