[ALL} Preliminary hookup of listxml (nw)

This commit is contained in:
Matt Nadareski
2018-01-15 01:39:23 -08:00
parent 6e7fe07ee6
commit ae2d0fe989
4 changed files with 49 additions and 9 deletions

View File

@@ -5737,7 +5737,17 @@ namespace SabreTools.Library.DatFiles
outfileNames.Add(DatFormat.DOSCenter, CreateOutfileNamesHelper(outDir, ".dc.dat", overwrite)); outfileNames.Add(DatFormat.DOSCenter, CreateOutfileNamesHelper(outDir, ".dc.dat", overwrite));
} }
//MAME Listroms // Logiqx XML
if ((DatFormat & DatFormat.Logiqx) != 0)
{
outfileNames.Add(DatFormat.Logiqx, CreateOutfileNamesHelper(outDir, ".xml", overwrite));
}
if ((DatFormat & DatFormat.LogiqxDepreciated) != 0)
{
outfileNames.Add(DatFormat.LogiqxDepreciated, CreateOutfileNamesHelper(outDir, ".xml", overwrite));
}
// MAME Listroms
if ((DatFormat & DatFormat.Listrom) != 0 if ((DatFormat & DatFormat.Listrom) != 0
&& (DatFormat & DatFormat.AttractMode) == 0) && (DatFormat & DatFormat.AttractMode) == 0)
{ {
@@ -5749,14 +5759,22 @@ namespace SabreTools.Library.DatFiles
outfileNames.Add(DatFormat.Listrom, CreateOutfileNamesHelper(outDir, ".lr.txt", overwrite)); outfileNames.Add(DatFormat.Listrom, CreateOutfileNamesHelper(outDir, ".lr.txt", overwrite));
} }
// Logiqx XML // MAME Listxml
if ((DatFormat & DatFormat.Logiqx) != 0) if (((DatFormat & DatFormat.Listxml) != 0)
&& (DatFormat & DatFormat.Logiqx) == 0
&& (DatFormat & DatFormat.LogiqxDepreciated) == 0
&& (DatFormat & DatFormat.SabreDat) == 0
&& (DatFormat & DatFormat.SoftwareList) == 0)
{ {
outfileNames.Add(DatFormat.Logiqx, CreateOutfileNamesHelper(outDir, ".xml", overwrite)); outfileNames.Add(DatFormat.Listxml, CreateOutfileNamesHelper(outDir, ".xml", overwrite));
} }
if ((DatFormat & DatFormat.LogiqxDepreciated) != 0) if (((DatFormat & DatFormat.Listxml) != 0
&& ((DatFormat & DatFormat.Logiqx) != 0
|| (DatFormat & DatFormat.LogiqxDepreciated) != 0
|| (DatFormat & DatFormat.SabreDat) != 0
|| (DatFormat & DatFormat.SoftwareList) != 0)))
{ {
outfileNames.Add(DatFormat.LogiqxDepreciated, CreateOutfileNamesHelper(outDir, ".xml", overwrite)); outfileNames.Add(DatFormat.Listxml, CreateOutfileNamesHelper(outDir, ".mame.xml", overwrite));
} }
// Missfile // Missfile
@@ -5775,6 +5793,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.LogiqxDepreciated) == 0
&& (DatFormat & DatFormat.Listxml) == 0
&& (DatFormat & DatFormat.SabreDat) == 0 && (DatFormat & DatFormat.SabreDat) == 0
&& (DatFormat & DatFormat.SoftwareList) == 0) && (DatFormat & DatFormat.SoftwareList) == 0)
{ {
@@ -5783,6 +5802,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.LogiqxDepreciated) != 0
|| (DatFormat & DatFormat.Listxml) != 0
|| (DatFormat & DatFormat.SabreDat) != 0 || (DatFormat & DatFormat.SabreDat) != 0
|| (DatFormat & DatFormat.SoftwareList) != 0))) || (DatFormat & DatFormat.SoftwareList) != 0)))
{ {

View File

@@ -194,9 +194,10 @@ namespace SabreTools.Library.Data
{ {
// XML Formats // XML Formats
Logiqx = 0x01, Logiqx = 0x01,
LogiqxDepreciated = Logiqx << 1, LogiqxDepreciated = Logiqx << 1, // Special internal type for "game" instead of "machine"
SoftwareList = LogiqxDepreciated << 1, // Special internal type for "game" instead of "machine" SoftwareList = LogiqxDepreciated << 1,
OfflineList = SoftwareList << 1, Listxml = SoftwareList << 1,
OfflineList = Listxml << 1,
SabreDat = OfflineList << 1, SabreDat = OfflineList << 1,
// Propietary Formats // Propietary Formats

View File

@@ -619,6 +619,8 @@ namespace SabreTools.Library.Tools
return new DosCenter(baseDat); return new DosCenter(baseDat);
case DatFormat.Listrom: case DatFormat.Listrom:
return new Listrom(baseDat); return new Listrom(baseDat);
case DatFormat.Listxml:
return new Listxml(baseDat);
case DatFormat.Logiqx: case DatFormat.Logiqx:
return new Logiqx(baseDat, false); return new Logiqx(baseDat, false);
case DatFormat.LogiqxDepreciated: case DatFormat.LogiqxDepreciated:
@@ -1096,7 +1098,15 @@ namespace SabreTools.Library.Tools
// Get the first two lines to check // Get the first two lines to check
StreamReader sr = File.OpenText(filename); StreamReader sr = File.OpenText(filename);
string first = sr.ReadLine().ToLowerInvariant(); string first = sr.ReadLine().ToLowerInvariant();
while (String.IsNullOrWhiteSpace(first))
{
first = sr.ReadLine();
}
string second = sr.ReadLine().ToLowerInvariant(); string second = sr.ReadLine().ToLowerInvariant();
while (String.IsNullOrWhiteSpace(second))
{
second = sr.ReadLine();
}
sr.Dispose(); sr.Dispose();
// If we have an XML-based DAT // If we have an XML-based DAT
@@ -1106,6 +1116,12 @@ namespace SabreTools.Library.Tools
{ {
return DatFormat.Logiqx; return DatFormat.Logiqx;
} }
else if (second.StartsWith("<!DOCTYPE mame")
|| second.StartsWith("<mame")
|| second.StartsWith("<m1"))
{
return DatFormat.Listxml;
}
else if (second.StartsWith("<!doctype softwarelist")) else if (second.StartsWith("<!doctype softwarelist"))
{ {
return DatFormat.SoftwareList; return DatFormat.SoftwareList;

View File

@@ -341,6 +341,9 @@ namespace SabreTools
case "output-listrom": case "output-listrom":
datHeader.DatFormat |= DatFormat.Listrom; datHeader.DatFormat |= DatFormat.Listrom;
break; break;
case "output-listxml": // TODO: Not added to help at all
datHeader.DatFormat |= DatFormat.Listxml;
break;
case "output-miss": case "output-miss":
datHeader.DatFormat |= DatFormat.MissFile; datHeader.DatFormat |= DatFormat.MissFile;
break; break;