mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
235 lines
7.8 KiB
C#
235 lines
7.8 KiB
C#
using System.Xml.Serialization;
|
|
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Converters;
|
|
using SabreTools.Core;
|
|
using SabreTools.Core.Tools;
|
|
|
|
namespace SabreTools.DatItems.Formats
|
|
{
|
|
/// <summary>
|
|
/// Represents one machine display
|
|
/// </summary>
|
|
[JsonObject("display"), XmlRoot("display")]
|
|
public class Display : DatItem
|
|
{
|
|
#region Fields
|
|
|
|
/// <summary>
|
|
/// Display tag
|
|
/// </summary>
|
|
[JsonProperty("tag", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("tag")]
|
|
public string? Tag
|
|
{
|
|
get => _internal.ReadString(Models.Internal.Display.TagKey);
|
|
set => _internal[Models.Internal.Display.TagKey] = value;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Display type
|
|
/// </summary>
|
|
[JsonProperty("type", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("type")]
|
|
[JsonConverter(typeof(StringEnumConverter))]
|
|
public DisplayType DisplayType
|
|
{
|
|
get => _internal.ReadString(Models.Internal.Display.DisplayTypeKey).AsDisplayType();
|
|
set => _internal[Models.Internal.Display.DisplayTypeKey] = value.FromDisplayType();
|
|
}
|
|
|
|
[JsonIgnore]
|
|
public bool DisplayTypeSpecified { get { return DisplayType != DisplayType.NULL; } }
|
|
|
|
/// <summary>
|
|
/// Display rotation
|
|
/// </summary>
|
|
[JsonProperty("rotate", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("rotate")]
|
|
public long? Rotate
|
|
{
|
|
get => _internal.ReadLong(Models.Internal.Display.RotateKey);
|
|
set => _internal[Models.Internal.Display.RotateKey] = value;
|
|
}
|
|
|
|
[JsonIgnore]
|
|
public bool RotateSpecified { get { return Rotate != null; } }
|
|
|
|
/// <summary>
|
|
/// Determines if display is flipped in the X-coordinates
|
|
/// </summary>
|
|
[JsonProperty("flipx", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("flipx")]
|
|
public bool? FlipX
|
|
{
|
|
get => _internal.ReadBool(Models.Internal.Display.FlipXKey);
|
|
set => _internal[Models.Internal.Display.FlipXKey] = value;
|
|
}
|
|
|
|
[JsonIgnore]
|
|
public bool FlipXSpecified { get { return FlipX != null; } }
|
|
|
|
/// <summary>
|
|
/// Display width
|
|
/// </summary>
|
|
[JsonProperty("width", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("width")]
|
|
public long? Width
|
|
{
|
|
get => _internal.ReadLong(Models.Internal.Display.WidthKey);
|
|
set => _internal[Models.Internal.Display.WidthKey] = value;
|
|
}
|
|
|
|
[JsonIgnore]
|
|
public bool WidthSpecified { get { return Width != null; } }
|
|
|
|
/// <summary>
|
|
/// Display height
|
|
/// </summary>
|
|
[JsonProperty("height", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("height")]
|
|
public long? Height
|
|
{
|
|
get => _internal.ReadLong(Models.Internal.Display.HeightKey);
|
|
set => _internal[Models.Internal.Display.HeightKey] = value;
|
|
}
|
|
|
|
[JsonIgnore]
|
|
public bool HeightSpecified { get { return Height != null; } }
|
|
|
|
/// <summary>
|
|
/// Refresh rate
|
|
/// </summary>
|
|
[JsonProperty("refresh", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("refresh")]
|
|
public double? Refresh
|
|
{
|
|
get => _internal.ReadDouble(Models.Internal.Display.RefreshKey);
|
|
set => _internal[Models.Internal.Display.RefreshKey] = value;
|
|
}
|
|
|
|
[JsonIgnore]
|
|
public bool RefreshSpecified { get { return Refresh != null; } }
|
|
|
|
/// <summary>
|
|
/// Pixel clock timer
|
|
/// </summary>
|
|
[JsonProperty("pixclock", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("pixclock")]
|
|
public long? PixClock
|
|
{
|
|
get => _internal.ReadLong(Models.Internal.Display.PixClockKey);
|
|
set => _internal[Models.Internal.Display.PixClockKey] = value;
|
|
}
|
|
|
|
[JsonIgnore]
|
|
public bool PixClockSpecified { get { return PixClock != null; } }
|
|
|
|
/// <summary>
|
|
/// Total horizontal lines
|
|
/// </summary>
|
|
[JsonProperty("htotal", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("htotal")]
|
|
public long? HTotal
|
|
{
|
|
get => _internal.ReadLong(Models.Internal.Display.HTotalKey);
|
|
set => _internal[Models.Internal.Display.HTotalKey] = value;
|
|
}
|
|
|
|
[JsonIgnore]
|
|
public bool HTotalSpecified { get { return HTotal != null; } }
|
|
|
|
/// <summary>
|
|
/// Horizontal blank end
|
|
/// </summary>
|
|
[JsonProperty("hbend", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("hbend")]
|
|
public long? HBEnd
|
|
{
|
|
get => _internal.ReadLong(Models.Internal.Display.HBEndKey);
|
|
set => _internal[Models.Internal.Display.HBEndKey] = value;
|
|
}
|
|
|
|
[JsonIgnore]
|
|
public bool HBEndSpecified { get { return HBEnd != null; } }
|
|
|
|
/// <summary>
|
|
/// Horizontal blank start
|
|
/// </summary>
|
|
[JsonProperty("hbstart", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("hbstart")]
|
|
public long? HBStart
|
|
{
|
|
get => _internal.ReadLong(Models.Internal.Display.HBStartKey);
|
|
set => _internal[Models.Internal.Display.HBStartKey] = value;
|
|
}
|
|
|
|
[JsonIgnore]
|
|
public bool HBStartSpecified { get { return HBStart != null; } }
|
|
|
|
/// <summary>
|
|
/// Total vertical lines
|
|
/// </summary>
|
|
[JsonProperty("vtotal", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("vtotal")]
|
|
public long? VTotal
|
|
{
|
|
get => _internal.ReadLong(Models.Internal.Display.VTotalKey);
|
|
set => _internal[Models.Internal.Display.VTotalKey] = value;
|
|
}
|
|
|
|
[JsonIgnore]
|
|
public bool VTotalSpecified { get { return VTotal != null; } }
|
|
|
|
/// <summary>
|
|
/// Vertical blank end
|
|
/// </summary>
|
|
[JsonProperty("vbend", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("vbend")]
|
|
public long? VBEnd
|
|
{
|
|
get => _internal.ReadLong(Models.Internal.Display.VBEndKey);
|
|
set => _internal[Models.Internal.Display.VBEndKey] = value;
|
|
}
|
|
|
|
[JsonIgnore]
|
|
public bool VBEndSpecified { get { return VBEnd != null; } }
|
|
|
|
/// <summary>
|
|
/// Vertical blank start
|
|
/// </summary>
|
|
[JsonProperty("vbstart", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("vbstart")]
|
|
public long? VBStart
|
|
{
|
|
get => _internal.ReadLong(Models.Internal.Display.VBStartKey);
|
|
set => _internal[Models.Internal.Display.VBStartKey] = value;
|
|
}
|
|
|
|
[JsonIgnore]
|
|
public bool VBStartSpecified { get { return VBStart != null; } }
|
|
|
|
#endregion
|
|
|
|
#region Constructors
|
|
|
|
/// <summary>
|
|
/// Create a default, empty Display object
|
|
/// </summary>
|
|
public Display()
|
|
{
|
|
_internal = new Models.Internal.Display();
|
|
Machine = new Machine();
|
|
|
|
ItemType = ItemType.Display;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Cloning Methods
|
|
|
|
/// <inheritdoc/>
|
|
public override object Clone()
|
|
{
|
|
return new Display()
|
|
{
|
|
ItemType = this.ItemType,
|
|
DupeType = this.DupeType,
|
|
|
|
Machine = this.Machine.Clone() as Machine ?? new Machine(),
|
|
Source = this.Source?.Clone() as Source,
|
|
Remove = this.Remove,
|
|
|
|
_internal = this._internal?.Clone() as Models.Internal.Display ?? new Models.Internal.Display(),
|
|
};
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|