WingMan – Diff between revs 24 and 32

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