From 0039d6e84d4e05e842542ad021a9c21e619c69c2 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Thu, 8 Oct 2020 19:44:40 -0700 Subject: Follow full C# convention --- grapher/Models/AccelGUI.cs | 2 +- grapher/Models/Serialized/GUISettings.cs | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/grapher/Models/AccelGUI.cs b/grapher/Models/AccelGUI.cs index 50207b2..d93017a 100644 --- a/grapher/Models/AccelGUI.cs +++ b/grapher/Models/AccelGUI.cs @@ -98,7 +98,7 @@ namespace grapher private void SaveGUISettingsOnClose(Object sender, FormClosingEventArgs e) { var guiSettings = Settings.MakeGUISettingsFromFields(); - if (!Settings.RawAccelSettings.GUISettings.ValueEquals(guiSettings)) + if (!Settings.RawAccelSettings.GUISettings.Equals(guiSettings)) { Settings.RawAccelSettings.GUISettings = guiSettings; Settings.RawAccelSettings.Save(); diff --git a/grapher/Models/Serialized/GUISettings.cs b/grapher/Models/Serialized/GUISettings.cs index f9e5755..c8f87ae 100644 --- a/grapher/Models/Serialized/GUISettings.cs +++ b/grapher/Models/Serialized/GUISettings.cs @@ -31,7 +31,19 @@ namespace grapher.Models.Serialized #region Methods - public bool ValueEquals(GUISettings other) + public override bool Equals(object obj) + { + var other = obj as GUISettings; + + if (other == null) + { + return false; + } + + return Equals(other); + } + + public bool Equals(GUISettings other) { return DPI == other.DPI && PollRate == other.PollRate && @@ -39,6 +51,14 @@ namespace grapher.Models.Serialized ShowVelocityAndGain == other.ShowVelocityAndGain; } + public override int GetHashCode() + { + return DPI.GetHashCode() ^ + PollRate.GetHashCode() ^ + ShowLastMouseMove.GetHashCode() ^ + ShowVelocityAndGain.GetHashCode(); + } + #endregion Methods } } -- cgit v1.2.3