mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-12-26 02:23:05 +00:00
Implement IEquatable
Format
This commit is contained in:
parent
95e78f6ee1
commit
a3b50fb28d
2 changed files with 64 additions and 12 deletions
|
@ -1,6 +1,8 @@
|
|||
using System;
|
||||
|
||||
namespace Ryujinx.Common.Configuration.Hid
|
||||
{
|
||||
public class KeyboardHotkeys
|
||||
public class KeyboardHotkeys : IEquatable<KeyboardHotkeys>
|
||||
{
|
||||
public Key ToggleVsync { get; set; }
|
||||
public Key Screenshot { get; set; }
|
||||
|
@ -11,5 +13,65 @@ namespace Ryujinx.Common.Configuration.Hid
|
|||
public Key ResScaleDown { get; set; }
|
||||
public Key VolumeUp { get; set; }
|
||||
public Key VolumeDown { get; set; }
|
||||
|
||||
public bool Equals(KeyboardHotkeys other)
|
||||
{
|
||||
if (other == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ReferenceEquals(this, other))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return ToggleVsync == other.ToggleVsync &&
|
||||
Screenshot == other.Screenshot &&
|
||||
ShowUI == other.ShowUI &&
|
||||
Pause == other.Pause &&
|
||||
ToggleMute == other.ToggleMute &&
|
||||
ResScaleUp == other.ResScaleUp &&
|
||||
ResScaleDown == other.ResScaleDown &&
|
||||
VolumeUp == other.VolumeUp &&
|
||||
VolumeDown == other.VolumeDown;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ReferenceEquals(this, obj))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (obj.GetType() != this.GetType())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return Equals((KeyboardHotkeys)obj);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
var hashCode = (int)ToggleVsync;
|
||||
hashCode = (hashCode * 397) ^ (int)Screenshot;
|
||||
hashCode = (hashCode * 397) ^ (int)ShowUI;
|
||||
hashCode = (hashCode * 397) ^ (int)Pause;
|
||||
hashCode = (hashCode * 397) ^ (int)ToggleMute;
|
||||
hashCode = (hashCode * 397) ^ (int)ResScaleUp;
|
||||
hashCode = (hashCode * 397) ^ (int)ResScaleDown;
|
||||
hashCode = (hashCode * 397) ^ (int)VolumeUp;
|
||||
hashCode = (hashCode * 397) ^ (int)VolumeDown;
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,17 +22,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Settings
|
|||
{
|
||||
bool isDirty = false;
|
||||
|
||||
var hotkeys = KeyboardHotkey.GetConfig();
|
||||
|
||||
isDirty |= config.Hid.Hotkeys.Value.ToggleVsync != hotkeys.ToggleVsync;
|
||||
isDirty |= config.Hid.Hotkeys.Value.Screenshot != hotkeys.Screenshot;
|
||||
isDirty |= config.Hid.Hotkeys.Value.ShowUI != hotkeys.ShowUI;
|
||||
isDirty |= config.Hid.Hotkeys.Value.Pause != hotkeys.Pause;
|
||||
isDirty |= config.Hid.Hotkeys.Value.ToggleMute != hotkeys.ToggleMute;
|
||||
isDirty |= config.Hid.Hotkeys.Value.ResScaleUp != hotkeys.ResScaleUp;
|
||||
isDirty |= config.Hid.Hotkeys.Value.ResScaleDown != hotkeys.ResScaleDown;
|
||||
isDirty |= config.Hid.Hotkeys.Value.VolumeUp != hotkeys.VolumeUp;
|
||||
isDirty |= config.Hid.Hotkeys.Value.VolumeDown != hotkeys.VolumeDown;
|
||||
isDirty |= !config.Hid.Hotkeys.Value.Equals(KeyboardHotkey.GetConfig());
|
||||
|
||||
return isDirty;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue