diff --git a/SabreTools.Library/DatFiles/DatFile.cs b/SabreTools.Library/DatFiles/DatFile.cs index d7e537f5..e533ff5f 100644 --- a/SabreTools.Library/DatFiles/DatFile.cs +++ b/SabreTools.Library/DatFiles/DatFile.cs @@ -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)); diff --git a/SabreTools.Library/DatFiles/Logiqx.cs b/SabreTools.Library/DatFiles/Logiqx.cs index 91ea1262..d50314fe 100644 --- a/SabreTools.Library/DatFiles/Logiqx.cs +++ b/SabreTools.Library/DatFiles/Logiqx.cs @@ -27,13 +27,18 @@ namespace SabreTools.Library.DatFiles /// internal class Logiqx : DatFile { + // Private instance variables specific to Logiqx DATs + bool _depreciated; + /// /// Constructor designed for casting a base DatFile /// /// Parent DatFile to copy from - public Logiqx(DatFile datFile) + /// True if the output uses "game", false if the output uses "machine" + public Logiqx(DatFile datFile, bool depreciated) : base(datFile, cloneHeader: false) { + _depreciated = depreciated; } /// @@ -1214,7 +1219,7 @@ namespace SabreTools.Library.DatFiles rom.MachineName = rom.MachineName.Substring(1); } - string state = "\t\n"; sw.Write(state); sw.Flush(); diff --git a/SabreTools.Library/DatFiles/OfflineList.cs b/SabreTools.Library/DatFiles/OfflineList.cs index 15ab4b79..98e39edb 100644 --- a/SabreTools.Library/DatFiles/OfflineList.cs +++ b/SabreTools.Library/DatFiles/OfflineList.cs @@ -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); } /// diff --git a/SabreTools.Library/DatFiles/SabreDat.cs b/SabreTools.Library/DatFiles/SabreDat.cs index 044b7053..235bf91e 100644 --- a/SabreTools.Library/DatFiles/SabreDat.cs +++ b/SabreTools.Library/DatFiles/SabreDat.cs @@ -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); } /// diff --git a/SabreTools.Library/DatFiles/SoftwareList.cs b/SabreTools.Library/DatFiles/SoftwareList.cs index a494b0be..ecbff682 100644 --- a/SabreTools.Library/DatFiles/SoftwareList.cs +++ b/SabreTools.Library/DatFiles/SoftwareList.cs @@ -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); } /// diff --git a/SabreTools.Library/Data/Flags.cs b/SabreTools.Library/Data/Flags.cs index e0c926e4..32e797ca 100644 --- a/SabreTools.Library/Data/Flags.cs +++ b/SabreTools.Library/Data/Flags.cs @@ -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, diff --git a/SabreTools.Library/README.1ST b/SabreTools.Library/README.1ST index 8c0ca82d..d86cb39f 100644 --- a/SabreTools.Library/README.1ST +++ b/SabreTools.Library/README.1ST @@ -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,8 +482,13 @@ 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 @@ -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) diff --git a/SabreTools.Library/Tools/Utilities.cs b/SabreTools.Library/Tools/Utilities.cs index 5069f2d8..d9d18e81 100644 --- a/SabreTools.Library/Tools/Utilities.cs +++ b/SabreTools.Library/Tools/Utilities.cs @@ -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: diff --git a/SabreTools/SabreTools.Help.cs b/SabreTools/SabreTools.Help.cs index 512bf99b..f7fdafe3 100644 --- a/SabreTools/SabreTools.Help.cs +++ b/SabreTools/SabreTools.Help.cs @@ -240,6 +240,17 @@ namespace SabreTools null); } } + private static Feature depreciatedFlag + { + get + { + return new Feature( + new List() { "-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); diff --git a/SabreTools/SabreTools.cs b/SabreTools/SabreTools.cs index 97a1c43c..ef2d249e 100644 --- a/SabreTools/SabreTools.cs +++ b/SabreTools/SabreTools.cs @@ -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;