[SabreTools, Flags, DatFiles/, Utilities] Add depreciated flag

This commit is contained in:
Matt Nadareski
2018-01-10 22:23:17 -08:00
parent 0607b86ad1
commit 1484e318aa
10 changed files with 71 additions and 14 deletions

View File

@@ -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));

View File

@@ -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();

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>