WingMan

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 6  →  ?path2? @ 7
/trunk/WingMan/MouseKey/MouseKeyBinding.cs
@@ -1,18 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace WingMan
namespace WingMan.MouseKey
{
public class MouseKeyBinding
public class MouseKeyBinding : IEquatable<MouseKeyBinding>
{
public MouseKeyBinding()
{
}
 
}
public MouseKeyBinding(string name, List<string> keys) :this()
public MouseKeyBinding(string name, List<string> keys) : this()
{
Name = name;
Keys = keys;
@@ -23,5 +21,28 @@
public string Name { get; set; } = string.Empty;
 
public List<string> Keys { get; set; } = new List<string>();
 
public bool Equals(MouseKeyBinding other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return string.Equals(Name, other.Name) && Keys.SequenceEqual(other.Keys);
}
 
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != GetType()) return false;
return Equals((MouseKeyBinding) obj);
}
 
public override int GetHashCode()
{
unchecked
{
return ((Name != null ? Name.GetHashCode() : 0) * 397) ^ (Keys != null ? Keys.GetHashCode() : 0);
}
}
}
}