mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2026-11-11 04:57:15 +00:00
Changed all namespaces to file-scope
This commit is contained in:
1 parent
a0c6ccebea
commit
30624035f1
353 files changed
+35775
-36129
No files matched your search
@@ -1,20 +1,19 @@
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace RGB.NET.Devices.Wooting.Enum
|
||||
namespace RGB.NET.Devices.Wooting.Enum;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the type of a wooting device
|
||||
/// </summary>
|
||||
public enum WootingDeviceType
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the type of a wooting device
|
||||
/// 10 Keyless Keyboard. E.g. Wooting One
|
||||
/// </summary>
|
||||
public enum WootingDeviceType
|
||||
{
|
||||
/// <summary>
|
||||
/// 10 Keyless Keyboard. E.g. Wooting One
|
||||
/// </summary>
|
||||
KeyboardTKL = 1,
|
||||
KeyboardTKL = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Full Size keyboard. E.g. Wooting Two
|
||||
/// </summary>
|
||||
Keyboard = 2
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Full Size keyboard. E.g. Wooting Two
|
||||
/// </summary>
|
||||
Keyboard = 2
|
||||
}
|
||||
@@ -3,17 +3,16 @@
|
||||
|
||||
#pragma warning disable 1591 // Missing XML comment for publicly visible type or member
|
||||
|
||||
namespace RGB.NET.Devices.Wooting.Enum
|
||||
namespace RGB.NET.Devices.Wooting.Enum;
|
||||
|
||||
/// <summary>
|
||||
/// Contains list of available physical layouts for Wooting keyboards.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Shop states ANSI (US) and ISO (UK/German/Nodics) - https://wooting.store/collections/wooting-keyboards/products/wooting-two
|
||||
/// </remarks>
|
||||
public enum WootingPhysicalKeyboardLayout
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains list of available physical layouts for Wooting keyboards.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Shop states ANSI (US) and ISO (UK/German/Nodics) - https://wooting.store/collections/wooting-keyboards/products/wooting-two
|
||||
/// </remarks>
|
||||
public enum WootingPhysicalKeyboardLayout
|
||||
{
|
||||
US = 0,
|
||||
UK = 1
|
||||
}
|
||||
}
|
||||
US = 0,
|
||||
UK = 1
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.Wooting.Generic
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a Wooting RGB-device.
|
||||
/// </summary>
|
||||
public interface IWootingRGBDevice : IRGBDevice
|
||||
{ }
|
||||
}
|
||||
namespace RGB.NET.Devices.Wooting.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a Wooting RGB-device.
|
||||
/// </summary>
|
||||
public interface IWootingRGBDevice : IRGBDevice
|
||||
{ }
|
||||
@@ -1,26 +1,25 @@
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.Wooting.Generic
|
||||
namespace RGB.NET.Devices.Wooting.Generic;
|
||||
|
||||
/// <inheritdoc cref="AbstractRGBDevice{TDeviceInfo}" />
|
||||
/// <inheritdoc cref="IWootingRGBDevice" />
|
||||
/// <summary>
|
||||
/// Represents a Wooting-device
|
||||
/// </summary>
|
||||
public abstract class WootingRGBDevice<TDeviceInfo> : AbstractRGBDevice<TDeviceInfo>, IWootingRGBDevice
|
||||
where TDeviceInfo : WootingRGBDeviceInfo
|
||||
{
|
||||
/// <inheritdoc cref="AbstractRGBDevice{TDeviceInfo}" />
|
||||
/// <inheritdoc cref="IWootingRGBDevice" />
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Represents a Wooting-device
|
||||
/// Initializes a new instance of the <see cref="WootingRGBDevice{TDeviceInfo}"/> class.
|
||||
/// </summary>
|
||||
public abstract class WootingRGBDevice<TDeviceInfo> : AbstractRGBDevice<TDeviceInfo>, IWootingRGBDevice
|
||||
where TDeviceInfo : WootingRGBDeviceInfo
|
||||
{
|
||||
#region Constructors
|
||||
/// <param name="info">The generic information provided by Wooting for the device.</param>
|
||||
/// <param name="updateTrigger">The update trigger used to update this device.</param>
|
||||
protected WootingRGBDevice(TDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, new WootingUpdateQueue(updateTrigger))
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="WootingRGBDevice{TDeviceInfo}"/> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The generic information provided by Wooting for the device.</param>
|
||||
/// <param name="updateTrigger">The update trigger used to update this device.</param>
|
||||
protected WootingRGBDevice(TDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, new WootingUpdateQueue(updateTrigger))
|
||||
{ }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -2,54 +2,53 @@
|
||||
using RGB.NET.Devices.Wooting.Enum;
|
||||
using RGB.NET.Devices.Wooting.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Wooting.Generic
|
||||
namespace RGB.NET.Devices.Wooting.Generic;
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents a generic information for a Wooting-<see cref="T:RGB.NET.Core.IRGBDevice" />.
|
||||
/// </summary>
|
||||
public class WootingRGBDeviceInfo : IRGBDeviceInfo
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
/// <inheritdoc />
|
||||
public RGBDeviceType DeviceType { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public string DeviceName { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Manufacturer => "Wooting";
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Model { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public object? LayoutMetadata { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Represents a generic information for a Wooting-<see cref="T:RGB.NET.Core.IRGBDevice" />.
|
||||
/// Gets the <see cref="WootingDeviceType"/> of the <see cref="WootingRGBDevice{TDeviceInfo}"/>.
|
||||
/// </summary>
|
||||
public class WootingRGBDeviceInfo : IRGBDeviceInfo
|
||||
public WootingDeviceType WootingDeviceType { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Internal constructor of managed <see cref="WootingRGBDeviceInfo"/>.
|
||||
/// </summary>
|
||||
/// <param name="deviceType">The type of the <see cref="IRGBDevice"/>.</param>
|
||||
/// <param name="deviceInfo">The <see cref="_WootingDeviceInfo"/> of the <see cref="IRGBDevice"/>.</param>
|
||||
internal WootingRGBDeviceInfo(RGBDeviceType deviceType, _WootingDeviceInfo deviceInfo)
|
||||
{
|
||||
#region Properties & Fields
|
||||
this.DeviceType = deviceType;
|
||||
this.WootingDeviceType = deviceInfo.DeviceType;
|
||||
|
||||
/// <inheritdoc />
|
||||
public RGBDeviceType DeviceType { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public string DeviceName { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Manufacturer => "Wooting";
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Model { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public object? LayoutMetadata { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="WootingDeviceType"/> of the <see cref="WootingRGBDevice{TDeviceInfo}"/>.
|
||||
/// </summary>
|
||||
public WootingDeviceType WootingDeviceType { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Internal constructor of managed <see cref="WootingRGBDeviceInfo"/>.
|
||||
/// </summary>
|
||||
/// <param name="deviceType">The type of the <see cref="IRGBDevice"/>.</param>
|
||||
/// <param name="deviceInfo">The <see cref="_WootingDeviceInfo"/> of the <see cref="IRGBDevice"/>.</param>
|
||||
internal WootingRGBDeviceInfo(RGBDeviceType deviceType, _WootingDeviceInfo deviceInfo)
|
||||
{
|
||||
this.DeviceType = deviceType;
|
||||
this.WootingDeviceType = deviceInfo.DeviceType;
|
||||
|
||||
Model = deviceInfo.Model;
|
||||
DeviceName = DeviceHelper.CreateDeviceName(Manufacturer, Model);
|
||||
}
|
||||
|
||||
#endregion
|
||||
Model = deviceInfo.Model;
|
||||
DeviceName = DeviceHelper.CreateDeviceName(Manufacturer, Model);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -2,44 +2,43 @@
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Devices.Wooting.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Wooting.Generic
|
||||
namespace RGB.NET.Devices.Wooting.Generic;
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents the update-queue performing updates for cooler master devices.
|
||||
/// </summary>
|
||||
public class WootingUpdateQueue : UpdateQueue
|
||||
{
|
||||
/// <inheritdoc />
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Represents the update-queue performing updates for cooler master devices.
|
||||
/// Initializes a new instance of the <see cref="WootingUpdateQueue"/> class.
|
||||
/// </summary>
|
||||
public class WootingUpdateQueue : UpdateQueue
|
||||
/// <param name="updateTrigger">The update trigger used by this queue.</param>
|
||||
public WootingUpdateQueue(IDeviceUpdateTrigger updateTrigger)
|
||||
: base(updateTrigger)
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="WootingUpdateQueue"/> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used by this queue.</param>
|
||||
public WootingUpdateQueue(IDeviceUpdateTrigger updateTrigger)
|
||||
: base(updateTrigger)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet)
|
||||
{
|
||||
lock (_WootingSDK.SdkLock)
|
||||
{
|
||||
foreach ((object key, Color color) in dataSet)
|
||||
{
|
||||
(int row, int column) = ((int, int))key;
|
||||
_WootingSDK.ArraySetSingle((byte)row, (byte)column, color.GetR(), color.GetG(), color.GetB());
|
||||
}
|
||||
|
||||
_WootingSDK.ArrayUpdateKeyboard();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet)
|
||||
{
|
||||
lock (_WootingSDK.SdkLock)
|
||||
{
|
||||
foreach ((object key, Color color) in dataSet)
|
||||
{
|
||||
(int row, int column) = ((int, int))key;
|
||||
_WootingSDK.ArraySetSingle((byte)row, (byte)column, color.GetR(), color.GetG(), color.GetB());
|
||||
}
|
||||
|
||||
_WootingSDK.ArrayUpdateKeyboard();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -2,34 +2,33 @@
|
||||
using System.ComponentModel;
|
||||
using System.Reflection;
|
||||
|
||||
namespace RGB.NET.Devices.Wooting.Helper
|
||||
namespace RGB.NET.Devices.Wooting.Helper;
|
||||
|
||||
/// <summary>
|
||||
/// Offers some extensions and helper-methods for enum related things.
|
||||
/// </summary>
|
||||
internal static class EnumExtension
|
||||
{
|
||||
/// <summary>
|
||||
/// Offers some extensions and helper-methods for enum related things.
|
||||
/// Gets the value of the <see cref="DescriptionAttribute"/>.
|
||||
/// </summary>
|
||||
internal static class EnumExtension
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the value of the <see cref="DescriptionAttribute"/>.
|
||||
/// </summary>
|
||||
/// <param name="source">The enum value to get the description from.</param>
|
||||
/// <returns>The value of the <see cref="DescriptionAttribute"/> or the <see cref="System.Enum.ToString()" /> result of the source.</returns>
|
||||
internal static string GetDescription(this System.Enum source)
|
||||
=> source.GetAttribute<DescriptionAttribute>()?.Description ?? source.ToString();
|
||||
/// <param name="source">The enum value to get the description from.</param>
|
||||
/// <returns>The value of the <see cref="DescriptionAttribute"/> or the <see cref="System.Enum.ToString()" /> result of the source.</returns>
|
||||
internal static string GetDescription(this System.Enum source)
|
||||
=> source.GetAttribute<DescriptionAttribute>()?.Description ?? source.ToString();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the attribute of type T.
|
||||
/// </summary>
|
||||
/// <param name="source">The enum value to get the attribute from</param>
|
||||
/// <typeparam name="T">The generic attribute type</typeparam>
|
||||
/// <returns>The <see cref="Attribute"/>.</returns>
|
||||
private static T? GetAttribute<T>(this System.Enum source)
|
||||
where T : Attribute
|
||||
{
|
||||
FieldInfo? fi = source.GetType().GetField(source.ToString());
|
||||
if (fi == null) return null;
|
||||
T[] attributes = (T[])fi.GetCustomAttributes(typeof(T), false);
|
||||
return attributes.Length > 0 ? attributes[0] : null;
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the attribute of type T.
|
||||
/// </summary>
|
||||
/// <param name="source">The enum value to get the attribute from</param>
|
||||
/// <typeparam name="T">The generic attribute type</typeparam>
|
||||
/// <returns>The <see cref="Attribute"/>.</returns>
|
||||
private static T? GetAttribute<T>(this System.Enum source)
|
||||
where T : Attribute
|
||||
{
|
||||
FieldInfo? fi = source.GetType().GetField(source.ToString());
|
||||
if (fi == null) return null;
|
||||
T[] attributes = (T[])fi.GetCustomAttributes(typeof(T), false);
|
||||
return attributes.Length > 0 ? attributes[0] : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,474 +4,473 @@ using System.Collections.Generic;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Devices.Wooting.Enum;
|
||||
|
||||
namespace RGB.NET.Devices.Wooting.Keyboard
|
||||
namespace RGB.NET.Devices.Wooting.Keyboard;
|
||||
|
||||
/// <summary>
|
||||
/// Contains all the hardware-id mappings for Wooting devices.
|
||||
/// </summary>
|
||||
internal static class WootingKeyboardLedMappings
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
#region TKL
|
||||
|
||||
private static readonly Dictionary<LedId, (int row, int column)> TKL_US = new()
|
||||
{
|
||||
{ LedId.Keyboard_Escape, (0,0) },
|
||||
{ LedId.Keyboard_F1, (0,2) },
|
||||
{ LedId.Keyboard_F2, (0,3) },
|
||||
{ LedId.Keyboard_F3, (0,4) },
|
||||
{ LedId.Keyboard_F4, (0,5) },
|
||||
{ LedId.Keyboard_F5, (0,6) },
|
||||
{ LedId.Keyboard_F6, (0,7) },
|
||||
{ LedId.Keyboard_F7, (0,8) },
|
||||
{ LedId.Keyboard_F8, (0,9) },
|
||||
{ LedId.Keyboard_F9, (0,10) },
|
||||
{ LedId.Keyboard_F10, (0,11) },
|
||||
{ LedId.Keyboard_F11, (0,12) },
|
||||
{ LedId.Keyboard_F12, (0,13) },
|
||||
{ LedId.Keyboard_PrintScreen, (0,14) },
|
||||
{ LedId.Keyboard_PauseBreak, (0,15) },
|
||||
{ LedId.Keyboard_Custom1, (0,16) },
|
||||
|
||||
{ LedId.Keyboard_GraveAccentAndTilde, (1,0) },
|
||||
{ LedId.Keyboard_1, (1,1) },
|
||||
{ LedId.Keyboard_2, (1,2) },
|
||||
{ LedId.Keyboard_3, (1,3) },
|
||||
{ LedId.Keyboard_4, (1,4) },
|
||||
{ LedId.Keyboard_5, (1,5) },
|
||||
{ LedId.Keyboard_6, (1,6) },
|
||||
{ LedId.Keyboard_7, (1,7) },
|
||||
{ LedId.Keyboard_8, (1,8) },
|
||||
{ LedId.Keyboard_9, (1,9) },
|
||||
{ LedId.Keyboard_0, (1,10) },
|
||||
{ LedId.Keyboard_MinusAndUnderscore, (1,11) },
|
||||
{ LedId.Keyboard_EqualsAndPlus, (1,12) },
|
||||
{ LedId.Keyboard_Backspace, (1,13) },
|
||||
{ LedId.Keyboard_Insert, (1,14) },
|
||||
{ LedId.Keyboard_Home, (1,15) },
|
||||
{ LedId.Keyboard_PageUp, (1,16) },
|
||||
|
||||
{ LedId.Keyboard_Tab, (2,0) },
|
||||
{ LedId.Keyboard_Q, (2,1) },
|
||||
{ LedId.Keyboard_W, (2,2) },
|
||||
{ LedId.Keyboard_E, (2,3) },
|
||||
{ LedId.Keyboard_R, (2,4) },
|
||||
{ LedId.Keyboard_T, (2,5) },
|
||||
{ LedId.Keyboard_Y, (2,6) },
|
||||
{ LedId.Keyboard_U, (2,7) },
|
||||
{ LedId.Keyboard_I, (2,8) },
|
||||
{ LedId.Keyboard_O, (2,9) },
|
||||
{ LedId.Keyboard_P, (2,10) },
|
||||
{ LedId.Keyboard_BracketLeft, (2,11) },
|
||||
{ LedId.Keyboard_BracketRight, (2,12) },
|
||||
{ LedId.Keyboard_Backslash, (2,13) },
|
||||
{ LedId.Keyboard_Delete, (2,14) },
|
||||
{ LedId.Keyboard_End, (2,15) },
|
||||
{ LedId.Keyboard_PageDown, (2,16) },
|
||||
|
||||
{ LedId.Keyboard_CapsLock, (3,0) },
|
||||
{ LedId.Keyboard_A, (3,1) },
|
||||
{ LedId.Keyboard_S, (3,2) },
|
||||
{ LedId.Keyboard_D, (3,3) },
|
||||
{ LedId.Keyboard_F, (3,4) },
|
||||
{ LedId.Keyboard_G, (3,5) },
|
||||
{ LedId.Keyboard_H, (3,6) },
|
||||
{ LedId.Keyboard_J, (3,7) },
|
||||
{ LedId.Keyboard_K, (3,8) },
|
||||
{ LedId.Keyboard_L, (3,9) },
|
||||
{ LedId.Keyboard_SemicolonAndColon, (3,10) },
|
||||
{ LedId.Keyboard_ApostropheAndDoubleQuote, (3,11) },
|
||||
{ LedId.Keyboard_Enter, (3,13) },
|
||||
|
||||
{ LedId.Keyboard_LeftShift, (4,0) },
|
||||
{ LedId.Keyboard_Z, (4,2) },
|
||||
{ LedId.Keyboard_X, (4,3) },
|
||||
{ LedId.Keyboard_C, (4,4) },
|
||||
{ LedId.Keyboard_V, (4,5) },
|
||||
{ LedId.Keyboard_B, (4,6) },
|
||||
{ LedId.Keyboard_N, (4,7) },
|
||||
{ LedId.Keyboard_M, (4,8) },
|
||||
{ LedId.Keyboard_CommaAndLessThan, (4,9) },
|
||||
{ LedId.Keyboard_PeriodAndBiggerThan, (4,10) },
|
||||
{ LedId.Keyboard_SlashAndQuestionMark, (4,11) },
|
||||
{ LedId.Keyboard_RightShift, (4,13) },
|
||||
{ LedId.Keyboard_ArrowUp, (4,15) },
|
||||
|
||||
{ LedId.Keyboard_LeftCtrl, (5,0) },
|
||||
{ LedId.Keyboard_LeftGui, (5,1) },
|
||||
{ LedId.Keyboard_LeftAlt, (5,2) },
|
||||
{ LedId.Keyboard_Space, (5,6) },
|
||||
{ LedId.Keyboard_RightAlt, (5,10) },
|
||||
{ LedId.Keyboard_RightGui, (5,11) },
|
||||
{ LedId.Keyboard_Application, (5,12) },
|
||||
{ LedId.Keyboard_RightCtrl, (5,13) },
|
||||
{ LedId.Keyboard_ArrowLeft, (5,14) },
|
||||
{ LedId.Keyboard_ArrowDown, (5,15) },
|
||||
{ LedId.Keyboard_ArrowRight, (5,16) }
|
||||
};
|
||||
|
||||
private static readonly Dictionary<LedId, (int row, int column)> TKL_UK = new()
|
||||
{
|
||||
{ LedId.Keyboard_Escape, (0,0) },
|
||||
{ LedId.Keyboard_F1, (0,2) },
|
||||
{ LedId.Keyboard_F2, (0,3) },
|
||||
{ LedId.Keyboard_F3, (0,4) },
|
||||
{ LedId.Keyboard_F4, (0,5) },
|
||||
{ LedId.Keyboard_F5, (0,6) },
|
||||
{ LedId.Keyboard_F6, (0,7) },
|
||||
{ LedId.Keyboard_F7, (0,8) },
|
||||
{ LedId.Keyboard_F8, (0,9) },
|
||||
{ LedId.Keyboard_F9, (0,10) },
|
||||
{ LedId.Keyboard_F10, (0,11) },
|
||||
{ LedId.Keyboard_F11, (0,12) },
|
||||
{ LedId.Keyboard_F12, (0,13) },
|
||||
{ LedId.Keyboard_PrintScreen, (0,14) },
|
||||
{ LedId.Keyboard_PauseBreak, (0,15) },
|
||||
{ LedId.Keyboard_Custom1, (0,16) },
|
||||
|
||||
{ LedId.Keyboard_GraveAccentAndTilde, (1,0) },
|
||||
{ LedId.Keyboard_1, (1,1) },
|
||||
{ LedId.Keyboard_2, (1,2) },
|
||||
{ LedId.Keyboard_3, (1,3) },
|
||||
{ LedId.Keyboard_4, (1,4) },
|
||||
{ LedId.Keyboard_5, (1,5) },
|
||||
{ LedId.Keyboard_6, (1,6) },
|
||||
{ LedId.Keyboard_7, (1,7) },
|
||||
{ LedId.Keyboard_8, (1,8) },
|
||||
{ LedId.Keyboard_9, (1,9) },
|
||||
{ LedId.Keyboard_0, (1,10) },
|
||||
{ LedId.Keyboard_MinusAndUnderscore, (1,11) },
|
||||
{ LedId.Keyboard_EqualsAndPlus, (1,12) },
|
||||
{ LedId.Keyboard_Backspace, (1,13) },
|
||||
{ LedId.Keyboard_Insert, (1,14) },
|
||||
{ LedId.Keyboard_Home, (1,15) },
|
||||
{ LedId.Keyboard_PageUp, (1,16) },
|
||||
|
||||
{ LedId.Keyboard_Tab, (2,0) },
|
||||
{ LedId.Keyboard_Q, (2,1) },
|
||||
{ LedId.Keyboard_W, (2,2) },
|
||||
{ LedId.Keyboard_E, (2,3) },
|
||||
{ LedId.Keyboard_R, (2,4) },
|
||||
{ LedId.Keyboard_T, (2,5) },
|
||||
{ LedId.Keyboard_Y, (2,6) },
|
||||
{ LedId.Keyboard_U, (2,7) },
|
||||
{ LedId.Keyboard_I, (2,8) },
|
||||
{ LedId.Keyboard_O, (2,9) },
|
||||
{ LedId.Keyboard_P, (2,10) },
|
||||
{ LedId.Keyboard_BracketLeft, (2,11) },
|
||||
{ LedId.Keyboard_BracketRight, (2,12) },
|
||||
{ LedId.Keyboard_Backslash, (2,13) },
|
||||
{ LedId.Keyboard_Delete, (2,14) },
|
||||
{ LedId.Keyboard_End, (2,15) },
|
||||
{ LedId.Keyboard_PageDown, (2,16) },
|
||||
|
||||
{ LedId.Keyboard_CapsLock, (3,0) },
|
||||
{ LedId.Keyboard_A, (3,1) },
|
||||
{ LedId.Keyboard_S, (3,2) },
|
||||
{ LedId.Keyboard_D, (3,3) },
|
||||
{ LedId.Keyboard_F, (3,4) },
|
||||
{ LedId.Keyboard_G, (3,5) },
|
||||
{ LedId.Keyboard_H, (3,6) },
|
||||
{ LedId.Keyboard_J, (3,7) },
|
||||
{ LedId.Keyboard_K, (3,8) },
|
||||
{ LedId.Keyboard_L, (3,9) },
|
||||
{ LedId.Keyboard_SemicolonAndColon, (3,10) },
|
||||
{ LedId.Keyboard_ApostropheAndDoubleQuote, (3,11) },
|
||||
{ LedId.Keyboard_NonUsTilde, (3,12) },
|
||||
{ LedId.Keyboard_Enter, (3,13) },
|
||||
|
||||
{ LedId.Keyboard_LeftShift, (4,0) },
|
||||
{ LedId.Keyboard_NonUsBackslash, (4,1) },
|
||||
{ LedId.Keyboard_Z, (4,2) },
|
||||
{ LedId.Keyboard_X, (4,3) },
|
||||
{ LedId.Keyboard_C, (4,4) },
|
||||
{ LedId.Keyboard_V, (4,5) },
|
||||
{ LedId.Keyboard_B, (4,6) },
|
||||
{ LedId.Keyboard_N, (4,7) },
|
||||
{ LedId.Keyboard_M, (4,8) },
|
||||
{ LedId.Keyboard_CommaAndLessThan, (4,9) },
|
||||
{ LedId.Keyboard_PeriodAndBiggerThan, (4,10) },
|
||||
{ LedId.Keyboard_SlashAndQuestionMark, (4,11) },
|
||||
{ LedId.Keyboard_RightShift, (4,13) },
|
||||
{ LedId.Keyboard_ArrowUp, (4,15) },
|
||||
|
||||
{ LedId.Keyboard_LeftCtrl, (5,0) },
|
||||
{ LedId.Keyboard_LeftGui, (5,1) },
|
||||
{ LedId.Keyboard_LeftAlt, (5,2) },
|
||||
{ LedId.Keyboard_Space, (5,6) },
|
||||
{ LedId.Keyboard_RightAlt, (5,10) },
|
||||
{ LedId.Keyboard_RightGui, (5,11) },
|
||||
{ LedId.Keyboard_Application, (5,12) },
|
||||
{ LedId.Keyboard_RightCtrl, (5,13) },
|
||||
{ LedId.Keyboard_ArrowLeft, (5,14) },
|
||||
{ LedId.Keyboard_ArrowDown, (5,15) },
|
||||
{ LedId.Keyboard_ArrowRight, (5,16) }
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
#region Fullsize
|
||||
|
||||
private static readonly Dictionary<LedId, (int row, int column)> Fullsize_US = new()
|
||||
{
|
||||
{ LedId.Keyboard_Escape, (0,0) },
|
||||
{ LedId.Keyboard_F1, (0,2) },
|
||||
{ LedId.Keyboard_F2, (0,3) },
|
||||
{ LedId.Keyboard_F3, (0,4) },
|
||||
{ LedId.Keyboard_F4, (0,5) },
|
||||
{ LedId.Keyboard_F5, (0,6) },
|
||||
{ LedId.Keyboard_F6, (0,7) },
|
||||
{ LedId.Keyboard_F7, (0,8) },
|
||||
{ LedId.Keyboard_F8, (0,9) },
|
||||
{ LedId.Keyboard_F9, (0,10) },
|
||||
{ LedId.Keyboard_F10, (0,11) },
|
||||
{ LedId.Keyboard_F11, (0,12) },
|
||||
{ LedId.Keyboard_F12, (0,13) },
|
||||
{ LedId.Keyboard_PrintScreen, (0,14) },
|
||||
{ LedId.Keyboard_PauseBreak, (0,15) },
|
||||
{ LedId.Keyboard_ScrollLock, (0,16) },
|
||||
{ LedId.Keyboard_Custom1, (0,17) },
|
||||
{ LedId.Keyboard_Custom2, (0,18) },
|
||||
{ LedId.Keyboard_Custom3, (0,19) },
|
||||
{ LedId.Keyboard_Custom4, (0,20) },
|
||||
|
||||
{ LedId.Keyboard_GraveAccentAndTilde, (1,0) },
|
||||
{ LedId.Keyboard_1, (1,1) },
|
||||
{ LedId.Keyboard_2, (1,2) },
|
||||
{ LedId.Keyboard_3, (1,3) },
|
||||
{ LedId.Keyboard_4, (1,4) },
|
||||
{ LedId.Keyboard_5, (1,5) },
|
||||
{ LedId.Keyboard_6, (1,6) },
|
||||
{ LedId.Keyboard_7, (1,7) },
|
||||
{ LedId.Keyboard_8, (1,8) },
|
||||
{ LedId.Keyboard_9, (1,9) },
|
||||
{ LedId.Keyboard_0, (1,10) },
|
||||
{ LedId.Keyboard_MinusAndUnderscore, (1,11) },
|
||||
{ LedId.Keyboard_EqualsAndPlus, (1,12) },
|
||||
{ LedId.Keyboard_Backspace, (1,13) },
|
||||
{ LedId.Keyboard_Insert, (1,14) },
|
||||
{ LedId.Keyboard_Home, (1,15) },
|
||||
{ LedId.Keyboard_PageUp, (1,16) },
|
||||
{ LedId.Keyboard_NumLock, (1,17) },
|
||||
{ LedId.Keyboard_NumSlash, (1,18) },
|
||||
{ LedId.Keyboard_NumAsterisk, (1,19) },
|
||||
{ LedId.Keyboard_NumMinus, (1,20) },
|
||||
|
||||
{ LedId.Keyboard_Tab, (2,0) },
|
||||
{ LedId.Keyboard_Q, (2,1) },
|
||||
{ LedId.Keyboard_W, (2,2) },
|
||||
{ LedId.Keyboard_E, (2,3) },
|
||||
{ LedId.Keyboard_R, (2,4) },
|
||||
{ LedId.Keyboard_T, (2,5) },
|
||||
{ LedId.Keyboard_Y, (2,6) },
|
||||
{ LedId.Keyboard_U, (2,7) },
|
||||
{ LedId.Keyboard_I, (2,8) },
|
||||
{ LedId.Keyboard_O, (2,9) },
|
||||
{ LedId.Keyboard_P, (2,10) },
|
||||
{ LedId.Keyboard_BracketLeft, (2,11) },
|
||||
{ LedId.Keyboard_BracketRight, (2,12) },
|
||||
{ LedId.Keyboard_Backslash, (2,13) },
|
||||
{ LedId.Keyboard_Delete, (2,14) },
|
||||
{ LedId.Keyboard_End, (2,15) },
|
||||
{ LedId.Keyboard_PageDown, (2,16) },
|
||||
{ LedId.Keyboard_Num7, (2,17) },
|
||||
{ LedId.Keyboard_Num8, (2,18) },
|
||||
{ LedId.Keyboard_Num9, (2,19) },
|
||||
{ LedId.Keyboard_NumPlus, (2,20) },
|
||||
|
||||
{ LedId.Keyboard_CapsLock, (3,0) },
|
||||
{ LedId.Keyboard_A, (3,1) },
|
||||
{ LedId.Keyboard_S, (3,2) },
|
||||
{ LedId.Keyboard_D, (3,3) },
|
||||
{ LedId.Keyboard_F, (3,4) },
|
||||
{ LedId.Keyboard_G, (3,5) },
|
||||
{ LedId.Keyboard_H, (3,6) },
|
||||
{ LedId.Keyboard_J, (3,7) },
|
||||
{ LedId.Keyboard_K, (3,8) },
|
||||
{ LedId.Keyboard_L, (3,9) },
|
||||
{ LedId.Keyboard_SemicolonAndColon, (3,10) },
|
||||
{ LedId.Keyboard_ApostropheAndDoubleQuote, (3,11) },
|
||||
{ LedId.Keyboard_Enter, (3,13) },
|
||||
{ LedId.Keyboard_Num4, (3,17) },
|
||||
{ LedId.Keyboard_Num5, (3,18) },
|
||||
{ LedId.Keyboard_Num6, (3,19) },
|
||||
|
||||
{ LedId.Keyboard_LeftShift, (4,0) },
|
||||
{ LedId.Keyboard_Z, (4,2) },
|
||||
{ LedId.Keyboard_X, (4,3) },
|
||||
{ LedId.Keyboard_C, (4,4) },
|
||||
{ LedId.Keyboard_V, (4,5) },
|
||||
{ LedId.Keyboard_B, (4,6) },
|
||||
{ LedId.Keyboard_N, (4,7) },
|
||||
{ LedId.Keyboard_M, (4,8) },
|
||||
{ LedId.Keyboard_CommaAndLessThan, (4,9) },
|
||||
{ LedId.Keyboard_PeriodAndBiggerThan, (4,10) },
|
||||
{ LedId.Keyboard_SlashAndQuestionMark, (4,11) },
|
||||
{ LedId.Keyboard_RightShift, (4,13) },
|
||||
{ LedId.Keyboard_ArrowUp, (4,15) },
|
||||
{ LedId.Keyboard_Num1, (4,17) },
|
||||
{ LedId.Keyboard_Num2, (4,18) },
|
||||
{ LedId.Keyboard_Num3, (4,19) },
|
||||
{ LedId.Keyboard_NumEnter, (4,20) },
|
||||
|
||||
{ LedId.Keyboard_LeftCtrl, (5,0) },
|
||||
{ LedId.Keyboard_LeftGui, (5,1) },
|
||||
{ LedId.Keyboard_LeftAlt, (5,2) },
|
||||
{ LedId.Keyboard_Space, (5,6) },
|
||||
{ LedId.Keyboard_RightAlt, (5,10) },
|
||||
{ LedId.Keyboard_RightGui, (5,11) },
|
||||
{ LedId.Keyboard_Application, (5,12) },
|
||||
{ LedId.Keyboard_RightCtrl, (5,13) },
|
||||
{ LedId.Keyboard_ArrowLeft, (5,14) },
|
||||
{ LedId.Keyboard_ArrowDown, (5,15) },
|
||||
{ LedId.Keyboard_ArrowRight, (5,16) },
|
||||
{ LedId.Keyboard_Num0, (5,18) },
|
||||
{ LedId.Keyboard_NumPeriodAndDelete, (5,19) }
|
||||
};
|
||||
|
||||
private static readonly Dictionary<LedId, (int row, int column)> Fullsize_UK = new()
|
||||
{
|
||||
{ LedId.Keyboard_Escape, (0,0) },
|
||||
{ LedId.Keyboard_F1, (0,2) },
|
||||
{ LedId.Keyboard_F2, (0,3) },
|
||||
{ LedId.Keyboard_F3, (0,4) },
|
||||
{ LedId.Keyboard_F4, (0,5) },
|
||||
{ LedId.Keyboard_F5, (0,6) },
|
||||
{ LedId.Keyboard_F6, (0,7) },
|
||||
{ LedId.Keyboard_F7, (0,8) },
|
||||
{ LedId.Keyboard_F8, (0,9) },
|
||||
{ LedId.Keyboard_F9, (0,10) },
|
||||
{ LedId.Keyboard_F10, (0,11) },
|
||||
{ LedId.Keyboard_F11, (0,12) },
|
||||
{ LedId.Keyboard_F12, (0,13) },
|
||||
{ LedId.Keyboard_PrintScreen, (0,14) },
|
||||
{ LedId.Keyboard_PauseBreak, (0,15) },
|
||||
{ LedId.Keyboard_ScrollLock, (0,16) },
|
||||
{ LedId.Keyboard_Custom1, (0,17) },
|
||||
{ LedId.Keyboard_Custom2, (0,18) },
|
||||
{ LedId.Keyboard_Custom3, (0,19) },
|
||||
{ LedId.Keyboard_Custom4, (0,20) },
|
||||
|
||||
{ LedId.Keyboard_GraveAccentAndTilde, (1,0) },
|
||||
{ LedId.Keyboard_1, (1,1) },
|
||||
{ LedId.Keyboard_2, (1,2) },
|
||||
{ LedId.Keyboard_3, (1,3) },
|
||||
{ LedId.Keyboard_4, (1,4) },
|
||||
{ LedId.Keyboard_5, (1,5) },
|
||||
{ LedId.Keyboard_6, (1,6) },
|
||||
{ LedId.Keyboard_7, (1,7) },
|
||||
{ LedId.Keyboard_8, (1,8) },
|
||||
{ LedId.Keyboard_9, (1,9) },
|
||||
{ LedId.Keyboard_0, (1,10) },
|
||||
{ LedId.Keyboard_MinusAndUnderscore, (1,11) },
|
||||
{ LedId.Keyboard_EqualsAndPlus, (1,12) },
|
||||
{ LedId.Keyboard_Backspace, (1,13) },
|
||||
{ LedId.Keyboard_Insert, (1,14) },
|
||||
{ LedId.Keyboard_Home, (1,15) },
|
||||
{ LedId.Keyboard_PageUp, (1,16) },
|
||||
{ LedId.Keyboard_NumLock, (1,17) },
|
||||
{ LedId.Keyboard_NumSlash, (1,18) },
|
||||
{ LedId.Keyboard_NumAsterisk, (1,19) },
|
||||
{ LedId.Keyboard_NumMinus, (1,20) },
|
||||
|
||||
{ LedId.Keyboard_Tab, (2,0) },
|
||||
{ LedId.Keyboard_Q, (2,1) },
|
||||
{ LedId.Keyboard_W, (2,2) },
|
||||
{ LedId.Keyboard_E, (2,3) },
|
||||
{ LedId.Keyboard_R, (2,4) },
|
||||
{ LedId.Keyboard_T, (2,5) },
|
||||
{ LedId.Keyboard_Y, (2,6) },
|
||||
{ LedId.Keyboard_U, (2,7) },
|
||||
{ LedId.Keyboard_I, (2,8) },
|
||||
{ LedId.Keyboard_O, (2,9) },
|
||||
{ LedId.Keyboard_P, (2,10) },
|
||||
{ LedId.Keyboard_BracketLeft, (2,11) },
|
||||
{ LedId.Keyboard_BracketRight, (2,12) },
|
||||
{ LedId.Keyboard_Backslash, (2,13) },
|
||||
{ LedId.Keyboard_Delete, (2,14) },
|
||||
{ LedId.Keyboard_End, (2,15) },
|
||||
{ LedId.Keyboard_PageDown, (2,16) },
|
||||
{ LedId.Keyboard_Num7, (2,17) },
|
||||
{ LedId.Keyboard_Num8, (2,18) },
|
||||
{ LedId.Keyboard_Num9, (2,19) },
|
||||
{ LedId.Keyboard_NumPlus, (2,20) },
|
||||
|
||||
{ LedId.Keyboard_CapsLock, (3,0) },
|
||||
{ LedId.Keyboard_A, (3,1) },
|
||||
{ LedId.Keyboard_S, (3,2) },
|
||||
{ LedId.Keyboard_D, (3,3) },
|
||||
{ LedId.Keyboard_F, (3,4) },
|
||||
{ LedId.Keyboard_G, (3,5) },
|
||||
{ LedId.Keyboard_H, (3,6) },
|
||||
{ LedId.Keyboard_J, (3,7) },
|
||||
{ LedId.Keyboard_K, (3,8) },
|
||||
{ LedId.Keyboard_L, (3,9) },
|
||||
{ LedId.Keyboard_SemicolonAndColon, (3,10) },
|
||||
{ LedId.Keyboard_ApostropheAndDoubleQuote, (3,11) },
|
||||
{ LedId.Keyboard_NonUsTilde, (3,12) },
|
||||
{ LedId.Keyboard_Enter, (3,13) },
|
||||
{ LedId.Keyboard_Num4, (3,17) },
|
||||
{ LedId.Keyboard_Num5, (3,18) },
|
||||
{ LedId.Keyboard_Num6, (3,19) },
|
||||
|
||||
{ LedId.Keyboard_LeftShift, (4,0) },
|
||||
{ LedId.Keyboard_NonUsBackslash, (4,1) },
|
||||
{ LedId.Keyboard_Z, (4,2) },
|
||||
{ LedId.Keyboard_X, (4,3) },
|
||||
{ LedId.Keyboard_C, (4,4) },
|
||||
{ LedId.Keyboard_V, (4,5) },
|
||||
{ LedId.Keyboard_B, (4,6) },
|
||||
{ LedId.Keyboard_N, (4,7) },
|
||||
{ LedId.Keyboard_M, (4,8) },
|
||||
{ LedId.Keyboard_CommaAndLessThan, (4,9) },
|
||||
{ LedId.Keyboard_PeriodAndBiggerThan, (4,10) },
|
||||
{ LedId.Keyboard_SlashAndQuestionMark, (4,11) },
|
||||
{ LedId.Keyboard_RightShift, (4,13) },
|
||||
{ LedId.Keyboard_ArrowUp, (4,15) },
|
||||
{ LedId.Keyboard_Num1, (4,17) },
|
||||
{ LedId.Keyboard_Num2, (4,18) },
|
||||
{ LedId.Keyboard_Num3, (4,19) },
|
||||
{ LedId.Keyboard_NumEnter, (4,20) },
|
||||
|
||||
{ LedId.Keyboard_LeftCtrl, (5,0) },
|
||||
{ LedId.Keyboard_LeftGui, (5,1) },
|
||||
{ LedId.Keyboard_LeftAlt, (5,2) },
|
||||
{ LedId.Keyboard_Space, (5,6) },
|
||||
{ LedId.Keyboard_RightAlt, (5,10) },
|
||||
{ LedId.Keyboard_RightGui, (5,11) },
|
||||
{ LedId.Keyboard_Application, (5,12) },
|
||||
{ LedId.Keyboard_RightCtrl, (5,13) },
|
||||
{ LedId.Keyboard_ArrowLeft, (5,14) },
|
||||
{ LedId.Keyboard_ArrowDown, (5,15) },
|
||||
{ LedId.Keyboard_ArrowRight, (5,16) },
|
||||
{ LedId.Keyboard_Num0, (5,18) },
|
||||
{ LedId.Keyboard_NumPeriodAndDelete, (5,19) }
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Contains all the hardware-id mappings for Wooting devices.
|
||||
/// </summary>
|
||||
internal static class WootingKeyboardLedMappings
|
||||
{
|
||||
#region Properties & Fields
|
||||
public static readonly Dictionary<WootingDeviceType, Dictionary<WootingPhysicalKeyboardLayout, Dictionary<LedId, (int row, int column)>>> Mapping =
|
||||
new()
|
||||
{
|
||||
{ WootingDeviceType.KeyboardTKL, new Dictionary<WootingPhysicalKeyboardLayout, Dictionary<LedId, (int row, int column)>>
|
||||
{
|
||||
{ WootingPhysicalKeyboardLayout.US, TKL_US },
|
||||
{ WootingPhysicalKeyboardLayout.UK, TKL_UK }
|
||||
}
|
||||
},
|
||||
|
||||
#region TKL
|
||||
|
||||
private static readonly Dictionary<LedId, (int row, int column)> TKL_US = new()
|
||||
{
|
||||
{ LedId.Keyboard_Escape, (0,0) },
|
||||
{ LedId.Keyboard_F1, (0,2) },
|
||||
{ LedId.Keyboard_F2, (0,3) },
|
||||
{ LedId.Keyboard_F3, (0,4) },
|
||||
{ LedId.Keyboard_F4, (0,5) },
|
||||
{ LedId.Keyboard_F5, (0,6) },
|
||||
{ LedId.Keyboard_F6, (0,7) },
|
||||
{ LedId.Keyboard_F7, (0,8) },
|
||||
{ LedId.Keyboard_F8, (0,9) },
|
||||
{ LedId.Keyboard_F9, (0,10) },
|
||||
{ LedId.Keyboard_F10, (0,11) },
|
||||
{ LedId.Keyboard_F11, (0,12) },
|
||||
{ LedId.Keyboard_F12, (0,13) },
|
||||
{ LedId.Keyboard_PrintScreen, (0,14) },
|
||||
{ LedId.Keyboard_PauseBreak, (0,15) },
|
||||
{ LedId.Keyboard_Custom1, (0,16) },
|
||||
|
||||
{ LedId.Keyboard_GraveAccentAndTilde, (1,0) },
|
||||
{ LedId.Keyboard_1, (1,1) },
|
||||
{ LedId.Keyboard_2, (1,2) },
|
||||
{ LedId.Keyboard_3, (1,3) },
|
||||
{ LedId.Keyboard_4, (1,4) },
|
||||
{ LedId.Keyboard_5, (1,5) },
|
||||
{ LedId.Keyboard_6, (1,6) },
|
||||
{ LedId.Keyboard_7, (1,7) },
|
||||
{ LedId.Keyboard_8, (1,8) },
|
||||
{ LedId.Keyboard_9, (1,9) },
|
||||
{ LedId.Keyboard_0, (1,10) },
|
||||
{ LedId.Keyboard_MinusAndUnderscore, (1,11) },
|
||||
{ LedId.Keyboard_EqualsAndPlus, (1,12) },
|
||||
{ LedId.Keyboard_Backspace, (1,13) },
|
||||
{ LedId.Keyboard_Insert, (1,14) },
|
||||
{ LedId.Keyboard_Home, (1,15) },
|
||||
{ LedId.Keyboard_PageUp, (1,16) },
|
||||
|
||||
{ LedId.Keyboard_Tab, (2,0) },
|
||||
{ LedId.Keyboard_Q, (2,1) },
|
||||
{ LedId.Keyboard_W, (2,2) },
|
||||
{ LedId.Keyboard_E, (2,3) },
|
||||
{ LedId.Keyboard_R, (2,4) },
|
||||
{ LedId.Keyboard_T, (2,5) },
|
||||
{ LedId.Keyboard_Y, (2,6) },
|
||||
{ LedId.Keyboard_U, (2,7) },
|
||||
{ LedId.Keyboard_I, (2,8) },
|
||||
{ LedId.Keyboard_O, (2,9) },
|
||||
{ LedId.Keyboard_P, (2,10) },
|
||||
{ LedId.Keyboard_BracketLeft, (2,11) },
|
||||
{ LedId.Keyboard_BracketRight, (2,12) },
|
||||
{ LedId.Keyboard_Backslash, (2,13) },
|
||||
{ LedId.Keyboard_Delete, (2,14) },
|
||||
{ LedId.Keyboard_End, (2,15) },
|
||||
{ LedId.Keyboard_PageDown, (2,16) },
|
||||
|
||||
{ LedId.Keyboard_CapsLock, (3,0) },
|
||||
{ LedId.Keyboard_A, (3,1) },
|
||||
{ LedId.Keyboard_S, (3,2) },
|
||||
{ LedId.Keyboard_D, (3,3) },
|
||||
{ LedId.Keyboard_F, (3,4) },
|
||||
{ LedId.Keyboard_G, (3,5) },
|
||||
{ LedId.Keyboard_H, (3,6) },
|
||||
{ LedId.Keyboard_J, (3,7) },
|
||||
{ LedId.Keyboard_K, (3,8) },
|
||||
{ LedId.Keyboard_L, (3,9) },
|
||||
{ LedId.Keyboard_SemicolonAndColon, (3,10) },
|
||||
{ LedId.Keyboard_ApostropheAndDoubleQuote, (3,11) },
|
||||
{ LedId.Keyboard_Enter, (3,13) },
|
||||
|
||||
{ LedId.Keyboard_LeftShift, (4,0) },
|
||||
{ LedId.Keyboard_Z, (4,2) },
|
||||
{ LedId.Keyboard_X, (4,3) },
|
||||
{ LedId.Keyboard_C, (4,4) },
|
||||
{ LedId.Keyboard_V, (4,5) },
|
||||
{ LedId.Keyboard_B, (4,6) },
|
||||
{ LedId.Keyboard_N, (4,7) },
|
||||
{ LedId.Keyboard_M, (4,8) },
|
||||
{ LedId.Keyboard_CommaAndLessThan, (4,9) },
|
||||
{ LedId.Keyboard_PeriodAndBiggerThan, (4,10) },
|
||||
{ LedId.Keyboard_SlashAndQuestionMark, (4,11) },
|
||||
{ LedId.Keyboard_RightShift, (4,13) },
|
||||
{ LedId.Keyboard_ArrowUp, (4,15) },
|
||||
|
||||
{ LedId.Keyboard_LeftCtrl, (5,0) },
|
||||
{ LedId.Keyboard_LeftGui, (5,1) },
|
||||
{ LedId.Keyboard_LeftAlt, (5,2) },
|
||||
{ LedId.Keyboard_Space, (5,6) },
|
||||
{ LedId.Keyboard_RightAlt, (5,10) },
|
||||
{ LedId.Keyboard_RightGui, (5,11) },
|
||||
{ LedId.Keyboard_Application, (5,12) },
|
||||
{ LedId.Keyboard_RightCtrl, (5,13) },
|
||||
{ LedId.Keyboard_ArrowLeft, (5,14) },
|
||||
{ LedId.Keyboard_ArrowDown, (5,15) },
|
||||
{ LedId.Keyboard_ArrowRight, (5,16) }
|
||||
{ WootingDeviceType.Keyboard, new Dictionary<WootingPhysicalKeyboardLayout, Dictionary<LedId, (int row, int column)>>
|
||||
{
|
||||
{ WootingPhysicalKeyboardLayout.US, Fullsize_US },
|
||||
{ WootingPhysicalKeyboardLayout.UK, Fullsize_UK }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private static readonly Dictionary<LedId, (int row, int column)> TKL_UK = new()
|
||||
{
|
||||
{ LedId.Keyboard_Escape, (0,0) },
|
||||
{ LedId.Keyboard_F1, (0,2) },
|
||||
{ LedId.Keyboard_F2, (0,3) },
|
||||
{ LedId.Keyboard_F3, (0,4) },
|
||||
{ LedId.Keyboard_F4, (0,5) },
|
||||
{ LedId.Keyboard_F5, (0,6) },
|
||||
{ LedId.Keyboard_F6, (0,7) },
|
||||
{ LedId.Keyboard_F7, (0,8) },
|
||||
{ LedId.Keyboard_F8, (0,9) },
|
||||
{ LedId.Keyboard_F9, (0,10) },
|
||||
{ LedId.Keyboard_F10, (0,11) },
|
||||
{ LedId.Keyboard_F11, (0,12) },
|
||||
{ LedId.Keyboard_F12, (0,13) },
|
||||
{ LedId.Keyboard_PrintScreen, (0,14) },
|
||||
{ LedId.Keyboard_PauseBreak, (0,15) },
|
||||
{ LedId.Keyboard_Custom1, (0,16) },
|
||||
|
||||
{ LedId.Keyboard_GraveAccentAndTilde, (1,0) },
|
||||
{ LedId.Keyboard_1, (1,1) },
|
||||
{ LedId.Keyboard_2, (1,2) },
|
||||
{ LedId.Keyboard_3, (1,3) },
|
||||
{ LedId.Keyboard_4, (1,4) },
|
||||
{ LedId.Keyboard_5, (1,5) },
|
||||
{ LedId.Keyboard_6, (1,6) },
|
||||
{ LedId.Keyboard_7, (1,7) },
|
||||
{ LedId.Keyboard_8, (1,8) },
|
||||
{ LedId.Keyboard_9, (1,9) },
|
||||
{ LedId.Keyboard_0, (1,10) },
|
||||
{ LedId.Keyboard_MinusAndUnderscore, (1,11) },
|
||||
{ LedId.Keyboard_EqualsAndPlus, (1,12) },
|
||||
{ LedId.Keyboard_Backspace, (1,13) },
|
||||
{ LedId.Keyboard_Insert, (1,14) },
|
||||
{ LedId.Keyboard_Home, (1,15) },
|
||||
{ LedId.Keyboard_PageUp, (1,16) },
|
||||
|
||||
{ LedId.Keyboard_Tab, (2,0) },
|
||||
{ LedId.Keyboard_Q, (2,1) },
|
||||
{ LedId.Keyboard_W, (2,2) },
|
||||
{ LedId.Keyboard_E, (2,3) },
|
||||
{ LedId.Keyboard_R, (2,4) },
|
||||
{ LedId.Keyboard_T, (2,5) },
|
||||
{ LedId.Keyboard_Y, (2,6) },
|
||||
{ LedId.Keyboard_U, (2,7) },
|
||||
{ LedId.Keyboard_I, (2,8) },
|
||||
{ LedId.Keyboard_O, (2,9) },
|
||||
{ LedId.Keyboard_P, (2,10) },
|
||||
{ LedId.Keyboard_BracketLeft, (2,11) },
|
||||
{ LedId.Keyboard_BracketRight, (2,12) },
|
||||
{ LedId.Keyboard_Backslash, (2,13) },
|
||||
{ LedId.Keyboard_Delete, (2,14) },
|
||||
{ LedId.Keyboard_End, (2,15) },
|
||||
{ LedId.Keyboard_PageDown, (2,16) },
|
||||
|
||||
{ LedId.Keyboard_CapsLock, (3,0) },
|
||||
{ LedId.Keyboard_A, (3,1) },
|
||||
{ LedId.Keyboard_S, (3,2) },
|
||||
{ LedId.Keyboard_D, (3,3) },
|
||||
{ LedId.Keyboard_F, (3,4) },
|
||||
{ LedId.Keyboard_G, (3,5) },
|
||||
{ LedId.Keyboard_H, (3,6) },
|
||||
{ LedId.Keyboard_J, (3,7) },
|
||||
{ LedId.Keyboard_K, (3,8) },
|
||||
{ LedId.Keyboard_L, (3,9) },
|
||||
{ LedId.Keyboard_SemicolonAndColon, (3,10) },
|
||||
{ LedId.Keyboard_ApostropheAndDoubleQuote, (3,11) },
|
||||
{ LedId.Keyboard_NonUsTilde, (3,12) },
|
||||
{ LedId.Keyboard_Enter, (3,13) },
|
||||
|
||||
{ LedId.Keyboard_LeftShift, (4,0) },
|
||||
{ LedId.Keyboard_NonUsBackslash, (4,1) },
|
||||
{ LedId.Keyboard_Z, (4,2) },
|
||||
{ LedId.Keyboard_X, (4,3) },
|
||||
{ LedId.Keyboard_C, (4,4) },
|
||||
{ LedId.Keyboard_V, (4,5) },
|
||||
{ LedId.Keyboard_B, (4,6) },
|
||||
{ LedId.Keyboard_N, (4,7) },
|
||||
{ LedId.Keyboard_M, (4,8) },
|
||||
{ LedId.Keyboard_CommaAndLessThan, (4,9) },
|
||||
{ LedId.Keyboard_PeriodAndBiggerThan, (4,10) },
|
||||
{ LedId.Keyboard_SlashAndQuestionMark, (4,11) },
|
||||
{ LedId.Keyboard_RightShift, (4,13) },
|
||||
{ LedId.Keyboard_ArrowUp, (4,15) },
|
||||
|
||||
{ LedId.Keyboard_LeftCtrl, (5,0) },
|
||||
{ LedId.Keyboard_LeftGui, (5,1) },
|
||||
{ LedId.Keyboard_LeftAlt, (5,2) },
|
||||
{ LedId.Keyboard_Space, (5,6) },
|
||||
{ LedId.Keyboard_RightAlt, (5,10) },
|
||||
{ LedId.Keyboard_RightGui, (5,11) },
|
||||
{ LedId.Keyboard_Application, (5,12) },
|
||||
{ LedId.Keyboard_RightCtrl, (5,13) },
|
||||
{ LedId.Keyboard_ArrowLeft, (5,14) },
|
||||
{ LedId.Keyboard_ArrowDown, (5,15) },
|
||||
{ LedId.Keyboard_ArrowRight, (5,16) }
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
#region Fullsize
|
||||
|
||||
private static readonly Dictionary<LedId, (int row, int column)> Fullsize_US = new()
|
||||
{
|
||||
{ LedId.Keyboard_Escape, (0,0) },
|
||||
{ LedId.Keyboard_F1, (0,2) },
|
||||
{ LedId.Keyboard_F2, (0,3) },
|
||||
{ LedId.Keyboard_F3, (0,4) },
|
||||
{ LedId.Keyboard_F4, (0,5) },
|
||||
{ LedId.Keyboard_F5, (0,6) },
|
||||
{ LedId.Keyboard_F6, (0,7) },
|
||||
{ LedId.Keyboard_F7, (0,8) },
|
||||
{ LedId.Keyboard_F8, (0,9) },
|
||||
{ LedId.Keyboard_F9, (0,10) },
|
||||
{ LedId.Keyboard_F10, (0,11) },
|
||||
{ LedId.Keyboard_F11, (0,12) },
|
||||
{ LedId.Keyboard_F12, (0,13) },
|
||||
{ LedId.Keyboard_PrintScreen, (0,14) },
|
||||
{ LedId.Keyboard_PauseBreak, (0,15) },
|
||||
{ LedId.Keyboard_ScrollLock, (0,16) },
|
||||
{ LedId.Keyboard_Custom1, (0,17) },
|
||||
{ LedId.Keyboard_Custom2, (0,18) },
|
||||
{ LedId.Keyboard_Custom3, (0,19) },
|
||||
{ LedId.Keyboard_Custom4, (0,20) },
|
||||
|
||||
{ LedId.Keyboard_GraveAccentAndTilde, (1,0) },
|
||||
{ LedId.Keyboard_1, (1,1) },
|
||||
{ LedId.Keyboard_2, (1,2) },
|
||||
{ LedId.Keyboard_3, (1,3) },
|
||||
{ LedId.Keyboard_4, (1,4) },
|
||||
{ LedId.Keyboard_5, (1,5) },
|
||||
{ LedId.Keyboard_6, (1,6) },
|
||||
{ LedId.Keyboard_7, (1,7) },
|
||||
{ LedId.Keyboard_8, (1,8) },
|
||||
{ LedId.Keyboard_9, (1,9) },
|
||||
{ LedId.Keyboard_0, (1,10) },
|
||||
{ LedId.Keyboard_MinusAndUnderscore, (1,11) },
|
||||
{ LedId.Keyboard_EqualsAndPlus, (1,12) },
|
||||
{ LedId.Keyboard_Backspace, (1,13) },
|
||||
{ LedId.Keyboard_Insert, (1,14) },
|
||||
{ LedId.Keyboard_Home, (1,15) },
|
||||
{ LedId.Keyboard_PageUp, (1,16) },
|
||||
{ LedId.Keyboard_NumLock, (1,17) },
|
||||
{ LedId.Keyboard_NumSlash, (1,18) },
|
||||
{ LedId.Keyboard_NumAsterisk, (1,19) },
|
||||
{ LedId.Keyboard_NumMinus, (1,20) },
|
||||
|
||||
{ LedId.Keyboard_Tab, (2,0) },
|
||||
{ LedId.Keyboard_Q, (2,1) },
|
||||
{ LedId.Keyboard_W, (2,2) },
|
||||
{ LedId.Keyboard_E, (2,3) },
|
||||
{ LedId.Keyboard_R, (2,4) },
|
||||
{ LedId.Keyboard_T, (2,5) },
|
||||
{ LedId.Keyboard_Y, (2,6) },
|
||||
{ LedId.Keyboard_U, (2,7) },
|
||||
{ LedId.Keyboard_I, (2,8) },
|
||||
{ LedId.Keyboard_O, (2,9) },
|
||||
{ LedId.Keyboard_P, (2,10) },
|
||||
{ LedId.Keyboard_BracketLeft, (2,11) },
|
||||
{ LedId.Keyboard_BracketRight, (2,12) },
|
||||
{ LedId.Keyboard_Backslash, (2,13) },
|
||||
{ LedId.Keyboard_Delete, (2,14) },
|
||||
{ LedId.Keyboard_End, (2,15) },
|
||||
{ LedId.Keyboard_PageDown, (2,16) },
|
||||
{ LedId.Keyboard_Num7, (2,17) },
|
||||
{ LedId.Keyboard_Num8, (2,18) },
|
||||
{ LedId.Keyboard_Num9, (2,19) },
|
||||
{ LedId.Keyboard_NumPlus, (2,20) },
|
||||
|
||||
{ LedId.Keyboard_CapsLock, (3,0) },
|
||||
{ LedId.Keyboard_A, (3,1) },
|
||||
{ LedId.Keyboard_S, (3,2) },
|
||||
{ LedId.Keyboard_D, (3,3) },
|
||||
{ LedId.Keyboard_F, (3,4) },
|
||||
{ LedId.Keyboard_G, (3,5) },
|
||||
{ LedId.Keyboard_H, (3,6) },
|
||||
{ LedId.Keyboard_J, (3,7) },
|
||||
{ LedId.Keyboard_K, (3,8) },
|
||||
{ LedId.Keyboard_L, (3,9) },
|
||||
{ LedId.Keyboard_SemicolonAndColon, (3,10) },
|
||||
{ LedId.Keyboard_ApostropheAndDoubleQuote, (3,11) },
|
||||
{ LedId.Keyboard_Enter, (3,13) },
|
||||
{ LedId.Keyboard_Num4, (3,17) },
|
||||
{ LedId.Keyboard_Num5, (3,18) },
|
||||
{ LedId.Keyboard_Num6, (3,19) },
|
||||
|
||||
{ LedId.Keyboard_LeftShift, (4,0) },
|
||||
{ LedId.Keyboard_Z, (4,2) },
|
||||
{ LedId.Keyboard_X, (4,3) },
|
||||
{ LedId.Keyboard_C, (4,4) },
|
||||
{ LedId.Keyboard_V, (4,5) },
|
||||
{ LedId.Keyboard_B, (4,6) },
|
||||
{ LedId.Keyboard_N, (4,7) },
|
||||
{ LedId.Keyboard_M, (4,8) },
|
||||
{ LedId.Keyboard_CommaAndLessThan, (4,9) },
|
||||
{ LedId.Keyboard_PeriodAndBiggerThan, (4,10) },
|
||||
{ LedId.Keyboard_SlashAndQuestionMark, (4,11) },
|
||||
{ LedId.Keyboard_RightShift, (4,13) },
|
||||
{ LedId.Keyboard_ArrowUp, (4,15) },
|
||||
{ LedId.Keyboard_Num1, (4,17) },
|
||||
{ LedId.Keyboard_Num2, (4,18) },
|
||||
{ LedId.Keyboard_Num3, (4,19) },
|
||||
{ LedId.Keyboard_NumEnter, (4,20) },
|
||||
|
||||
{ LedId.Keyboard_LeftCtrl, (5,0) },
|
||||
{ LedId.Keyboard_LeftGui, (5,1) },
|
||||
{ LedId.Keyboard_LeftAlt, (5,2) },
|
||||
{ LedId.Keyboard_Space, (5,6) },
|
||||
{ LedId.Keyboard_RightAlt, (5,10) },
|
||||
{ LedId.Keyboard_RightGui, (5,11) },
|
||||
{ LedId.Keyboard_Application, (5,12) },
|
||||
{ LedId.Keyboard_RightCtrl, (5,13) },
|
||||
{ LedId.Keyboard_ArrowLeft, (5,14) },
|
||||
{ LedId.Keyboard_ArrowDown, (5,15) },
|
||||
{ LedId.Keyboard_ArrowRight, (5,16) },
|
||||
{ LedId.Keyboard_Num0, (5,18) },
|
||||
{ LedId.Keyboard_NumPeriodAndDelete, (5,19) }
|
||||
};
|
||||
|
||||
private static readonly Dictionary<LedId, (int row, int column)> Fullsize_UK = new()
|
||||
{
|
||||
{ LedId.Keyboard_Escape, (0,0) },
|
||||
{ LedId.Keyboard_F1, (0,2) },
|
||||
{ LedId.Keyboard_F2, (0,3) },
|
||||
{ LedId.Keyboard_F3, (0,4) },
|
||||
{ LedId.Keyboard_F4, (0,5) },
|
||||
{ LedId.Keyboard_F5, (0,6) },
|
||||
{ LedId.Keyboard_F6, (0,7) },
|
||||
{ LedId.Keyboard_F7, (0,8) },
|
||||
{ LedId.Keyboard_F8, (0,9) },
|
||||
{ LedId.Keyboard_F9, (0,10) },
|
||||
{ LedId.Keyboard_F10, (0,11) },
|
||||
{ LedId.Keyboard_F11, (0,12) },
|
||||
{ LedId.Keyboard_F12, (0,13) },
|
||||
{ LedId.Keyboard_PrintScreen, (0,14) },
|
||||
{ LedId.Keyboard_PauseBreak, (0,15) },
|
||||
{ LedId.Keyboard_ScrollLock, (0,16) },
|
||||
{ LedId.Keyboard_Custom1, (0,17) },
|
||||
{ LedId.Keyboard_Custom2, (0,18) },
|
||||
{ LedId.Keyboard_Custom3, (0,19) },
|
||||
{ LedId.Keyboard_Custom4, (0,20) },
|
||||
|
||||
{ LedId.Keyboard_GraveAccentAndTilde, (1,0) },
|
||||
{ LedId.Keyboard_1, (1,1) },
|
||||
{ LedId.Keyboard_2, (1,2) },
|
||||
{ LedId.Keyboard_3, (1,3) },
|
||||
{ LedId.Keyboard_4, (1,4) },
|
||||
{ LedId.Keyboard_5, (1,5) },
|
||||
{ LedId.Keyboard_6, (1,6) },
|
||||
{ LedId.Keyboard_7, (1,7) },
|
||||
{ LedId.Keyboard_8, (1,8) },
|
||||
{ LedId.Keyboard_9, (1,9) },
|
||||
{ LedId.Keyboard_0, (1,10) },
|
||||
{ LedId.Keyboard_MinusAndUnderscore, (1,11) },
|
||||
{ LedId.Keyboard_EqualsAndPlus, (1,12) },
|
||||
{ LedId.Keyboard_Backspace, (1,13) },
|
||||
{ LedId.Keyboard_Insert, (1,14) },
|
||||
{ LedId.Keyboard_Home, (1,15) },
|
||||
{ LedId.Keyboard_PageUp, (1,16) },
|
||||
{ LedId.Keyboard_NumLock, (1,17) },
|
||||
{ LedId.Keyboard_NumSlash, (1,18) },
|
||||
{ LedId.Keyboard_NumAsterisk, (1,19) },
|
||||
{ LedId.Keyboard_NumMinus, (1,20) },
|
||||
|
||||
{ LedId.Keyboard_Tab, (2,0) },
|
||||
{ LedId.Keyboard_Q, (2,1) },
|
||||
{ LedId.Keyboard_W, (2,2) },
|
||||
{ LedId.Keyboard_E, (2,3) },
|
||||
{ LedId.Keyboard_R, (2,4) },
|
||||
{ LedId.Keyboard_T, (2,5) },
|
||||
{ LedId.Keyboard_Y, (2,6) },
|
||||
{ LedId.Keyboard_U, (2,7) },
|
||||
{ LedId.Keyboard_I, (2,8) },
|
||||
{ LedId.Keyboard_O, (2,9) },
|
||||
{ LedId.Keyboard_P, (2,10) },
|
||||
{ LedId.Keyboard_BracketLeft, (2,11) },
|
||||
{ LedId.Keyboard_BracketRight, (2,12) },
|
||||
{ LedId.Keyboard_Backslash, (2,13) },
|
||||
{ LedId.Keyboard_Delete, (2,14) },
|
||||
{ LedId.Keyboard_End, (2,15) },
|
||||
{ LedId.Keyboard_PageDown, (2,16) },
|
||||
{ LedId.Keyboard_Num7, (2,17) },
|
||||
{ LedId.Keyboard_Num8, (2,18) },
|
||||
{ LedId.Keyboard_Num9, (2,19) },
|
||||
{ LedId.Keyboard_NumPlus, (2,20) },
|
||||
|
||||
{ LedId.Keyboard_CapsLock, (3,0) },
|
||||
{ LedId.Keyboard_A, (3,1) },
|
||||
{ LedId.Keyboard_S, (3,2) },
|
||||
{ LedId.Keyboard_D, (3,3) },
|
||||
{ LedId.Keyboard_F, (3,4) },
|
||||
{ LedId.Keyboard_G, (3,5) },
|
||||
{ LedId.Keyboard_H, (3,6) },
|
||||
{ LedId.Keyboard_J, (3,7) },
|
||||
{ LedId.Keyboard_K, (3,8) },
|
||||
{ LedId.Keyboard_L, (3,9) },
|
||||
{ LedId.Keyboard_SemicolonAndColon, (3,10) },
|
||||
{ LedId.Keyboard_ApostropheAndDoubleQuote, (3,11) },
|
||||
{ LedId.Keyboard_NonUsTilde, (3,12) },
|
||||
{ LedId.Keyboard_Enter, (3,13) },
|
||||
{ LedId.Keyboard_Num4, (3,17) },
|
||||
{ LedId.Keyboard_Num5, (3,18) },
|
||||
{ LedId.Keyboard_Num6, (3,19) },
|
||||
|
||||
{ LedId.Keyboard_LeftShift, (4,0) },
|
||||
{ LedId.Keyboard_NonUsBackslash, (4,1) },
|
||||
{ LedId.Keyboard_Z, (4,2) },
|
||||
{ LedId.Keyboard_X, (4,3) },
|
||||
{ LedId.Keyboard_C, (4,4) },
|
||||
{ LedId.Keyboard_V, (4,5) },
|
||||
{ LedId.Keyboard_B, (4,6) },
|
||||
{ LedId.Keyboard_N, (4,7) },
|
||||
{ LedId.Keyboard_M, (4,8) },
|
||||
{ LedId.Keyboard_CommaAndLessThan, (4,9) },
|
||||
{ LedId.Keyboard_PeriodAndBiggerThan, (4,10) },
|
||||
{ LedId.Keyboard_SlashAndQuestionMark, (4,11) },
|
||||
{ LedId.Keyboard_RightShift, (4,13) },
|
||||
{ LedId.Keyboard_ArrowUp, (4,15) },
|
||||
{ LedId.Keyboard_Num1, (4,17) },
|
||||
{ LedId.Keyboard_Num2, (4,18) },
|
||||
{ LedId.Keyboard_Num3, (4,19) },
|
||||
{ LedId.Keyboard_NumEnter, (4,20) },
|
||||
|
||||
{ LedId.Keyboard_LeftCtrl, (5,0) },
|
||||
{ LedId.Keyboard_LeftGui, (5,1) },
|
||||
{ LedId.Keyboard_LeftAlt, (5,2) },
|
||||
{ LedId.Keyboard_Space, (5,6) },
|
||||
{ LedId.Keyboard_RightAlt, (5,10) },
|
||||
{ LedId.Keyboard_RightGui, (5,11) },
|
||||
{ LedId.Keyboard_Application, (5,12) },
|
||||
{ LedId.Keyboard_RightCtrl, (5,13) },
|
||||
{ LedId.Keyboard_ArrowLeft, (5,14) },
|
||||
{ LedId.Keyboard_ArrowDown, (5,15) },
|
||||
{ LedId.Keyboard_ArrowRight, (5,16) },
|
||||
{ LedId.Keyboard_Num0, (5,18) },
|
||||
{ LedId.Keyboard_NumPeriodAndDelete, (5,19) }
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Contains all the hardware-id mappings for Wooting devices.
|
||||
/// </summary>
|
||||
public static readonly Dictionary<WootingDeviceType, Dictionary<WootingPhysicalKeyboardLayout, Dictionary<LedId, (int row, int column)>>> Mapping =
|
||||
new()
|
||||
{
|
||||
{ WootingDeviceType.KeyboardTKL, new Dictionary<WootingPhysicalKeyboardLayout, Dictionary<LedId, (int row, int column)>>
|
||||
{
|
||||
{ WootingPhysicalKeyboardLayout.US, TKL_US },
|
||||
{ WootingPhysicalKeyboardLayout.UK, TKL_UK }
|
||||
}
|
||||
},
|
||||
|
||||
{ WootingDeviceType.Keyboard, new Dictionary<WootingPhysicalKeyboardLayout, Dictionary<LedId, (int row, int column)>>
|
||||
{
|
||||
{ WootingPhysicalKeyboardLayout.US, Fullsize_US },
|
||||
{ WootingPhysicalKeyboardLayout.UK, Fullsize_UK }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -3,53 +3,52 @@ using RGB.NET.Core;
|
||||
using RGB.NET.Devices.Wooting.Enum;
|
||||
using RGB.NET.Devices.Wooting.Generic;
|
||||
|
||||
namespace RGB.NET.Devices.Wooting.Keyboard
|
||||
namespace RGB.NET.Devices.Wooting.Keyboard;
|
||||
|
||||
/// <inheritdoc cref="WootingRGBDevice{TDeviceInfo}" />
|
||||
/// <summary>
|
||||
/// Represents a Wooting keyboard.
|
||||
/// </summary>
|
||||
public class WootingKeyboardRGBDevice : WootingRGBDevice<WootingKeyboardRGBDeviceInfo>, IKeyboard
|
||||
{
|
||||
/// <inheritdoc cref="WootingRGBDevice{TDeviceInfo}" />
|
||||
#region Properties & Fields
|
||||
|
||||
IKeyboardDeviceInfo IKeyboard.DeviceInfo => DeviceInfo;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents a Wooting keyboard.
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Wooting.Keyboard.WootingKeyboardRGBDevice" /> class.
|
||||
/// </summary>
|
||||
public class WootingKeyboardRGBDevice : WootingRGBDevice<WootingKeyboardRGBDeviceInfo>, IKeyboard
|
||||
/// <param name="info">The specific information provided by Wooting for the keyboard</param>
|
||||
/// <param name="updateTrigger">The update trigger used to update this device.</param>
|
||||
internal WootingKeyboardRGBDevice(WootingKeyboardRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, updateTrigger)
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
IKeyboardDeviceInfo IKeyboard.DeviceInfo => DeviceInfo;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Wooting.Keyboard.WootingKeyboardRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by Wooting for the keyboard</param>
|
||||
/// <param name="updateTrigger">The update trigger used to update this device.</param>
|
||||
internal WootingKeyboardRGBDevice(WootingKeyboardRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, updateTrigger)
|
||||
{
|
||||
InitializeLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
private void InitializeLayout()
|
||||
{
|
||||
//TODO DarthAffe 13.02.2021: Check how the mapping can work without knowing the physical layout
|
||||
Dictionary<LedId, (int row, int column)> mapping = WootingKeyboardLedMappings.Mapping[DeviceInfo.WootingDeviceType][WootingPhysicalKeyboardLayout.US];
|
||||
|
||||
foreach (KeyValuePair<LedId, (int row, int column)> led in mapping)
|
||||
AddLed(led.Key, new Point(led.Value.column * 19, led.Value.row * 19), new Size(19, 19));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override object GetLedCustomData(LedId ledId) => WootingKeyboardLedMappings.Mapping[DeviceInfo.WootingDeviceType][WootingPhysicalKeyboardLayout.US][ledId];
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate) => UpdateQueue.SetData(GetUpdateData(ledsToUpdate));
|
||||
|
||||
#endregion
|
||||
InitializeLayout();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
private void InitializeLayout()
|
||||
{
|
||||
//TODO DarthAffe 13.02.2021: Check how the mapping can work without knowing the physical layout
|
||||
Dictionary<LedId, (int row, int column)> mapping = WootingKeyboardLedMappings.Mapping[DeviceInfo.WootingDeviceType][WootingPhysicalKeyboardLayout.US];
|
||||
|
||||
foreach (KeyValuePair<LedId, (int row, int column)> led in mapping)
|
||||
AddLed(led.Key, new Point(led.Value.column * 19, led.Value.row * 19), new Size(19, 19));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override object GetLedCustomData(LedId ledId) => WootingKeyboardLedMappings.Mapping[DeviceInfo.WootingDeviceType][WootingPhysicalKeyboardLayout.US][ledId];
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate) => UpdateQueue.SetData(GetUpdateData(ledsToUpdate));
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -2,31 +2,30 @@
|
||||
using RGB.NET.Devices.Wooting.Generic;
|
||||
using RGB.NET.Devices.Wooting.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Wooting.Keyboard
|
||||
namespace RGB.NET.Devices.Wooting.Keyboard;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Wooting.Keyboard.WootingKeyboardRGBDevice" />.
|
||||
/// </summary>
|
||||
public class WootingKeyboardRGBDeviceInfo : WootingRGBDeviceInfo, IKeyboardDeviceInfo
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
/// <inheritdoc />
|
||||
public KeyboardLayoutType Layout => KeyboardLayoutType.Unknown;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Wooting.Keyboard.WootingKeyboardRGBDevice" />.
|
||||
/// Internal constructor of managed <see cref="T:RGB.NET.Devices.Wooting.WootingKeyboardRGBDeviceInfo" />.
|
||||
/// </summary>
|
||||
public class WootingKeyboardRGBDeviceInfo : WootingRGBDeviceInfo, IKeyboardDeviceInfo
|
||||
{
|
||||
#region Properties & Fields
|
||||
/// <param name="deviceInfo">The native <see cref="T:RGB.NET.Devices.Wooting.Native._WootingDeviceInfo" />.</param>
|
||||
internal WootingKeyboardRGBDeviceInfo(_WootingDeviceInfo deviceInfo)
|
||||
: base(RGBDeviceType.Keyboard, deviceInfo)
|
||||
{ }
|
||||
|
||||
/// <inheritdoc />
|
||||
public KeyboardLayoutType Layout => KeyboardLayoutType.Unknown;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Internal constructor of managed <see cref="T:RGB.NET.Devices.Wooting.WootingKeyboardRGBDeviceInfo" />.
|
||||
/// </summary>
|
||||
/// <param name="deviceInfo">The native <see cref="T:RGB.NET.Devices.Wooting.Native._WootingDeviceInfo" />.</param>
|
||||
internal WootingKeyboardRGBDeviceInfo(_WootingDeviceInfo deviceInfo)
|
||||
: base(RGBDeviceType.Keyboard, deviceInfo)
|
||||
{ }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -4,23 +4,22 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using RGB.NET.Devices.Wooting.Enum;
|
||||
|
||||
namespace RGB.NET.Devices.Wooting.Native
|
||||
namespace RGB.NET.Devices.Wooting.Native;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct _WootingDeviceInfo
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct _WootingDeviceInfo
|
||||
{
|
||||
internal bool Connected { get; private set; }
|
||||
internal bool Connected { get; private set; }
|
||||
|
||||
internal string Model { get; private set; }
|
||||
internal string Model { get; private set; }
|
||||
|
||||
internal byte MaxRows { get; private set; }
|
||||
internal byte MaxRows { get; private set; }
|
||||
|
||||
internal byte MaxColumns { get; private set; }
|
||||
internal byte MaxColumns { get; private set; }
|
||||
|
||||
internal byte KeycodeLimit { get; private set; }
|
||||
internal byte KeycodeLimit { get; private set; }
|
||||
|
||||
internal WootingDeviceType DeviceType { get; private set; }
|
||||
internal WootingDeviceType DeviceType { get; private set; }
|
||||
|
||||
internal bool V2Interface { get; set; }
|
||||
}
|
||||
}
|
||||
internal bool V2Interface { get; set; }
|
||||
}
|
||||
@@ -8,123 +8,121 @@ using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.Wooting.Native
|
||||
namespace RGB.NET.Devices.Wooting.Native;
|
||||
|
||||
// ReSharper disable once InconsistentNaming
|
||||
internal static class _WootingSDK
|
||||
{
|
||||
// ReSharper disable once InconsistentNaming
|
||||
internal static class _WootingSDK
|
||||
#region Library management
|
||||
|
||||
private static IntPtr _dllHandle = IntPtr.Zero;
|
||||
internal static object SdkLock = new();
|
||||
|
||||
/// <summary>
|
||||
/// Reloads the SDK.
|
||||
/// </summary>
|
||||
internal static void Reload()
|
||||
{
|
||||
#region Library management
|
||||
|
||||
private static IntPtr _dllHandle = IntPtr.Zero;
|
||||
internal static object SdkLock = new();
|
||||
|
||||
/// <summary>
|
||||
/// Reloads the SDK.
|
||||
/// </summary>
|
||||
internal static void Reload()
|
||||
{
|
||||
UnloadWootingSDK();
|
||||
LoadWootingSDK();
|
||||
}
|
||||
|
||||
private static void LoadWootingSDK()
|
||||
{
|
||||
if (_dllHandle != IntPtr.Zero) return;
|
||||
|
||||
// HACK: Load library at runtime to support both, x86 and x64 with one managed dll
|
||||
List<string> possiblePathList = Environment.Is64BitProcess ? WootingDeviceProvider.PossibleX64NativePaths : WootingDeviceProvider.PossibleX86NativePaths;
|
||||
string? dllPath = possiblePathList.FirstOrDefault(File.Exists);
|
||||
if (dllPath == null) throw new RGBDeviceException($"Can't find the Wooting-SDK at one of the expected locations:\r\n '{string.Join("\r\n", possiblePathList.Select(Path.GetFullPath))}'");
|
||||
|
||||
SetDllDirectory(Path.GetDirectoryName(Path.GetFullPath(dllPath))!);
|
||||
|
||||
_dllHandle = LoadLibrary(dllPath);
|
||||
if (_dllHandle == IntPtr.Zero) throw new RGBDeviceException($"Wooting LoadLibrary failed with error code {Marshal.GetLastWin32Error()}");
|
||||
|
||||
_getDeviceInfoPointer = (GetDeviceInfoPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "wooting_rgb_device_info"), typeof(GetDeviceInfoPointer));
|
||||
_keyboardConnectedPointer = (KeyboardConnectedPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "wooting_rgb_kbd_connected"), typeof(KeyboardConnectedPointer));
|
||||
_resetPointer = (ResetPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "wooting_rgb_reset_rgb"), typeof(ResetPointer));
|
||||
_closePointer = (ClosePointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "wooting_rgb_close"), typeof(ClosePointer));
|
||||
_arrayUpdateKeyboardPointer = (ArrayUpdateKeyboardPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "wooting_rgb_array_update_keyboard"), typeof(ArrayUpdateKeyboardPointer));
|
||||
_arraySetSinglePointer = (ArraySetSinglePointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "wooting_rgb_array_set_single"), typeof(ArraySetSinglePointer));
|
||||
}
|
||||
|
||||
internal static void UnloadWootingSDK()
|
||||
{
|
||||
if (_dllHandle == IntPtr.Zero) return;
|
||||
|
||||
Reset();
|
||||
Close();
|
||||
|
||||
_getDeviceInfoPointer = null;
|
||||
_keyboardConnectedPointer = null;
|
||||
_arrayUpdateKeyboardPointer = null;
|
||||
_arraySetSinglePointer = null;
|
||||
_resetPointer = null;
|
||||
_closePointer = null;
|
||||
|
||||
// ReSharper disable once EmptyEmbeddedStatement - DarthAffe 20.02.2016: We might need to reduce the internal reference counter more than once to set the library free
|
||||
while (FreeLibrary(_dllHandle)) ;
|
||||
_dllHandle = IntPtr.Zero;
|
||||
}
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
private static extern bool SetDllDirectory(string lpPathName);
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
private static extern IntPtr LoadLibrary(string dllToLoad);
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
private static extern bool FreeLibrary(IntPtr dllHandle);
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
private static extern IntPtr GetProcAddress(IntPtr dllHandle, string name);
|
||||
|
||||
#endregion
|
||||
|
||||
#region SDK-METHODS
|
||||
|
||||
#region Pointers
|
||||
|
||||
private static GetDeviceInfoPointer? _getDeviceInfoPointer;
|
||||
private static KeyboardConnectedPointer? _keyboardConnectedPointer;
|
||||
private static ResetPointer? _resetPointer;
|
||||
private static ClosePointer? _closePointer;
|
||||
private static ArrayUpdateKeyboardPointer? _arrayUpdateKeyboardPointer;
|
||||
private static ArraySetSinglePointer? _arraySetSinglePointer;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Delegates
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
private delegate IntPtr GetDeviceInfoPointer();
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
private delegate bool KeyboardConnectedPointer();
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
private delegate bool ResetPointer();
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
private delegate bool ClosePointer();
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
private delegate bool ArrayUpdateKeyboardPointer();
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
private delegate bool ArraySetSinglePointer(byte row, byte column, byte red, byte green, byte blue);
|
||||
|
||||
#endregion
|
||||
|
||||
internal static IntPtr GetDeviceInfo() => (_getDeviceInfoPointer ?? throw new RGBDeviceException("The Wooting-SDK is not initialized.")).Invoke();
|
||||
internal static bool KeyboardConnected() => (_keyboardConnectedPointer ?? throw new RGBDeviceException("The Wooting-SDK is not initialized.")).Invoke();
|
||||
internal static bool Reset() => (_resetPointer ?? throw new RGBDeviceException("The Wooting-SDK is not initialized.")).Invoke();
|
||||
internal static bool Close() => (_closePointer ?? throw new RGBDeviceException("The Wooting-SDK is not initialized.")).Invoke();
|
||||
internal static bool ArrayUpdateKeyboard() => (_arrayUpdateKeyboardPointer ?? throw new RGBDeviceException("The Wooting-SDK is not initialized.")).Invoke();
|
||||
internal static bool ArraySetSingle(byte row, byte column, byte red, byte green, byte blue) => (_arraySetSinglePointer ?? throw new RGBDeviceException("The Wooting-SDK is not initialized.")).Invoke(row, column, red, green, blue);
|
||||
|
||||
#endregion
|
||||
UnloadWootingSDK();
|
||||
LoadWootingSDK();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void LoadWootingSDK()
|
||||
{
|
||||
if (_dllHandle != IntPtr.Zero) return;
|
||||
|
||||
// HACK: Load library at runtime to support both, x86 and x64 with one managed dll
|
||||
List<string> possiblePathList = Environment.Is64BitProcess ? WootingDeviceProvider.PossibleX64NativePaths : WootingDeviceProvider.PossibleX86NativePaths;
|
||||
string? dllPath = possiblePathList.FirstOrDefault(File.Exists);
|
||||
if (dllPath == null) throw new RGBDeviceException($"Can't find the Wooting-SDK at one of the expected locations:\r\n '{string.Join("\r\n", possiblePathList.Select(Path.GetFullPath))}'");
|
||||
|
||||
SetDllDirectory(Path.GetDirectoryName(Path.GetFullPath(dllPath))!);
|
||||
|
||||
_dllHandle = LoadLibrary(dllPath);
|
||||
if (_dllHandle == IntPtr.Zero) throw new RGBDeviceException($"Wooting LoadLibrary failed with error code {Marshal.GetLastWin32Error()}");
|
||||
|
||||
_getDeviceInfoPointer = (GetDeviceInfoPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "wooting_rgb_device_info"), typeof(GetDeviceInfoPointer));
|
||||
_keyboardConnectedPointer = (KeyboardConnectedPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "wooting_rgb_kbd_connected"), typeof(KeyboardConnectedPointer));
|
||||
_resetPointer = (ResetPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "wooting_rgb_reset_rgb"), typeof(ResetPointer));
|
||||
_closePointer = (ClosePointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "wooting_rgb_close"), typeof(ClosePointer));
|
||||
_arrayUpdateKeyboardPointer = (ArrayUpdateKeyboardPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "wooting_rgb_array_update_keyboard"), typeof(ArrayUpdateKeyboardPointer));
|
||||
_arraySetSinglePointer = (ArraySetSinglePointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "wooting_rgb_array_set_single"), typeof(ArraySetSinglePointer));
|
||||
}
|
||||
|
||||
internal static void UnloadWootingSDK()
|
||||
{
|
||||
if (_dllHandle == IntPtr.Zero) return;
|
||||
|
||||
Reset();
|
||||
Close();
|
||||
|
||||
_getDeviceInfoPointer = null;
|
||||
_keyboardConnectedPointer = null;
|
||||
_arrayUpdateKeyboardPointer = null;
|
||||
_arraySetSinglePointer = null;
|
||||
_resetPointer = null;
|
||||
_closePointer = null;
|
||||
|
||||
// ReSharper disable once EmptyEmbeddedStatement - DarthAffe 20.02.2016: We might need to reduce the internal reference counter more than once to set the library free
|
||||
while (FreeLibrary(_dllHandle)) ;
|
||||
_dllHandle = IntPtr.Zero;
|
||||
}
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
private static extern bool SetDllDirectory(string lpPathName);
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
private static extern IntPtr LoadLibrary(string dllToLoad);
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
private static extern bool FreeLibrary(IntPtr dllHandle);
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
private static extern IntPtr GetProcAddress(IntPtr dllHandle, string name);
|
||||
|
||||
#endregion
|
||||
|
||||
#region SDK-METHODS
|
||||
|
||||
#region Pointers
|
||||
|
||||
private static GetDeviceInfoPointer? _getDeviceInfoPointer;
|
||||
private static KeyboardConnectedPointer? _keyboardConnectedPointer;
|
||||
private static ResetPointer? _resetPointer;
|
||||
private static ClosePointer? _closePointer;
|
||||
private static ArrayUpdateKeyboardPointer? _arrayUpdateKeyboardPointer;
|
||||
private static ArraySetSinglePointer? _arraySetSinglePointer;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Delegates
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
private delegate IntPtr GetDeviceInfoPointer();
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
private delegate bool KeyboardConnectedPointer();
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
private delegate bool ResetPointer();
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
private delegate bool ClosePointer();
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
private delegate bool ArrayUpdateKeyboardPointer();
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
private delegate bool ArraySetSinglePointer(byte row, byte column, byte red, byte green, byte blue);
|
||||
|
||||
#endregion
|
||||
|
||||
internal static IntPtr GetDeviceInfo() => (_getDeviceInfoPointer ?? throw new RGBDeviceException("The Wooting-SDK is not initialized.")).Invoke();
|
||||
internal static bool KeyboardConnected() => (_keyboardConnectedPointer ?? throw new RGBDeviceException("The Wooting-SDK is not initialized.")).Invoke();
|
||||
internal static bool Reset() => (_resetPointer ?? throw new RGBDeviceException("The Wooting-SDK is not initialized.")).Invoke();
|
||||
internal static bool Close() => (_closePointer ?? throw new RGBDeviceException("The Wooting-SDK is not initialized.")).Invoke();
|
||||
internal static bool ArrayUpdateKeyboard() => (_arrayUpdateKeyboardPointer ?? throw new RGBDeviceException("The Wooting-SDK is not initialized.")).Invoke();
|
||||
internal static bool ArraySetSingle(byte row, byte column, byte red, byte green, byte blue) => (_arraySetSinglePointer ?? throw new RGBDeviceException("The Wooting-SDK is not initialized.")).Invoke(row, column, red, green, blue);
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -5,87 +5,86 @@ using RGB.NET.Core;
|
||||
using RGB.NET.Devices.Wooting.Keyboard;
|
||||
using RGB.NET.Devices.Wooting.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Wooting
|
||||
namespace RGB.NET.Devices.Wooting;
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents a device provider responsible for Wooting devices.
|
||||
/// </summary>
|
||||
public class WootingDeviceProvider : AbstractRGBDeviceProvider
|
||||
{
|
||||
/// <inheritdoc />
|
||||
#region Properties & Fields
|
||||
|
||||
private static WootingDeviceProvider? _instance;
|
||||
/// <summary>
|
||||
/// Represents a device provider responsible for Wooting devices.
|
||||
/// Gets the singleton <see cref="WootingDeviceProvider"/> instance.
|
||||
/// </summary>
|
||||
public class WootingDeviceProvider : AbstractRGBDeviceProvider
|
||||
public static WootingDeviceProvider Instance => _instance ?? new WootingDeviceProvider();
|
||||
|
||||
/// <summary>
|
||||
/// Gets a modifiable list of paths used to find the native SDK-dlls for x86 applications.
|
||||
/// The first match will be used.
|
||||
/// </summary>
|
||||
public static List<string> PossibleX86NativePaths { get; } = new() { "x86/wooting-rgb-sdk.dll" };
|
||||
|
||||
/// <summary>
|
||||
/// Gets a modifiable list of paths used to find the native SDK-dlls for x64 applications.
|
||||
/// The first match will be used.
|
||||
/// </summary>
|
||||
public static List<string> PossibleX64NativePaths { get; } = new() { "x64/wooting-rgb-sdk64.dll" };
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="WootingDeviceProvider"/> class.
|
||||
/// </summary>
|
||||
/// <exception cref="InvalidOperationException">Thrown if this constructor is called even if there is already an instance of this class.</exception>
|
||||
public WootingDeviceProvider()
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private static WootingDeviceProvider? _instance;
|
||||
/// <summary>
|
||||
/// Gets the singleton <see cref="WootingDeviceProvider"/> instance.
|
||||
/// </summary>
|
||||
public static WootingDeviceProvider Instance => _instance ?? new WootingDeviceProvider();
|
||||
|
||||
/// <summary>
|
||||
/// Gets a modifiable list of paths used to find the native SDK-dlls for x86 applications.
|
||||
/// The first match will be used.
|
||||
/// </summary>
|
||||
public static List<string> PossibleX86NativePaths { get; } = new() { "x86/wooting-rgb-sdk.dll" };
|
||||
|
||||
/// <summary>
|
||||
/// Gets a modifiable list of paths used to find the native SDK-dlls for x64 applications.
|
||||
/// The first match will be used.
|
||||
/// </summary>
|
||||
public static List<string> PossibleX64NativePaths { get; } = new() { "x64/wooting-rgb-sdk64.dll" };
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="WootingDeviceProvider"/> class.
|
||||
/// </summary>
|
||||
/// <exception cref="InvalidOperationException">Thrown if this constructor is called even if there is already an instance of this class.</exception>
|
||||
public WootingDeviceProvider()
|
||||
{
|
||||
if (_instance != null) throw new InvalidOperationException($"There can be only one instance of type {nameof(WootingDeviceProvider)}");
|
||||
_instance = this;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void InitializeSDK()
|
||||
{
|
||||
lock (_WootingSDK.SdkLock)
|
||||
{
|
||||
_WootingSDK.Reload();
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override IEnumerable<IRGBDevice> LoadDevices()
|
||||
{
|
||||
lock (_WootingSDK.SdkLock)
|
||||
{
|
||||
if (_WootingSDK.KeyboardConnected())
|
||||
{
|
||||
_WootingDeviceInfo nativeDeviceInfo = (_WootingDeviceInfo)Marshal.PtrToStructure(_WootingSDK.GetDeviceInfo(), typeof(_WootingDeviceInfo))!;
|
||||
|
||||
yield return new WootingKeyboardRGBDevice(new WootingKeyboardRGBDeviceInfo(nativeDeviceInfo), GetUpdateTrigger());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
|
||||
lock (_WootingSDK.SdkLock)
|
||||
{
|
||||
try { _WootingSDK.UnloadWootingSDK(); }
|
||||
catch { /* at least we tried */ }
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
if (_instance != null) throw new InvalidOperationException($"There can be only one instance of type {nameof(WootingDeviceProvider)}");
|
||||
_instance = this;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void InitializeSDK()
|
||||
{
|
||||
lock (_WootingSDK.SdkLock)
|
||||
{
|
||||
_WootingSDK.Reload();
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override IEnumerable<IRGBDevice> LoadDevices()
|
||||
{
|
||||
lock (_WootingSDK.SdkLock)
|
||||
{
|
||||
if (_WootingSDK.KeyboardConnected())
|
||||
{
|
||||
_WootingDeviceInfo nativeDeviceInfo = (_WootingDeviceInfo)Marshal.PtrToStructure(_WootingSDK.GetDeviceInfo(), typeof(_WootingDeviceInfo))!;
|
||||
|
||||
yield return new WootingKeyboardRGBDevice(new WootingKeyboardRGBDeviceInfo(nativeDeviceInfo), GetUpdateTrigger());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
|
||||
lock (_WootingSDK.SdkLock)
|
||||
{
|
||||
try { _WootingSDK.UnloadWootingSDK(); }
|
||||
catch { /* at least we tried */ }
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
Reference in new issue
Block a user