mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-05-06 20:43:36 +00:00
44 lines
1.3 KiB
C#
44 lines
1.3 KiB
C#
using System.Xml.Serialization;
|
|
using Newtonsoft.Json;
|
|
|
|
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
|
|
bool? soundOnly = ReadBool(Data.Models.Metadata.Chip.SoundOnlyKey);
|
|
if (soundOnly is not null)
|
|
Write<string?>(Data.Models.Metadata.Chip.SoundOnlyKey, soundOnly.FromYesNo());
|
|
|
|
string? chipType = ReadString(Data.Models.Metadata.Chip.ChipTypeKey);
|
|
if (chipType is not null)
|
|
Write<string?>(Data.Models.Metadata.Chip.ChipTypeKey, chipType.AsChipType().AsStringValue());
|
|
}
|
|
|
|
public Chip(Data.Models.Metadata.Chip item, Machine machine, Source source) : this(item)
|
|
{
|
|
Write<Source?>(SourceKey, source);
|
|
CopyMachineInformation(machine);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|