Fill in some accidental gaps

This commit is contained in:
Matt Nadareski
2026-04-03 10:04:32 -04:00
parent 3f82312943
commit 600b0a6dbd
3 changed files with 311 additions and 121 deletions

View File

@@ -1,10 +1,11 @@
using System;
using System.Xml.Serialization;
using Newtonsoft.Json;
namespace SabreTools.Data.Models.Metadata
{
[JsonObject("control"), XmlRoot("control")]
public class Control : DatItem
public class Control : DatItem, ICloneable, IEquatable<Control>
{
#region Properties
@@ -37,5 +38,79 @@ namespace SabreTools.Data.Models.Metadata
#endregion
public Control() => ItemType = ItemType.Control;
/// <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;
}
}
}