WingMan – Diff between revs 32 and 36
?pathlinks?
Rev 32 | Rev 36 | |||
---|---|---|---|---|
Line 5... | Line 5... | |||
5 | using System.Threading; |
5 | using System.Threading; |
|
6 | using System.Threading.Tasks; |
6 | using System.Threading.Tasks; |
|
7 | using System.Threading.Tasks.Dataflow; |
7 | using System.Threading.Tasks.Dataflow; |
|
8 | using System.Windows.Forms; |
8 | using System.Windows.Forms; |
|
9 | using Gma.System.MouseKeyHook; |
9 | using Gma.System.MouseKeyHook; |
|
- | 10 | using ProtoBuf; |
||
10 | using WingMan.Communication; |
11 | using WingMan.Communication; |
|
11 | using WingMan.Utilities; |
12 | using WingMan.Utilities; |
|
Line 12... | Line 13... | |||
12 | |
13 | |
|
13 | namespace WingMan.Bindings |
14 | namespace WingMan.Bindings |
|
14 | { |
15 | { |
|
15 | public class KeyInterceptor : IDisposable |
16 | public class KeyInterceptor : IDisposable |
|
16 | { |
17 | { |
|
Line 17... | Line 18... | |||
17 | public delegate void MouseKeyBindingMatched(object sender, KeyBindingMatchedEventArgs args); |
18 | public delegate void MouseKeyBindingMatched(object sender, KeyBindingMatchedEventArgs args); |
|
Line 18... | Line 19... | |||
18 | |
19 | |
|
19 | private volatile bool ProcessPipe; |
20 | private volatile bool _processPipe; |
|
20 | |
21 | |
|
21 | public KeyInterceptor(RemoteKeyBindings remoteKeyBindings, MqttCommunication mqttCommunication, |
22 | public KeyInterceptor(RemoteKeyBindings remoteKeyBindings, MqttCommunication mqttCommunication, |
|
Line 96... | Line 97... | |||
96 | { |
97 | { |
|
97 | await DataFlowSemaphoreSlim.WaitAsync(CancellationToken); |
98 | await DataFlowSemaphoreSlim.WaitAsync(CancellationToken); |
|
Line 98... | Line 99... | |||
98 | |
99 | |
|
99 | try |
100 | try |
|
100 | { |
101 | { |
|
101 | if (!ProcessPipe) |
102 | if (!_processPipe) |
|
Line 102... | Line 103... | |||
102 | return; |
103 | return; |
|
103 | |
104 | |
|
104 | foreach (var binding in RemoteKeyBindings.Bindings) |
105 | foreach (var binding in RemoteKeyBindings.Bindings) |
|
Line 114... | Line 115... | |||
114 | CancellationToken, |
115 | CancellationToken, |
|
115 | TaskContinuationOptions.None, TaskScheduler); |
116 | TaskContinuationOptions.None, TaskScheduler); |
|
Line 116... | Line 117... | |||
116 | |
117 | |
|
117 | using (var memoryStream = new MemoryStream()) |
118 | using (var memoryStream = new MemoryStream()) |
|
118 | { |
119 | { |
|
119 | ExecuteKeyBinding.XmlSerializer.Serialize(memoryStream, |
120 | Serializer.Serialize(memoryStream, |
|
Line 120... | Line 121... | |||
120 | new ExecuteKeyBinding(binding.Nick, binding.Name)); |
121 | new ExecuteKeyBinding(binding.Nick, binding.Name)); |
|
Line 121... | Line 122... | |||
121 | |
122 | |
|
Line 133... | Line 134... | |||
133 | |
134 | |
|
Line 134... | Line 135... | |||
134 | public event MouseKeyBindingMatched OnMouseKeyBindingMatched; |
135 | public event MouseKeyBindingMatched OnMouseKeyBindingMatched; |
|
135 | |
136 | |
|
136 | private async void MouseKeyGloalHookOnKeyDown(object sender, KeyEventArgs e) |
137 | private async void MouseKeyGloalHookOnKeyDown(object sender, KeyEventArgs e) |
|
Line 137... | Line 138... | |||
137 | { |
138 | { |
|
138 | ProcessPipe = true; |
139 | _processPipe = true; |
|
Line 139... | Line 140... | |||
139 | |
140 | |
|
Line 152... | Line 153... | |||
152 | } |
153 | } |
|
153 | } |
154 | } |
|
Line 154... | Line 155... | |||
154 | |
155 | |
|
155 | private void MouseKeyGloalHookOnKeyUp(object sender, KeyEventArgs e) |
156 | private void MouseKeyGloalHookOnKeyUp(object sender, KeyEventArgs e) |
|
156 | { |
157 | { |
|
157 | ProcessPipe = false; |
158 | _processPipe = false; |
|
158 | } |
159 | } |
|
159 | } |
- | ||
160 | } |
160 | } |
|
- | 161 | } |