mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
64 lines
1.6 KiB
C#
64 lines
1.6 KiB
C#
using System.Xml.Serialization;
|
|
using Newtonsoft.Json;
|
|
using SabreTools.Core;
|
|
|
|
namespace SabreTools.DatItems.Formats
|
|
{
|
|
/// <summary>
|
|
/// Represents which Chip(s) is associated with a set
|
|
/// </summary>
|
|
[JsonObject("chip"), XmlRoot("chip")]
|
|
public class Chip : DatItem
|
|
{
|
|
#region Accessors
|
|
|
|
/// <inheritdoc/>
|
|
public override string? GetName() => GetFieldValue<string>(Models.Metadata.Chip.NameKey);
|
|
|
|
/// <inheritdoc/>
|
|
public override void SetName(string? name) => SetFieldValue(Models.Metadata.Chip.NameKey, name);
|
|
|
|
#endregion
|
|
|
|
#region Constructors
|
|
|
|
/// <summary>
|
|
/// Create a default, empty Chip object
|
|
/// </summary>
|
|
public Chip()
|
|
{
|
|
_internal = new Models.Metadata.Chip();
|
|
|
|
SetName(string.Empty);
|
|
SetFieldValue<ItemType>(Models.Metadata.DatItem.TypeKey, ItemType.Chip);
|
|
SetFieldValue<Machine>(DatItem.MachineKey, new Machine());
|
|
}
|
|
|
|
/// <summary>
|
|
/// Create a Chip object from the internal model
|
|
/// </summary>
|
|
public Chip(Models.Metadata.Chip? item)
|
|
{
|
|
_internal = item ?? [];
|
|
|
|
SetFieldValue<ItemType>(Models.Metadata.DatItem.TypeKey, ItemType.Chip);
|
|
SetFieldValue<Machine>(DatItem.MachineKey, new Machine());
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Cloning Methods
|
|
|
|
/// <inheritdoc/>
|
|
public override object Clone()
|
|
{
|
|
return new Chip()
|
|
{
|
|
_internal = this._internal?.Clone() as Models.Metadata.Chip ?? [],
|
|
};
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|