Files
SabreTools/SabreTools.DatItems/Formats/SoftwareList.cs

66 lines
1.8 KiB
C#
Raw Normal View History

using System.Xml.Serialization;
2020-08-31 23:26:07 -07:00
using Newtonsoft.Json;
using SabreTools.Core;
2020-08-31 23:26:07 -07:00
2021-02-02 10:23:43 -08:00
namespace SabreTools.DatItems.Formats
2020-08-31 23:26:07 -07:00
{
/// <summary>
/// Represents which SoftwareList(s) is associated with a set
/// </summary>
2022-11-03 12:22:17 -07:00
/// <remarks>
/// TODO: Add new fields to documentation
/// </remarks>
2020-09-08 10:12:41 -07:00
[JsonObject("softwarelist"), XmlRoot("softwarelist")]
2020-08-31 23:26:07 -07:00
public class SoftwareList : DatItem
{
#region Accessors
/// <inheritdoc/>
2024-03-08 15:31:21 -05:00
public override string? GetName() => GetFieldValue<string>(Models.Metadata.SoftwareList.NameKey);
2020-09-02 12:19:12 -07:00
/// <inheritdoc/>
2024-03-08 15:31:21 -05:00
public override void SetName(string? name) => SetFieldValue(Models.Metadata.SoftwareList.NameKey, name);
2020-08-31 23:26:07 -07:00
#endregion
#region Constructors
/// <summary>
/// Create a default, empty SoftwareList object
/// </summary>
public SoftwareList()
{
2023-09-04 23:51:37 -04:00
_internal = new Models.Metadata.SoftwareList();
2023-08-15 01:38:01 -04:00
2024-03-08 20:42:24 -05:00
SetName(string.Empty);
2024-03-10 16:49:07 -04:00
SetFieldValue<ItemType>(Models.Metadata.DatItem.TypeKey, ItemType.SoftwareList);
SetFieldValue<Machine>(DatItem.MachineKey, new Machine());
2020-08-31 23:26:07 -07:00
}
2024-03-09 21:46:38 -05:00
/// <summary>
/// Create a SoftwareList object from the internal model
/// </summary>
public SoftwareList(Models.Metadata.SoftwareList 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.SoftwareList);
SetFieldValue<Machine>(DatItem.MachineKey, new Machine());
2024-03-09 21:46:38 -05:00
}
2020-08-31 23:26:07 -07:00
#endregion
#region Cloning Methods
public override object Clone()
{
return new SoftwareList()
{
2024-02-28 19:19:50 -05:00
_internal = this._internal?.Clone() as Models.Metadata.SoftwareList ?? [],
2020-08-31 23:26:07 -07:00
};
}
#endregion
}
}