Make items XML serializable

This commit is contained in:
Matt Nadareski
2020-09-07 22:00:02 -07:00
parent d70415b989
commit 60818dba00
39 changed files with 523 additions and 94 deletions

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Serialization;
using SabreTools.Library.Filtering;
using SabreTools.Library.Tools;
@@ -12,6 +13,7 @@ namespace SabreTools.Library.DatItems
/// Represents one ListXML input
/// </summary>
[JsonObject("input")]
[XmlRoot("input")]
public class Input : DatItem
{
#region Fields
@@ -20,32 +22,52 @@ namespace SabreTools.Library.DatItems
/// Input service ID
/// </summary>
[JsonProperty("service", DefaultValueHandling = DefaultValueHandling.Ignore)]
[XmlElement("service")]
public bool? Service { get; set; }
[JsonIgnore]
public bool ServiceSpecified { get { return Service != null; } }
/// <summary>
/// Determins if this has a tilt sensor
/// </summary>
[JsonProperty("tilt", DefaultValueHandling = DefaultValueHandling.Ignore)]
[XmlElement("tilt")]
public bool? Tilt { get; set; }
[JsonIgnore]
public bool TiltSpecified { get { return Tilt != null; } }
/// <summary>
/// Number of players on the input
/// </summary>
[JsonProperty("players", DefaultValueHandling = DefaultValueHandling.Ignore)]
[XmlElement("players")]
public long? Players { get; set; }
[JsonIgnore]
public bool PlayersSpecified { get { return Players != null; } }
/// <summary>
/// Number of coins required
/// </summary>
[JsonProperty("coins", DefaultValueHandling = DefaultValueHandling.Ignore)]
[XmlElement("coins")]
public long? Coins { get; set; }
[JsonIgnore]
public bool CoinsSpecified { get { return Coins != null; } }
/// <summary>
/// Set of controls for the input
/// </summary>
[JsonProperty("controls", DefaultValueHandling = DefaultValueHandling.Ignore)]
[XmlElement("controls")]
public List<Control> Controls { get; set; }
[JsonIgnore]
public bool ControlsSpecified { get { return Controls != null && Controls.Count > 0; } }
#endregion
#region Accessors