Use Listxml serializer for reading only

This commit is contained in:
Matt Nadareski
2023-08-01 11:48:28 -04:00
parent af2e49cffd
commit dbef70b845
14 changed files with 1004 additions and 1009 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -271,6 +271,7 @@ namespace SabreTools.DatFiles.Formats
ConvertDisks(game.Disk, machine, filename, indexId, statsOnly, ref containsItems); ConvertDisks(game.Disk, machine, filename, indexId, statsOnly, ref containsItems);
ConvertMedia(game.Media, machine, filename, indexId, statsOnly, ref containsItems); ConvertMedia(game.Media, machine, filename, indexId, statsOnly, ref containsItems);
ConvertDeviceRefs(game.DeviceRef, machine, filename, indexId, statsOnly, ref containsItems); ConvertDeviceRefs(game.DeviceRef, machine, filename, indexId, statsOnly, ref containsItems);
ConvertSamples(game.Sample, machine, filename, indexId, statsOnly, ref containsItems);
ConvertArchives(game.Archive, machine, filename, indexId, statsOnly, ref containsItems); ConvertArchives(game.Archive, machine, filename, indexId, statsOnly, ref containsItems);
ConvertDrivers(game.Driver, machine, filename, indexId, statsOnly, ref containsItems); ConvertDrivers(game.Driver, machine, filename, indexId, statsOnly, ref containsItems);
ConvertSoftwareLists(game.SoftwareList, machine, filename, indexId, statsOnly, ref containsItems); ConvertSoftwareLists(game.SoftwareList, machine, filename, indexId, statsOnly, ref containsItems);

View File

@@ -9,6 +9,7 @@ namespace SabreTools.Models.Listxml
[XmlAttribute("name")] [XmlAttribute("name")]
public string Name { get; set; } public string Name { get; set; }
/// <remarks>(yes|no) "no"</remarks>
[XmlAttribute("default")] [XmlAttribute("default")]
public string Default { get; set; } public string Default { get; set; }

View File

@@ -9,31 +9,31 @@ namespace SabreTools.Models.Listxml
[XmlAttribute("type")] [XmlAttribute("type")]
public string Type { get; set; } public string Type { get; set; }
/// <remarks>Numeric?</remarks> /// <remarks>Numeric</remarks>
[XmlAttribute("player")] [XmlAttribute("player")]
public string? Player { get; set; } public string? Player { get; set; }
/// <remarks>Numeric?</remarks> /// <remarks>Numeric</remarks>
[XmlAttribute("buttons")] [XmlAttribute("buttons")]
public string? Buttons { get; set; } public string? Buttons { get; set; }
/// <remarks>Numeric?</remarks> /// <remarks>Numeric</remarks>
[XmlAttribute("reqbuttons")] [XmlAttribute("reqbuttons")]
public string? ReqButtons { get; set; } public string? ReqButtons { get; set; }
/// <remarks>Numeric?</remarks> /// <remarks>Numeric</remarks>
[XmlAttribute("minimum")] [XmlAttribute("minimum")]
public string? Minimum { get; set; } public string? Minimum { get; set; }
/// <remarks>Numeric?</remarks> /// <remarks>Numeric</remarks>
[XmlAttribute("maximum")] [XmlAttribute("maximum")]
public string? Maximum { get; set; } public string? Maximum { get; set; }
/// <remarks>Numeric?</remarks> /// <remarks>Numeric</remarks>
[XmlAttribute("sensitivity")] [XmlAttribute("sensitivity")]
public string? Sensitivity { get; set; } public string? Sensitivity { get; set; }
/// <remarks>Numeric?</remarks> /// <remarks>Numeric</remarks>
[XmlAttribute("keydelta")] [XmlAttribute("keydelta")]
public string? KeyDelta { get; set; } public string? KeyDelta { get; set; }

View File

@@ -15,6 +15,7 @@ namespace SabreTools.Models.Listxml
[XmlAttribute("fixed_image")] [XmlAttribute("fixed_image")]
public string? FixedImage { get; set; } public string? FixedImage { get; set; }
/// <remarks>Numeric boolean</remarks>
[XmlAttribute("mandatory")] [XmlAttribute("mandatory")]
public string? Mandatory { get; set; } public string? Mandatory { get; set; }

View File

