2026-03-24 18:03:01 -04:00
|
|
|
using System.Xml.Serialization;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
|
|
|
|
namespace SabreTools.Metadata.DatItems.Formats
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Represents one ListXML confsetting
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonObject("confsetting"), XmlRoot("confsetting")]
|
|
|
|
|
public sealed class ConfSetting : DatItem<Data.Models.Metadata.ConfSetting>
|
|
|
|
|
{
|
2026-04-04 16:07:37 -04:00
|
|
|
#region Properties
|
2026-03-24 18:03:01 -04:00
|
|
|
|
2026-04-03 23:33:11 -04:00
|
|
|
public Condition? Condition { get; set; }
|
|
|
|
|
|
2026-03-24 18:03:01 -04:00
|
|
|
[JsonIgnore]
|
2026-04-03 23:33:11 -04:00
|
|
|
public bool ConditionSpecified => Condition is not null;
|
2026-03-24 18:03:01 -04:00
|
|
|
|
2026-04-01 16:52:55 -04:00
|
|
|
public bool? Default
|
|
|
|
|
{
|
|
|
|
|
get => (_internal as Data.Models.Metadata.ConfSetting)?.Default;
|
|
|
|
|
set => (_internal as Data.Models.Metadata.ConfSetting)?.Default = value;
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-02 21:07:41 -04:00
|
|
|
/// <inheritdoc>/>
|
|
|
|
|
public override Data.Models.Metadata.ItemType ItemType
|
|
|
|
|
=> Data.Models.Metadata.ItemType.ConfSetting;
|
|
|
|
|
|
2026-04-02 13:21:37 -04:00
|
|
|
public string? Name
|
|
|
|
|
{
|
|
|
|
|
get => (_internal as Data.Models.Metadata.ConfSetting)?.Name;
|
|
|
|
|
set => (_internal as Data.Models.Metadata.ConfSetting)?.Name = value;
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-02 11:18:49 -04:00
|
|
|
public string? Value
|
|
|
|
|
{
|
|
|
|
|
get => (_internal as Data.Models.Metadata.ConfSetting)?.Value;
|
|
|
|
|
set => (_internal as Data.Models.Metadata.ConfSetting)?.Value = value;
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-24 18:03:01 -04:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Constructors
|
|
|
|
|
|
|
|
|
|
public ConfSetting() : base() { }
|
|
|
|
|
|
|
|
|
|
public ConfSetting(Data.Models.Metadata.ConfSetting item) : base(item)
|
|
|
|
|
{
|
|
|
|
|
// Handle subitems
|
2026-04-03 23:33:11 -04:00
|
|
|
if (item.Condition is not null)
|
|
|
|
|
Condition = new Condition(item.Condition);
|
2026-03-24 18:03:01 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ConfSetting(Data.Models.Metadata.ConfSetting item, Machine machine, Source source) : this(item)
|
|
|
|
|
{
|
2026-04-02 17:06:01 -04:00
|
|
|
Source = source;
|
2026-03-24 18:03:01 -04:00
|
|
|
CopyMachineInformation(machine);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
2026-04-04 10:25:49 -04:00
|
|
|
#region Accessors
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
public override string? GetName() => Name;
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
public override void SetName(string? name) => Name = name;
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
2026-03-24 18:03:01 -04:00
|
|
|
#region Cloning Methods
|
|
|
|
|
|
2026-03-26 23:46:20 -04:00
|
|
|
/// <inheritdoc/>
|
2026-04-04 13:11:10 -04:00
|
|
|
public override object Clone() => new ConfSetting(GetInternalClone());
|
2026-03-26 23:46:20 -04:00
|
|
|
|
2026-03-24 18:03:01 -04:00
|
|
|
/// <inheritdoc/>
|
|
|
|
|
public override Data.Models.Metadata.ConfSetting GetInternalClone()
|
|
|
|
|
{
|
2026-04-04 13:11:10 -04:00
|
|
|
var confSettingItem = (_internal as Data.Models.Metadata.ConfSetting)?.Clone() as Data.Models.Metadata.ConfSetting ?? [];
|
2026-03-24 18:03:01 -04:00
|
|
|
|
2026-04-03 23:33:11 -04:00
|
|
|
if (Condition is not null)
|
|
|
|
|
confSettingItem.Condition = Condition.GetInternalClone();
|
2026-03-24 18:03:01 -04:00
|
|
|
|
|
|
|
|
return confSettingItem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|