WingMan

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 35  →  ?path2? @ 36
/trunk/WingMan/Bindings/KeyBindingsSynchronizer.cs
@@ -5,6 +5,7 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using ProtoBuf;
using WingMan.Communication;
 
namespace WingMan.Bindings
@@ -21,7 +22,7 @@
CancellationToken = cancellationToken;
TaskScheduler = taskScheduler;
 
SynchronizedMouseKeyBindings = new ConcurrentDictionary<string, List<KeyBinding>>();
SynchronizedMouseKeyBindings = new ConcurrentDictionary<string, List<string>>();
 
MqttCommunication.OnMessageReceived += MqttCommunicationOnMessageReceived;
 
@@ -30,7 +31,7 @@
 
private LocalKeyBindings LocalKeyBindings { get; }
 
private ConcurrentDictionary<string, List<KeyBinding>> SynchronizedMouseKeyBindings { get; }
private ConcurrentDictionary<string, List<string>> SynchronizedMouseKeyBindings { get; }
 
private MqttCommunication MqttCommunication { get; }
 
@@ -57,7 +58,7 @@
memoryStream.Position = 0L;
 
var mouseKeyBindingsExchange =
(KeyBindingExchange) KeyBindingExchange.XmlSerializer.Deserialize(memoryStream);
Serializer.Deserialize<KeyBindingExchange>(memoryStream);
 
// Do not add own bindings.
if (string.Equals(mouseKeyBindingsExchange.Nick, MqttCommunication.Nick))
@@ -91,8 +92,9 @@
 
using (var memoryStream = new MemoryStream())
{
KeyBindingExchange.XmlSerializer.Serialize(memoryStream,
new KeyBindingExchange(MqttCommunication.Nick, LocalKeyBindings.Bindings));
Serializer.Serialize(memoryStream,
new KeyBindingExchange(MqttCommunication.Nick,
LocalKeyBindings.Bindings.Select(binding => binding.Name).ToList()));
 
memoryStream.Position = 0L;