@@ -21,43 +21,43 @@ namespace SabreTools.Models.Listxml
[XmlAttribute("flipx")] [XmlAttribute("flipx")]
public string? FlipX { get; set; } public string? FlipX { get; set; }
/// <remarks>Numeric?</remarks> /// <remarks>Numeric</remarks>
[XmlAttribute("width")] [XmlAttribute("width")]
public string? Width { get; set; } public string? Width { get; set; }
/// <remarks>Numeric?</remarks> /// <remarks>Numeric</remarks>
[XmlAttribute("height")] [XmlAttribute("height")]
public string? Height { get; set; } public string? Height { get; set; }
/// <remarks>Numeric?</remarks> /// <remarks>Numeric</remarks>
[XmlAttribute("refresh")] [XmlAttribute("refresh")]
public string Refresh { get; set; } public string Refresh { get; set; }
/// <remarks>Numeric?</remarks> /// <remarks>Numeric</remarks>
[XmlAttribute("pixclock")] [XmlAttribute("pixclock")]
public string? PixClock { get; set; } public string? PixClock { get; set; }
/// <remarks>Numeric?</remarks> /// <remarks>Numeric</remarks>
[XmlAttribute("htotal")] [XmlAttribute("htotal")]
public string? HTotal { get; set; } public string? HTotal { get; set; }
/// <remarks>Numeric?</remarks> /// <remarks>Numeric</remarks>
[XmlAttribute("hbend")] [XmlAttribute("hbend")]
public string? HBEnd { get; set; } public string? HBEnd { get; set; }
/// <remarks>Numeric?</remarks> /// <remarks>Numeric</remarks>
[XmlAttribute("hbstart")] [XmlAttribute("hbstart")]
public string? HBStart { get; set; } public string? HBStart { get; set; }
/// <remarks>Numeric?</remarks> /// <remarks>Numeric</remarks>
[XmlAttribute("vtotal")] [XmlAttribute("vtotal")]
public string? VTotal { get; set; } public string? VTotal { get; set; }
/// <remarks>Numeric?</remarks> /// <remarks>Numeric</remarks>
[XmlAttribute("vbend")] [XmlAttribute("vbend")]
public string? VBEnd { get; set; } public string? VBEnd { get; set; }
/// <remarks>Numeric?</remarks> /// <remarks>Numeric</remarks>
[XmlAttribute("vbstart")] [XmlAttribute("vbstart")]
public string? VBStart { get; set; } public string? VBStart { get; set; }

View File

@@ -3,10 +3,5 @@ using System.Xml.Serialization;
namespace SabreTools.Models.Listxml namespace SabreTools.Models.Listxml
{ {
[XmlRoot("game")] [XmlRoot("game")]
public class Game : GameBase public class Game : GameBase { }
{
/// <remarks>Appears after Manufacturer</remarks>
[XmlElement("history")]
public string? History { get; set; }
}
} }

View File

@@ -11,6 +11,22 @@ namespace SabreTools.Models.Listxml
[XmlAttribute("name")] [XmlAttribute("name")]
public string Name { get; set; } public string Name { get; set; }
/// <remarks>Machine only</remarks>
[XmlAttribute("sourcefile")]
public string? SourceFile { get; set; }
/// <remarks>(yes|no) "no", Machine only</remarks>
[XmlAttribute("isbios")]
public string? IsBios { get; set; }
/// <remarks>(yes|no) "no", Machine only</remarks>
[XmlAttribute("isdevice")]
public string? IsDevice { get; set; }
/// <remarks>(yes|no) "no", Machine only</remarks>
[XmlAttribute("ismechanical")]
public string? IsMechanical { get; set; }
/// <remarks>(yes|no) "no"</remarks> /// <remarks>(yes|no) "no"</remarks>
[XmlAttribute("runnable")] [XmlAttribute("runnable")]
public string? Runnable { get; set; } public string? Runnable { get; set; }
@@ -33,6 +49,10 @@ namespace SabreTools.Models.Listxml
[XmlElement("manufacturer")] [XmlElement("manufacturer")]
public string? Manufacturer { get; set; } public string? Manufacturer { get; set; }
/// <remarks>Game only</remarks>
[XmlElement("history")]
public string? History { get; set; }
[XmlElement("biosset")] [XmlElement("biosset")]
public BiosSet[]? BiosSet { get; set; } public BiosSet[]? BiosSet { get; set; }

View File

@@ -14,7 +14,7 @@ namespace SabreTools.Models.Listxml
[XmlAttribute("tilt")] [XmlAttribute("tilt")]
public string? Tilt { get; set; } public string? Tilt { get; set; }
/// <remarks>Numeric?</remarks> /// <remarks>Numeric</remarks>
[XmlAttribute("players")] [XmlAttribute("players")]
public string Players { get; set; } public string Players { get; set; }

