mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-04-05 22:01:33 +00:00
42 lines
1.4 KiB
C#
42 lines
1.4 KiB
C#
using System.Xml.Serialization;
|
|
using Newtonsoft.Json;
|
|
using SabreTools.Metadata.Tools;
|
|
|
|
namespace SabreTools.Metadata.DatItems.Formats
|
|
{
|
|
/// <summary>
|
|
/// Represents which Chip(s) is associated with a set
|
|
/// </summary>
|
|
[JsonObject("chip"), XmlRoot("chip")]
|
|
public sealed class Chip : DatItem<Data.Models.Metadata.Chip>
|
|
{
|
|
#region Fields
|
|
|
|
/// <inheritdoc>/>
|
|
protected override ItemType ItemType => ItemType.Chip;
|
|
|
|
#endregion
|
|
|
|
#region Constructors
|
|
|
|
public Chip() : base() { }
|
|
|
|
public Chip(Data.Models.Metadata.Chip item) : base(item)
|
|
{
|
|
// Process flag values
|
|
if (GetBoolFieldValue(Data.Models.Metadata.Chip.SoundOnlyKey) is not null)
|
|
SetFieldValue<string?>(Data.Models.Metadata.Chip.SoundOnlyKey, GetBoolFieldValue(Data.Models.Metadata.Chip.SoundOnlyKey).FromYesNo());
|
|
if (GetStringFieldValue(Data.Models.Metadata.Chip.ChipTypeKey) is not null)
|
|
SetFieldValue<string?>(Data.Models.Metadata.Chip.ChipTypeKey, GetStringFieldValue(Data.Models.Metadata.Chip.ChipTypeKey).AsChipType().AsStringValue());
|
|
}
|
|
|
|
public Chip(Data.Models.Metadata.Chip item, Machine machine, Source source) : this(item)
|
|
{
|
|
SetFieldValue<Source?>(SourceKey, source);
|
|
CopyMachineInformation(machine);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|