diff --git a/Devices/Keyboard/Keys/ListKeyGroup.cs b/Devices/Keyboard/Keys/ListKeyGroup.cs index 7fc5b84..009d0bf 100644 --- a/Devices/Keyboard/Keys/ListKeyGroup.cs +++ b/Devices/Keyboard/Keys/ListKeyGroup.cs @@ -40,6 +40,27 @@ namespace CUE.NET.Devices.Keyboard.Keys : this(keyboard, true, keys) { } + /// + /// Initializes a new instance of the class. + /// + /// The keyboard this keygroup belongs to. + /// The initial keys of this keygroup. + public ListKeyGroup(CorsairKeyboard keyboard, IEnumerable keys) + : this(keyboard, true, keys) + { } + + /// + /// Initializes a new instance of the class. + /// + /// The keyboard this keygroup belongs to. + /// Specifies whether this keygroup should be automatically attached or not. + /// The initial keys of this keygroup. + public ListKeyGroup(CorsairKeyboard keyboard, bool autoAttach, IEnumerable keys) + : base(keyboard, autoAttach) + { + AddKeys(keys); + } + /// /// Initializes a new instance of the class. /// @@ -49,7 +70,7 @@ namespace CUE.NET.Devices.Keyboard.Keys public ListKeyGroup(CorsairKeyboard keyboard, bool autoAttach, params CorsairKey[] keys) : base(keyboard, autoAttach) { - AddKey(keys); + AddKeys(keys); } /// @@ -61,6 +82,15 @@ namespace CUE.NET.Devices.Keyboard.Keys : this(keyboard, true, keys) { } + /// + /// Initializes a new instance of the class. + /// + /// The keyboard this keygroup belongs to. + /// The IDs of the initial keys of this keygroup. + public ListKeyGroup(CorsairKeyboard keyboard, IEnumerable keys) + : this(keyboard, true, keys) + { } + /// /// Initializes a new instance of the class. /// @@ -70,7 +100,19 @@ namespace CUE.NET.Devices.Keyboard.Keys public ListKeyGroup(CorsairKeyboard keyboard, bool autoAttach, params CorsairKeyboardKeyId[] keys) : base(keyboard, autoAttach) { - AddKey(keys); + AddKeys(keys); + } + + /// + /// Initializes a new instance of the class. + /// + /// The keyboard this keygroup belongs to. + /// Specifies whether this keygroup should be automatically attached or not. + /// The IDs of the initial keys of this keygroup. + public ListKeyGroup(CorsairKeyboard keyboard, bool autoAttach, IEnumerable keys) + : base(keyboard, autoAttach) + { + AddKeys(keys); } #endregion @@ -83,11 +125,7 @@ namespace CUE.NET.Devices.Keyboard.Keys /// The key(s) to add. public void AddKey(params CorsairKey[] keys) { - if (keys != null) - foreach (CorsairKey key in keys) - if (key != null && !ContainsKey(key)) - GroupKeys.Add(key); - + AddKeys(keys); } /// @@ -95,6 +133,27 @@ namespace CUE.NET.Devices.Keyboard.Keys /// /// The ID(s) of the key(s) to add. public void AddKey(params CorsairKeyboardKeyId[] keyIds) + { + AddKeys(keyIds); + } + + /// + /// Adds the given keys to the keygroup. + /// + /// The keys to add. + public void AddKeys(IEnumerable keys) + { + if (keys != null) + foreach (CorsairKey key in keys) + if (key != null && !ContainsKey(key)) + GroupKeys.Add(key); + } + + /// + /// Adds the given keys to the keygroup. + /// + /// The IDs of the keys to add. + public void AddKeys(IEnumerable keyIds) { if (keyIds != null) foreach (CorsairKeyboardKeyId keyId in keyIds) @@ -107,10 +166,7 @@ namespace CUE.NET.Devices.Keyboard.Keys /// The key(s) to remove. public void RemoveKey(params CorsairKey[] keys) { - if (keys != null) - foreach (CorsairKey key in keys) - if (key != null) - GroupKeys.Remove(key); + RemoveKeys(keys); } /// @@ -118,6 +174,27 @@ namespace CUE.NET.Devices.Keyboard.Keys /// /// The ID(s) of the key(s) to remove. public void RemoveKey(params CorsairKeyboardKeyId[] keyIds) + { + RemoveKeys(keyIds); + } + + /// + /// Removes the given keys from the keygroup. + /// + /// The keys to remove. + public void RemoveKeys(IEnumerable keys) + { + if (keys != null) + foreach (CorsairKey key in keys) + if (key != null) + GroupKeys.Remove(key); + } + + /// + /// Removes the given keys from the keygroup. + /// + /// The IDs of the keys to remove. + public void RemoveKeys(IEnumerable keyIds) { if (keyIds != null) foreach (CorsairKeyboardKeyId keyId in keyIds)