Update Listxml deserialization test, fix issues

This commit is contained in:
Matt Nadareski
2023-07-14 11:09:57 -04:00
parent bda3315c7a
commit 4dc0185629
13 changed files with 283942 additions and 134 deletions

View File

@@ -16,6 +16,10 @@ namespace SabreTools.Models.Listxml
[XmlAttribute("type")]
public string Type { get; set; }
/// <remarks>Only present in older versions</remarks>
[XmlAttribute("soundonly")]
public string SoundOnly { get; set; }
[XmlAttribute("clock")]
public string? Clock { get; set; }

View File

@@ -9,6 +9,10 @@ namespace SabreTools.Models.Listxml
[XmlAttribute("name")]
public string Name { get; set; }
/// <remarks>Only present in older versions</remarks>
[XmlAttribute("md5")]
public string? MD5 { get; set; }
[XmlAttribute("sha1")]
public string? SHA1 { get; set; }

View File

@@ -6,10 +6,22 @@ namespace SabreTools.Models.Listxml
[XmlRoot("driver")]
public class Driver
{
/// <remarks>(good|imperfect|preliminary)</remarks>
/// <remarks>(good|imperfect|preliminary), (good|preliminary|test) in older versions</remarks>
[XmlAttribute("status")]
public string Status { get; set; }
/// <remarks>(good|imperfect|preliminary), Only present in older versions</remarks>
[XmlAttribute("color")]
public string Color { get; set; }
/// <remarks>(good|imperfect|preliminary), Only present in older versions</remarks>
[XmlAttribute("sound")]
public string Sound { get; set; }
/// <remarks>Only present in older versions</remarks>
[XmlAttribute("palettesize")]
public string PaletteSize { get; set; }
/// <remarks>(good|imperfect|preliminary)</remarks>
[XmlAttribute("emulation")]
public string Emulation { get; set; }

View File

@@ -0,0 +1,12 @@
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; }
}
}

View File

