mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Make items XML serializable
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user