WingMan – Blame information for rev 32

Subversion Repositories:
Rev:
Rev Author Line No. Line
4 office 1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4  
14 office 5 namespace WingMan.Bindings
4 office 6 {
10 office 7 public class KeyBinding : IEquatable<KeyBinding>
4 office 8 {
10 office 9 public KeyBinding()
5 office 10 {
7 office 11 }
5 office 12  
10 office 13 public KeyBinding(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  
24 office 25 public bool Enabled { get; set; }
26  
10 office 27 public bool Equals(KeyBinding other)
7 office 28 {
29 if (ReferenceEquals(null, other)) return false;
30 if (ReferenceEquals(this, other)) return true;
31 return string.Equals(Name, other.Name) && Keys.SequenceEqual(other.Keys);
32 }
33  
34 public override bool Equals(object obj)
35 {
36 if (ReferenceEquals(null, obj)) return false;
37 if (ReferenceEquals(this, obj)) return true;
38 if (obj.GetType() != GetType()) return false;
10 office 39 return Equals((KeyBinding) obj);
7 office 40 }
41  
42 public override int GetHashCode()
43 {
44 unchecked
45 {
46 return ((Name != null ? Name.GetHashCode() : 0) * 397) ^ (Keys != null ? Keys.GetHashCode() : 0);
47 }
48 }
4 office 49 }
32 office 50 }