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);
ConvertMedia(game.Media, 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);
ConvertDrivers(game.Driver, 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")]
public string Name { get; set; }
/// <remarks>(yes|no) "no"</remarks>
[XmlAttribute("default")]
public string Default { get; set; }

View File

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

View File

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

View File

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

View File

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

View File

@@ -11,6 +11,22 @@ namespace SabreTools.Models.Listxml
[XmlAttribute("name")]
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>
[XmlAttribute("runnable")]
public string? Runnable { get; set; }
@@ -33,6 +49,10 @@ namespace SabreTools.Models.Listxml
[XmlElement("manufacturer")]
public string? Manufacturer { get; set; }
/// <remarks>Game only</remarks>
[XmlElement("history")]
public string? History { get; set; }
[XmlElement("biosset")]
public BiosSet[]? BiosSet { get; set; }

View File

@@ -14,7 +14,7 @@ namespace SabreTools.Models.Listxml
[XmlAttribute("tilt")]
public string? Tilt { get; set; }
/// <remarks>Numeric?</remarks>
/// <remarks>Numeric</remarks>
[XmlAttribute("players")]
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
{
[XmlRoot("machine")]
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; }
}
public class Machine : GameBase { }
}

View File

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

View File

@@ -12,7 +12,7 @@ namespace SabreTools.Test.DatTools
[InlineData("test-logiqx.xml", DatFormat.Logiqx, 6)]
//[InlineData(null, DatFormat.LogiqxDeprecated, 0)] // Not parsed separately
[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(null, DatFormat.SabreXML, 0)] // TODO: Create good-enough test file for this
[InlineData("test-openmsx.xml", DatFormat.OpenMSX, 3)]

View File

@@ -12,7 +12,6 @@
</adjuster>
<biosset name="biosset" description="description" default="yes" />
<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">
<condition tag="tag" mask="mask" relation="eq" value="value" />
<conflocation name="conflocation" number="1" inverted="no" />