From 69a9a122d06f706d4da832d34a21bab55baca3fb Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Sun, 11 Sep 2016 19:36:57 +0200 Subject: [PATCH] Added missing 'char' indexer for keyboards --- Devices/Keyboard/CorsairKeyboard.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Devices/Keyboard/CorsairKeyboard.cs b/Devices/Keyboard/CorsairKeyboard.cs index 1d79e45..6491a1e 100644 --- a/Devices/Keyboard/CorsairKeyboard.cs +++ b/Devices/Keyboard/CorsairKeyboard.cs @@ -7,6 +7,7 @@ using System; using System.Drawing; using System.Runtime.InteropServices; using CUE.NET.Devices.Generic; +using CUE.NET.Devices.Generic.Enums; using CUE.NET.Native; namespace CUE.NET.Devices.Keyboard @@ -23,6 +24,26 @@ namespace CUE.NET.Devices.Keyboard /// public CorsairKeyboardDeviceInfo KeyboardDeviceInfo { get; } + #region Indexers + + /// + /// Gets the representing the given character by calling the SDK-method 'CorsairGetLedIdForKeyName'.
+ /// Note that this currently only works for letters. + ///
+ /// The character of the key. + /// The led representing the given character or null if no led is found. + public CorsairLed this[char key] + { + get + { + CorsairLedId ledId = _CUESDK.CorsairGetLedIdForKeyName(key); + CorsairLed led; + return LedMapping.TryGetValue(ledId, out led) ? led : null; + } + } + + #endregion + #endregion #region Constructors