WingMan
/trunk/WingMan/Bindings/KeyInterceptor.cs |
@@ -36,18 +36,13 @@ |
} |
|
private BatchBlock<string> KeyComboBatchBlock { get; set; } |
|
private ActionBlock<string[]> KeyComboActionBlock { get; set; } |
|
private IDisposable KeyComboDataFlowLink { get; set; } |
|
private SemaphoreSlim DataFlowSemaphoreSlim { get; } |
|
private RemoteKeyBindings RemoteKeyBindings { get; } |
private MqttCommunication MqttCommunication { get; } |
private TaskScheduler TaskScheduler { get; } |
private CancellationToken CancellationToken { get; } |
|
private IKeyboardMouseEvents MouseKeyGloalHook { get; set; } |
|
public void Dispose() |
@@ -75,6 +70,8 @@ |
|
// Create a sliding window of size equal to the longest key combination. |
var maxKeyComboLength = RemoteKeyBindings.Bindings.Max(binding => binding.Keys.Count); |
if (maxKeyComboLength <= 0) |
return; |
|
KeyComboBatchBlock = |
new BatchBlock<string>(maxKeyComboLength); |
@@ -139,7 +136,8 @@ |
await DataFlowSemaphoreSlim.WaitAsync(CancellationToken); |
try |
{ |
if (KeyComboBatchBlock != null) await KeyComboBatchBlock.SendAsync(key, CancellationToken); |
if (KeyComboBatchBlock != null) |
await KeyComboBatchBlock.SendAsync(key, CancellationToken); |
} |
finally |
{ |