2020-12-14 10:58:43 -08:00
|
|
|
|
using System.Xml.Serialization;
|
2020-09-02 15:38:10 -07:00
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
using Newtonsoft.Json.Converters;
|
2022-11-03 12:22:17 -07:00
|
|
|
|
using SabreTools.Core;
|
2020-09-02 15:38:10 -07:00
|
|
|
|
|
2021-02-02 10:23:43 -08:00
|
|
|
|
namespace SabreTools.DatItems.Formats
|
2020-09-02 15:38:10 -07:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Represents the a driver of the machine
|
|
|
|
|
|
/// </summary>
|
2022-11-03 12:22:17 -07:00
|
|
|
|
/// <remarks>
|
|
|
|
|
|
/// TODO: Add new fields to documentation
|
|
|
|
|
|
/// </remarks>
|
2020-09-08 10:12:41 -07:00
|
|
|
|
[JsonObject("driver"), XmlRoot("driver")]
|
2020-09-02 15:38:10 -07:00
|
|
|
|
public class Driver : DatItem
|
|
|
|
|
|
{
|
|
|
|
|
|
#region Fields
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Overall driver status
|
|
|
|
|
|
/// </summary>
|
2022-11-03 12:22:17 -07:00
|
|
|
|
[JsonProperty("status", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("status")]
|
2020-09-02 15:38:10 -07:00
|
|
|
|
[JsonConverter(typeof(StringEnumConverter))]
|
|
|
|
|
|
public SupportStatus Status { get; set; }
|
|
|
|
|
|
|
2020-09-07 22:00:02 -07:00
|
|
|
|
[JsonIgnore]
|
|
|
|
|
|
public bool StatusSpecified { get { return Status != SupportStatus.NULL; } }
|
|
|
|
|
|
|
2020-09-02 15:38:10 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Driver emulation status
|
|
|
|
|
|
/// </summary>
|
2022-11-03 12:22:17 -07:00
|
|
|
|
[JsonProperty("emulation", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("emulation")]
|
2020-09-02 15:38:10 -07:00
|
|
|
|
[JsonConverter(typeof(StringEnumConverter))]
|
|
|
|
|
|
public SupportStatus Emulation { get; set; }
|
|
|
|
|
|
|
2020-09-07 22:00:02 -07:00
|
|
|
|
[JsonIgnore]
|
2022-11-03 12:22:17 -07:00
|
|
|
|
public bool EmulationSpecified { get { return Emulation != SupportStatus.NULL; } }
|
2020-09-07 22:00:02 -07:00
|
|
|
|
|
2020-09-02 15:38:10 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Cocktail orientation status
|
|
|
|
|
|
/// </summary>
|
2022-11-03 12:22:17 -07:00
|
|
|
|
[JsonProperty("cocktail", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("cocktail")]
|
2020-09-02 15:38:10 -07:00
|
|
|
|
[JsonConverter(typeof(StringEnumConverter))]
|
|
|
|
|
|
public SupportStatus Cocktail { get; set; }
|
|
|
|
|
|
|
2020-09-07 22:00:02 -07:00
|
|
|
|
[JsonIgnore]
|
2022-11-03 12:22:17 -07:00
|
|
|
|
public bool CocktailSpecified { get { return Cocktail != SupportStatus.NULL; } }
|
2020-09-07 22:00:02 -07:00
|
|
|
|
|
2020-09-02 15:38:10 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Save state support status
|
|
|
|
|
|
/// </summary>
|
2022-11-03 12:22:17 -07:00
|
|
|
|
[JsonProperty("savestate", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("savestate")]
|
2020-09-02 15:38:10 -07:00
|
|
|
|
[JsonConverter(typeof(StringEnumConverter))]
|
|
|
|
|
|
public Supported SaveState { get; set; }
|
|
|
|
|
|
|
2020-09-07 22:00:02 -07:00
|
|
|
|
[JsonIgnore]
|
|
|
|
|
|
public bool SaveStateSpecified { get { return SaveState != Supported.NULL; } }
|
|
|
|
|
|
|
2022-11-03 11:37:55 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Requires artwork
|
|
|
|
|
|
/// </summary>
|
2022-11-03 12:22:17 -07:00
|
|
|
|
[JsonProperty("requiresartwork", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("requiresartwork")]
|
2022-11-03 11:37:55 -07:00
|
|
|
|
public bool? RequiresArtwork { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
|
public bool RequiresArtworkSpecified { get { return RequiresArtwork != null; } }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Unofficial
|
|
|
|
|
|
/// </summary>
|
2022-11-03 12:22:17 -07:00
|
|
|
|
[JsonProperty("unofficial", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("unofficial")]
|
2022-11-03 11:37:55 -07:00
|
|
|
|
public bool? Unofficial { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
|
public bool UnofficialSpecified { get { return Unofficial != null; } }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// No sound hardware
|
|
|
|
|
|
/// </summary>
|
2022-11-03 12:22:17 -07:00
|
|
|
|
[JsonProperty("nosoundhardware", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("nosoundhardware")]
|
2022-11-03 11:37:55 -07:00
|
|
|
|
public bool? NoSoundHardware { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
|
public bool NoSoundHardwareSpecified { get { return NoSoundHardware != null; } }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Incomplete
|
|
|
|
|
|
/// </summary>
|
2022-11-03 12:22:17 -07:00
|
|
|
|
[JsonProperty("incomplete", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("incomplete")]
|
2022-11-03 11:37:55 -07:00
|
|
|
|
public bool? Incomplete { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
|
public bool IncompleteSpecified { get { return Incomplete != null; } }
|
|
|
|
|
|
|
2020-09-02 15:38:10 -07:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Constructors
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Create a default, empty Driver object
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public Driver()
|
|
|
|
|
|
{
|
|
|
|
|
|
ItemType = ItemType.Driver;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Cloning Methods
|
|
|
|
|
|
|
2022-11-03 12:22:17 -07:00
|
|
|
|
/// <inheritdoc/>
|
2020-09-02 15:38:10 -07:00
|
|
|
|
public override object Clone()
|
|
|
|
|
|
{
|
|
|
|
|
|
return new Driver()
|
|
|
|
|
|
{
|
|
|
|
|
|
ItemType = this.ItemType,
|
|
|
|
|
|
DupeType = this.DupeType,
|
|
|
|
|
|
|
|
|
|
|
|
Machine = this.Machine.Clone() as Machine,
|
|
|
|
|
|
Source = this.Source.Clone() as Source,
|
|
|
|
|
|
Remove = this.Remove,
|
|
|
|
|
|
|
|
|
|
|
|
Status = this.Status,
|
|
|
|
|
|
Emulation = this.Emulation,
|
|
|
|
|
|
Cocktail = this.Cocktail,
|
|
|
|
|
|
SaveState = this.SaveState,
|
2022-11-03 11:37:55 -07:00
|
|
|
|
RequiresArtwork = this.RequiresArtwork,
|
|
|
|
|
|
Unofficial = this.Unofficial,
|
|
|
|
|
|
NoSoundHardware = this.NoSoundHardware,
|
|
|
|
|
|
Incomplete = this.Incomplete,
|
2020-09-02 15:38:10 -07:00
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Comparision Methods
|
|
|
|
|
|
|
2022-11-03 12:22:17 -07:00
|
|
|
|
/// <inheritdoc/>
|
2020-09-02 15:38:10 -07:00
|
|
|
|
public override bool Equals(DatItem other)
|
|
|
|
|
|
{
|
|
|
|
|
|
// If we don't have a Driver, return false
|
|
|
|
|
|
if (ItemType != other.ItemType)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
// Otherwise, treat it as a Driver
|
|
|
|
|
|
Driver newOther = other as Driver;
|
|
|
|
|
|
|
|
|
|
|
|
// If the Feature information matches
|
|
|
|
|
|
return (Status == newOther.Status
|
|
|
|
|
|
&& Emulation == newOther.Emulation
|
|
|
|
|
|
&& Cocktail == newOther.Cocktail
|
2022-11-03 11:37:55 -07:00
|
|
|
|
&& SaveState == newOther.SaveState
|
|
|
|
|
|
&& RequiresArtwork == newOther.RequiresArtwork
|
|
|
|
|
|
&& Unofficial == newOther.Unofficial
|
|
|
|
|
|
&& NoSoundHardware == newOther.NoSoundHardware
|
|
|
|
|
|
&& Incomplete == newOther.Incomplete);
|
2020-09-02 15:38:10 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|