WingMan – Diff between revs 35 and 36
?pathlinks?
Rev 35 | Rev 36 | |||
---|---|---|---|---|
Line 3... | Line 3... | |||
3 | using System.Collections.Generic; |
3 | using System.Collections.Generic; |
|
4 | using System.IO; |
4 | using System.IO; |
|
5 | using System.Linq; |
5 | using System.Linq; |
|
6 | using System.Threading; |
6 | using System.Threading; |
|
7 | using System.Threading.Tasks; |
7 | using System.Threading.Tasks; |
|
- | 8 | using ProtoBuf; |
||
8 | using WingMan.Communication; |
9 | using WingMan.Communication; |
|
Line 9... | Line 10... | |||
9 | |
10 | |
|
10 | namespace WingMan.Bindings |
11 | namespace WingMan.Bindings |
|
11 | { |
12 | { |
|
Line 19... | Line 20... | |||
19 | LocalKeyBindings = localKeyBindings; |
20 | LocalKeyBindings = localKeyBindings; |
|
20 | MqttCommunication = mqttCommunication; |
21 | MqttCommunication = mqttCommunication; |
|
21 | CancellationToken = cancellationToken; |
22 | CancellationToken = cancellationToken; |
|
22 | TaskScheduler = taskScheduler; |
23 | TaskScheduler = taskScheduler; |
|
Line 23... | Line 24... | |||
23 | |
24 | |
|
Line 24... | Line 25... | |||
24 | SynchronizedMouseKeyBindings = new ConcurrentDictionary<string, List<KeyBinding>>(); |
25 | SynchronizedMouseKeyBindings = new ConcurrentDictionary<string, List<string>>(); |
|
Line 25... | Line 26... | |||
25 | |
26 | |
|
26 | MqttCommunication.OnMessageReceived += MqttCommunicationOnMessageReceived; |
27 | MqttCommunication.OnMessageReceived += MqttCommunicationOnMessageReceived; |
|
Line 27... | Line 28... | |||
27 | |
28 | |
|
Line 28... | Line 29... | |||
28 | Task.Run(PeriodicSynchronize, CancellationToken); |
29 | Task.Run(PeriodicSynchronize, CancellationToken); |
|
Line 29... | Line 30... | |||
29 | } |
30 | } |
|
Line 30... | Line 31... | |||
30 | |
31 | |
|
31 | private LocalKeyBindings LocalKeyBindings { get; } |
32 | private LocalKeyBindings LocalKeyBindings { get; } |
|
Line 55... | Line 56... | |||
55 | await e.PayloadStream.CopyToAsync(memoryStream); |
56 | await e.PayloadStream.CopyToAsync(memoryStream); |
|
Line 56... | Line 57... | |||
56 | |
57 | |
|
Line 57... | Line 58... | |||
57 | memoryStream.Position = 0L; |
58 | memoryStream.Position = 0L; |
|
58 | |
59 | |
|
Line 59... | Line 60... | |||
59 | var mouseKeyBindingsExchange = |
60 | var mouseKeyBindingsExchange = |
|
60 | (KeyBindingExchange) KeyBindingExchange.XmlSerializer.Deserialize(memoryStream); |
61 | Serializer.Deserialize<KeyBindingExchange>(memoryStream); |
|
61 | |
62 | |
|
Line 89... | Line 90... | |||
89 | if (!MqttCommunication.Running) |
90 | if (!MqttCommunication.Running) |
|
90 | continue; |
91 | continue; |
|
Line 91... | Line 92... | |||
91 | |
92 | |
|
92 | using (var memoryStream = new MemoryStream()) |
93 | using (var memoryStream = new MemoryStream()) |
|
93 | { |
94 | { |
|
94 | KeyBindingExchange.XmlSerializer.Serialize(memoryStream, |
95 | Serializer.Serialize(memoryStream, |
|
- | 96 | new KeyBindingExchange(MqttCommunication.Nick, |
||
Line 95... | Line 97... | |||
95 | new KeyBindingExchange(MqttCommunication.Nick, LocalKeyBindings.Bindings)); |
97 | LocalKeyBindings.Bindings.Select(binding => binding.Name).ToList())); |
|
Line 96... | Line 98... | |||
96 | |
98 | |
|
97 | memoryStream.Position = 0L; |
99 | memoryStream.Position = 0L; |