@@ -0,0 +1,109 @@
using System.Xml;
using System.Xml.Serialization;
namespace SabreTools.Models.Listxml
{
/// <summary>
/// Base class to unify the various game-like types
/// </summary>
public abstract class GameBase
{
[XmlAttribute("name")]
public string Name { get; set; }
/// <remarks>(yes|no) "no"</remarks>
[XmlAttribute("runnable")]
public string? Runnable { get; set; }
[XmlAttribute("cloneof")]
public string? CloneOf { get; set; }
[XmlAttribute("romof")]
public string? RomOf { get; set; }
[XmlAttribute("sampleof")]
public string? SampleOf { get; set; }
[XmlElement("description")]
public string Description { get; set; }
[XmlElement("year")]
public string? Year { get; set; }
[XmlElement("manufacturer")]
public string? Manufacturer { get; set; }
[XmlElement("biosset")]
public BiosSet[]? BiosSet { get; set; }
[XmlElement("rom")]
public Rom[]? Rom { get; set; }
[XmlElement("disk")]
public Disk[]? Disk { get; set; }
[XmlElement("device_ref")]
public DeviceRef[]? DeviceRef { get; set; }
[XmlElement("sample")]
public Sample[]? Sample { get; set; }
[XmlElement("chip")]
public Chip[]? Chip { get; set; }
[XmlElement("display")]
public Display[]? Display { get; set; }
/// <remarks>Only present in older versions</remarks>
[XmlElement("video")]
public Video[]? Video { get; set; }
[XmlElement("sound")]
public Sound? Sound { get; set; }
[XmlElement("input")]
public Input? Input { get; set; }
[XmlElement("dipswitch")]
public DipSwitch[]? DipSwitch { get; set; }
[XmlElement("configuration")]
public Configuration[]? Configuration { get; set; }
[XmlElement("port")]
public Port[]? Port { get; set; }
[XmlElement("adjuster")]
public Adjuster[]? Adjuster { get; set; }
[XmlElement("driver")]
public Driver? Driver { get; set; }
[XmlElement("feature")]
public Feature[]? Feature { get; set; }
[XmlElement("device")]
public Device[]? Device { get; set; }
[XmlElement("slot")]
public Slot[]? Slot { get; set; }
[XmlElement("softwarelist")]
public SoftwareList[]? SoftwareList { get; set; }
[XmlElement("ramoption")]
public RamOption[]? RamOption { 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

@@ -18,11 +18,18 @@ namespace SabreTools.Models.Listxml
[XmlAttribute("players")]
public string Players { get; set; }
/// <remarks>Only present in older versions</remarks>
[XmlAttribute("control")]
public string? ControlAttr { get; set; }
/// <remarks>Only present in older versions, Numeric?</remarks>
[XmlAttribute("buttons")]
public string Buttons { get; set; }
/// <remarks>Numeric?</remarks>
[XmlAttribute("coins")]
public string? Coins { get; set; }
/// <remarks>Numeric?</remarks>
[XmlElement("control")]
public Control[]? Control { get; set; }

View File

@@ -1,118 +1,25 @@
using System.Xml;
using System.Xml.Serialization;
namespace SabreTools.Models.Listxml
{
[XmlRoot("machine")]
public class Machine
public class Machine : GameBase
{
[XmlAttribute("name")]
public string Name { get; set; }
/// <remarks>Appears after Name</remarks>
[XmlAttribute("sourcefile")]
public string? SourceFile { get; set; }
/// <remarks>(yes|no) "no"</remarks>
/// <remarks>(yes|no) "no", Appears after SourceFile</remarks>
[XmlAttribute("isbios")]
public string? IsBios { get; set; }
/// <remarks>(yes|no) "no"</remarks>
/// <remarks>(yes|no) "no", Appears after IsBios</remarks>
[XmlAttribute("isdevice")]
public string? IsDevice { get; set; }
/// <remarks>(yes|no) "no"</remarks>
/// <remarks>(yes|no) "no", Appears after IsDevice</remarks>
[XmlAttribute("ismechanical")]
public string? IsMechanical { get; set; }
/// <remarks>(yes|no) "no"</remarks>
[XmlAttribute("runnable")]
public string? Runnable { get; set; }
[XmlAttribute("cloneof")]
public string? CloneOf { get; set; }
[XmlAttribute("romof")]
public string? RomOf { get; set; }
[XmlAttribute("sampleof")]
public string? SampleOf { get; set; }
[XmlElement("description")]
public string Description { get; set; }
[XmlElement("year")]
public string? Year { get; set; }
[XmlElement("manufacturer")]
public string? Manufacturer { get; set; }
[XmlElement("biosset")]
public BiosSet[]? BiosSet { get; set; }
[XmlElement("rom")]
public Rom[]? Rom { get; set; }
[XmlElement("disk")]
public Disk[]? Disk { get; set; }
[XmlElement("device_ref")]
public DeviceRef[]? DeviceRef { get; set; }
[XmlElement("sample")]
public Sample[]? Sample { get; set; }
[XmlElement("chip")]
public Chip[]? Chip { get; set; }
[XmlElement("display")]
public Display[]? Display { get; set; }
[XmlElement("sound")]
public Sound? Sound { get; set; }
[XmlElement("input")]
public Input? Input { get; set; }
[XmlElement("dipswitch")]
public DipSwitch[]? DipSwitch { get; set; }
[XmlElement("configuration")]
public Configuration[]? Configuration { get; set; }
[XmlElement("port")]
public Port[]? Port { get; set; }
[XmlElement("adjuster")]
public Adjuster[]? Adjuster { get; set; }
[XmlElement("driver")]
public Driver? Driver { get; set; }
[XmlElement("feature")]
public Feature[]? Feature { get; set; }
[XmlElement("device")]
public Device[]? Device { get; set; }
[XmlElement("slot")]
public Slot[]? Slot { get; set; }
[XmlElement("softwarelist")]
public SoftwareList[]? SoftwareList { get; set; }
[XmlElement("ramoption")]
public RamOption[]? RamOption { 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

@@ -16,8 +16,9 @@ namespace SabreTools.Models.Listxml
[XmlAttribute("mameconfig")]
public string MameConfig { get; set; }
[XmlElement("machine")]
public Machine[] Machine { get; set; }
[XmlElement("machine", typeof(Machine))]
[XmlElement("game", typeof(Game))]
public GameBase[] Game { get; set; }
#region DO NOT USE IN PRODUCTION

View File

@@ -39,6 +39,14 @@ namespace SabreTools.Models.Listxml
[XmlAttribute("optional")]
public string? Optional { get; set; }
/// <remarks>(yes|no) "no", Only present in older versions</remarks>
[XmlAttribute("dispose")]
public string? Dispose { get; set; }
/// <remarks>(yes|no) "no", Only present in older versions</remarks>
[XmlAttribute("soundonly")]
public string? SoundOnly { get; set; }
#region DO NOT USE IN PRODUCTION
/// <remarks>Should be empty</remarks>

View File

@@ -0,0 +1,49 @@
using System.Xml;
using System.Xml.Serialization;
namespace SabreTools.Models.Listxml
{
[XmlRoot("video")]
public class Video
{
/// <remarks>(raster|vector)</remarks>
[XmlAttribute("screen")]
public string Screen { get; set; }
/// <remarks>(vertical|horizontal)</remarks>
[XmlAttribute("orientation")]
public string Orientation { get; set; }
/// <remarks>Numeric?</remarks>
[XmlAttribute("width")]
public string? Width { get; set; }
/// <remarks>Numeric?</remarks>
[XmlAttribute("height")]
public string? Height { get; set; }
/// <remarks>Numeric?</remarks>
[XmlAttribute("aspectx")]
public string? AspectX { get; set; }
/// <remarks>Numeric?</remarks>
[XmlAttribute("aspecty")]
public string? AspectY { get; set; }
/// <remarks>Numeric?</remarks>
[XmlAttribute("refresh")]
public string? Refresh { 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
}
}