Files
SabreTools/SabreTools.DatItems/Formats/Analog.cs

74 lines
1.7 KiB
C#
Raw Normal View History

using System.Xml.Serialization;
using Newtonsoft.Json;
2022-11-03 12:22:17 -07:00
using SabreTools.Core;
2021-02-02 10:23:43 -08:00
namespace SabreTools.DatItems.Formats
{
/// <summary>
/// Represents a single analog item
/// </summary>
2020-09-08 10:12:41 -07:00
[JsonObject("analog"), XmlRoot("analog")]
public class Analog : DatItem
{
#region Fields
/// <summary>
/// Analog mask value
/// </summary>
2022-11-03 12:22:17 -07:00
[JsonProperty("mask", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("mask")]
public string Mask { get; set; }
#endregion
#region Constructors
/// <summary>
/// Create a default, empty Analog object
/// </summary>
public Analog()
{
ItemType = ItemType.Analog;
}
#endregion
#region Cloning Methods
2022-11-03 12:22:17 -07:00
/// <inheritdoc/>
public override object Clone()
{
return new Analog()
{
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine.Clone() as Machine,
Source = this.Source.Clone() as Source,
Remove = this.Remove,
Mask = this.Mask,
};
}
#endregion
#region Comparision Methods
2022-11-03 12:22:17 -07:00
/// <inheritdoc/>
public override bool Equals(DatItem other)
{
// If we don't have a Analog, return false
if (ItemType != other.ItemType)
return false;
// Otherwise, treat it as a Analog
Analog newOther = other as Analog;
// If the Feature information matches
return (Mask == newOther.Mask);
}
#endregion
}
}