2020-12-14 10:58:43 -08:00
|
|
|
|
using System.Xml.Serialization;
|
2020-08-23 22:23:55 -07:00
|
|
|
|
using Newtonsoft.Json;
|
2022-11-03 12:22:17 -07:00
|
|
|
|
using SabreTools.Core;
|
2024-03-05 01:42:42 -05:00
|
|
|
|
using SabreTools.Filter;
|
2016-10-12 16:02:51 -07:00
|
|
|
|
|
2021-02-02 10:23:43 -08:00
|
|
|
|
namespace SabreTools.DatItems.Formats
|
2016-09-19 18:04:24 -07:00
|
|
|
|
{
|
2019-01-08 17:40:12 -08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Represents which BIOS(es) is associated with a set
|
|
|
|
|
|
/// </summary>
|
2020-09-08 10:12:41 -07:00
|
|
|
|
[JsonObject("biosset"), XmlRoot("biosset")]
|
2019-01-08 17:40:12 -08:00
|
|
|
|
public class BiosSet : DatItem
|
|
|
|
|
|
{
|
2020-08-20 13:17:14 -07:00
|
|
|
|
#region Fields
|
2019-01-08 17:40:12 -08:00
|
|
|
|
|
2020-09-02 12:19:12 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Name of the item
|
|
|
|
|
|
/// </summary>
|
2022-11-03 12:22:17 -07:00
|
|
|
|
[JsonProperty("name"), XmlElement("name")]
|
2023-08-14 13:17:51 -04:00
|
|
|
|
public string? Name
|
|
|
|
|
|
{
|
2023-09-04 23:51:37 -04:00
|
|
|
|
get => _internal.ReadString(Models.Metadata.BiosSet.NameKey);
|
|
|
|
|
|
set => _internal[Models.Metadata.BiosSet.NameKey] = value;
|
2023-08-14 13:17:51 -04:00
|
|
|
|
}
|
2020-09-02 12:19:12 -07:00
|
|
|
|
|
2019-01-08 17:40:12 -08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Description of the BIOS
|
|
|
|
|
|
/// </summary>
|
2022-11-03 12:22:17 -07:00
|
|
|
|
[JsonProperty("description", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("description")]
|
2023-08-14 13:17:51 -04:00
|
|
|
|
public string? Description
|
|
|
|
|
|
{
|
2023-09-04 23:51:37 -04:00
|
|
|
|
get => _internal.ReadString(Models.Metadata.BiosSet.DescriptionKey);
|
|
|
|
|
|
set => _internal[Models.Metadata.BiosSet.DescriptionKey] = value;
|
2023-08-14 13:17:51 -04:00
|
|
|
|
}
|
2019-01-08 17:40:12 -08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Determine whether the BIOS is default
|
|
|
|
|
|
/// </summary>
|
2022-11-03 12:22:17 -07:00
|
|
|
|
[JsonProperty("default", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("default")]
|
2023-08-14 13:17:51 -04:00
|
|
|
|
public bool? Default
|
|
|
|
|
|
{
|
2023-09-04 23:51:37 -04:00
|
|
|
|
get => _internal.ReadBool(Models.Metadata.BiosSet.DefaultKey);
|
|
|
|
|
|
set => _internal[Models.Metadata.BiosSet.DefaultKey] = value;
|
2023-08-14 13:17:51 -04:00
|
|
|
|
}
|
2019-01-08 17:40:12 -08:00
|
|
|
|
|
2020-09-07 22:00:02 -07:00
|
|
|
|
[JsonIgnore]
|
|
|
|
|
|
public bool DefaultSpecified { get { return Default != null; } }
|
|
|
|
|
|
|
2019-01-08 17:40:12 -08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
2020-08-17 17:28:32 -07:00
|
|
|
|
#region Accessors
|
|
|
|
|
|
|
2020-12-13 14:01:16 -08:00
|
|
|
|
/// <inheritdoc/>
|
2023-08-14 13:17:51 -04:00
|
|
|
|
public override string? GetName() => Name;
|
2020-09-02 12:19:12 -07:00
|
|
|
|
|
2020-12-13 14:01:16 -08:00
|
|
|
|
/// <inheritdoc/>
|
2023-08-14 13:17:51 -04:00
|
|
|
|
public override void SetName(string? name) => Name = name;
|
2020-12-13 14:01:16 -08:00
|
|
|
|
|
2020-08-17 17:28:32 -07:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
2019-01-08 17:40:12 -08:00
|
|
|
|
#region Constructors
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2020-08-31 23:26:07 -07:00
|
|
|
|
/// Create a default, empty BiosSet object
|
2019-01-08 17:40:12 -08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public BiosSet()
|
|
|
|
|
|
{
|
2023-09-04 23:51:37 -04:00
|
|
|
|
_internal = new Models.Metadata.BiosSet();
|
2023-08-15 01:38:01 -04:00
|
|
|
|
Machine = new Machine();
|
|
|
|
|
|
|
2020-08-20 13:17:14 -07:00
|
|
|
|
Name = string.Empty;
|
|
|
|
|
|
ItemType = ItemType.BiosSet;
|
2019-01-08 17:40:12 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Cloning Methods
|
|
|
|
|
|
|
2022-11-03 12:22:17 -07:00
|
|
|
|
/// <inheritdoc/>
|
2019-01-08 17:40:12 -08:00
|
|
|
|
public override object Clone()
|
|
|
|
|
|
{
|
|
|
|
|
|
return new BiosSet()
|
|
|
|
|
|
{
|
|
|
|
|
|
ItemType = this.ItemType,
|
|
|
|
|
|
DupeType = this.DupeType,
|
|
|
|
|
|
|
2023-08-15 01:38:01 -04:00
|
|
|
|
Machine = this.Machine.Clone() as Machine ?? new Machine(),
|
2023-08-14 13:17:51 -04:00
|
|
|
|
Source = this.Source?.Clone() as Source,
|
2020-08-20 13:17:14 -07:00
|
|
|
|
Remove = this.Remove,
|
2019-01-08 17:40:12 -08:00
|
|
|
|
|
2024-02-28 19:19:50 -05:00
|
|
|
|
_internal = this._internal?.Clone() as Models.Metadata.BiosSet ?? [],
|
2019-01-08 17:40:12 -08:00
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
2016-09-19 18:04:24 -07:00
|
|
|
|
}
|