Files
SabreTools/SabreTools.DatItems/Formats/Condition.cs

53 lines
1.4 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 condition on a machine or other item
/// </summary>
2020-09-08 10:12:41 -07:00
[JsonObject("condition"), XmlRoot("condition")]
public class Condition : DatItem
{
#region Constructors
/// <summary>
/// Create a default, empty Condition object
/// </summary>
public Condition()
{
2023-09-04 23:51:37 -04:00
_internal = new Models.Metadata.Condition();
2023-08-15 01:38:01 -04:00
2024-03-10 16:49:07 -04:00
SetFieldValue<ItemType>(Models.Metadata.DatItem.TypeKey, ItemType.Condition);
SetFieldValue<Machine>(DatItem.MachineKey, new Machine());
}
2024-03-09 21:46:38 -05:00
/// <summary>
/// Create a Condition object from the internal model
/// </summary>
public Condition(Models.Metadata.Condition item)
2024-03-09 21:46:38 -05:00
{
_internal = item;
2024-03-09 21:46:38 -05:00
2024-03-10 16:49:07 -04:00
SetFieldValue<ItemType>(Models.Metadata.DatItem.TypeKey, ItemType.Condition);
SetFieldValue<Machine>(DatItem.MachineKey, new Machine());
2024-03-09 21:46:38 -05:00
}
#endregion
#region Cloning Methods
2022-11-03 12:22:17 -07:00
/// <inheritdoc/>
public override object Clone()
{
return new Condition()
{
2024-02-28 19:19:50 -05:00
_internal = this._internal?.Clone() as Models.Metadata.Condition ?? [],
};
}
#endregion
}
}