WingMan – Blame information for rev 7

Subversion Repositories:
Rev:
Rev Author Line No. Line
4 office 1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4  
7 office 5 namespace WingMan.MouseKey
4 office 6 {
7 office 7 public class MouseKeyBinding : IEquatable<MouseKeyBinding>
4 office 8 {
5 office 9 public MouseKeyBinding()
10 {
7 office 11 }
5 office 12  
7 office 13 public MouseKeyBinding(string name, List<string> keys) : this()
5 office 14 {
15 Name = name;
16 Keys = keys;
17 }
18  
4 office 19 public string DisplayName => $"{Name} ({string.Join(" + ", Keys.ToArray())})";
20  
21 public string Name { get; set; } = string.Empty;
22  
23 public List<string> Keys { get; set; } = new List<string>();
7 office 24  
25 public bool Equals(MouseKeyBinding other)
26 {
27 if (ReferenceEquals(null, other)) return false;
28 if (ReferenceEquals(this, other)) return true;
29 return string.Equals(Name, other.Name) && Keys.SequenceEqual(other.Keys);
30 }
31  
32 public override bool Equals(object obj)
33 {
34 if (ReferenceEquals(null, obj)) return false;
35 if (ReferenceEquals(this, obj)) return true;
36 if (obj.GetType() != GetType()) return false;
37 return Equals((MouseKeyBinding) obj);
38 }
39  
40 public override int GetHashCode()
41 {
42 unchecked
43 {
44 return ((Name != null ? Name.GetHashCode() : 0) * 397) ^ (Keys != null ? Keys.GetHashCode() : 0);
45 }
46 }
4 office 47 }
48 }