WingMan – Diff between revs 5 and 7
?pathlinks?
Rev 5 | Rev 7 | |||
---|---|---|---|---|
Line 1... | Line 1... | |||
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 | using System.Text; |
- | ||
5 | using System.Threading.Tasks; |
- | ||
Line 6... | Line 4... | |||
6 | |
4 | |
|
7 | namespace WingMan |
5 | namespace WingMan.MouseKey |
|
8 | { |
6 | { |
|
9 | public class MouseKeyBinding |
7 | public class MouseKeyBinding : IEquatable<MouseKeyBinding> |
|
10 | { |
8 | { |
|
11 | public MouseKeyBinding() |
9 | public MouseKeyBinding() |
|
12 | { |
- | ||
13 | |
10 | { |
|
- | 11 | } |
||
14 | } |
12 | |
|
15 | public MouseKeyBinding(string name, List<string> keys) :this() |
13 | public MouseKeyBinding(string name, List<string> keys) : this() |
|
16 | { |
14 | { |
|
17 | Name = name; |
15 | Name = name; |
|
18 | Keys = keys; |
16 | Keys = keys; |
|
Line 19... | Line 17... | |||
19 | } |
17 | } |
|
Line 20... | Line 18... | |||
20 | |
18 | |
|
Line 21... | Line 19... | |||
21 | public string DisplayName => $"{Name} ({string.Join(" + ", Keys.ToArray())})"; |
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>(); |
||
- | 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 |
||
22 | |
43 | { |
|
23 | public string Name { get; set; } = string.Empty; |
44 | return ((Name != null ? Name.GetHashCode() : 0) * 397) ^ (Keys != null ? Keys.GetHashCode() : 0); |