Files

117 lines
3.2 KiB
C#
Raw Permalink Normal View History

2026-04-03 10:04:32 -04:00
using System;
2025-09-26 10:20:48 -04:00
using System.Xml.Serialization;
using Newtonsoft.Json;
2025-09-26 13:06:18 -04:00
namespace SabreTools.Data.Models.Metadata
2025-09-26 10:20:48 -04:00
{
[JsonObject("control"), XmlRoot("control")]
2026-04-03 10:04:32 -04:00
public class Control : DatItem, ICloneable, IEquatable<Control>
2025-09-26 10:20:48 -04:00
{
2026-04-01 21:59:16 -04:00
#region Properties
public long? Buttons { get; set; }
2026-04-02 02:18:08 -04:00
/// <remarks>(joy|stick|paddle|pedal|lightgun|positional|dial|trackball|mouse|only_buttons|keypad|keyboard|mahjong|hanafuda|gambling)</remarks>
public ControlType? ControlType { get; set; }
public long? KeyDelta { get; set; }
2026-04-01 21:59:16 -04:00
public long? Maximum { get; set; }
2025-09-26 10:20:48 -04:00
public long? Minimum { get; set; }
2025-09-26 10:20:48 -04:00
public long? Player { get; set; }
2025-09-26 10:20:48 -04:00
public long? ReqButtons { get; set; }
2025-09-26 10:20:48 -04:00
/// <remarks>(yes|no) "no"</remarks>
public bool? Reverse { get; set; }
2025-09-26 10:20:48 -04:00
public long? Sensitivity { get; set; }
2025-09-26 10:20:48 -04:00
public string? Ways { get; set; }
2025-09-26 10:20:48 -04:00
public string? Ways2 { get; set; }
2025-09-26 10:20:48 -04:00
public string? Ways3 { get; set; }
2025-09-26 10:20:48 -04:00
#endregion
public Control() => ItemType = ItemType.Control;
2026-04-03 10:04:32 -04:00
/// <inheritdoc/>
public object Clone()
{
var obj = new Control();
obj.Buttons = Buttons;
obj.ControlType = ControlType;
obj.KeyDelta = KeyDelta;
obj.Maximum = Maximum;
obj.Minimum = Minimum;
obj.Player = Player;
obj.ReqButtons = ReqButtons;
obj.Reverse = Reverse;
obj.Sensitivity = Sensitivity;
obj.Ways = Ways;
obj.Ways2 = Ways2;
obj.Ways3 = Ways3;
return obj;
}
/// <inheritdoc/>
public bool Equals(Control? other)
{
// Null never matches
if (other is null)
return false;
// Properties
if (Buttons != other.Buttons)
return false;
if (ControlType != other.ControlType)
return false;
if (KeyDelta != other.KeyDelta)
return false;
if (Maximum != other.Maximum)
return false;
if (Minimum != other.Minimum)
return false;
if (Player != other.Player)
return false;
if (ReqButtons != other.ReqButtons)
return false;
if (Reverse != other.Reverse)
return false;
if (Sensitivity != other.Sensitivity)
return false;
if ((Ways is null) ^ (other.Ways is null))
return false;
else if (Ways is not null && !Ways.Equals(other.Ways, StringComparison.OrdinalIgnoreCase))
return false;
if ((Ways2 is null) ^ (other.Ways2 is null))
return false;
else if (Ways2 is not null && !Ways2.Equals(other.Ways2, StringComparison.OrdinalIgnoreCase))
return false;
if ((Ways3 is null) ^ (other.Ways3 is null))
return false;
else if (Ways3 is not null && !Ways3.Equals(other.Ways3, StringComparison.OrdinalIgnoreCase))
return false;
return true;
}
2025-09-26 10:20:48 -04:00
}
}