mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
98 lines
2.7 KiB
C#
98 lines
2.7 KiB
C#
using System.Xml.Serialization;
|
|
using Newtonsoft.Json;
|
|
using SabreTools.Core;
|
|
|
|
namespace SabreTools.DatItems.Formats
|
|
{
|
|
/// <summary>
|
|
/// Represents one diplocation
|
|
/// </summary>
|
|
[JsonObject("diplocation"), XmlRoot("diplocation")]
|
|
public class DipLocation : DatItem
|
|
{
|
|
#region Fields
|
|
|
|
/// <summary>
|
|
/// Location name
|
|
/// </summary>
|
|
[JsonProperty("name"), XmlElement("name")]
|
|
public string? Name
|
|
{
|
|
get => _internal.ReadString(Models.Internal.DipLocation.NameKey);
|
|
set => _internal[Models.Internal.DipLocation.NameKey] = value;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Location ID
|
|
/// </summary>
|
|
[JsonProperty("number", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("number")]
|
|
public long? Number
|
|
{
|
|
get => _internal.ReadLong(Models.Internal.DipLocation.NameKey);
|
|
set => _internal[Models.Internal.DipLocation.NameKey] = value;
|
|
}
|
|
|
|
[JsonIgnore]
|
|
public bool NumberSpecified { get { return Number != null; } }
|
|
|
|
/// <summary>
|
|
/// Determines if location is inverted or not
|
|
/// </summary>
|
|
[JsonProperty("inverted", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("inverted")]
|
|
public bool? Inverted
|
|
{
|
|
get => _internal.ReadBool(Models.Internal.DipLocation.InvertedKey);
|
|
set => _internal[Models.Internal.DipLocation.InvertedKey] = value;
|
|
}
|
|
|
|
[JsonIgnore]
|
|
public bool InvertedSpecified { get { return Inverted != null; } }
|
|
|
|
#endregion
|
|
|
|
#region Accessors
|
|
|
|
/// <inheritdoc/>
|
|
public override string? GetName() => Name;
|
|
|
|
/// <inheritdoc/>
|
|
public override void SetName(string? name) => Name = name;
|
|
|
|
#endregion
|
|
|
|
#region Constructors
|
|
|
|
/// <summary>
|
|
/// Create a default, empty DipLocation object
|
|
/// </summary>
|
|
public DipLocation()
|
|
{
|
|
_internal = new Models.Internal.DipLocation();
|
|
Name = string.Empty;
|
|
ItemType = ItemType.DipLocation;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Cloning Methods
|
|
|
|
/// <inheritdoc/>
|
|
public override object Clone()
|
|
{
|
|
return new DipLocation()
|
|
{
|
|
ItemType = this.ItemType,
|
|
DupeType = this.DupeType,
|
|
|
|
Machine = this.Machine?.Clone() as Machine,
|
|
Source = this.Source?.Clone() as Source,
|
|
Remove = this.Remove,
|
|
|
|
_internal = this._internal?.Clone() as Models.Internal.DipLocation ?? new Models.Internal.DipLocation(),
|
|
};
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|