mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-04-09 15:53:06 +00:00
99 lines
2.4 KiB
C#
99 lines
2.4 KiB
C#
using System.Xml.Serialization;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace SabreTools.Metadata.DatItems.Formats
|
|
{
|
|
/// <summary>
|
|
/// Represents a condition on a machine or other item
|
|
/// </summary>
|
|
[JsonObject("condition"), XmlRoot("condition")]
|
|
public sealed class Condition : DatItem<Data.Models.Metadata.Condition>
|
|
{
|
|
#region Properties
|
|
|
|
/// <inheritdoc>/>
|
|
public override Data.Models.Metadata.ItemType ItemType
|
|
=> Data.Models.Metadata.ItemType.Condition;
|
|
|
|
public string? Mask
|
|
{
|
|
get => _internal.Mask;
|
|
set => _internal.Mask = value;
|
|
}
|
|
|
|
public Data.Models.Metadata.Relation? Relation
|
|
{
|
|
get => _internal.Relation;
|
|
set => _internal.Relation = value;
|
|
}
|
|
|
|
public string? Tag
|
|
{
|
|
get => _internal.Tag;
|
|
set => _internal.Tag = value;
|
|
}
|
|
|
|
public string? Value
|
|
{
|
|
get => _internal.Value;
|
|
set => _internal.Value = value;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Constructors
|
|
|
|
public Condition() : base() { }
|
|
|
|
public Condition(Data.Models.Metadata.Condition item) : base(item) { }
|
|
|
|
public Condition(Data.Models.Metadata.Condition item, Machine machine, Source source) : this(item)
|
|
{
|
|
Source = source;
|
|
CopyMachineInformation(machine);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Accessors
|
|
|
|
/// <inheritdoc/>
|
|
public override string? GetName() => null;
|
|
|
|
/// <inheritdoc/>
|
|
public override void SetName(string? name) { }
|
|
|
|
#endregion
|
|
|
|
#region Cloning Methods
|
|
|
|
/// <inheritdoc/>
|
|
public override object Clone() => new Condition(GetInternalClone());
|
|
|
|
/// <inheritdoc/>
|
|
public override Data.Models.Metadata.Condition GetInternalClone()
|
|
=> _internal.Clone() as Data.Models.Metadata.Condition ?? new();
|
|
|
|
#endregion
|
|
|
|
#region Comparision Methods
|
|
|
|
/// <inheritdoc/>
|
|
public override bool Equals(DatItem? other)
|
|
{
|
|
// If the other item is null
|
|
if (other is null)
|
|
return false;
|
|
|
|
// If the type matches
|
|
if (other is Condition otherCondition)
|
|
return _internal.Equals(otherCondition._internal);
|
|
|
|
// Everything else fails
|
|
return false;
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|