Files

153 lines
3.7 KiB
C#
Raw Permalink Normal View History

2026-03-24 18:03:01 -04:00
using System.Xml.Serialization;
using Newtonsoft.Json;
namespace SabreTools.Metadata.DatItems.Formats
{
/// <summary>
/// Represents control for an input
/// </summary>
[JsonObject("control"), XmlRoot("control")]
public sealed class Control : DatItem<Data.Models.Metadata.Control>
{
2026-04-04 16:07:37 -04:00
#region Properties
2026-04-01 21:59:16 -04:00
public long? Buttons
{
get => _internal.Buttons;
set => _internal.Buttons = value;
}
2026-04-02 02:18:08 -04:00
public Data.Models.Metadata.ControlType? ControlType
{
get => _internal.ControlType;
set => _internal.ControlType = value;
2026-04-02 02:18:08 -04:00
}
2026-04-02 21:07:41 -04:00
/// <inheritdoc>/>
public override Data.Models.Metadata.ItemType ItemType
=> Data.Models.Metadata.ItemType.Control;
public long? KeyDelta
{
get => _internal.KeyDelta;
set => _internal.KeyDelta = value;
}
public long? Maximum
{
get => _internal.Maximum;
set => _internal.Maximum = value;
}
public long? Minimum
{
get => _internal.Minimum;
set => _internal.Minimum = value;
}
public long? Player
{
get => _internal.Player;
set => _internal.Player = value;
}
public long? ReqButtons
{
get => _internal.ReqButtons;
set => _internal.ReqButtons = value;
}
2026-04-01 21:59:16 -04:00
public bool? Reverse
{
get => _internal.Reverse;
set => _internal.Reverse = value;
2026-04-01 21:59:16 -04:00
}
public long? Sensitivity
{
get => _internal.Sensitivity;
set => _internal.Sensitivity = value;
}
public string? Ways
{
get => _internal.Ways;
set => _internal.Ways = value;
}
public string? Ways2
{
get => _internal.Ways2;
set => _internal.Ways2 = value;
}
public string? Ways3
{
get => _internal.Ways3;
set => _internal.Ways3 = value;
}
2026-04-01 21:59:16 -04:00
#endregion
2026-03-24 18:03:01 -04:00
#region Constructors
public Control() : base() { }
public Control(Data.Models.Metadata.Control item) : base(item) { }
2026-03-24 18:03:01 -04:00
public Control(Data.Models.Metadata.Control item, Machine machine, Source source) : this(item)
{
Source = source;
2026-03-24 18:03:01 -04:00
CopyMachineInformation(machine);
}
public Control(Data.Models.Metadata.Control item, long machineIndex, long sourceIndex) : this(item)
{
SourceIndex = sourceIndex;
MachineIndex = machineIndex;
}
2026-03-24 18:03:01 -04:00
#endregion
2026-03-26 23:46:20 -04:00
#region Accessors
/// <inheritdoc/>
public override string? GetName() => null;
/// <inheritdoc/>
public override void SetName(string? name) { }
#endregion
2026-03-26 23:46:20 -04:00
#region Cloning Methods
/// <inheritdoc/>
2026-04-04 13:11:10 -04:00
public override object Clone() => new Control(GetInternalClone());
/// <inheritdoc/>
public override Data.Models.Metadata.Control GetInternalClone()
=> _internal.Clone() as Data.Models.Metadata.Control ?? new();
2026-03-26 23:46:20 -04:00
#endregion
2026-04-04 19:14:11 -04:00
#region Comparision Methods
2026-04-04 19:47:00 -04:00
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is Control otherControl)
return _internal.Equals(otherControl._internal);
2026-04-04 19:47:00 -04:00
// Everything else fails
return false;
}
2026-04-04 19:14:11 -04:00
#endregion
2026-03-24 18:03:01 -04:00
}
}