From c77a88995d836e633f24b8caaee57b396a6b93dd Mon Sep 17 00:00:00 2001 From: evilC Date: Thu, 22 Mar 2018 20:49:41 +0000 Subject: [PATCH] Tidy --- C#/AutoHotInterception/InterceptionWrapper.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/C#/AutoHotInterception/InterceptionWrapper.cs b/C#/AutoHotInterception/InterceptionWrapper.cs index 85da769..2f01b2b 100644 --- a/C#/AutoHotInterception/InterceptionWrapper.cs +++ b/C#/AutoHotInterception/InterceptionWrapper.cs @@ -17,7 +17,7 @@ public class InterceptionWrapper private readonly bool _filterState = false; - private readonly ConcurrentDictionary> _mappings = new ConcurrentDictionary>(); + private readonly ConcurrentDictionary> _mappings = new ConcurrentDictionary>(); private readonly ConcurrentDictionary _contextCallbacks = new ConcurrentDictionary(); // If a the ID of a device exists as a key in this Dictionary, then that device is filtered. // Used by IsMonitoredKeyboard @@ -63,10 +63,10 @@ public class InterceptionWrapper if (id == 0) return false; if (!_mappings.ContainsKey(id)) { - _mappings.TryAdd(id, new ConcurrentDictionary()); + _mappings.TryAdd(id, new ConcurrentDictionary()); } - _mappings[id].TryAdd(code, new Mapping() { block = block, callback = callback }); + _mappings[id].TryAdd(code, new MappingOptions() { Block = block, Callback = callback }); _filteredDevices[id] = true; SetFilterState(true); @@ -195,11 +195,11 @@ public class InterceptionWrapper { hasSubscription = true; var mapping = _mappings[i][code]; - if (mapping.block) + if (mapping.Block) { block = true; } - mapping.callback(1 - state); + mapping.Callback(1 - state); } // If this key had no subscriptions, but Context Mode is set for this keyboard... // ... then set the Context before sending the key @@ -226,11 +226,10 @@ public class InterceptionWrapper } } - private class Mapping + private class MappingOptions { - public ushort code; - public bool block = false; - public dynamic callback; + public bool Block { get; set; } = false; + public dynamic Callback { get; set; } }