mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Convert remaining items, add NameKey
This commit is contained in:
@@ -8,55 +8,22 @@ namespace SabreTools.DatItems.Formats
|
||||
/// Represents which Chip(s) is associated with a set
|
||||
/// </summary>
|
||||
[JsonObject("chip"), XmlRoot("chip")]
|
||||
public class Chip : DatItem
|
||||
public sealed class Chip : DatItem<Models.Metadata.Chip>
|
||||
{
|
||||
#region Accessors
|
||||
#region Fields
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string? GetName() => GetFieldValue<string>(Models.Metadata.Chip.NameKey);
|
||||
/// <inheritdoc>/>
|
||||
protected override ItemType ItemType => ItemType.Chip;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void SetName(string? name) => SetFieldValue(Models.Metadata.Chip.NameKey, name);
|
||||
/// <inheritdoc>/>
|
||||
protected override string? NameKey => Models.Metadata.Chip.NameKey;
|
||||
|
||||
#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 ?? [],
|
||||
};
|
||||
}
|
||||
public Chip() : base() { }
|
||||
public Chip(Models.Metadata.Chip item) : base(item) { }
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user