WingMan – Diff between revs 32 and 35
?pathlinks?
Rev 32 | Rev 35 | |||
---|---|---|---|---|
Line 2... | Line 2... | |||
2 | using System.IO; |
2 | using System.IO; |
|
3 | using System.Threading; |
3 | using System.Threading; |
|
4 | using System.Threading.Tasks; |
4 | using System.Threading.Tasks; |
|
5 | using WindowsInput; |
5 | using WindowsInput; |
|
6 | using WindowsInput.Native; |
6 | using WindowsInput.Native; |
|
7 | using MQTTnet; |
- | ||
8 | using WingMan.Communication; |
7 | using WingMan.Communication; |
|
9 | using WingMan.Utilities; |
8 | using WingMan.Utilities; |
|
Line 10... | Line 9... | |||
10 | |
9 | |
|
11 | namespace WingMan.Bindings |
10 | namespace WingMan.Bindings |
|
Line 39... | Line 38... | |||
39 | MqttCommunication.OnMessageReceived -= OnMqttMessageReceived; |
38 | MqttCommunication.OnMessageReceived -= OnMqttMessageReceived; |
|
40 | } |
39 | } |
|
Line 41... | Line 40... | |||
41 | |
40 | |
|
Line 42... | Line 41... | |||
42 | public event MouseKeyBindingExecuting OnMouseKeyBindingExecuting; |
41 | public event MouseKeyBindingExecuting OnMouseKeyBindingExecuting; |
|
43 | |
42 | |
|
44 | private async void OnMqttMessageReceived(object sender, MqttApplicationMessageReceivedEventArgs e) |
43 | private async void OnMqttMessageReceived(object sender, MqttCommunicationMessageReceivedEventArgs e) |
|
45 | { |
44 | { |
|
Line 46... | Line 45... | |||
46 | if (e.ApplicationMessage.Topic != "execute") |
45 | if (e.Topic != "execute") |
|
47 | return; |
46 | return; |
|
- | 47 | |
||
- | 48 | using (var memoryStream = new MemoryStream()) |
||
- | 49 | { |
||
- | 50 | await e.PayloadStream.CopyToAsync(memoryStream); |
||
48 | |
51 | |
|
49 | using (var memoryStream = new MemoryStream(e.ApplicationMessage.Payload)) |
52 | memoryStream.Position = 0L; |
|
Line 50... | Line 53... | |||
50 | { |
53 | |
|
51 | var executeMouseKeyBinding = |
54 | var executeMouseKeyBinding = |
|
Line 98... | Line 101... | |||
98 | InputSimulator.Keyboard.KeyUp((VirtualKeyCode) press); |
101 | InputSimulator.Keyboard.KeyUp((VirtualKeyCode) press); |
|
99 | } |
102 | } |
|
100 | } |
103 | } |
|
101 | } |
104 | } |
|
102 | } |
105 | } |
|
103 | } |
- | ||
104 | |
106 | } |
|
- | 107 | |