mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-10-01 11:12:19 +00:00
Convert DipLocation fully over to properties
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
using System;
|
||||
using System.Xml.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SabreTools.Data.Models.Metadata
|
||||
{
|
||||
[JsonObject("diplocation"), XmlRoot("diplocation")]
|
||||
public class DipLocation : DatItem
|
||||
public class DipLocation : DatItem, ICloneable, IEquatable<DipLocation>
|
||||
{
|
||||
#region Properties
|
||||
|
||||
@@ -13,15 +14,44 @@ namespace SabreTools.Data.Models.Metadata
|
||||
|
||||
public string? Name { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keys
|
||||
|
||||
/// <remarks>string, possibly long</remarks>
|
||||
public const string NumberKey = "number";
|
||||
public long? Number { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public DipLocation() => ItemType = ItemType.DipLocation;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public object Clone()
|
||||
{
|
||||
var obj = new DipLocation();
|
||||
|
||||
obj.Inverted = Inverted;
|
||||
obj.Name = Name;
|
||||
obj.Number = Number;
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Equals(DipLocation? other)
|
||||
{
|
||||
// Null never matches
|
||||
if (other is null)
|
||||
return false;
|
||||
|
||||
// Properties
|
||||
if (Inverted != other.Inverted)
|
||||
return false;
|
||||
|
||||
if ((Name is null) ^ (other.Name is null))
|
||||
return false;
|
||||
else if (Name is not null && !Name.Equals(other.Name, StringComparison.OrdinalIgnoreCase))
|
||||
return false;
|
||||
|
||||
if (Number != other.Number)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user