View File

@@ -0,0 +1,28 @@
using System.Xml;
using System.Xml.Serialization;
namespace SabreTools.Models.Listxml
{
[XmlRoot("m1")]
public class M1
{
[XmlAttribute("version")]
public string? Version { get; set; }
[XmlElement("machine", typeof(Machine))]
[XmlElement("game", typeof(Game))]
public GameBase[] Game { get; set; }
#region DO NOT USE IN PRODUCTION
/// <remarks>Should be empty</remarks>
[XmlAnyAttribute]
public XmlAttribute[]? ADDITIONAL_ATTRIBUTES { get; set; }
/// <remarks>Should be empty</remarks>
[XmlAnyElement]
public object[]? ADDITIONAL_ELEMENTS { get; set; }
#endregion
}
}

View File

@@ -3,23 +3,5 @@ using System.Xml.Serialization;
namespace SabreTools.Models.Listxml namespace SabreTools.Models.Listxml
{ {
[XmlRoot("machine")] [XmlRoot("machine")]
public class Machine : GameBase public class Machine : GameBase { }
{
/// <remarks>Appears after Name</remarks>
[XmlAttribute("sourcefile")]
public string? SourceFile { get; set; }
/// <remarks>(yes|no) "no", Appears after SourceFile</remarks>
[XmlAttribute("isbios")]
public string? IsBios { get; set; }
/// <remarks>(yes|no) "no", Appears after IsBios</remarks>
[XmlAttribute("isdevice")]
public string? IsDevice { get; set; }
/// <remarks>(yes|no) "no", Appears after IsDevice</remarks>
[XmlAttribute("ismechanical")]
public string? IsMechanical { get; set; }
}
} }

View File

@@ -12,8 +12,9 @@ namespace SabreTools.Models.Listxml
[XmlAttribute("bios")] [XmlAttribute("bios")]
public string? Bios { get; set; } public string? Bios { get; set; }
/// <remarks>Numeric</remarks>
[XmlAttribute("size")] [XmlAttribute("size")]
public long Size { get; set; } public string Size { get; set; }
[XmlAttribute("crc")] [XmlAttribute("crc")]
public string? CRC { get; set; } public string? CRC { get; set; }

View File

@@ -12,7 +12,7 @@ namespace SabreTools.Test.DatTools
[InlineData("test-logiqx.xml", DatFormat.Logiqx, 6)] [InlineData("test-logiqx.xml", DatFormat.Logiqx, 6)]
//[InlineData(null, DatFormat.LogiqxDeprecated, 0)] // Not parsed separately //[InlineData(null, DatFormat.LogiqxDeprecated, 0)] // Not parsed separately
[InlineData("test-softwarelist.xml", DatFormat.SoftwareList, 5)] [InlineData("test-softwarelist.xml", DatFormat.SoftwareList, 5)]
[InlineData("test-listxml.xml", DatFormat.Listxml, 20)] [InlineData("test-listxml.xml", DatFormat.Listxml, 19)]
[InlineData("test-offlinelist.xml", DatFormat.OfflineList, 1)] [InlineData("test-offlinelist.xml", DatFormat.OfflineList, 1)]
//[InlineData(null, DatFormat.SabreXML, 0)] // TODO: Create good-enough test file for this //[InlineData(null, DatFormat.SabreXML, 0)] // TODO: Create good-enough test file for this
[InlineData("test-openmsx.xml", DatFormat.OpenMSX, 3)] [InlineData("test-openmsx.xml", DatFormat.OpenMSX, 3)]

View File

@@ -12,7 +12,6 @@
</adjuster> </adjuster>
<biosset name="biosset" description="description" default="yes" /> <biosset name="biosset" description="description" default="yes" />
<chip name="cpu" tag="cpu" type="cpu" clock="100000" /> <chip name="cpu" tag="cpu" type="cpu" clock="100000" />
<condition tag="tag" mask="mask" relation="eq" value="value" />
<configuration name="configuration" tag="tag" mask="mask"> <configuration name="configuration" tag="tag" mask="mask">
<condition tag="tag" mask="mask" relation="eq" value="value" /> <condition tag="tag" mask="mask" relation="eq" value="value" />
<conflocation name="conflocation" number="1" inverted="no" /> <conflocation name="conflocation" number="1" inverted="no" />