1
0
mirror of https://github.com/DarthAffe/RGB.NET.git synced 2025-12-13 10:08:31 +00:00

Refactored LedIds

Everything is now based on the same ids for all devices
This commit is contained in:
Darth Affe 2017-12-13 17:19:56 +01:00
parent 200e471e4d
commit c5a1825f50
80 changed files with 2923 additions and 3657 deletions

View File

@ -4,7 +4,9 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using RGB.NET.Core.Layout;
namespace RGB.NET.Core namespace RGB.NET.Core
{ {
@ -46,7 +48,7 @@ namespace RGB.NET.Core
/// <summary> /// <summary>
/// Gets a dictionary containing all <see cref="Led"/> of the <see cref="IRGBDevice"/>. /// Gets a dictionary containing all <see cref="Led"/> of the <see cref="IRGBDevice"/>.
/// </summary> /// </summary>
protected Dictionary<ILedId, Led> LedMapping { get; } = new Dictionary<ILedId, Led>(); protected Dictionary<LedId, Led> LedMapping { get; } = new Dictionary<LedId, Led>();
/// <summary> /// <summary>
/// Gets a dictionary containing all <see cref="IRGBDeviceSpecialPart"/> associated with this <see cref="IRGBDevice"/>. /// Gets a dictionary containing all <see cref="IRGBDeviceSpecialPart"/> associated with this <see cref="IRGBDevice"/>.
@ -56,7 +58,7 @@ namespace RGB.NET.Core
#region Indexer #region Indexer
/// <inheritdoc /> /// <inheritdoc />
Led IRGBDevice.this[ILedId ledId] => LedMapping.TryGetValue(ledId, out Led led) ? led : null; Led IRGBDevice.this[LedId ledId] => LedMapping.TryGetValue(ledId, out Led led) ? led : null;
/// <inheritdoc /> /// <inheritdoc />
Led IRGBDevice.this[Point location] => LedMapping.Values.FirstOrDefault(x => x.LedRectangle.Contains(location)); Led IRGBDevice.this[Point location] => LedMapping.Values.FirstOrDefault(x => x.LedRectangle.Contains(location));
@ -111,18 +113,66 @@ namespace RGB.NET.Core
/// <summary> /// <summary>
/// Initializes the <see cref="Led"/> with the specified id. /// Initializes the <see cref="Led"/> with the specified id.
/// </summary> /// </summary>
/// <param name="ledId">The <see cref="ILedId"/> to initialize.</param> /// <param name="ledId">The <see cref="LedId"/> to initialize.</param>
/// <param name="ledRectangle">The <see cref="Rectangle"/> representing the position of the <see cref="Led"/> to initialize.</param> /// <param name="ledRectangle">The <see cref="Rectangle"/> representing the position of the <see cref="Led"/> to initialize.</param>
/// <returns></returns> /// <returns></returns>
protected virtual Led InitializeLed(ILedId ledId, Rectangle ledRectangle) protected virtual Led InitializeLed(LedId ledId, Rectangle ledRectangle)
{ {
if (LedMapping.ContainsKey(ledId)) return null; if ((ledId == LedId.Invalid) || LedMapping.ContainsKey(ledId)) return null;
Led led = new Led(this, ledId, ledRectangle); Led led = new Led(this, ledId, ledRectangle, CreateLedCustomData(ledId));
LedMapping.Add(ledId, led); LedMapping.Add(ledId, led);
return led; return led;
} }
/// <summary>
/// Applies the given layout.
/// </summary>
/// <param name="layoutPath">The file containing the layout.</param>
/// <param name="imageLayout">The name of the layout used to get the images of the leds.</param>
/// <param name="imageBasePath">The path images for this device are collected in.</param>
/// <param name="createMissingLeds">If set to true a new led is initialized for every id in the layout if it doesn't already exist.</param>
protected virtual void ApplyLayoutFromFile(string layoutPath, string imageLayout, string imageBasePath, bool createMissingLeds = false)
{
DeviceLayout layout = DeviceLayout.Load(layoutPath);
if (layout != null)
{
LedImageLayout ledImageLayout = layout.LedImageLayouts.FirstOrDefault(x => string.Equals(x.Layout, imageLayout, StringComparison.OrdinalIgnoreCase));
Size = new Size(layout.Width, layout.Height);
if (layout.Leds != null)
foreach (LedLayout layoutLed in layout.Leds)
{
if (Enum.TryParse(layoutLed.Id, true, out LedId ledId))
{
if (!LedMapping.TryGetValue(ledId, out Led led) && createMissingLeds)
led = InitializeLed(ledId, new Rectangle());
if (led != null)
{
led.LedRectangle.Location = new Point(layoutLed.X, layoutLed.Y);
led.LedRectangle.Size = new Size(layoutLed.Width, layoutLed.Height);
led.Shape = layoutLed.Shape;
led.ShapeData = layoutLed.ShapeData;
LedImage image = ledImageLayout?.LedImages.FirstOrDefault(x => x.Id == layoutLed.Id);
led.Image = (!string.IsNullOrEmpty(image?.Image))
? new Uri(Path.Combine(imageBasePath, image.Image), UriKind.Absolute)
: new Uri(Path.Combine(imageBasePath, "Missing.png"), UriKind.Absolute);
}
}
}
}
}
/// <summary>
/// Creates provider-specific data associated with this <see cref="LedId"/>.
/// </summary>
/// <param name="ledId">The <see cref="LedId"/>.</param>
protected virtual object CreateLedCustomData(LedId ledId) => null;
/// <inheritdoc /> /// <inheritdoc />
public void AddSpecialDevicePart<T>(T specialDevicePart) public void AddSpecialDevicePart<T>(T specialDevicePart)
where T : class, IRGBDeviceSpecialPart where T : class, IRGBDeviceSpecialPart

View File

@ -2,14 +2,31 @@
namespace RGB.NET.Core namespace RGB.NET.Core
{ {
/// <summary>
/// Contains a list of different device device update modes.
/// </summary>
[Flags] [Flags]
public enum DeviceUpdateMode public enum DeviceUpdateMode
{ {
/// <summary>
/// Represents nothing.
/// </summary>
None = 0, None = 0,
/// <summary>
/// Represents a mode which updates the leds of the device.
/// </summary>
Sync = 1 << 0, Sync = 1 << 0,
/// <summary>
/// Represents a mode which reads the color of the leds of the device.
/// This isn't supported by all devices!
/// </summary>
SyncBack = 1 << 1, SyncBack = 1 << 1,
/// <summary>
/// Represents all update modes.
/// </summary>
NoUpdate = 1 << 0xFF NoUpdate = 1 << 0xFF
} }
} }

View File

@ -38,11 +38,11 @@ namespace RGB.NET.Core
#region Indexer #region Indexer
/// <summary> /// <summary>
/// Gets the <see cref="Led"/> with the specified <see cref="ILedId"/>. /// Gets the <see cref="Led"/> with the specified <see cref="LedId"/>.
/// </summary> /// </summary>
/// <param name="ledId">The <see cref="ILedId"/> of the <see cref="Led"/> to get.</param> /// <param name="ledId">The <see cref="LedId"/> of the <see cref="Led"/> to get.</param>
/// <returns>The <see cref="Led"/> with the specified <see cref="ILedId"/> or null if no <see cref="Led"/> is found.</returns> /// <returns>The <see cref="Led"/> with the specified <see cref="LedId"/> or null if no <see cref="Led"/> is found.</returns>
Led this[ILedId ledId] { get; } Led this[LedId ledId] { get; }
/// <summary> /// <summary>
/// Gets the <see cref="Led" /> at the given physical location. /// Gets the <see cref="Led" /> at the given physical location.

View File

@ -28,12 +28,12 @@ namespace RGB.NET.Core
IEnumerable<Led> GetLeds(); IEnumerable<Led> GetLeds();
/// <summary> /// <summary>
/// Called when the <see cref="ILedId"/> is attached to the <see cref="RGBSurface"/>. /// Called when the <see cref="ILedGroup"/> is attached to the <see cref="RGBSurface"/>.
/// </summary> /// </summary>
void OnAttach(); void OnAttach();
/// <summary> /// <summary>
/// Called when the <see cref="ILedId"/> is detached from the <see cref="RGBSurface"/>. /// Called when the <see cref="ILedGroup"/> is detached from the <see cref="RGBSurface"/>.
/// </summary> /// </summary>
void OnDetach(); void OnDetach();
} }

View File

@ -1,18 +0,0 @@
namespace RGB.NET.Core
{
/// <summary>
/// Represents a generic Id of a <see cref="Led"/>.
/// </summary>
public interface ILedId
{
/// <summary>
/// Gets the <see cref="IRGBDevice"/> the <see cref="ILedId"/> belongs to.
/// </summary>
IRGBDevice Device { get; }
/// <summary>
/// Gets a value indicating if this <see cref="ILedId"/> is valid.
/// </summary>
bool IsValid { get; }
}
}

View File

@ -20,9 +20,9 @@ namespace RGB.NET.Core
public IRGBDevice Device { get; } public IRGBDevice Device { get; }
/// <summary> /// <summary>
/// Gets the <see cref="ILedId"/> of the <see cref="Led" />. /// Gets the <see cref="LedId"/> of the <see cref="Led" />.
/// </summary> /// </summary>
public ILedId Id { get; } public LedId Id { get; }
private Shape _shape = Shape.Rectangle; private Shape _shape = Shape.Rectangle;
/// <summary> /// <summary>
@ -99,6 +99,11 @@ namespace RGB.NET.Core
/// </summary> /// </summary>
public Uri Image { get; set; } public Uri Image { get; set; }
/// <summary>
/// Gets the provider-specific data associated with this led.
/// </summary>
public object CustomData { get; }
#endregion #endregion
#region Constructors #region Constructors
@ -107,13 +112,15 @@ namespace RGB.NET.Core
/// Initializes a new instance of the <see cref="Led"/> class. /// Initializes a new instance of the <see cref="Led"/> class.
/// </summary> /// </summary>
/// <param name="device">The <see cref="IRGBDevice"/> the <see cref="Led"/> is associated with.</param> /// <param name="device">The <see cref="IRGBDevice"/> the <see cref="Led"/> is associated with.</param>
/// <param name="id">The <see cref="ILedId"/> of the <see cref="Led"/>.</param> /// <param name="id">The <see cref="LedId"/> of the <see cref="Led"/>.</param>
/// <param name="ledRectangle">The <see cref="Rectangle"/> representing the physical location of the <see cref="Led"/> relative to the <see cref="Device"/>.</param> /// <param name="ledRectangle">The <see cref="Rectangle"/> representing the physical location of the <see cref="Led"/> relative to the <see cref="Device"/>.</param>
internal Led(IRGBDevice device, ILedId id, Rectangle ledRectangle) /// <param name="customData">The provider-specific data associated with this led.</param>
internal Led(IRGBDevice device, LedId id, Rectangle ledRectangle, object customData = null)
{ {
this.Device = device; this.Device = device;
this.Id = id; this.Id = id;
this.LedRectangle = ledRectangle; this.LedRectangle = ledRectangle;
this.CustomData = customData;
} }
#endregion #endregion
@ -124,10 +131,7 @@ namespace RGB.NET.Core
/// Converts the <see cref="Id"/> and the <see cref="Color"/> of this <see cref="Led"/> to a human-readable string. /// Converts the <see cref="Id"/> and the <see cref="Color"/> of this <see cref="Led"/> to a human-readable string.
/// </summary> /// </summary>
/// <returns>A string that contains the <see cref="Id"/> and the <see cref="Color"/> of this <see cref="Led"/>. For example "Enter [A: 255, R: 255, G: 0, B: 0]".</returns> /// <returns>A string that contains the <see cref="Id"/> and the <see cref="Color"/> of this <see cref="Led"/>. For example "Enter [A: 255, R: 255, G: 0, B: 0]".</returns>
public override string ToString() public override string ToString() => $"{Id} {Color}";
{
return $"{Id} {Color}";
}
/// <summary> /// <summary>
/// Updates the <see cref="LedRectangle"/> to the requested <see cref="Core.Color"/>. /// Updates the <see cref="LedRectangle"/> to the requested <see cref="Core.Color"/>.

View File

@ -9,6 +9,8 @@ namespace RGB.NET.Core
{ {
Invalid = -1, Invalid = -1,
Logo = 0,
/*### Keyboard ###*/ /*### Keyboard ###*/
Keyboard_Escape = 0x00000001, Keyboard_Escape = 0x00000001,
Keyboard_F1 = 0x00000002, Keyboard_F1 = 0x00000002,
@ -35,61 +37,64 @@ namespace RGB.NET.Core
Keyboard_9 = 0x00000018, Keyboard_9 = 0x00000018,
Keyboard_0 = 0x00000019, Keyboard_0 = 0x00000019,
Keyboard_MinusAndUnderscore = 0x0000001A, Keyboard_MinusAndUnderscore = 0x0000001A,
Keyboard_Backspace = 0x0000001B, Keyboard_EqualsAndPlus = 0x0000001B,
Keyboard_Tab = 0x0000001C, Keyboard_Backspace = 0x0000001C,
Keyboard_Q = 0x0000001D, Keyboard_Tab = 0x0000001D,
Keyboard_W = 0x0000001E, Keyboard_Q = 0x0000001E,
Keyboard_E = 0x0000001F, Keyboard_W = 0x0000001F,
Keyboard_R = 0x00000020, Keyboard_E = 0x00000020,
Keyboard_T = 0x00000021, Keyboard_R = 0x00000021,
Keyboard_Y = 0x00000022, Keyboard_T = 0x00000022,
Keyboard_U = 0x00000023, Keyboard_Y = 0x00000023,
Keyboard_I = 0x00000024, Keyboard_U = 0x00000024,
Keyboard_O = 0x00000025, Keyboard_I = 0x00000025,
Keyboard_P = 0x00000026, Keyboard_O = 0x00000026,
Keyboard_BracketLeft = 0x000000027, Keyboard_P = 0x00000027,
Keyboard_Backslash = 0x000000028, Keyboard_BracketLeft = 0x000000028,
Keyboard_Enter = 0x00000029, Keyboard_BracketRight = 0x000000029,
Keyboard_CapsLock = 0x0000002A, Keyboard_Backslash = 0x00000002A,
Keyboard_A = 0x0000002B, Keyboard_Enter = 0x0000002B,
Keyboard_S = 0x0000002C, Keyboard_CapsLock = 0x0000002C,
Keyboard_D = 0x0000002D, Keyboard_A = 0x0000002D,
Keyboard_F = 0x0000002E, Keyboard_S = 0x0000002E,
Keyboard_G = 0x0000002F, Keyboard_D = 0x0000002F,
Keyboard_H = 0x00000030, Keyboard_F = 0x00000030,
Keyboard_J = 0x00000031, Keyboard_G = 0x00000031,
Keyboard_K = 0x00000032, Keyboard_H = 0x00000032,
Keyboard_L = 0x00000033, Keyboard_J = 0x00000033,
Keyboard_SemicolonAndColon = 0x00000034, Keyboard_K = 0x00000034,
Keyboard_ApostropheAndDoubleQuote = 0x00000035, Keyboard_L = 0x00000035,
Keyboard_NonUsTilde = 0x00000036, Keyboard_SemicolonAndColon = 0x00000036,
Keyboard_LeftShift = 0x00000037, Keyboard_ApostropheAndDoubleQuote = 0x00000037,
Keyboard_NonUsBackslash = 0x00000038, Keyboard_NonUsTilde = 0x00000038,
Keyboard_Z = 0x00000039, Keyboard_LeftShift = 0x00000039,
Keyboard_X = 0x0000003A, Keyboard_NonUsBackslash = 0x0000003A,
Keyboard_C = 0x0000003B, Keyboard_Z = 0x0000003B,
Keyboard_V = 0x0000003C, Keyboard_X = 0x0000003C,
Keyboard_B = 0x0000003D, Keyboard_C = 0x0000003D,
Keyboard_N = 0x0000003E, Keyboard_V = 0x0000003E,
Keyboard_M = 0x0000003F, Keyboard_B = 0x0000003F,
Keyboard_CommaAndLessThan = 0x00000040, Keyboard_N = 0x00000040,
Keyboard_RightShift = 0x00000041, Keyboard_M = 0x00000041,
Keyboard_PeriodAndBiggerThan = 0x00000042, Keyboard_CommaAndLessThan = 0x00000042,
Keyboard_SlashAndQuestionMark = 0x00000043, Keyboard_PeriodAndBiggerThan = 0x00000043,
Keyboard_LeftCtrl = 0x00000044, Keyboard_SlashAndQuestionMark = 0x00000044,
Keyboard_LeftGui = 0x00000045, Keyboard_RightShift = 0x00000045,
Keyboard_LeftAlt = 0x00000046, Keyboard_LeftCtrl = 0x00000046,
Keyboard_Lang2 = 0x00000047, Keyboard_LeftGui = 0x00000047,
Keyboard_Space = 0x00000048, Keyboard_LeftAlt = 0x00000048,
Keyboard_Lang1 = 0x00000049, Keyboard_Lang2 = 0x00000049,
Keyboard_International2 = 0x0000004A, Keyboard_Space = 0x0000004A,
Keyboard_RightAlt = 0x0000004B, Keyboard_Lang1 = 0x0000004B,
Keyboard_RightGui = 0x0000004C, Keyboard_RightAlt = 0x0000004C,
Keyboard_Application = 0x0000004D, Keyboard_RightGui = 0x0000004D,
Keyboard_RightCtrl = 0x0000004E, Keyboard_Application = 0x0000004E,
International3 = 0x0000004F, Keyboard_RightCtrl = 0x0000004F,
International5 = 0x00000050, Keyboard_International1 = 0x00000050,
International4 = 0x00000051, Keyboard_International2 = 0x00000051,
Keyboard_International3 = 0x00000052,
Keyboard_International5 = 0x00000053,
Keyboard_International4 = 0x00000054,
Keyboard_PrintScreen = 0x00001001, Keyboard_PrintScreen = 0x00001001,
Keyboard_ScrollLock = 0x000001002, Keyboard_ScrollLock = 0x000001002,
@ -100,10 +105,10 @@ namespace RGB.NET.Core
Keyboard_Delete = 0x00001007, Keyboard_Delete = 0x00001007,
Keyboard_End = 0x00001008, Keyboard_End = 0x00001008,
Keyboard_PageDown = 0x00001009, Keyboard_PageDown = 0x00001009,
Keyboard_UpArrow = 0x0000100A, Keyboard_ArrowUp = 0x0000100A,
Keyboard_LeftArrow = 0x0000100B, Keyboard_ArrowLeft = 0x0000100B,
Keyboard_DownArrow = 0x0000100C, Keyboard_ArrowDown = 0x0000100C,
Keyboard_RightArrow = 0x0000100D, Keyboard_ArrowRight = 0x0000100D,
Keyboard_NumLock = 0x00002001, Keyboard_NumLock = 0x00002001,
Keyboard_NumSlash = 0x00002002, Keyboard_NumSlash = 0x00002002,
@ -112,20 +117,22 @@ namespace RGB.NET.Core
Keyboard_Num7 = 0x00002005, Keyboard_Num7 = 0x00002005,
Keyboard_Num8 = 0x00002006, Keyboard_Num8 = 0x00002006,
Keyboard_Num9 = 0x00002007, Keyboard_Num9 = 0x00002007,
Keyboard_NumPlus = 0x00002008, Keyboard_NumComma = 0x00002008,
Keyboard_Num4 = 0x00002009, Keyboard_NumPlus = 0x00002009,
Keyboard_Num5 = 0x0000200A, Keyboard_Num4 = 0x0000200A,
Keyboard_Num6 = 0x0000200B, Keyboard_Num5 = 0x0000200B,
Keyboard_Num1 = 0x0000200C, Keyboard_Num6 = 0x0000200C,
Keyboard_Num2 = 0x0000200D, Keyboard_Num1 = 0x0000200D,
Keyboard_Num3 = 0x0000200E, Keyboard_Num2 = 0x0000200E,
Keyboard_NumEnter = 0x0000200F, Keyboard_Num3 = 0x0000200F,
Keyboard_Num0 = 0x00002010, Keyboard_NumEnter = 0x00002010,
Keyboard_NumComma = 0x00002011, Keyboard_Num0 = 0x00002011,
Keyboard_Num00 = 0x00002012,
Keyboard_NumPeriodAndDelete = 0x00002013,
Keyboard_MediaMute = 0x00003001, Keyboard_MediaMute = 0x00003001,
Keyboard_MediaVolumeDown = 0x00003002, Keyboard_MediaVolumeDown = 0x00003002,
Keyboard_MediaVokumeUp = 0x00003003, Keyboard_MediaVolumeUp = 0x00003003,
Keyboard_MediaStop = 0x00003004, Keyboard_MediaStop = 0x00003004,
Keyboard_MediaPreviousTrack = 0x00003005, Keyboard_MediaPreviousTrack = 0x00003005,
Keyboard_MediaPlay = 0x00003006, Keyboard_MediaPlay = 0x00003006,
@ -207,8 +214,6 @@ namespace RGB.NET.Core
Keyboard_Custom31 = 0x0000701F, Keyboard_Custom31 = 0x0000701F,
Keyboard_Custom32 = 0x00007020, Keyboard_Custom32 = 0x00007020,
Keyboard_Logo = 0x000FFFFF,
/*### Mouse ###*/ /*### Mouse ###*/
Mouse1 = 0x00100001, Mouse1 = 0x00100001,
Mouse2 = 0x00100002, Mouse2 = 0x00100002,

View File

@ -79,7 +79,6 @@
<Compile Include="Exceptions\RGBDeviceException.cs" /> <Compile Include="Exceptions\RGBDeviceException.cs" />
<Compile Include="Groups\AbstractLedGroup.cs" /> <Compile Include="Groups\AbstractLedGroup.cs" />
<Compile Include="Groups\ILedGroup.cs" /> <Compile Include="Groups\ILedGroup.cs" />
<Compile Include="Leds\ILedId.cs" />
<Compile Include="MVVM\AbstractBindable.cs" /> <Compile Include="MVVM\AbstractBindable.cs" />
<Compile Include="Leds\Color.cs" /> <Compile Include="Leds\Color.cs" />
<Compile Include="Extensions\MathExtensions.cs" /> <Compile Include="Extensions\MathExtensions.cs" />

View File

@ -1,30 +0,0 @@
// ReSharper disable InconsistentNaming
#pragma warning disable 1591 // Missing XML comment for publicly visible type or member
namespace RGB.NET.Devices.Asus
{
/// <summary>
/// Contains list of all LEDs available for all Asus devices.
/// </summary>
public enum AsusLedIds
{
Invalid = -1,
//TODO DarthAffe 07.10.2017: Create useful Ids for all devices
MainboardLed1 = 0x01,
MainboardLed2 = 0x02,
MainboardLed3 = 0x03,
MainboardLed4 = 0x04,
MainboardLed5 = 0x05,
GraphicsCardLed1 = 0x11,
DramLed1 = 0x21,
MouseLed1 = 0x31,
KeyboardLed1 = 0x41,
}
}

View File

@ -1,111 +0,0 @@
using System.Diagnostics;
using RGB.NET.Core;
namespace RGB.NET.Devices.Asus
{
/// <inheritdoc />
/// <summary>
/// Represents a Id of a <see cref="T:RGB.NET.Core.Led" /> on a <see cref="T:RGB.NET.Devices.Asus.AsusRGBDevice" />.
/// </summary>
[DebuggerDisplay("{" + nameof(LedId) + "}")]
public class AsusLedId : ILedId
{
#region Properties & Fields
internal readonly AsusLedIds LedId;
internal readonly int Index;
/// <inheritdoc />
public IRGBDevice Device { get; }
/// <inheritdoc />
public bool IsValid => LedId != AsusLedIds.Invalid;
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="AsusLedId"/> class.
/// </summary>
/// <param name="device">The <see cref="IRGBDevice"/> the <see cref="ILedId"/> belongs to.</param>
/// <param name="ledId">The <see cref="AsusLedId"/> of the represented <see cref="Led"/>.</param>
public AsusLedId(IRGBDevice device, AsusLedIds ledId)
{
this.Device = device;
this.LedId = ledId;
}
/// <summary>
/// Initializes a new instance of the <see cref="AsusLedId"/> class.
/// </summary>
/// <param name="device">The <see cref="IRGBDevice"/> the <see cref="ILedId"/> belongs to.</param>
/// <param name="ledId">The <see cref="AsusLedId"/> of the represented <see cref="Led"/>.</param>
/// <param name="index">The index in the mapping array of the device.</param>
public AsusLedId(IRGBDevice device, AsusLedIds ledId, int index)
{
this.Device = device;
this.LedId = ledId;
this.Index = index;
}
#endregion
#region Methods
/// <summary>
/// Converts the Id of this <see cref="AsusLedId"/> to a human-readable string.
/// </summary>
/// <returns>A string that contains the Id of this <see cref="AsusLedId"/>. For example "Enter".</returns>
public override string ToString() => LedId.ToString();
/// <summary>
/// Tests whether the specified object is a <see cref="AsusLedId" /> and is equivalent to this <see cref="AsusLedId" />.
/// </summary>
/// <param name="obj">The object to test.</param>
/// <returns><c>true</c> if <paramref name="obj" /> is a <see cref="AsusLedId" /> equivalent to this <see cref="AsusLedId" />; otherwise, <c>false</c>.</returns>
public override bool Equals(object obj)
{
AsusLedId compareLedId = obj as AsusLedId;
if (ReferenceEquals(compareLedId, null))
return false;
if (ReferenceEquals(this, compareLedId))
return true;
if (GetType() != compareLedId.GetType())
return false;
return compareLedId.LedId == LedId;
}
/// <summary>
/// Returns a hash code for this <see cref="AsusLedId" />.
/// </summary>
/// <returns>An integer value that specifies the hash code for this <see cref="AsusLedId" />.</returns>
public override int GetHashCode() => LedId.GetHashCode();
#endregion
#region Operators
/// <summary>
/// Returns a value that indicates whether two specified <see cref="AsusLedId" /> are equal.
/// </summary>
/// <param name="ledId1">The first <see cref="AsusLedId" /> to compare.</param>
/// <param name="ledId2">The second <see cref="AsusLedId" /> to compare.</param>
/// <returns><c>true</c> if <paramref name="ledId1" /> and <paramref name="ledId2" /> are equal; otherwise, <c>false</c>.</returns>
public static bool operator ==(AsusLedId ledId1, AsusLedId ledId2) => ReferenceEquals(ledId1, null) ? ReferenceEquals(ledId2, null) : ledId1.Equals(ledId2);
/// <summary>
/// Returns a value that indicates whether two specified <see cref="AsusLedId" /> are equal.
/// </summary>
/// <param name="ledId1">The first <see cref="AsusLedId" /> to compare.</param>
/// <param name="ledId2">The second <see cref="AsusLedId" /> to compare.</param>
/// <returns><c>true</c> if <paramref name="ledId1" /> and <paramref name="ledId2" /> are not equal; otherwise, <c>false</c>.</returns>
public static bool operator !=(AsusLedId ledId1, AsusLedId ledId2) => !(ledId1 == ledId2);
#endregion
}
}

View File

@ -1,10 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using RGB.NET.Core; using RGB.NET.Core;
using RGB.NET.Core.Layout;
namespace RGB.NET.Devices.Asus namespace RGB.NET.Devices.Asus
{ {
@ -67,44 +65,6 @@ namespace RGB.NET.Devices.Asus
/// </summary> /// </summary>
protected abstract void InitializeLayout(); protected abstract void InitializeLayout();
/// <summary>
/// Applies the given layout.
/// </summary>
/// <param name="layoutPath">The file containing the layout.</param>
/// <param name="imageLayout">The name of the layout used to get the images of the leds.</param>
/// <param name="imageBasePath">The path images for this device are collected in.</param>
protected void ApplyLayoutFromFile(string layoutPath, string imageLayout, string imageBasePath)
{
DeviceLayout layout = DeviceLayout.Load(layoutPath);
if (layout != null)
{
LedImageLayout ledImageLayout = layout.LedImageLayouts.FirstOrDefault(x => string.Equals(x.Layout, imageLayout, StringComparison.OrdinalIgnoreCase));
Size = new Size(layout.Width, layout.Height);
if (layout.Leds != null)
foreach (LedLayout layoutLed in layout.Leds)
{
if (Enum.TryParse(layoutLed.Id, true, out AsusLedIds ledId))
{
if (LedMapping.TryGetValue(new AsusLedId(this, ledId), out Led led))
{
led.LedRectangle.Location = new Point(layoutLed.X, layoutLed.Y);
led.LedRectangle.Size = new Size(layoutLed.Width, layoutLed.Height);
led.Shape = layoutLed.Shape;
led.ShapeData = layoutLed.ShapeData;
LedImage image = ledImageLayout?.LedImages.FirstOrDefault(x => x.Id == layoutLed.Id);
led.Image = (!string.IsNullOrEmpty(image?.Image))
? new Uri(Path.Combine(imageBasePath, image.Image), UriKind.Absolute)
: new Uri(Path.Combine(imageBasePath, "Missing.png"), UriKind.Absolute);
}
}
}
}
}
/// <inheritdoc /> /// <inheritdoc />
protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate) protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate)
{ {
@ -114,7 +74,7 @@ namespace RGB.NET.Devices.Asus
{ {
foreach (Led led in leds) foreach (Led led in leds)
{ {
int index = (((AsusLedId)led.Id).Index) * 3; int index = ((int)led.CustomData) * 3;
ColorData[index] = led.Color.R; ColorData[index] = led.Color.R;
ColorData[index + 1] = led.Color.G; ColorData[index + 1] = led.Color.G;
ColorData[index + 2] = led.Color.B; ColorData[index + 2] = led.Color.B;

View File

@ -30,13 +30,16 @@ namespace RGB.NET.Devices.Asus
//TODO DarthAffe 07.10.2017: Look for a good default layout //TODO DarthAffe 07.10.2017: Look for a good default layout
int ledCount = _AsusSDK.GetGPULedCount(DeviceInfo.Handle); int ledCount = _AsusSDK.GetGPULedCount(DeviceInfo.Handle);
for (int i = 0; i < ledCount; i++) for (int i = 0; i < ledCount; i++)
InitializeLed(new AsusLedId(this, AsusLedIds.GraphicsCardLed1 + i, i), new Rectangle(i * 10, 0, 10, 10)); InitializeLed(LedId.GraphicsCard1 + i, new Rectangle(i * 10, 0, 10, 10));
//TODO DarthAffe 07.10.2017: We don'T know the model, how to save layouts and images? //TODO DarthAffe 07.10.2017: We don't know the model, how to save layouts and images?
ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Asus\GraphicsCards\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Asus\GraphicsCards\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"),
null, PathHelper.GetAbsolutePath(@"Images\Asus\GraphicsCards")); null, PathHelper.GetAbsolutePath(@"Images\Asus\GraphicsCards"));
} }
/// <inheritdoc />
protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.GraphicsCard1;
/// <inheritdoc /> /// <inheritdoc />
protected override void ApplyColorData() => _AsusSDK.SetGPUColor(DeviceInfo.Handle, ColorData); protected override void ApplyColorData() => _AsusSDK.SetGPUColor(DeviceInfo.Handle, ColorData);

View File

@ -27,16 +27,19 @@ namespace RGB.NET.Devices.Asus
/// <inheritdoc /> /// <inheritdoc />
protected override void InitializeLayout() protected override void InitializeLayout()
{ {
//TODO DarthAffe 07.10.2017: Look for a good default layout //TODO DarthAffe 07.10.2017: This doesn't make sense at all ... Find someone with such a keyboard!
int ledCount = _AsusSDK.GetClaymoreKeyboardLedCount(DeviceInfo.Handle); int ledCount = _AsusSDK.GetClaymoreKeyboardLedCount(DeviceInfo.Handle);
for (int i = 0; i < ledCount; i++) for (int i = 0; i < ledCount; i++)
InitializeLed(new AsusLedId(this, AsusLedIds.KeyboardLed1 + i, i), new Rectangle(i * 19, 0, 19, 19)); InitializeLed(LedId.Keyboard_Escape + i, new Rectangle(i * 19, 0, 19, 19));
string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper(); string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper();
ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Asus\Keyboards\{model}\{DeviceInfo.PhysicalLayout.ToString().ToUpper()}.xml"), ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Asus\Keyboards\{model}\{DeviceInfo.PhysicalLayout.ToString().ToUpper()}.xml"),
DeviceInfo.LogicalLayout.ToString(), PathHelper.GetAbsolutePath(@"Images\Asus\Keyboards")); DeviceInfo.LogicalLayout.ToString(), PathHelper.GetAbsolutePath(@"Images\Asus\Keyboards"));
} }
/// <inheritdoc />
protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Keyboard_Escape;
/// <inheritdoc /> /// <inheritdoc />
protected override void ApplyColorData() => _AsusSDK.SetClaymoreKeyboardColor(DeviceInfo.Handle, ColorData); protected override void ApplyColorData() => _AsusSDK.SetClaymoreKeyboardColor(DeviceInfo.Handle, ColorData);

View File

@ -30,19 +30,22 @@ namespace RGB.NET.Devices.Asus
//TODO DarthAffe 07.10.2017: Look for a good default layout //TODO DarthAffe 07.10.2017: Look for a good default layout
int ledCount = _AsusSDK.GetMbLedCount(DeviceInfo.Handle); int ledCount = _AsusSDK.GetMbLedCount(DeviceInfo.Handle);
for (int i = 0; i < ledCount; i++) for (int i = 0; i < ledCount; i++)
InitializeLed(new AsusLedId(this, AsusLedIds.MainboardLed1 + i, i), new Rectangle(i * 40, 0, 40, 8)); InitializeLed(LedId.Mainboard1 + i, new Rectangle(i * 40, 0, 40, 8));
//TODO DarthAffe 07.10.2017: We don'T know the model, how to save layouts and images? //TODO DarthAffe 07.10.2017: We don'T know the model, how to save layouts and images?
ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Asus\Mainboards\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Asus\Mainboards\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"),
null, PathHelper.GetAbsolutePath(@"Images\Asus\Mainboards")); null, PathHelper.GetAbsolutePath(@"Images\Asus\Mainboards"));
} }
/// <inheritdoc />
protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mainboard1;
/// <inheritdoc /> /// <inheritdoc />
public override void SyncBack() public override void SyncBack()
{ {
byte[] colorData = _AsusSDK.GetMbColor(DeviceInfo.Handle); byte[] colorData = _AsusSDK.GetMbColor(DeviceInfo.Handle);
for (int i = 0; i < LedMapping.Count; i++) for (int i = 0; i < LedMapping.Count; i++)
LedMapping[new AsusLedId(this, AsusLedIds.MainboardLed1 + i)].Color = new Color(colorData[(i * 3)], colorData[(i * 3) + 2], colorData[(i * 3) + 1]); LedMapping[LedId.Mainboard1 + i].Color = new Color(colorData[(i * 3)], colorData[(i * 3) + 2], colorData[(i * 3) + 1]);
} }
/// <inheritdoc /> /// <inheritdoc />

View File

@ -30,12 +30,15 @@ namespace RGB.NET.Devices.Asus
//TODO DarthAffe 07.10.2017: Look for a good default layout //TODO DarthAffe 07.10.2017: Look for a good default layout
int ledCount = _AsusSDK.GetRogMouseLedCount(DeviceInfo.Handle); int ledCount = _AsusSDK.GetRogMouseLedCount(DeviceInfo.Handle);
for (int i = 0; i < ledCount; i++) for (int i = 0; i < ledCount; i++)
InitializeLed(new AsusLedId(this, AsusLedIds.MouseLed1 + i, i), new Rectangle(i * 10, 0, 10, 10)); InitializeLed(LedId.Mouse1 + i, new Rectangle(i * 10, 0, 10, 10));
ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Asus\Mouses\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Asus\Mouses\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"),
null, PathHelper.GetAbsolutePath(@"Images\Asus\Mouses")); null, PathHelper.GetAbsolutePath(@"Images\Asus\Mouses"));
} }
/// <inheritdoc />
protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mouse1;
/// <inheritdoc /> /// <inheritdoc />
protected override void ApplyColorData() => _AsusSDK.SetRogMouseColor(DeviceInfo.Handle, ColorData); protected override void ApplyColorData() => _AsusSDK.SetRogMouseColor(DeviceInfo.Handle, ColorData);

View File

@ -48,11 +48,9 @@
<Compile Include="AsusDeviceProvider.cs" /> <Compile Include="AsusDeviceProvider.cs" />
<Compile Include="Dram\AsusDramRGBDevice.cs" /> <Compile Include="Dram\AsusDramRGBDevice.cs" />
<Compile Include="Dram\AsusDramRGBDeviceInfo.cs" /> <Compile Include="Dram\AsusDramRGBDeviceInfo.cs" />
<Compile Include="Enum\AsusLedIds.cs" />
<Compile Include="Enum\AsusLogicalKeyboardLayout.cs" /> <Compile Include="Enum\AsusLogicalKeyboardLayout.cs" />
<Compile Include="Enum\AsusPhysicalKeyboardLayout.cs" /> <Compile Include="Enum\AsusPhysicalKeyboardLayout.cs" />
<Compile Include="Generic\AsusRGBDevice.cs" /> <Compile Include="Generic\AsusRGBDevice.cs" />
<Compile Include="Generic\AsusLedId.cs" />
<Compile Include="Generic\AsusRGBDeviceInfo.cs" /> <Compile Include="Generic\AsusRGBDeviceInfo.cs" />
<Compile Include="Generic\IAsusRGBDevice.cs" /> <Compile Include="Generic\IAsusRGBDevice.cs" />
<Compile Include="GraphicsCard\AsusGraphicsCardRGBDevice.cs" /> <Compile Include="GraphicsCard\AsusGraphicsCardRGBDevice.cs" />

View File

@ -1,137 +0,0 @@
// ReSharper disable InconsistentNaming
#pragma warning disable 1591 // Missing XML comment for publicly visible type or member
namespace RGB.NET.Devices.CoolerMaster
{
/// <summary>
/// Contains list of all LEDs available for all CoolerMaster devices.
/// </summary>
public enum CoolerMasterLedIds
{
Invalid = -1,
Esc = 0,
F1 = 1,
F2 = 2,
F3 = 3,
F4 = 4,
F5 = 6,
F6 = 7,
F7 = 8,
F8 = 9,
F9 = 11,
F10 = 12,
F11 = 13,
F12 = 14,
Snapshot = 15,
ScrollLock = 16,
Pause = 17,
P1 = 18,
P2 = 19,
P3 = 20,
P4 = 21,
Gravis = 22,
D1 = 23,
D2 = 24,
D3 = 25,
D4 = 26,
D5 = 27,
D6 = 28,
D7 = 29,
D8 = 30,
D9 = 31,
D0 = 32,
Minus = 33,
Equals = 34,
Backspace = 36,
Insert = 37,
Home = 38,
PageUp = 39,
Numlock = 40,
KeypadSlash = 41,
KeypadAsterisk = 42,
KeypadMinus = 43,
Tab = 44,
Q = 45,
W = 46,
E = 47,
R = 48,
T = 49,
Y = 50,
U = 51,
I = 52,
O = 53,
P = 54,
BracketLeft = 55,
BracketRight = 56,
Backslash = 58,
Delete = 59,
End = 60,
PageDown = 61,
Keypad7 = 62,
Keypad8 = 63,
Keypad9 = 64,
KeypadPlus = 65,
CapsLock = 66,
A = 67,
S = 68,
D = 69,
F = 70,
G = 71,
H = 72,
J = 73,
K = 74,
L = 75,
Semicolon = 76,
Apostroph = 77,
CODEA2 = 78,
Enter = 80,
Keypad4 = 84,
Keypad5 = 85,
Keypad6 = 86,
LShift = 88,
CODEA5 = 89,
Z = 90,
X = 91,
C = 92,
V = 93,
B = 94,
N = 95,
M = 96,
Comma = 97,
Period = 98,
Slash = 99,
RShift = 102,
Up = 104,
Keypad1 = 106,
Keypad2 = 107,
Keypad3 = 108,
KeypadEnter = 109,
LCtrl = 110,
LWin = 111,
LAlt = 112,
Space = 116,
RAlt = 120,
RWin = 121,
App = 122,
RCtrl = 124,
Left = 125,
Down = 126,
Right = 127,
Keypad0 = 128,
Keypad00 = 129,
KeypadPeriod = 130,
Side1 = 132,
Side2 = 133,
Side3 = 134,
Back1 = 135,
Wheel = 136
}
}

View File

@ -1,126 +0,0 @@
using System.Diagnostics;
using RGB.NET.Core;
namespace RGB.NET.Devices.CoolerMaster
{
/// <inheritdoc />
/// <summary>
/// Represents a Id of a <see cref="T:RGB.NET.Core.Led" /> on a <see cref="T:RGB.NET.Devices.CoolerMaster.CoolerMasterRGBDevice" />.
/// </summary>
[DebuggerDisplay("{" + nameof(LedId) + "}")]
public class CoolerMasterLedId : ILedId
{
#region Properties & Fields
internal readonly CoolerMasterLedIds LedId;
internal readonly int Row;
internal readonly int Column;
/// <inheritdoc />
public IRGBDevice Device { get; }
/// <inheritdoc />
public bool IsValid => LedId != CoolerMasterLedIds.Invalid;
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="CoolerMasterLedId"/> class.
/// </summary>
/// <param name="device">The <see cref="IRGBDevice"/> the <see cref="ILedId"/> belongs to.</param>
/// <param name="ledId">The <see cref="CoolerMasterLedId"/> of the represented <see cref="Led"/>.</param>
public CoolerMasterLedId(IRGBDevice device, CoolerMasterLedIds ledId)
{
this.Device = device;
this.LedId = ledId;
}
/// <summary>
/// Initializes a new instance of the <see cref="CoolerMasterLedId"/> class.
/// </summary>
/// <param name="device">The <see cref="IRGBDevice"/> the <see cref="ILedId"/> belongs to.</param>
/// <param name="ledId">The <see cref="CoolerMasterLedId"/> of the represented <see cref="Led"/>.</param>
/// <param name="row">The row in the mapping table of the device.</param>
/// <param name="column">The column in the mapping table of the device.</param>
public CoolerMasterLedId(IRGBDevice device, CoolerMasterLedIds ledId, int row, int column)
{
this.Device = device;
this.LedId = ledId;
this.Row = row;
this.Column = column;
}
#endregion
#region Methods
/// <summary>
/// Converts the Id of this <see cref="CoolerMasterLedId"/> to a human-readable string.
/// </summary>
/// <returns>A string that contains the Id of this <see cref="CoolerMasterLedId"/>. For example "Enter".</returns>
public override string ToString()
{
return LedId.ToString();
}
/// <summary>
/// Tests whether the specified object is a <see cref="CoolerMasterLedId" /> and is equivalent to this <see cref="CoolerMasterLedId" />.
/// </summary>
/// <param name="obj">The object to test.</param>
/// <returns><c>true</c> if <paramref name="obj" /> is a <see cref="CoolerMasterLedId" /> equivalent to this <see cref="CoolerMasterLedId" />; otherwise, <c>false</c>.</returns>
public override bool Equals(object obj)
{
CoolerMasterLedId compareLedId = obj as CoolerMasterLedId;
if (ReferenceEquals(compareLedId, null))
return false;
if (ReferenceEquals(this, compareLedId))
return true;
if (GetType() != compareLedId.GetType())
return false;
return compareLedId.LedId == LedId;
}
/// <summary>
/// Returns a hash code for this <see cref="CoolerMasterLedId" />.
/// </summary>
/// <returns>An integer value that specifies the hash code for this <see cref="CoolerMasterLedId" />.</returns>
public override int GetHashCode()
{
return LedId.GetHashCode();
}
#endregion
#region Operators
/// <summary>
/// Returns a value that indicates whether two specified <see cref="CoolerMasterLedId" /> are equal.
/// </summary>
/// <param name="ledId1">The first <see cref="CoolerMasterLedId" /> to compare.</param>
/// <param name="ledId2">The second <see cref="CoolerMasterLedId" /> to compare.</param>
/// <returns><c>true</c> if <paramref name="ledId1" /> and <paramref name="ledId2" /> are equal; otherwise, <c>false</c>.</returns>
public static bool operator ==(CoolerMasterLedId ledId1, CoolerMasterLedId ledId2)
{
return ReferenceEquals(ledId1, null) ? ReferenceEquals(ledId2, null) : ledId1.Equals(ledId2);
}
/// <summary>
/// Returns a value that indicates whether two specified <see cref="CoolerMasterLedId" /> are equal.
/// </summary>
/// <param name="ledId1">The first <see cref="CoolerMasterLedId" /> to compare.</param>
/// <param name="ledId2">The second <see cref="CoolerMasterLedId" /> to compare.</param>
/// <returns><c>true</c> if <paramref name="ledId1" /> and <paramref name="ledId2" /> are not equal; otherwise, <c>false</c>.</returns>
public static bool operator !=(CoolerMasterLedId ledId1, CoolerMasterLedId ledId2)
{
return !(ledId1 == ledId2);
}
#endregion
}
}

View File

@ -1,9 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using RGB.NET.Core; using RGB.NET.Core;
using RGB.NET.Core.Layout;
using RGB.NET.Devices.CoolerMaster.Native; using RGB.NET.Devices.CoolerMaster.Native;
namespace RGB.NET.Devices.CoolerMaster namespace RGB.NET.Devices.CoolerMaster
@ -60,44 +58,6 @@ namespace RGB.NET.Devices.CoolerMaster
/// </summary> /// </summary>
protected abstract void InitializeLayout(); protected abstract void InitializeLayout();
/// <summary>
/// Applies the given layout.
/// </summary>
/// <param name="layoutPath">The file containing the layout.</param>
/// <param name="imageLayout">The name of the layout used to get the images of the leds.</param>
/// <param name="imageBasePath">The path images for this device are collected in.</param>
protected void ApplyLayoutFromFile(string layoutPath, string imageLayout, string imageBasePath)
{
DeviceLayout layout = DeviceLayout.Load(layoutPath);
if (layout != null)
{
LedImageLayout ledImageLayout = layout.LedImageLayouts.FirstOrDefault(x => string.Equals(x.Layout, imageLayout, StringComparison.OrdinalIgnoreCase));
Size = new Size(layout.Width, layout.Height);
if (layout.Leds != null)
foreach (LedLayout layoutLed in layout.Leds)
{
if (Enum.TryParse(layoutLed.Id, true, out CoolerMasterLedIds ledId))
{
if (LedMapping.TryGetValue(new CoolerMasterLedId(this, ledId), out Led led))
{
led.LedRectangle.Location = new Point(layoutLed.X, layoutLed.Y);
led.LedRectangle.Size = new Size(layoutLed.Width, layoutLed.Height);
led.Shape = layoutLed.Shape;
led.ShapeData = layoutLed.ShapeData;
LedImage image = ledImageLayout?.LedImages.FirstOrDefault(x => x.Id == layoutLed.Id);
led.Image = (!string.IsNullOrEmpty(image?.Image))
? new Uri(Path.Combine(imageBasePath, image.Image), UriKind.Absolute)
: new Uri(Path.Combine(imageBasePath, "Missing.png"), UriKind.Absolute);
}
}
}
}
}
/// <inheritdoc /> /// <inheritdoc />
protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate) protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate)
{ {
@ -109,8 +69,8 @@ namespace RGB.NET.Devices.CoolerMaster
foreach (Led led in leds) foreach (Led led in leds)
{ {
CoolerMasterLedId ledId = (CoolerMasterLedId)led.Id; (int row, int column) = ((int, int))led.CustomData;
_CoolerMasterSDK.SetLedColor(ledId.Row, ledId.Column, led.Color.R, led.Color.G, led.Color.B); _CoolerMasterSDK.SetLedColor(row, column, led.Color.R, led.Color.G, led.Color.B);
} }
_CoolerMasterSDK.RefreshLed(false); _CoolerMasterSDK.RefreshLed(false);

View File

@ -1,5 +1,4 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using RGB.NET.Core; using RGB.NET.Core;
namespace RGB.NET.Devices.CoolerMaster namespace RGB.NET.Devices.CoolerMaster
@ -28,11 +27,10 @@ namespace RGB.NET.Devices.CoolerMaster
/// <inheritdoc /> /// <inheritdoc />
protected override void InitializeLayout() protected override void InitializeLayout()
{ {
Dictionary<CoolerMasterLedIds, Tuple<int, int>> mapping = CoolerMasterKeyboardLedMappings.Mapping[DeviceInfo.DeviceIndex][DeviceInfo.PhysicalLayout]; Dictionary<LedId, (int row, int column)> mapping = CoolerMasterKeyboardLedMappings.Mapping[DeviceInfo.DeviceIndex][DeviceInfo.PhysicalLayout];
foreach (KeyValuePair<CoolerMasterLedIds, Tuple<int, int>> led in mapping) foreach (KeyValuePair<LedId, (int row, int column)> led in mapping)
InitializeLed(new CoolerMasterLedId(this, led.Key, led.Value.Item1, led.Value.Item2), InitializeLed(led.Key, new Rectangle(led.Value.column * 19, led.Value.row * 19, 19, 19));
new Rectangle(led.Value.Item2 * 19, led.Value.Item1 * 19, 19, 19));
string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper(); string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper();
ApplyLayoutFromFile(PathHelper.GetAbsolutePath( ApplyLayoutFromFile(PathHelper.GetAbsolutePath(
@ -40,6 +38,9 @@ namespace RGB.NET.Devices.CoolerMaster
DeviceInfo.LogicalLayout.ToString(), PathHelper.GetAbsolutePath(@"Images\CoolerMaster\Keyboards")); DeviceInfo.LogicalLayout.ToString(), PathHelper.GetAbsolutePath(@"Images\CoolerMaster\Keyboards"));
} }
/// <inheritdoc />
protected override object CreateLedCustomData(LedId ledId) => CoolerMasterKeyboardLedMappings.Mapping[DeviceInfo.DeviceIndex][DeviceInfo.PhysicalLayout][ledId];
#endregion #endregion
} }
} }

View File

@ -1,5 +1,5 @@
using System; using System.Collections.Generic;
using System.Collections.Generic; using RGB.NET.Core;
namespace RGB.NET.Devices.CoolerMaster namespace RGB.NET.Devices.CoolerMaster
{ {
@ -14,24 +14,24 @@ namespace RGB.NET.Devices.CoolerMaster
/// Contains all the hardware-id mappings for CoolerMaster devices. /// Contains all the hardware-id mappings for CoolerMaster devices.
/// </summary> /// </summary>
// ReSharper disable once InconsistentNaming // ReSharper disable once InconsistentNaming
public static readonly Dictionary<CoolerMasterDevicesIndexes, Dictionary<CoolerMasterLedIds, Tuple<int, int>>> Mapping = public static readonly Dictionary<CoolerMasterDevicesIndexes, Dictionary<LedId, (int row, int column)>> Mapping =
new Dictionary<CoolerMasterDevicesIndexes, Dictionary<CoolerMasterLedIds, Tuple<int, int>>> new Dictionary<CoolerMasterDevicesIndexes, Dictionary<LedId, (int row, int column)>>
{ {
{ CoolerMasterDevicesIndexes.MasterMouse_L, new Dictionary<CoolerMasterLedIds, Tuple<int, int>> { CoolerMasterDevicesIndexes.MasterMouse_L, new Dictionary<LedId, (int row, int column)>
{ {
{ CoolerMasterLedIds.Side1, new Tuple<int, int>(0,0) }, { LedId.Mouse1, (0,0) },
{ CoolerMasterLedIds.Side2, new Tuple<int, int>(1,0) }, { LedId.Mouse2, (1,0) },
{ CoolerMasterLedIds.Side3, new Tuple<int, int>(2,0) }, { LedId.Mouse3, (2,0) },
{ CoolerMasterLedIds.Back1, new Tuple<int, int>(3,0) }, { LedId.Mouse4, (3,0) },
} }
}, },
{ CoolerMasterDevicesIndexes.MasterMouse_S, new Dictionary<CoolerMasterLedIds, Tuple<int, int>> { CoolerMasterDevicesIndexes.MasterMouse_S, new Dictionary<LedId, (int row, int column)>
{ {
{ CoolerMasterLedIds.Back1, new Tuple<int, int>(0,0) }, { LedId.Mouse1, (0,0) },
{ CoolerMasterLedIds.Wheel, new Tuple<int, int>(1,0) }, { LedId.Mouse2, (1,0) },
{ CoolerMasterLedIds.Side3, new Tuple<int, int>(2,0) }, { LedId.Mouse3, (2,0) },
{ CoolerMasterLedIds.Back1, new Tuple<int, int>(3,0) }, { LedId.Mouse4, (3,0) },
} }
}, },
}; };

View File

@ -48,12 +48,10 @@
<ItemGroup> <ItemGroup>
<Compile Include="Attributes\DeviceTypeAttribute.cs" /> <Compile Include="Attributes\DeviceTypeAttribute.cs" />
<Compile Include="CoolerMasterDeviceProvider.cs" /> <Compile Include="CoolerMasterDeviceProvider.cs" />
<Compile Include="Enum\CoolerMasterLedIds.cs" />
<Compile Include="Enum\CoolerMasterPhysicalKeyboardLayout.cs" /> <Compile Include="Enum\CoolerMasterPhysicalKeyboardLayout.cs" />
<Compile Include="Enum\CoolerMasterDevicesIndexes.cs" /> <Compile Include="Enum\CoolerMasterDevicesIndexes.cs" />
<Compile Include="Enum\CoolerMasterEffects.cs" /> <Compile Include="Enum\CoolerMasterEffects.cs" />
<Compile Include="Enum\CoolerMasterLogicalKeyboardLayout.cs" /> <Compile Include="Enum\CoolerMasterLogicalKeyboardLayout.cs" />
<Compile Include="Generic\CoolerMasterLedId.cs" />
<Compile Include="Generic\CoolerMasterRGBDevice.cs" /> <Compile Include="Generic\CoolerMasterRGBDevice.cs" />
<Compile Include="Generic\CoolerMasterRGBDeviceInfo.cs" /> <Compile Include="Generic\CoolerMasterRGBDeviceInfo.cs" />
<Compile Include="Generic\ICoolerMasterRGBDevice.cs" /> <Compile Include="Generic\ICoolerMasterRGBDevice.cs" />

View File

@ -7,7 +7,7 @@ namespace RGB.NET.Devices.Corsair
/// <summary> /// <summary>
/// Contains list of all LEDs available for all corsair devices. /// Contains list of all LEDs available for all corsair devices.
/// </summary> /// </summary>
public enum CorsairLedIds public enum CorsairLedId
{ {
Invalid = 0, Invalid = 0,
Escape = 1, Escape = 1,

View File

@ -1,108 +0,0 @@
using System.Diagnostics;
using RGB.NET.Core;
namespace RGB.NET.Devices.Corsair
{
/// <inheritdoc />
/// <summary>
/// Represents a Id of a <see cref="T:RGB.NET.Core.Led" /> on a <see cref="T:RGB.NET.Devices.Corsair.CorsairRGBDevice" />.
/// </summary>
[DebuggerDisplay("{" + nameof(LedId) + "}")]
public class CorsairLedId : ILedId
{
#region Properties & Fields
internal readonly CorsairLedIds LedId;
/// <inheritdoc />
public IRGBDevice Device { get; }
/// <inheritdoc />
public bool IsValid => LedId != CorsairLedIds.Invalid;
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="CorsairLedId"/> class.
/// </summary>
/// <param name="device">The <see cref="IRGBDevice"/> the <see cref="ILedId"/> belongs to.</param>
/// <param name="ledId">The <see cref="CorsairLedId"/> of the represented <see cref="Led"/>.</param>
public CorsairLedId(IRGBDevice device, CorsairLedIds ledId)
{
this.Device = device;
this.LedId = ledId;
}
#endregion
#region Methods
/// <summary>
/// Converts the Id of this <see cref="CorsairLedId"/> to a human-readable string.
/// </summary>
/// <returns>A string that contains the Id of this <see cref="CorsairLedId"/>. For example "Enter".</returns>
public override string ToString()
{
return LedId.ToString();
}
/// <summary>
/// Tests whether the specified object is a <see cref="CorsairLedId" /> and is equivalent to this <see cref="CorsairLedId" />.
/// </summary>
/// <param name="obj">The object to test.</param>
/// <returns><c>true</c> if <paramref name="obj" /> is a <see cref="CorsairLedId" /> equivalent to this <see cref="CorsairLedId" />; otherwise, <c>false</c>.</returns>
public override bool Equals(object obj)
{
CorsairLedId compareLedId = obj as CorsairLedId;
if (ReferenceEquals(compareLedId, null))
return false;
if (ReferenceEquals(this, compareLedId))
return true;
if (GetType() != compareLedId.GetType())
return false;
return compareLedId.LedId == LedId;
}
/// <summary>
/// Returns a hash code for this <see cref="CorsairLedId" />.
/// </summary>
/// <returns>An integer value that specifies the hash code for this <see cref="CorsairLedId" />.</returns>
public override int GetHashCode()
{
return LedId.GetHashCode();
}
#endregion
#region Operators
/// <summary>
/// Returns a value that indicates whether two specified <see cref="CorsairLedId" /> are equal.
/// </summary>
/// <param name="ledId1">The first <see cref="CorsairLedId" /> to compare.</param>
/// <param name="ledId2">The second <see cref="CorsairLedId" /> to compare.</param>
/// <returns><c>true</c> if <paramref name="ledId1" /> and <paramref name="ledId2" /> are equal; otherwise, <c>false</c>.</returns>
public static bool operator ==(CorsairLedId ledId1, CorsairLedId ledId2)
{
return ReferenceEquals(ledId1, null) ? ReferenceEquals(ledId2, null) : ledId1.Equals(ledId2);
}
/// <summary>
/// Returns a value that indicates whether two specified <see cref="CorsairLedId" /> are equal.
/// </summary>
/// <param name="ledId1">The first <see cref="CorsairLedId" /> to compare.</param>
/// <param name="ledId2">The second <see cref="CorsairLedId" /> to compare.</param>
/// <returns><c>true</c> if <paramref name="ledId1" /> and <paramref name="ledId2" /> are not equal; otherwise, <c>false</c>.</returns>
public static bool operator !=(CorsairLedId ledId1, CorsairLedId ledId2)
{
return !(ledId1 == ledId2);
}
#endregion
}
}

View File

@ -1,10 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using RGB.NET.Core; using RGB.NET.Core;
using RGB.NET.Core.Layout;
using RGB.NET.Devices.Corsair.Native; using RGB.NET.Devices.Corsair.Native;
namespace RGB.NET.Devices.Corsair namespace RGB.NET.Devices.Corsair
@ -25,6 +23,24 @@ namespace RGB.NET.Devices.Corsair
/// </summary> /// </summary>
public override TDeviceInfo DeviceInfo { get; } public override TDeviceInfo DeviceInfo { get; }
/// <summary>
/// Gets a dictionary containing all <see cref="Led"/> of the <see cref="CorsairRGBDevice{TDeviceInfo}"/>.
/// </summary>
// ReSharper disable once MemberCanBePrivate.Global
protected Dictionary<CorsairLedId, Led> InternalLedMapping { get; } = new Dictionary<CorsairLedId, Led>();
#endregion
#region Indexer
/// <summary>
/// Gets the <see cref="Led"/> with the specified <see cref="CorsairLedId"/>.
/// </summary>
/// <param name="ledId">The <see cref="CorsairLedId"/> of the <see cref="Led"/> to get.</param>
/// <returns>The <see cref="Led"/> with the specified <see cref="CorsairLedId"/> or null if no <see cref="Led"/> is found.</returns>
// ReSharper disable once MemberCanBePrivate.Global
public Led this[CorsairLedId ledId] => InternalLedMapping.TryGetValue(ledId, out Led led) ? led : null;
#endregion #endregion
#region Constructors #region Constructors
@ -49,6 +65,13 @@ namespace RGB.NET.Devices.Corsair
{ {
InitializeLayout(); InitializeLayout();
foreach (Led led in LedMapping.Values)
{
CorsairLedId ledId = (CorsairLedId)led.CustomData;
if (ledId != CorsairLedId.Invalid)
InternalLedMapping.Add(ledId, led);
}
if (Size == Size.Invalid) if (Size == Size.Invalid)
{ {
Rectangle ledRectangle = new Rectangle(this.Select(x => x.LedRectangle)); Rectangle ledRectangle = new Rectangle(this.Select(x => x.LedRectangle));
@ -61,48 +84,10 @@ namespace RGB.NET.Devices.Corsair
/// </summary> /// </summary>
protected abstract void InitializeLayout(); protected abstract void InitializeLayout();
/// <summary>
/// Applies the given layout.
/// </summary>
/// <param name="layoutPath">The file containing the layout.</param>
/// <param name="imageLayout">The name of the layout used to get the images of the leds.</param>
/// <param name="imageBasePath">The path images for this device are collected in.</param>
protected void ApplyLayoutFromFile(string layoutPath, string imageLayout, string imageBasePath)
{
DeviceLayout layout = DeviceLayout.Load(layoutPath);
if (layout != null)
{
LedImageLayout ledImageLayout = layout.LedImageLayouts.FirstOrDefault(x => string.Equals(x.Layout, imageLayout, StringComparison.OrdinalIgnoreCase));
Size = new Size(layout.Width, layout.Height);
if (layout.Leds != null)
foreach (LedLayout layoutLed in layout.Leds)
{
if (Enum.TryParse(layoutLed.Id, true, out CorsairLedIds ledId))
{
if (LedMapping.TryGetValue(new CorsairLedId(this, ledId), out Led led))
{
led.LedRectangle.Location = new Point(layoutLed.X, layoutLed.Y);
led.LedRectangle.Size = new Size(layoutLed.Width, layoutLed.Height);
led.Shape = layoutLed.Shape;
led.ShapeData = layoutLed.ShapeData;
LedImage image = ledImageLayout?.LedImages.FirstOrDefault(x => x.Id == layoutLed.Id);
led.Image = (!string.IsNullOrEmpty(image?.Image))
? new Uri(Path.Combine(imageBasePath, image.Image), UriKind.Absolute)
: new Uri(Path.Combine(imageBasePath, "Missing.png"), UriKind.Absolute);
}
}
}
}
}
/// <inheritdoc /> /// <inheritdoc />
protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate) protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate)
{ {
List<Led> leds = ledsToUpdate.Where(x => x.Color.A > 0).ToList(); List<Led> leds = ledsToUpdate.Where(x => (x.Color.A > 0) && (x.CustomData is CorsairLedId ledId && (ledId != CorsairLedId.Invalid))).ToList();
if (leds.Count > 0) // CUE seems to crash if 'CorsairSetLedsColors' is called with a zero length array if (leds.Count > 0) // CUE seems to crash if 'CorsairSetLedsColors' is called with a zero length array
{ {
@ -113,7 +98,7 @@ namespace RGB.NET.Devices.Corsair
{ {
_CorsairLedColor color = new _CorsairLedColor _CorsairLedColor color = new _CorsairLedColor
{ {
ledId = (int)((CorsairLedId)led.Id).LedId, ledId = (int)led.CustomData,
r = led.Color.R, r = led.Color.R,
g = led.Color.G, g = led.Color.G,
b = led.Color.B b = led.Color.B
@ -135,7 +120,7 @@ namespace RGB.NET.Devices.Corsair
IntPtr addPtr = new IntPtr(ptr.ToInt64()); IntPtr addPtr = new IntPtr(ptr.ToInt64());
foreach (Led led in this) foreach (Led led in this)
{ {
_CorsairLedColor color = new _CorsairLedColor { ledId = (int)((CorsairLedId)led.Id).LedId }; _CorsairLedColor color = new _CorsairLedColor { ledId = (int)led.CustomData };
Marshal.StructureToPtr(color, addPtr, false); Marshal.StructureToPtr(color, addPtr, false);
addPtr = new IntPtr(addPtr.ToInt64() + structSize); addPtr = new IntPtr(addPtr.ToInt64() + structSize);
} }
@ -145,7 +130,7 @@ namespace RGB.NET.Devices.Corsair
for (int i = 0; i < LedMapping.Count; i++) for (int i = 0; i < LedMapping.Count; i++)
{ {
_CorsairLedColor ledColor = (_CorsairLedColor)Marshal.PtrToStructure(readPtr, typeof(_CorsairLedColor)); _CorsairLedColor ledColor = (_CorsairLedColor)Marshal.PtrToStructure(readPtr, typeof(_CorsairLedColor));
LedMapping[new CorsairLedId(this, (CorsairLedIds)ledColor.ledId)].Color = new Color(ledColor.r, ledColor.g, ledColor.b); this[(CorsairLedId)ledColor.ledId].Color = new Color(ledColor.r, ledColor.g, ledColor.b);
readPtr = new IntPtr(readPtr.ToInt64() + structSize); readPtr = new IntPtr(readPtr.ToInt64() + structSize);
} }

View File

@ -29,13 +29,16 @@ namespace RGB.NET.Devices.Corsair
/// <inheritdoc /> /// <inheritdoc />
protected override void InitializeLayout() protected override void InitializeLayout()
{ {
InitializeLed(new CorsairLedId(this, CorsairLedIds.LeftLogo), new Rectangle(0, 0, 10, 10)); InitializeLed(LedId.Headset1, new Rectangle(0, 0, 10, 10));
InitializeLed(new CorsairLedId(this, CorsairLedIds.RightLogo), new Rectangle(10, 0, 10, 10)); InitializeLed(LedId.Headset2, new Rectangle(10, 0, 10, 10));
ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Corsair\Headsets\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Corsair\Headsets\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"),
null, PathHelper.GetAbsolutePath(@"Images\Corsair\Headsets")); null, PathHelper.GetAbsolutePath(@"Images\Corsair\Headsets"));
} }
/// <inheritdoc />
protected override object CreateLedCustomData(LedId ledId) => HeadsetIdMapping.DEFAULT.TryGetValue(ledId, out CorsairLedId id) ? id : CorsairLedId.Invalid;
#endregion #endregion
} }
} }

View File

@ -0,0 +1,14 @@
using System.Collections.Generic;
using RGB.NET.Core;
namespace RGB.NET.Devices.Corsair
{
internal static class HeadsetIdMapping
{
internal static readonly Dictionary<LedId, CorsairLedId> DEFAULT = new Dictionary<LedId, CorsairLedId>
{
{ LedId.Headset1, CorsairLedId.LeftLogo },
{ LedId.Headset2, CorsairLedId.RightLogo },
};
}
}

View File

@ -47,14 +47,17 @@ namespace RGB.NET.Devices.Corsair
positions.Add(ledPosition); positions.Add(ledPosition);
} }
foreach (_CorsairLedPosition ledPosition in positions.OrderBy(p => p.ledId)) Dictionary<CorsairLedId, LedId> mapping = HeadsetStandIdMapping.DEFAULT.SwapKeyValue();
InitializeLed(new CorsairLedId(this, ledPosition.ledId), foreach (_CorsairLedPosition ledPosition in positions.OrderBy(p => p.LedId))
new Rectangle(ledPosition.left, ledPosition.top, ledPosition.width, ledPosition.height)); InitializeLed(mapping.TryGetValue(ledPosition.LedId, out LedId ledId) ? ledId : LedId.Invalid, new Rectangle(ledPosition.left, ledPosition.top, ledPosition.width, ledPosition.height));
ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Corsair\HeadsetStands\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Corsair\HeadsetStands\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"),
null, PathHelper.GetAbsolutePath(@"Images\Corsair\HeadsetStands")); null, PathHelper.GetAbsolutePath(@"Images\Corsair\HeadsetStands"));
} }
/// <inheritdoc />
protected override object CreateLedCustomData(LedId ledId) => HeadsetStandIdMapping.DEFAULT.TryGetValue(ledId, out CorsairLedId id) ? id : CorsairLedId.Invalid;
#endregion #endregion
} }
} }

View File

@ -0,0 +1,21 @@
using System.Collections.Generic;
using RGB.NET.Core;
namespace RGB.NET.Devices.Corsair
{
internal static class HeadsetStandIdMapping
{
internal static readonly Dictionary<LedId, CorsairLedId> DEFAULT = new Dictionary<LedId, CorsairLedId>
{
{ LedId.HeadsetStand1, CorsairLedId.HeadsetStandZone1 },
{ LedId.HeadsetStand2, CorsairLedId.HeadsetStandZone2 },
{ LedId.HeadsetStand3, CorsairLedId.HeadsetStandZone3 },
{ LedId.HeadsetStand4, CorsairLedId.HeadsetStandZone4 },
{ LedId.HeadsetStand5, CorsairLedId.HeadsetStandZone5 },
{ LedId.HeadsetStand6, CorsairLedId.HeadsetStandZone6 },
{ LedId.HeadsetStand7, CorsairLedId.HeadsetStandZone7 },
{ LedId.HeadsetStand8, CorsairLedId.HeadsetStandZone8 },
{ LedId.HeadsetStand9, CorsairLedId.HeadsetStandZone9 }
};
}
}

View File

@ -0,0 +1,10 @@
using System.Collections.Generic;
using System.Linq;
namespace RGB.NET.Devices.Corsair
{
internal static class DictionaryExtension
{
public static Dictionary<TValue, TKey> SwapKeyValue<TKey, TValue>(this Dictionary<TKey, TValue> dictionary) => dictionary.ToDictionary(x => x.Value, x => x.Key);
}
}

View File

@ -2,6 +2,7 @@
// ReSharper disable UnusedMember.Global // ReSharper disable UnusedMember.Global
using System; using System;
using System.Collections.Generic;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using RGB.NET.Core; using RGB.NET.Core;
using RGB.NET.Devices.Corsair.Native; using RGB.NET.Devices.Corsair.Native;
@ -38,11 +39,11 @@ namespace RGB.NET.Devices.Corsair
int structSize = Marshal.SizeOf(typeof(_CorsairLedPosition)); int structSize = Marshal.SizeOf(typeof(_CorsairLedPosition));
IntPtr ptr = nativeLedPositions.pLedPosition; IntPtr ptr = nativeLedPositions.pLedPosition;
Dictionary<CorsairLedId, LedId> mapping = KeyboardIdMapping.DEFAULT.SwapKeyValue();
for (int i = 0; i < nativeLedPositions.numberOfLed; i++) for (int i = 0; i < nativeLedPositions.numberOfLed; i++)
{ {
_CorsairLedPosition ledPosition = (_CorsairLedPosition)Marshal.PtrToStructure(ptr, typeof(_CorsairLedPosition)); _CorsairLedPosition ledPosition = (_CorsairLedPosition)Marshal.PtrToStructure(ptr, typeof(_CorsairLedPosition));
InitializeLed(new CorsairLedId(this, ledPosition.ledId), InitializeLed(mapping.TryGetValue(ledPosition.LedId, out LedId ledId) ? ledId : LedId.Invalid, new Rectangle(ledPosition.left, ledPosition.top, ledPosition.width, ledPosition.height));
new Rectangle(ledPosition.left, ledPosition.top, ledPosition.width, ledPosition.height));
ptr = new IntPtr(ptr.ToInt64() + structSize); ptr = new IntPtr(ptr.ToInt64() + structSize);
} }
@ -53,6 +54,9 @@ namespace RGB.NET.Devices.Corsair
DeviceInfo.LogicalLayout.ToString(), PathHelper.GetAbsolutePath(@"Images\Corsair\Keyboards")); DeviceInfo.LogicalLayout.ToString(), PathHelper.GetAbsolutePath(@"Images\Corsair\Keyboards"));
} }
/// <inheritdoc />
protected override object CreateLedCustomData(LedId ledId) => KeyboardIdMapping.DEFAULT.TryGetValue(ledId, out CorsairLedId id) ? id : CorsairLedId.Invalid;
#endregion #endregion
} }
} }

View File

@ -0,0 +1,158 @@
using System.Collections.Generic;
using RGB.NET.Core;
namespace RGB.NET.Devices.Corsair
{
internal static class KeyboardIdMapping
{
internal static readonly Dictionary<LedId, CorsairLedId> DEFAULT = new Dictionary<LedId, CorsairLedId>
{
{ LedId.Invalid, CorsairLedId.Invalid },
{ LedId.Keyboard_Escape, CorsairLedId.Escape },
{ LedId.Keyboard_F1, CorsairLedId.F1 },
{ LedId.Keyboard_F2, CorsairLedId.F2 },
{ LedId.Keyboard_F3, CorsairLedId.F3 },
{ LedId.Keyboard_F4, CorsairLedId.F4 },
{ LedId.Keyboard_F5, CorsairLedId.F5 },
{ LedId.Keyboard_F6, CorsairLedId.F6 },
{ LedId.Keyboard_F7, CorsairLedId.F7 },
{ LedId.Keyboard_F8, CorsairLedId.F8 },
{ LedId.Keyboard_F9, CorsairLedId.F9 },
{ LedId.Keyboard_F10, CorsairLedId.F10 },
{ LedId.Keyboard_F11, CorsairLedId.F11 },
{ LedId.Keyboard_GraveAccentAndTilde, CorsairLedId.GraveAccentAndTilde },
{ LedId.Keyboard_1, CorsairLedId.D1 },
{ LedId.Keyboard_2, CorsairLedId.D2 },
{ LedId.Keyboard_3, CorsairLedId.D3 },
{ LedId.Keyboard_4, CorsairLedId.D4 },
{ LedId.Keyboard_5, CorsairLedId.D5 },
{ LedId.Keyboard_6, CorsairLedId.D6 },
{ LedId.Keyboard_7, CorsairLedId.D7 },
{ LedId.Keyboard_8, CorsairLedId.D8 },
{ LedId.Keyboard_9, CorsairLedId.D9 },
{ LedId.Keyboard_0, CorsairLedId.D0 },
{ LedId.Keyboard_MinusAndUnderscore, CorsairLedId.MinusAndUnderscore },
{ LedId.Keyboard_Tab, CorsairLedId.Tab },
{ LedId.Keyboard_Q, CorsairLedId.Q },
{ LedId.Keyboard_W, CorsairLedId.W },
{ LedId.Keyboard_E, CorsairLedId.E },
{ LedId.Keyboard_R, CorsairLedId.R },
{ LedId.Keyboard_T, CorsairLedId.T },
{ LedId.Keyboard_Y, CorsairLedId.Y },
{ LedId.Keyboard_U, CorsairLedId.U },
{ LedId.Keyboard_I, CorsairLedId.I },
{ LedId.Keyboard_O, CorsairLedId.O },
{ LedId.Keyboard_P, CorsairLedId.P },
{ LedId.Keyboard_BracketLeft, CorsairLedId.BracketLeft },
{ LedId.Keyboard_CapsLock, CorsairLedId.CapsLock },
{ LedId.Keyboard_A, CorsairLedId.A },
{ LedId.Keyboard_S, CorsairLedId.S },
{ LedId.Keyboard_D, CorsairLedId.D },
{ LedId.Keyboard_F, CorsairLedId.F },
{ LedId.Keyboard_G, CorsairLedId.G },
{ LedId.Keyboard_H, CorsairLedId.H },
{ LedId.Keyboard_J, CorsairLedId.J },
{ LedId.Keyboard_K, CorsairLedId.K },
{ LedId.Keyboard_L, CorsairLedId.L },
{ LedId.Keyboard_SemicolonAndColon, CorsairLedId.SemicolonAndColon },
{ LedId.Keyboard_ApostropheAndDoubleQuote, CorsairLedId.ApostropheAndDoubleQuote },
{ LedId.Keyboard_LeftShift, CorsairLedId.LeftShift },
{ LedId.Keyboard_NonUsBackslash, CorsairLedId.NonUsBackslash },
{ LedId.Keyboard_Z, CorsairLedId.Z },
{ LedId.Keyboard_X, CorsairLedId.X },
{ LedId.Keyboard_C, CorsairLedId.C },
{ LedId.Keyboard_V, CorsairLedId.V },
{ LedId.Keyboard_B, CorsairLedId.B },
{ LedId.Keyboard_N, CorsairLedId.N },
{ LedId.Keyboard_M, CorsairLedId.M },
{ LedId.Keyboard_CommaAndLessThan, CorsairLedId.CommaAndLessThan },
{ LedId.Keyboard_PeriodAndBiggerThan, CorsairLedId.PeriodAndBiggerThan },
{ LedId.Keyboard_SlashAndQuestionMark, CorsairLedId.SlashAndQuestionMark },
{ LedId.Keyboard_LeftCtrl, CorsairLedId.LeftCtrl },
{ LedId.Keyboard_LeftGui, CorsairLedId.LeftGui },
{ LedId.Keyboard_LeftAlt, CorsairLedId.LeftAlt },
{ LedId.Keyboard_Lang2, CorsairLedId.Lang2 },
{ LedId.Keyboard_Space, CorsairLedId.Space },
{ LedId.Keyboard_Lang1, CorsairLedId.Lang1 },
{ LedId.Keyboard_International2, CorsairLedId.International2 },
{ LedId.Keyboard_RightAlt, CorsairLedId.RightAlt },
{ LedId.Keyboard_RightGui, CorsairLedId.RightGui },
{ LedId.Keyboard_Application, CorsairLedId.Application },
{ LedId.Keyboard_Brightness, CorsairLedId.Brightness },
{ LedId.Keyboard_F12, CorsairLedId.F12 },
{ LedId.Keyboard_PrintScreen, CorsairLedId.PrintScreen },
{ LedId.Keyboard_ScrollLock, CorsairLedId.ScrollLock },
{ LedId.Keyboard_PauseBreak, CorsairLedId.PauseBreak },
{ LedId.Keyboard_Insert, CorsairLedId.Insert },
{ LedId.Keyboard_Home, CorsairLedId.Home },
{ LedId.Keyboard_PageUp, CorsairLedId.PageUp },
{ LedId.Keyboard_BracketRight, CorsairLedId.BracketRight },
{ LedId.Keyboard_Backslash, CorsairLedId.Backslash },
{ LedId.Keyboard_NonUsTilde, CorsairLedId.NonUsTilde },
{ LedId.Keyboard_Enter, CorsairLedId.Enter },
{ LedId.Keyboard_International1, CorsairLedId.International1 },
{ LedId.Keyboard_EqualsAndPlus, CorsairLedId.EqualsAndPlus },
{ LedId.Keyboard_International3, CorsairLedId.International3 },
{ LedId.Keyboard_Backspace, CorsairLedId.Backspace },
{ LedId.Keyboard_Delete, CorsairLedId.Delete },
{ LedId.Keyboard_End, CorsairLedId.End },
{ LedId.Keyboard_PageDown, CorsairLedId.PageDown },
{ LedId.Keyboard_RightShift, CorsairLedId.RightShift },
{ LedId.Keyboard_RightCtrl, CorsairLedId.RightCtrl },
{ LedId.Keyboard_ArrowUp, CorsairLedId.UpArrow },
{ LedId.Keyboard_ArrowLeft, CorsairLedId.LeftArrow },
{ LedId.Keyboard_ArrowDown, CorsairLedId.DownArrow },
{ LedId.Keyboard_ArrowRight, CorsairLedId.RightArrow },
{ LedId.Keyboard_WinLock, CorsairLedId.WinLock },
{ LedId.Keyboard_MediaMute, CorsairLedId.Mute },
{ LedId.Keyboard_MediaStop, CorsairLedId.Stop },
{ LedId.Keyboard_MediaPreviousTrack, CorsairLedId.ScanPreviousTrack },
{ LedId.Keyboard_MediaPlay, CorsairLedId.PlayPause },
{ LedId.Keyboard_MediaNextTrack, CorsairLedId.ScanNextTrack },
{ LedId.Keyboard_NumLock, CorsairLedId.NumLock },
{ LedId.Keyboard_NumSlash, CorsairLedId.KeypadSlash },
{ LedId.Keyboard_NumAsterisk, CorsairLedId.KeypadAsterisk },
{ LedId.Keyboard_NumMinus, CorsairLedId.KeypadMinus },
{ LedId.Keyboard_NumPlus, CorsairLedId.KeypadPlus },
{ LedId.Keyboard_NumEnter, CorsairLedId.KeypadEnter },
{ LedId.Keyboard_Num7, CorsairLedId.Keypad7 },
{ LedId.Keyboard_Num8, CorsairLedId.Keypad8 },
{ LedId.Keyboard_Num9, CorsairLedId.Keypad9 },
{ LedId.Keyboard_NumComma, CorsairLedId.KeypadComma },
{ LedId.Keyboard_Num4, CorsairLedId.Keypad4 },
{ LedId.Keyboard_Num5, CorsairLedId.Keypad5 },
{ LedId.Keyboard_Num6, CorsairLedId.Keypad6 },
{ LedId.Keyboard_Num1, CorsairLedId.Keypad1 },
{ LedId.Keyboard_Num2, CorsairLedId.Keypad2 },
{ LedId.Keyboard_Num3, CorsairLedId.Keypad3 },
{ LedId.Keyboard_Num0, CorsairLedId.Keypad0 },
{ LedId.Keyboard_NumPeriodAndDelete, CorsairLedId.KeypadPeriodAndDelete },
{ LedId.Keyboard_Programmable1, CorsairLedId.G1 },
{ LedId.Keyboard_Programmable2, CorsairLedId.G2 },
{ LedId.Keyboard_Programmable3, CorsairLedId.G3 },
{ LedId.Keyboard_Programmable4, CorsairLedId.G4 },
{ LedId.Keyboard_Programmable5, CorsairLedId.G5 },
{ LedId.Keyboard_Programmable6, CorsairLedId.G6 },
{ LedId.Keyboard_Programmable7, CorsairLedId.G7 },
{ LedId.Keyboard_Programmable8, CorsairLedId.G8 },
{ LedId.Keyboard_Programmable9, CorsairLedId.G9 },
{ LedId.Keyboard_Programmable10, CorsairLedId.G10 },
{ LedId.Keyboard_MediaVolumeUp, CorsairLedId.VolumeUp },
{ LedId.Keyboard_MediaVolumeDown, CorsairLedId.VolumeDown },
{ LedId.Keyboard_MacroRecording, CorsairLedId.MR },
{ LedId.Keyboard_Macro1, CorsairLedId.M1 },
{ LedId.Keyboard_Macro2, CorsairLedId.M2 },
{ LedId.Keyboard_Macro3, CorsairLedId.M3 },
{ LedId.Keyboard_Programmable11, CorsairLedId.G11 },
{ LedId.Keyboard_Programmable12, CorsairLedId.G12 },
{ LedId.Keyboard_Programmable13, CorsairLedId.G13 },
{ LedId.Keyboard_Programmable14, CorsairLedId.G14 },
{ LedId.Keyboard_Programmable15, CorsairLedId.G15 },
{ LedId.Keyboard_Programmable16, CorsairLedId.G16 },
{ LedId.Keyboard_Programmable17, CorsairLedId.G17 },
{ LedId.Keyboard_Programmable18, CorsairLedId.G18 },
{ LedId.Keyboard_International5, CorsairLedId.International5 },
{ LedId.Keyboard_International4, CorsairLedId.International4 },
};
}
}

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Device xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Device xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Name>Corsair K70 RGB - Physical UK</Name> <Name>Corsair K70 RGB - Physical UK</Name>
<Description>Physical UK-Layout of Corsairs K70 RGB (Logical: BE, CH, DE, ES, EU, FR, IT, ND, MEX, RU, UK, US_Int)</Description> <Description>Physical UK-Layout of Corsairs K70 RGB (Logical: BE, CH, DE, ES, EU, FR, IT, ND, MEX, RU, UK, US_Int)</Description>
@ -10,483 +10,483 @@
<Height>165</Height> <Height>165</Height>
<Leds> <Leds>
<!-- Extra-Keys: Brightness -> Mute --> <!-- Extra-Keys: Brightness -> Mute -->
<Led Id="Brightness"> <Led Id="Keyboard_Brightness">
<Shape>Circle</Shape> <Shape>Circle</Shape>
<X>298</X> <X>298</X>
<Y>6</Y> <Y>6</Y>
<Width>10mm</Width> <Width>10mm</Width>
<Height>10mm</Height> <Height>10mm</Height>
</Led> </Led>
<Led Id="WinLock"> <Led Id="Keyboard_WinLock">
<Shape>Circle</Shape> <Shape>Circle</Shape>
<X>+9</X> <X>+9</X>
<Width>10mm</Width> <Width>10mm</Width>
<Height>10mm</Height> <Height>10mm</Height>
</Led> </Led>
<Led Id="Mute"> <Led Id="Keyboard_MediaMute">
<X>375</X> <X>375</X>
<Y>6</Y> <Y>6</Y>
<Height>12mm</Height> <Height>12mm</Height>
</Led> </Led>
<!-- Esc -> NextTrack --> <!-- Esc -> NextTrack -->
<Led Id="Escape"> <Led Id="Keyboard_Escape">
<X>4</X> <X>4</X>
<Y>28</Y> <Y>28</Y>
</Led> </Led>
<Led Id="F1"> <Led Id="Keyboard_F1">
<X>+12.667</X> <X>+12.667</X>
</Led> </Led>
<Led Id="F2" /> <Led Id="Keyboard_F2" />
<Led Id="F3" /> <Led Id="Keyboard_F3" />
<Led Id="F4" /> <Led Id="Keyboard_F4" />
<Led Id="F5"> <Led Id="Keyboard_F5">
<X>+12.667</X> <X>+12.667</X>
</Led> </Led>
<Led Id="F6" /> <Led Id="Keyboard_F6" />
<Led Id="F7" /> <Led Id="Keyboard_F7" />
<Led Id="F8" /> <Led Id="Keyboard_F8" />
<Led Id="F9"> <Led Id="Keyboard_F9">
<X>+12.667</X> <X>+12.667</X>
</Led> </Led>
<Led Id="F10" /> <Led Id="Keyboard_F10" />
<Led Id="F11" /> <Led Id="Keyboard_F11" />
<Led Id="F12" /> <Led Id="Keyboard_F12" />
<Led Id="PrintScreen"> <Led Id="Keyboard_PrintScreen">
<X>+5</X> <X>+5</X>
</Led> </Led>
<Led Id="ScrollLock" /> <Led Id="Keyboard_ScrollLock" />
<Led Id="PauseBreak" /> <Led Id="Keyboard_PauseBreak" />
<Led Id="Stop"> <Led Id="Keyboard_MediaStop">
<X>+5</X> <X>+5</X>
<Height>12mm</Height> <Height>12mm</Height>
</Led> </Led>
<Led Id="ScanPreviousTrack"> <Led Id="Keyboard_MediaPreviousTrack">
<Height>12mm</Height> <Height>12mm</Height>
</Led> </Led>
<Led Id="PlayPause"> <Led Id="Keyboard_MediaPlay">
<Height>12mm</Height> <Height>12mm</Height>
</Led> </Led>
<Led Id="ScanNextTrack"> <Led Id="Keyboard_MediaNextTrack">
<Height>12mm</Height> <Height>12mm</Height>
</Led> </Led>
<!-- ^ -> Num- --> <!-- ^ -> Num- -->
<Led Id="GraveAccentAndTilde"> <Led Id="Keyboard_GraveAccentAndTilde">
<X>4</X> <X>4</X>
<Y>49</Y> <Y>49</Y>
</Led> </Led>
<Led Id="D1" /> <Led Id="Keyboard_1" />
<Led Id="D2" /> <Led Id="Keyboard_2" />
<Led Id="D3" /> <Led Id="Keyboard_3" />
<Led Id="D4" /> <Led Id="Keyboard_4" />
<Led Id="D5" /> <Led Id="Keyboard_5" />
<Led Id="D6" /> <Led Id="Keyboard_6" />
<Led Id="D7" /> <Led Id="Keyboard_7" />
<Led Id="D8" /> <Led Id="Keyboard_8" />
<Led Id="D9" /> <Led Id="Keyboard_9" />
<Led Id="D0" /> <Led Id="Keyboard_0" />
<Led Id="MinusAndUnderscore" /> <Led Id="Keyboard_MinusAndUnderscore" />
<Led Id="EqualsAndPlus" /> <Led Id="Keyboard_EqualsAndPlus" />
<Led Id="Backspace"> <Led Id="Keyboard_Backspace">
<Width>2</Width> <Width>2</Width>
</Led> </Led>
<Led Id="Insert"> <Led Id="Keyboard_Insert">
<X>+5</X> <X>+5</X>
</Led> </Led>
<Led Id="Home" /> <Led Id="Keyboard_Home" />
<Led Id="PageUp" /> <Led Id="Keyboard_PageUp" />
<Led Id="NumLock"> <Led Id="Keyboard_NumLock">
<X>+5</X> <X>+5</X>
</Led> </Led>
<Led Id="KeypadSlash" /> <Led Id="Keyboard_NumSlash" />
<Led Id="KeypadAsterisk" /> <Led Id="Keyboard_NumAsterisk" />
<Led Id="KeypadMinus" /> <Led Id="Keyboard_NumMinus" />
<!-- Tab -> Num+ --> <!-- Tab -> Num+ -->
<Led Id="Tab"> <Led Id="Keyboard_Tab">
<X>4</X> <X>4</X>
<Y>+</Y> <Y>+</Y>
<Width>1.5</Width> <Width>1.5</Width>
</Led> </Led>
<Led Id="Q" /> <Led Id="Keyboard_Q" />
<Led Id="W" /> <Led Id="Keyboard_W" />
<Led Id="E" /> <Led Id="Keyboard_E" />
<Led Id="R" /> <Led Id="Keyboard_R" />
<Led Id="T" /> <Led Id="Keyboard_T" />
<Led Id="Y" /> <Led Id="Keyboard_Y" />
<Led Id="U" /> <Led Id="Keyboard_U" />
<Led Id="I" /> <Led Id="Keyboard_I" />
<Led Id="O" /> <Led Id="Keyboard_O" />
<Led Id="P" /> <Led Id="Keyboard_P" />
<Led Id="BracketLeft" /> <Led Id="Keyboard_BracketLeft" />
<Led Id="BracketRight" /> <Led Id="Keyboard_BracketRight" />
<Led Id="Enter"> <Led Id="Keyboard_Enter">
<Shape>M0,0 L0,0.5 L0.16666666666,0.5 L0.16666666666,1 L1,1 L1,0 Z</Shape> <Shape>M0,0 L0,0.5 L0.16666666666,0.5 L0.16666666666,1 L1,1 L1,0 Z</Shape>
<Width>1.5</Width> <Width>1.5</Width>
<Height>2</Height> <Height>2</Height>
</Led> </Led>
<Led Id="Delete"> <Led Id="Keyboard_Delete">
<X>+5</X> <X>+5</X>
</Led> </Led>
<Led Id="End" /> <Led Id="Keyboard_End" />
<Led Id="PageDown" /> <Led Id="Keyboard_PageDown" />
<Led Id="Keypad7"> <Led Id="Keyboard_Num7">
<X>+5</X> <X>+5</X>
</Led> </Led>
<Led Id="Keypad8" /> <Led Id="Keyboard_Num8" />
<Led Id="Keypad9" /> <Led Id="Keyboard_Num9" />
<Led Id="KeypadPlus"> <Led Id="Keyboard_NumPlus">
<Height>2</Height> <Height>2</Height>
</Led> </Led>
<!-- CapsLock -> Num6 --> <!-- CapsLock -> Num6 -->
<Led Id="CapsLock"> <Led Id="Keyboard_CapsLock">
<X>4</X> <X>4</X>
<Y>~</Y> <Y>~</Y>
<Width>1.75</Width> <Width>1.75</Width>
</Led> </Led>
<Led Id="A" /> <Led Id="Keyboard_A" />
<Led Id="S" /> <Led Id="Keyboard_S" />
<Led Id="D" /> <Led Id="Keyboard_D" />
<Led Id="F" /> <Led Id="Keyboard_F" />
<Led Id="G" /> <Led Id="Keyboard_G" />
<Led Id="H" /> <Led Id="Keyboard_H" />
<Led Id="J" /> <Led Id="Keyboard_J" />
<Led Id="K" /> <Led Id="Keyboard_K" />
<Led Id="L" /> <Led Id="Keyboard_L" />
<Led Id="SemicolonAndColon" /> <Led Id="Keyboard_SemicolonAndColon" />
<Led Id="ApostropheAndDoubleQuote" /> <Led Id="Keyboard_ApostropheAndDoubleQuote" />
<Led Id="NonUsTilde" /> <Led Id="Keyboard_NonUsTilde" />
<Led Id="Keypad4"> <Led Id="Keyboard_Num4">
<X>+90.75</X> <X>+90.75</X>
</Led> </Led>
<Led Id="Keypad5" /> <Led Id="Keyboard_Num5" />
<Led Id="Keypad6" /> <Led Id="Keyboard_Num6" />
<!-- LShift -> NumEnter --> <!-- LShift -> NumEnter -->
<Led Id="LeftShift"> <Led Id="Keyboard_LeftShift">
<X>4</X> <X>4</X>
<Y>+</Y> <Y>+</Y>
<Width>1.25</Width> <Width>1.25</Width>
</Led> </Led>
<Led Id="NonUsBackslash" /> <Led Id="Keyboard_NonUsBackslash" />
<Led Id="Z" /> <Led Id="Keyboard_Z" />
<Led Id="X" /> <Led Id="Keyboard_X" />
<Led Id="C" /> <Led Id="Keyboard_C" />
<Led Id="V" /> <Led Id="Keyboard_V" />
<Led Id="B" /> <Led Id="Keyboard_B" />
<Led Id="N" /> <Led Id="Keyboard_N" />
<Led Id="M" /> <Led Id="Keyboard_M" />
<Led Id="CommaAndLessThan" /> <Led Id="Keyboard_CommaAndLessThan" />
<Led Id="PeriodAndBiggerThan" /> <Led Id="Keyboard_PeriodAndBiggerThan" />
<Led Id="SlashAndQuestionMark" /> <Led Id="Keyboard_SlashAndQuestionMark" />
<Led Id="RightShift"> <Led Id="Keyboard_RightShift">
<Width>2.75</Width> <Width>2.75</Width>
</Led> </Led>
<Led Id="UpArrow"> <Led Id="Keyboard_ArrowUp">
<X>+24</X> <X>+24</X>
</Led> </Led>
<Led Id="Keypad1"> <Led Id="Keyboard_Num1">
<X>+24</X> <X>+24</X>
</Led> </Led>
<Led Id="Keypad2" /> <Led Id="Keyboard_Num2" />
<Led Id="Keypad3" /> <Led Id="Keyboard_Num3" />
<Led Id="KeypadEnter"> <Led Id="Keyboard_NumEnter">
<Height>2</Height> <Height>2</Height>
</Led> </Led>
<!-- LCtrl -> NumPeriod --> <!-- LCtrl -> NumPeriod -->
<Led Id="LeftCtrl"> <Led Id="Keyboard_LeftCtrl">
<X>4</X> <X>4</X>
<Y>~</Y> <Y>~</Y>
<Width>1.5</Width> <Width>1.5</Width>
</Led> </Led>
<Led Id="LeftGui" /> <Led Id="Keyboard_LeftGui" />
<Led Id="LeftAlt"> <Led Id="Keyboard_LeftAlt">
<Width>1.25</Width> <Width>1.25</Width>
</Led> </Led>
<Led Id="Space"> <Led Id="Keyboard_Space">
<Width>6.5</Width> <Width>6.5</Width>
</Led> </Led>
<Led Id="RightAlt"> <Led Id="Keyboard_RightAlt">
<Width>1.25</Width> <Width>1.25</Width>
</Led> </Led>
<Led Id="RightGui" /> <Led Id="Keyboard_RightGui" />
<Led Id="Application" /> <Led Id="Keyboard_Application" />
<Led Id="RightCtrl"> <Led Id="Keyboard_RightCtrl">
<Width>1.5</Width> <Width>1.5</Width>
</Led> </Led>
<Led Id="LeftArrow"> <Led Id="Keyboard_ArrowLeft">
<X>+5</X> <X>+5</X>
</Led> </Led>
<Led Id="DownArrow" /> <Led Id="Keyboard_ArrowDown" />
<Led Id="RightArrow" /> <Led Id="Keyboard_ArrowRight" />
<Led Id="Keypad0"> <Led Id="Keyboard_Num0">
<X>+5</X> <X>+5</X>
<Width>2</Width> <Width>2</Width>
</Led> </Led>
<Led Id="KeypadPeriodAndDelete" /> <Led Id="Keyboard_NumPeriodAndDelete" />
</Leds> </Leds>
<LedImageLayouts> <LedImageLayouts>
<LedImageLayout Layout="DE"> <LedImageLayout Layout="DE">
<LedImages> <LedImages>
<LedImage Id="Brightness" Image="K_Keys\Brightness.png" /> <LedImage Id="Keyboard_Brightness" Image="K_Keys\Brightness.png" />
<LedImage Id="WinLock" Image="K_Keys\WinLock.png" /> <LedImage Id="Keyboard_WinLock" Image="K_Keys\WinLock.png" />
<LedImage Id="Mute" Image="K_Keys\Mute.png" /> <LedImage Id="Keyboard_MediaMute" Image="K_Keys\Mute.png" />
<LedImage Id="Escape" Image="K_Keys\Escape.png" /> <LedImage Id="Keyboard_Escape" Image="K_Keys\Escape.png" />
<LedImage Id="F1" Image="K_Keys\F1.png" /> <LedImage Id="Keyboard_F1" Image="K_Keys\F1.png" />
<LedImage Id="F2" Image="K_Keys\F2.png" /> <LedImage Id="Keyboard_F2" Image="K_Keys\F2.png" />
<LedImage Id="F3" Image="K_Keys\F3.png" /> <LedImage Id="Keyboard_F3" Image="K_Keys\F3.png" />
<LedImage Id="F4" Image="K_Keys\F4.png" /> <LedImage Id="Keyboard_F4" Image="K_Keys\F4.png" />
<LedImage Id="F5" Image="K_Keys\F5.png" /> <LedImage Id="Keyboard_F5" Image="K_Keys\F5.png" />
<LedImage Id="F6" Image="K_Keys\F6.png" /> <LedImage Id="Keyboard_F6" Image="K_Keys\F6.png" />
<LedImage Id="F7" Image="K_Keys\F7.png" /> <LedImage Id="Keyboard_F7" Image="K_Keys\F7.png" />
<LedImage Id="F8" Image="K_Keys\F8.png" /> <LedImage Id="Keyboard_F8" Image="K_Keys\F8.png" />
<LedImage Id="F9" Image="K_Keys\F9.png" /> <LedImage Id="Keyboard_F9" Image="K_Keys\F9.png" />
<LedImage Id="F10" Image="K_Keys\F10.png" /> <LedImage Id="Keyboard_F10" Image="K_Keys\F10.png" />
<LedImage Id="F11" Image="K_Keys\F11.png" /> <LedImage Id="Keyboard_F11" Image="K_Keys\F11.png" />
<LedImage Id="F12" Image="K_Keys\F12.png" /> <LedImage Id="Keyboard_F12" Image="K_Keys\F12.png" />
<LedImage Id="PrintScreen" Image="K_Keys\Drucken.png" /> <LedImage Id="Keyboard_PrintScreen" Image="K_Keys\Drucken.png" />
<LedImage Id="ScrollLock" Image="K_Keys\Rollen.png" /> <LedImage Id="Keyboard_ScrollLock" Image="K_Keys\Rollen.png" />
<LedImage Id="PauseBreak" Image="K_Keys\PauseUntbr.png" /> <LedImage Id="Keyboard_PauseBreak" Image="K_Keys\PauseUntbr.png" />
<LedImage Id="Stop" Image="K_Keys\Stop.png" /> <LedImage Id="Keyboard_MediaStop" Image="K_Keys\Stop.png" />
<LedImage Id="ScanPreviousTrack" Image="K_Keys\PreviousTrack.png" /> <LedImage Id="Keyboard_MediaPreviousTrack" Image="K_Keys\PreviousTrack.png" />
<LedImage Id="PlayPause" Image="K_Keys\PlayPause.png" /> <LedImage Id="Keyboard_MediaPlay" Image="K_Keys\PlayPause.png" />
<LedImage Id="ScanNextTrack" Image="K_Keys\NextTrack.png" /> <LedImage Id="Keyboard_MediaNextTrack" Image="K_Keys\NextTrack.png" />
<LedImage Id="GraveAccentAndTilde" Image="K_Keys\Circumflex_Degree.png" /> <LedImage Id="Keyboard_GraveAccentAndTilde" Image="K_Keys\Circumflex_Degree.png" />
<LedImage Id="D1" Image="K_Keys\1_ExclamationMark.png" /> <LedImage Id="Keyboard_1" Image="K_Keys\1_ExclamationMark.png" />
<LedImage Id="D2" Image="K_Keys\2_QuotationMark_Exponent2.png" /> <LedImage Id="Keyboard_2" Image="K_Keys\2_QuotationMark_Exponent2.png" />
<LedImage Id="D3" Image="K_Keys\3_SectionSign_Exponent3.png" /> <LedImage Id="Keyboard_3" Image="K_Keys\3_SectionSign_Exponent3.png" />
<LedImage Id="D4" Image="K_Keys\4_Dollar.png" /> <LedImage Id="Keyboard_4" Image="K_Keys\4_Dollar.png" />
<LedImage Id="D5" Image="K_Keys\5_Percent.png" /> <LedImage Id="Keyboard_5" Image="K_Keys\5_Percent.png" />
<LedImage Id="D6" Image="K_Keys\6_Ampersand.png" /> <LedImage Id="Keyboard_6" Image="K_Keys\6_Ampersand.png" />
<LedImage Id="D7" Image="K_Keys\7_Slash_CurlyBracketLeft.png" /> <LedImage Id="Keyboard_7" Image="K_Keys\7_Slash_CurlyBracketLeft.png" />
<LedImage Id="D8" Image="K_Keys\8_BracketLeft_SquareBracketLeft.png" /> <LedImage Id="Keyboard_8" Image="K_Keys\8_BracketLeft_SquareBracketLeft.png" />
<LedImage Id="D9" Image="K_Keys\9_BracketRight_SquareBracketRight.png" /> <LedImage Id="Keyboard_9" Image="K_Keys\9_BracketRight_SquareBracketRight.png" />
<LedImage Id="D0" Image="K_Keys\0_Equals_CurlyBracketRight.png" /> <LedImage Id="Keyboard_0" Image="K_Keys\0_Equals_CurlyBracketRight.png" />
<LedImage Id="MinusAndUnderscore" Image="K_Keys\QuestionMark_SharpS_Backslash.png" /> <LedImage Id="Keyboard_MinusAndUnderscore" Image="K_Keys\QuestionMark_SharpS_Backslash.png" />
<LedImage Id="EqualsAndPlus" Image="K_Keys\AccentGrave_AccentAcute.png" /> <LedImage Id="Keyboard_EqualsAndPlus" Image="K_Keys\AccentGrave_AccentAcute.png" />
<LedImage Id="Backspace" Image="K_Keys\Backspace.png" /> <LedImage Id="Keyboard_Backspace" Image="K_Keys\Backspace.png" />
<LedImage Id="Insert" Image="K_Keys\Einfg.png" /> <LedImage Id="Keyboard_Insert" Image="K_Keys\Einfg.png" />
<LedImage Id="Home" Image="K_Keys\Pos1.png" /> <LedImage Id="Keyboard_Home" Image="K_Keys\Pos1.png" />
<LedImage Id="PageUp" Image="K_Keys\BildUp.png" /> <LedImage Id="Keyboard_PageUp" Image="K_Keys\BildUp.png" />
<LedImage Id="NumLock" Image="K_Keys\Num.png" /> <LedImage Id="Keyboard_NumLock" Image="K_Keys\Num.png" />
<LedImage Id="KeypadSlash" Image="K_Keys\Slash.png" /> <LedImage Id="Keyboard_NumSlash" Image="K_Keys\Slash.png" />
<LedImage Id="KeypadAsterisk" Image="K_Keys\Asterisk.png" /> <LedImage Id="Keyboard_NumAsterisk" Image="K_Keys\Asterisk.png" />
<LedImage Id="KeypadMinus" Image="K_Keys\Minus.png" /> <LedImage Id="Keyboard_NumMinus" Image="K_Keys\Minus.png" />
<LedImage Id="Tab" Image="K_Keys\Tab.png" /> <LedImage Id="Keyboard_Tab" Image="K_Keys\Tab.png" />
<LedImage Id="Q" Image="K_Keys\Q_At.png" /> <LedImage Id="Keyboard_Q" Image="K_Keys\Q_At.png" />
<LedImage Id="W" Image="K_Keys\W.png" /> <LedImage Id="Keyboard_W" Image="K_Keys\W.png" />
<LedImage Id="E" Image="K_Keys\E_Euro.png" /> <LedImage Id="Keyboard_E" Image="K_Keys\E_Euro.png" />
<LedImage Id="R" Image="K_Keys\R.png" /> <LedImage Id="Keyboard_R" Image="K_Keys\R.png" />
<LedImage Id="T" Image="K_Keys\T.png" /> <LedImage Id="Keyboard_T" Image="K_Keys\T.png" />
<LedImage Id="Y" Image="K_Keys\Z.png" /> <LedImage Id="Keyboard_Y" Image="K_Keys\Z.png" />
<LedImage Id="U" Image="K_Keys\U.png" /> <LedImage Id="Keyboard_U" Image="K_Keys\U.png" />
<LedImage Id="I" Image="K_Keys\I.png" /> <LedImage Id="Keyboard_I" Image="K_Keys\I.png" />
<LedImage Id="O" Image="K_Keys\O.png" /> <LedImage Id="Keyboard_O" Image="K_Keys\O.png" />
<LedImage Id="P" Image="K_Keys\P.png" /> <LedImage Id="Keyboard_P" Image="K_Keys\P.png" />
<LedImage Id="BracketLeft" Image="K_Keys\UE.png" /> <LedImage Id="Keyboard_BracketLeft" Image="K_Keys\UE.png" />
<LedImage Id="BracketRight" Image="K_Keys\Plus_Asterisk_Tilde.png" /> <LedImage Id="Keyboard_BracketRight" Image="K_Keys\Plus_Asterisk_Tilde.png" />
<LedImage Id="Enter" Image="K_Keys\Enter.png" /> <LedImage Id="Keyboard_Enter" Image="K_Keys\Enter.png" />
<LedImage Id="Delete" Image="K_Keys\Entf.png" /> <LedImage Id="Keyboard_Delete" Image="K_Keys\Entf.png" />
<LedImage Id="End" Image="K_Keys\Ende.png" /> <LedImage Id="Keyboard_End" Image="K_Keys\Ende.png" />
<LedImage Id="PageDown" Image="K_Keys\BildDown.png" /> <LedImage Id="Keyboard_PageDown" Image="K_Keys\BildDown.png" />
<LedImage Id="Keypad7" Image="K_Keys\Num7_Pos1.png" /> <LedImage Id="Keyboard_Num7" Image="K_Keys\Num7_Pos1.png" />
<LedImage Id="Keypad8" Image="K_Keys\Num8_ArrowUp.png" /> <LedImage Id="Keyboard_Num8" Image="K_Keys\Num8_ArrowUp.png" />
<LedImage Id="Keypad9" Image="K_Keys\Num9_BildUp.png" /> <LedImage Id="Keyboard_Num9" Image="K_Keys\Num9_BildUp.png" />
<LedImage Id="KeypadPlus" Image="K_Keys\NumPlus.png" /> <LedImage Id="Keyboard_NumPlus" Image="K_Keys\NumPlus.png" />
<LedImage Id="CapsLock" Image="K_Keys\CapsLock.png" /> <LedImage Id="Keyboard_CapsLock" Image="K_Keys\CapsLock.png" />
<LedImage Id="A" Image="K_Keys\A.png" /> <LedImage Id="Keyboard_A" Image="K_Keys\A.png" />
<LedImage Id="S" Image="K_Keys\S.png" /> <LedImage Id="Keyboard_S" Image="K_Keys\S.png" />
<LedImage Id="D" Image="K_Keys\D.png" /> <LedImage Id="Keyboard_D" Image="K_Keys\D.png" />
<LedImage Id="F" Image="K_Keys\F.png" /> <LedImage Id="Keyboard_F" Image="K_Keys\F.png" />
<LedImage Id="G" Image="K_Keys\G.png" /> <LedImage Id="Keyboard_G" Image="K_Keys\G.png" />
<LedImage Id="H" Image="K_Keys\H.png" /> <LedImage Id="Keyboard_H" Image="K_Keys\H.png" />
<LedImage Id="J" Image="K_Keys\J.png" /> <LedImage Id="Keyboard_J" Image="K_Keys\J.png" />
<LedImage Id="K" Image="K_Keys\K.png" /> <LedImage Id="Keyboard_K" Image="K_Keys\K.png" />
<LedImage Id="L" Image="K_Keys\L.png" /> <LedImage Id="Keyboard_L" Image="K_Keys\L.png" />
<LedImage Id="SemicolonAndColon" Image="K_Keys\OE.png" /> <LedImage Id="Keyboard_SemicolonAndColon" Image="K_Keys\OE.png" />
<LedImage Id="ApostropheAndDoubleQuote" Image="K_Keys\AE.png" /> <LedImage Id="Keyboard_ApostropheAndDoubleQuote" Image="K_Keys\AE.png" />
<LedImage Id="NonUsTilde" Image="K_Keys\Hash_Apostrophe.png" /> <LedImage Id="Keyboard_NonUsTilde" Image="K_Keys\Hash_Apostrophe.png" />
<LedImage Id="Keypad4" Image="K_Keys\Num4_ArrowLeft.png" /> <LedImage Id="Keyboard_Num4" Image="K_Keys\Num4_ArrowLeft.png" />
<LedImage Id="Keypad5" Image="K_Keys\Num5.png" /> <LedImage Id="Keyboard_Num5" Image="K_Keys\Num5.png" />
<LedImage Id="Keypad6" Image="K_Keys\Num6_ArrowRight.png" /> <LedImage Id="Keyboard_Num6" Image="K_Keys\Num6_ArrowRight.png" />
<LedImage Id="LeftShift" Image="K_Keys\Shift.png" /> <LedImage Id="Keyboard_LeftShift" Image="K_Keys\Shift.png" />
<LedImage Id="NonUsBackslash" Image="K_Keys\LessThan_GreaterThan_Pipe.png" /> <LedImage Id="Keyboard_NonUsBackslash" Image="K_Keys\LessThan_GreaterThan_Pipe.png" />
<LedImage Id="Z" Image="K_Keys\Y.png" /> <LedImage Id="Keyboard_Z" Image="K_Keys\Y.png" />
<LedImage Id="X" Image="K_Keys\X.png" /> <LedImage Id="Keyboard_X" Image="K_Keys\X.png" />
<LedImage Id="C" Image="K_Keys\C.png" /> <LedImage Id="Keyboard_C" Image="K_Keys\C.png" />
<LedImage Id="V" Image="K_Keys\V.png" /> <LedImage Id="Keyboard_V" Image="K_Keys\V.png" />
<LedImage Id="B" Image="K_Keys\B.png" /> <LedImage Id="Keyboard_B" Image="K_Keys\B.png" />
<LedImage Id="N" Image="K_Keys\N.png" /> <LedImage Id="Keyboard_N" Image="K_Keys\N.png" />
<LedImage Id="M" Image="K_Keys\M_Mu.png" /> <LedImage Id="Keyboard_M" Image="K_Keys\M_Mu.png" />
<LedImage Id="CommaAndLessThan" Image="K_Keys\Comma_Semicolon.png" /> <LedImage Id="Keyboard_CommaAndLessThan" Image="K_Keys\Comma_Semicolon.png" />
<LedImage Id="PeriodAndBiggerThan" Image="K_Keys\Dot_Colon.png" /> <LedImage Id="Keyboard_PeriodAndBiggerThan" Image="K_Keys\Dot_Colon.png" />
<LedImage Id="SlashAndQuestionMark" Image="K_Keys\Hyphen_Underscore.png" /> <LedImage Id="Keyboard_SlashAndQuestionMark" Image="K_Keys\Hyphen_Underscore.png" />
<LedImage Id="RightShift" Image="K_Keys\ShiftBig.png" /> <LedImage Id="Keyboard_RightShift" Image="K_Keys\ShiftBig.png" />
<LedImage Id="UpArrow" Image="K_Keys\CaretUp.png" /> <LedImage Id="Keyboard_ArrowUp" Image="K_Keys\CaretUp.png" />
<LedImage Id="Keypad1" Image="K_Keys\Num1_Ende.png" /> <LedImage Id="Keyboard_Num1" Image="K_Keys\Num1_Ende.png" />
<LedImage Id="Keypad2" Image="K_Keys\Num2_ArrowDown.png" /> <LedImage Id="Keyboard_Num2" Image="K_Keys\Num2_ArrowDown.png" />
<LedImage Id="Keypad3" Image="K_Keys\Num3_BildDown.png" /> <LedImage Id="Keyboard_Num3" Image="K_Keys\Num3_BildDown.png" />
<LedImage Id="KeypadEnter" Image="K_Keys\NumEnter.png" /> <LedImage Id="Keyboard_NumEnter" Image="K_Keys\NumEnter.png" />
<LedImage Id="LeftCtrl" Image="K_Keys\Strg.png" /> <LedImage Id="Keyboard_LeftCtrl" Image="K_Keys\Strg.png" />
<LedImage Id="LeftGui" Image="K_Keys\Windows.png" /> <LedImage Id="Keyboard_LeftGui" Image="K_Keys\Windows.png" />
<LedImage Id="LeftAlt" Image="K_Keys\Alt.png" /> <LedImage Id="Keyboard_LeftAlt" Image="K_Keys\Alt.png" />
<LedImage Id="Space" Image="K_Keys\Space.png" /> <LedImage Id="Keyboard_Space" Image="K_Keys\Space.png" />
<LedImage Id="RightAlt" Image="K_Keys\AltGr.png" /> <LedImage Id="Keyboard_RightAlt" Image="K_Keys\AltGr.png" />
<LedImage Id="RightGui" Image="K_Keys\Windows.png" /> <LedImage Id="Keyboard_RightGui" Image="K_Keys\Windows.png" />
<LedImage Id="Application" Image="K_Keys\Menu.png" /> <LedImage Id="Keyboard_Application" Image="K_Keys\Menu.png" />
<LedImage Id="RightCtrl" Image="K_Keys\Strg.png" /> <LedImage Id="Keyboard_RightCtrl" Image="K_Keys\Strg.png" />
<LedImage Id="LeftArrow" Image="K_Keys\CaretLeft.png" /> <LedImage Id="Keyboard_ArrowLeft" Image="K_Keys\CaretLeft.png" />
<LedImage Id="DownArrow" Image="K_Keys\CaretDown.png" /> <LedImage Id="Keyboard_ArrowDown" Image="K_Keys\CaretDown.png" />
<LedImage Id="RightArrow" Image="K_Keys\CaretRight.png" /> <LedImage Id="Keyboard_ArrowRight" Image="K_Keys\CaretRight.png" />
<LedImage Id="Keypad0" Image="K_Keys\Num0_Einfg.png" /> <LedImage Id="Keyboard_Num0" Image="K_Keys\Num0_Einfg.png" />
<LedImage Id="KeypadPeriodAndDelete" Image="K_Keys\Comma_Entf.png" /> <LedImage Id="Keyboard_NumPeriodAndDelete" Image="K_Keys\Comma_Entf.png" />
</LedImages> </LedImages>
</LedImageLayout> </LedImageLayout>
<LedImageLayout Layout="EU"> <LedImageLayout Layout="EU">
<LedImages> <LedImages>
<LedImage Id="Brightness" Image="K_Keys\Brightness.png" /> <LedImage Id="Keyboard_Brightness" Image="K_Keys\Brightness.png" />
<LedImage Id="WinLock" Image="K_Keys\WinLock.png" /> <LedImage Id="Keyboard_WinLock" Image="K_Keys\WinLock.png" />
<LedImage Id="Mute" Image="K_Keys\Mute.png" /> <LedImage Id="Keyboard_MediaMute" Image="K_Keys\Mute.png" />
<LedImage Id="Escape" Image="K_Keys\Escape.png" /> <LedImage Id="Keyboard_Escape" Image="K_Keys\Escape.png" />
<LedImage Id="F1" Image="K_Keys\F1.png" /> <LedImage Id="Keyboard_F1" Image="K_Keys\F1.png" />
<LedImage Id="F2" Image="K_Keys\F2.png" /> <LedImage Id="Keyboard_F2" Image="K_Keys\F2.png" />
<LedImage Id="F3" Image="K_Keys\F3.png" /> <LedImage Id="Keyboard_F3" Image="K_Keys\F3.png" />
<LedImage Id="F4" Image="K_Keys\F4.png" /> <LedImage Id="Keyboard_F4" Image="K_Keys\F4.png" />
<LedImage Id="F5" Image="K_Keys\F5.png" /> <LedImage Id="Keyboard_F5" Image="K_Keys\F5.png" />
<LedImage Id="F6" Image="K_Keys\F6.png" /> <LedImage Id="Keyboard_F6" Image="K_Keys\F6.png" />
<LedImage Id="F7" Image="K_Keys\F7.png" /> <LedImage Id="Keyboard_F7" Image="K_Keys\F7.png" />
<LedImage Id="F8" Image="K_Keys\F8.png" /> <LedImage Id="Keyboard_F8" Image="K_Keys\F8.png" />
<LedImage Id="F9" Image="K_Keys\F9.png" /> <LedImage Id="Keyboard_F9" Image="K_Keys\F9.png" />
<LedImage Id="F10" Image="K_Keys\F10.png" /> <LedImage Id="Keyboard_F10" Image="K_Keys\F10.png" />
<LedImage Id="F11" Image="K_Keys\F11.png" /> <LedImage Id="Keyboard_F11" Image="K_Keys\F11.png" />
<LedImage Id="F12" Image="K_Keys\F12.png" /> <LedImage Id="Keyboard_F12" Image="K_Keys\F12.png" />
<LedImage Id="PrintScreen" Image="K_Keys\PrtScnSysRq.png" /> <LedImage Id="Keyboard_PrintScreen" Image="K_Keys\PrtScnSysRq.png" />
<LedImage Id="ScrollLock" Image="K_Keys\ScrollLock.png" /> <LedImage Id="Keyboard_ScrollLock" Image="K_Keys\ScrollLock.png" />
<LedImage Id="PauseBreak" Image="K_Keys\PauseBreak.png" /> <LedImage Id="Keyboard_PauseBreak" Image="K_Keys\PauseBreak.png" />
<LedImage Id="Stop" Image="K_Keys\Stop.png" /> <LedImage Id="Keyboard_MediaStop" Image="K_Keys\Stop.png" />
<LedImage Id="ScanPreviousTrack" Image="K_Keys\PreviousTrack.png" /> <LedImage Id="Keyboard_MediaPreviousTrack" Image="K_Keys\PreviousTrack.png" />
<LedImage Id="PlayPause" Image="K_Keys\PlayPause.png" /> <LedImage Id="Keyboard_MediaPlay" Image="K_Keys\PlayPause.png" />
<LedImage Id="ScanNextTrack" Image="K_Keys\NextTrack.png" /> <LedImage Id="Keyboard_MediaNextTrack" Image="K_Keys\NextTrack.png" />
<LedImage Id="GraveAccentAndTilde" Image="K_Keys\AccentGrave_Tilde.png" /> <LedImage Id="Keyboard_GraveAccentAndTilde" Image="K_Keys\AccentGrave_Tilde.png" />
<LedImage Id="D1" Image="K_Keys\1_ExclamationMark.png" /> <LedImage Id="Keyboard_1" Image="K_Keys\1_ExclamationMark.png" />
<LedImage Id="D2" Image="K_Keys\2_At.png" /> <LedImage Id="Keyboard_2" Image="K_Keys\2_At.png" />
<LedImage Id="D3" Image="K_Keys\3_Hash.png" /> <LedImage Id="Keyboard_3" Image="K_Keys\3_Hash.png" />
<LedImage Id="D4" Image="K_Keys\4_Dollar.png" /> <LedImage Id="Keyboard_4" Image="K_Keys\4_Dollar.png" />
<LedImage Id="D5" Image="K_Keys\5_Percent_Euro.png" /> <LedImage Id="Keyboard_5" Image="K_Keys\5_Percent_Euro.png" />
<LedImage Id="D6" Image="K_Keys\6_Circumflex.png" /> <LedImage Id="Keyboard_6" Image="K_Keys\6_Circumflex.png" />
<LedImage Id="D7" Image="K_Keys\7_Ampersand.png" /> <LedImage Id="Keyboard_7" Image="K_Keys\7_Ampersand.png" />
<LedImage Id="D8" Image="K_Keys\8_Asterisk.png" /> <LedImage Id="Keyboard_8" Image="K_Keys\8_Asterisk.png" />
<LedImage Id="D9" Image="K_Keys\9_BracketRight.png" /> <LedImage Id="Keyboard_9" Image="K_Keys\9_BracketRight.png" />
<LedImage Id="D0" Image="K_Keys\0_BracketRight.png" /> <LedImage Id="Keyboard_0" Image="K_Keys\0_BracketRight.png" />
<LedImage Id="MinusAndUnderscore" Image="K_Keys\Hyphen_Underscore.png" /> <LedImage Id="Keyboard_MinusAndUnderscore" Image="K_Keys\Hyphen_Underscore.png" />
<LedImage Id="EqualsAndPlus" Image="K_Keys\Equals_Plus.png" /> <LedImage Id="Keyboard_EqualsAndPlus" Image="K_Keys\Equals_Plus.png" />
<LedImage Id="Backspace" Image="K_Keys\Backspace.png" /> <LedImage Id="Keyboard_Backspace" Image="K_Keys\Backspace.png" />
<LedImage Id="Insert" Image="K_Keys\Insert.png" /> <LedImage Id="Keyboard_Insert" Image="K_Keys\Insert.png" />
<LedImage Id="Home" Image="K_Keys\Home.png" /> <LedImage Id="Keyboard_Home" Image="K_Keys\Home.png" />
<LedImage Id="PageUp" Image="K_Keys\PageUp.png" /> <LedImage Id="Keyboard_PageUp" Image="K_Keys\PageUp.png" />
<LedImage Id="NumLock" Image="K_Keys\NumLock.png" /> <LedImage Id="Keyboard_NumLock" Image="K_Keys\NumLock.png" />
<LedImage Id="KeypadSlash" Image="K_Keys\Slash.png" /> <LedImage Id="Keyboard_NumSlash" Image="K_Keys\Slash.png" />
<LedImage Id="KeypadAsterisk" Image="K_Keys\Asterisk.png" /> <LedImage Id="Keyboard_NumAsterisk" Image="K_Keys\Asterisk.png" />
<LedImage Id="KeypadMinus" Image="K_Keys\Minus.png" /> <LedImage Id="Keyboard_NumMinus" Image="K_Keys\Minus.png" />
<LedImage Id="Tab" Image="K_Keys\TabWText.png" /> <LedImage Id="Keyboard_Tab" Image="K_Keys\TabWText.png" />
<LedImage Id="Q" Image="K_Keys\Q.png" /> <LedImage Id="Keyboard_Q" Image="K_Keys\Q.png" />
<LedImage Id="W" Image="K_Keys\W.png" /> <LedImage Id="Keyboard_W" Image="K_Keys\W.png" />
<LedImage Id="E" Image="K_Keys\E.png" /> <LedImage Id="Keyboard_E" Image="K_Keys\E.png" />
<LedImage Id="R" Image="K_Keys\R.png" /> <LedImage Id="Keyboard_R" Image="K_Keys\R.png" />
<LedImage Id="T" Image="K_Keys\T.png" /> <LedImage Id="Keyboard_T" Image="K_Keys\T.png" />
<LedImage Id="Y" Image="K_Keys\Y.png" /> <LedImage Id="Keyboard_Y" Image="K_Keys\Y.png" />
<LedImage Id="U" Image="K_Keys\U.png" /> <LedImage Id="Keyboard_U" Image="K_Keys\U.png" />
<LedImage Id="I" Image="K_Keys\I.png" /> <LedImage Id="Keyboard_I" Image="K_Keys\I.png" />
<LedImage Id="O" Image="K_Keys\O.png" /> <LedImage Id="Keyboard_O" Image="K_Keys\O.png" />
<LedImage Id="P" Image="K_Keys\P.png" /> <LedImage Id="Keyboard_P" Image="K_Keys\P.png" />
<LedImage Id="BracketLeft" Image="K_Keys\SquareBracketLeft_CurlyBracketLeft.png" /> <LedImage Id="Keyboard_BracketLeft" Image="K_Keys\SquareBracketLeft_CurlyBracketLeft.png" />
<LedImage Id="BracketRight" Image="K_Keys\SquareBracketRight_CurlyBracketRight.png" /> <LedImage Id="Keyboard_BracketRight" Image="K_Keys\SquareBracketRight_CurlyBracketRight.png" />
<LedImage Id="Enter" Image="K_Keys\EnterWText.png" /> <LedImage Id="Keyboard_Enter" Image="K_Keys\EnterWText.png" />
<LedImage Id="Delete" Image="K_Keys\Delete.png" /> <LedImage Id="Keyboard_Delete" Image="K_Keys\Delete.png" />
<LedImage Id="End" Image="K_Keys\End.png" /> <LedImage Id="Keyboard_End" Image="K_Keys\End.png" />
<LedImage Id="PageDown" Image="K_Keys\PageDown.png" /> <LedImage Id="Keyboard_PageDown" Image="K_Keys\PageDown.png" />
<LedImage Id="Keypad7" Image="K_Keys\Num7_Home.png" /> <LedImage Id="Keyboard_Num7" Image="K_Keys\Num7_Home.png" />
<LedImage Id="Keypad8" Image="K_Keys\Num8_ArrowUp.png" /> <LedImage Id="Keyboard_Num8" Image="K_Keys\Num8_ArrowUp.png" />
<LedImage Id="Keypad9" Image="K_Keys\Num9_PgUp.png" /> <LedImage Id="Keyboard_Num9" Image="K_Keys\Num9_PgUp.png" />
<LedImage Id="KeypadPlus" Image="K_Keys\NumPlus.png" /> <LedImage Id="Keyboard_NumPlus" Image="K_Keys\NumPlus.png" />
<LedImage Id="CapsLock" Image="K_Keys\CapsLockText.png" /> <LedImage Id="Keyboard_CapsLock" Image="K_Keys\CapsLockText.png" />
<LedImage Id="A" Image="K_Keys\A.png" /> <LedImage Id="Keyboard_A" Image="K_Keys\A.png" />
<LedImage Id="S" Image="K_Keys\S.png" /> <LedImage Id="Keyboard_S" Image="K_Keys\S.png" />
<LedImage Id="D" Image="K_Keys\D.png" /> <LedImage Id="Keyboard_D" Image="K_Keys\D.png" />
<LedImage Id="F" Image="K_Keys\F.png" /> <LedImage Id="Keyboard_F" Image="K_Keys\F.png" />
<LedImage Id="G" Image="K_Keys\G.png" /> <LedImage Id="Keyboard_G" Image="K_Keys\G.png" />
<LedImage Id="H" Image="K_Keys\H.png" /> <LedImage Id="Keyboard_H" Image="K_Keys\H.png" />
<LedImage Id="J" Image="K_Keys\J.png" /> <LedImage Id="Keyboard_J" Image="K_Keys\J.png" />
<LedImage Id="K" Image="K_Keys\K.png" /> <LedImage Id="Keyboard_K" Image="K_Keys\K.png" />
<LedImage Id="L" Image="K_Keys\L.png" /> <LedImage Id="Keyboard_L" Image="K_Keys\L.png" />
<LedImage Id="SemicolonAndColon" Image="K_Keys\Semicolon_Colon.png" /> <LedImage Id="Keyboard_SemicolonAndColon" Image="K_Keys\Semicolon_Colon.png" />
<LedImage Id="ApostropheAndDoubleQuote" Image="K_Keys\Apostrophe_QuotationMark.png" /> <LedImage Id="Keyboard_ApostropheAndDoubleQuote" Image="K_Keys\Apostrophe_QuotationMark.png" />
<LedImage Id="NonUsTilde" Image="K_Keys\Blackslash_Pipe.png" /> <LedImage Id="Keyboard_NonUsTilde" Image="K_Keys\Blackslash_Pipe.png" />
<LedImage Id="Keypad4" Image="K_Keys\Num4_ArrowLeft.png" /> <LedImage Id="Keyboard_Num4" Image="K_Keys\Num4_ArrowLeft.png" />
<LedImage Id="Keypad5" Image="K_Keys\Num5.png" /> <LedImage Id="Keyboard_Num5" Image="K_Keys\Num5.png" />
<LedImage Id="Keypad6" Image="K_Keys\Num6_ArrowRight.png" /> <LedImage Id="Keyboard_Num6" Image="K_Keys\Num6_ArrowRight.png" />
<LedImage Id="LeftShift" Image="K_Keys\ShiftWText.png" /> <LedImage Id="Keyboard_LeftShift" Image="K_Keys\ShiftWText.png" />
<LedImage Id="NonUsBackslash" Image="K_Keys\Blackslash_Pipe.png" /> <LedImage Id="Keyboard_NonUsBackslash" Image="K_Keys\Blackslash_Pipe.png" />
<LedImage Id="Z" Image="K_Keys\Z.png" /> <LedImage Id="Keyboard_Z" Image="K_Keys\Z.png" />
<LedImage Id="X" Image="K_Keys\X.png" /> <LedImage Id="Keyboard_X" Image="K_Keys\X.png" />
<LedImage Id="C" Image="K_Keys\C.png" /> <LedImage Id="Keyboard_C" Image="K_Keys\C.png" />
<LedImage Id="V" Image="K_Keys\V.png" /> <LedImage Id="Keyboard_V" Image="K_Keys\V.png" />
<LedImage Id="B" Image="K_Keys\B.png" /> <LedImage Id="Keyboard_B" Image="K_Keys\B.png" />
<LedImage Id="N" Image="K_Keys\N.png" /> <LedImage Id="Keyboard_N" Image="K_Keys\N.png" />
<LedImage Id="M" Image="K_Keys\M.png" /> <LedImage Id="Keyboard_M" Image="K_Keys\M.png" />
<LedImage Id="CommaAndLessThan" Image="K_Keys\LessThan_Comma.png" /> <LedImage Id="Keyboard_CommaAndLessThan" Image="K_Keys\LessThan_Comma.png" />
<LedImage Id="PeriodAndBiggerThan" Image="K_Keys\GreaterThan_Dot.png" /> <LedImage Id="Keyboard_PeriodAndBiggerThan" Image="K_Keys\GreaterThan_Dot.png" />
<LedImage Id="SlashAndQuestionMark" Image="K_Keys\QuestionMark_Slash.png" /> <LedImage Id="Keyboard_SlashAndQuestionMark" Image="K_Keys\QuestionMark_Slash.png" />
<LedImage Id="RightShift" Image="K_Keys\ShiftWTextBig.png" /> <LedImage Id="Keyboard_RightShift" Image="K_Keys\ShiftWTextBig.png" />
<LedImage Id="UpArrow" Image="K_Keys\CaretUp.png" /> <LedImage Id="Keyboard_ArrowUp" Image="K_Keys\CaretUp.png" />
<LedImage Id="Keypad1" Image="K_Keys\Num1_End.png" /> <LedImage Id="Keyboard_Num1" Image="K_Keys\Num1_End.png" />
<LedImage Id="Keypad2" Image="K_Keys\Num2_ArrowDown.png" /> <LedImage Id="Keyboard_Num2" Image="K_Keys\Num2_ArrowDown.png" />
<LedImage Id="Keypad3" Image="K_Keys\Num3_PgDn.png" /> <LedImage Id="Keyboard_Num3" Image="K_Keys\Num3_PgDn.png" />
<LedImage Id="KeypadEnter" Image="K_Keys\NumEnter.png" /> <LedImage Id="Keyboard_NumEnter" Image="K_Keys\NumEnter.png" />
<LedImage Id="LeftCtrl" Image="K_Keys\Ctrl.png" /> <LedImage Id="Keyboard_LeftCtrl" Image="K_Keys\Ctrl.png" />
<LedImage Id="LeftGui" Image="K_Keys\Windows.png" /> <LedImage Id="Keyboard_LeftGui" Image="K_Keys\Windows.png" />
<LedImage Id="LeftAlt" Image="K_Keys\Alt.png" /> <LedImage Id="Keyboard_LeftAlt" Image="K_Keys\Alt.png" />
<LedImage Id="Space" Image="K_Keys\Space.png" /> <LedImage Id="Keyboard_Space" Image="K_Keys\Space.png" />
<LedImage Id="RightAlt" Image="K_Keys\AltGr.png" /> <LedImage Id="Keyboard_RightAlt" Image="K_Keys\AltGr.png" />
<LedImage Id="RightGui" Image="K_Keys\Windows.png" /> <LedImage Id="Keyboard_RightGui" Image="K_Keys\Windows.png" />
<LedImage Id="Application" Image="K_Keys\Menu.png" /> <LedImage Id="Keyboard_Application" Image="K_Keys\Menu.png" />
<LedImage Id="RightCtrl" Image="K_Keys\Ctrl.png" /> <LedImage Id="Keyboard_RightCtrl" Image="K_Keys\Ctrl.png" />
<LedImage Id="LeftArrow" Image="K_Keys\CaretLeft.png" /> <LedImage Id="Keyboard_ArrowLeft" Image="K_Keys\CaretLeft.png" />
<LedImage Id="DownArrow" Image="K_Keys\CaretDown.png" /> <LedImage Id="Keyboard_ArrowDown" Image="K_Keys\CaretDown.png" />
<LedImage Id="RightArrow" Image="K_Keys\CaretRight.png" /> <LedImage Id="Keyboard_ArrowRight" Image="K_Keys\CaretRight.png" />
<LedImage Id="Keypad0" Image="K_Keys\Num0_Ins.png" /> <LedImage Id="Keyboard_Num0" Image="K_Keys\Num0_Ins.png" />
<LedImage Id="KeypadPeriodAndDelete" Image="K_Keys\Comma_Del.png" /> <LedImage Id="Keyboard_NumPeriodAndDelete" Image="K_Keys\Comma_Del.png" />
</LedImages> </LedImages>
</LedImageLayout> </LedImageLayout>
</LedImageLayouts> </LedImageLayouts>

View File

@ -10,255 +10,255 @@
<Height>169</Height> <Height>169</Height>
<Leds> <Leds>
<!-- Extra-Keys: ? -> Mute --> <!-- Extra-Keys: ? -> Mute -->
<Led Id="Brightness"> <Led Id="Keyboard_Brightness">
<X>91.5</X> <X>91.5</X>
<Y>8.333</Y> <Y>8.333</Y>
<Width>14.5mm</Width> <Width>14.5mm</Width>
<Height>12mm</Height> <Height>12mm</Height>
</Led> </Led>
<Led Id="WinLock"> <Led Id="Keyboard_WinLock">
<Width>14.5mm</Width> <Width>14.5mm</Width>
<Height>12mm</Height> <Height>12mm</Height>
</Led> </Led>
<Led Id="Mute"> <Led Id="Keyboard_MediaMute">
<X>382</X> <X>382</X>
<Y>8.333</Y> <Y>8.333</Y>
<Height>12mm</Height> <Height>12mm</Height>
</Led> </Led>
<!-- Esc -> NextTrack --> <!-- Esc -> NextTrack -->
<Led Id="Escape"> <Led Id="Keyboard_Escape">
<X>30</X> <X>30</X>
<Y>32</Y> <Y>32</Y>
</Led> </Led>
<Led Id="F1"> <Led Id="Keyboard_F1">
<X>+12.667</X> <X>+12.667</X>
</Led> </Led>
<Led Id="F2" /> <Led Id="Keyboard_F2" />
<Led Id="F3" /> <Led Id="Keyboard_F3" />
<Led Id="F4" /> <Led Id="Keyboard_F4" />
<Led Id="F5"> <Led Id="Keyboard_F5">
<X>+12.667</X> <X>+12.667</X>
</Led> </Led>
<Led Id="F6" /> <Led Id="Keyboard_F6" />
<Led Id="F7" /> <Led Id="Keyboard_F7" />
<Led Id="F8" /> <Led Id="Keyboard_F8" />
<Led Id="F9"> <Led Id="Keyboard_F9">
<X>+12.667</X> <X>+12.667</X>
</Led> </Led>
<Led Id="F10" /> <Led Id="Keyboard_F10" />
<Led Id="F11" /> <Led Id="Keyboard_F11" />
<Led Id="F12" /> <Led Id="Keyboard_F12" />
<Led Id="PrintScreen"> <Led Id="Keyboard_PrintScreen">
<X>+5</X> <X>+5</X>
</Led> </Led>
<Led Id="ScrollLock" /> <Led Id="Keyboard_ScrollLock" />
<Led Id="PauseBreak" /> <Led Id="Keyboard_PauseBreak" />
<Led Id="Stop"> <Led Id="Keyboard_MediaStop">
<X>+5</X> <X>+5</X>
<Y>31</Y> <Y>31</Y>
<Height>17mm</Height> <Height>17mm</Height>
</Led> </Led>
<Led Id="ScanPreviousTrack"> <Led Id="Keyboard_MediaPreviousTrack">
<Height>17mm</Height> <Height>17mm</Height>
</Led> </Led>
<Led Id="PlayPause"> <Led Id="Keyboard_MediaPlay">
<Height>17mm</Height> <Height>17mm</Height>
</Led> </Led>
<Led Id="ScanNextTrack"> <Led Id="Keyboard_MediaNextTrack">
<Height>17mm</Height> <Height>17mm</Height>
</Led> </Led>
<!-- ^ -> Num- --> <!-- ^ -> Num- -->
<Led Id="GraveAccentAndTilde"> <Led Id="Keyboard_GraveAccentAndTilde">
<X>30</X> <X>30</X>
<Y>53</Y> <Y>53</Y>
</Led> </Led>
<Led Id="D1" /> <Led Id="Keyboard_1" />
<Led Id="D2" /> <Led Id="Keyboard_2" />
<Led Id="D3" /> <Led Id="Keyboard_3" />
<Led Id="D4" /> <Led Id="Keyboard_4" />
<Led Id="D5" /> <Led Id="Keyboard_5" />
<Led Id="D6" /> <Led Id="Keyboard_6" />
<Led Id="D7" /> <Led Id="Keyboard_7" />
<Led Id="D8" /> <Led Id="Keyboard_8" />
<Led Id="D9" /> <Led Id="Keyboard_9" />
<Led Id="D0" /> <Led Id="Keyboard_0" />
<Led Id="MinusAndUnderscore" /> <Led Id="Keyboard_MinusAndUnderscore" />
<Led Id="EqualsAndPlus" /> <Led Id="Keyboard_EqualsAndPlus" />
<Led Id="Backspace"> <Led Id="Keyboard_Backspace">
<Width>2</Width> <Width>2</Width>
</Led> </Led>
<Led Id="Insert"> <Led Id="Keyboard_Insert">
<X>+5</X> <X>+5</X>
</Led> </Led>
<Led Id="Home" /> <Led Id="Keyboard_Home" />
<Led Id="PageUp" /> <Led Id="Keyboard_PageUp" />
<Led Id="NumLock"> <Led Id="Keyboard_NumLock">
<X>+5</X> <X>+5</X>
</Led> </Led>
<Led Id="KeypadSlash" /> <Led Id="Keyboard_NumSlash" />
<Led Id="KeypadAsterisk" /> <Led Id="Keyboard_NumAsterisk" />
<Led Id="KeypadMinus" /> <Led Id="Keyboard_NumMinus" />
<!-- Tab -> Num+ --> <!-- Tab -> Num+ -->
<Led Id="Tab"> <Led Id="Keyboard_Tab">
<X>30</X> <X>30</X>
<Y>+</Y> <Y>+</Y>
<Width>1.5</Width> <Width>1.5</Width>
</Led> </Led>
<Led Id="Q" /> <Led Id="Keyboard_Q" />
<Led Id="W" /> <Led Id="Keyboard_W" />
<Led Id="E" /> <Led Id="Keyboard_E" />
<Led Id="R" /> <Led Id="Keyboard_R" />
<Led Id="T" /> <Led Id="Keyboard_T" />
<Led Id="Y" /> <Led Id="Keyboard_Y" />
<Led Id="U" /> <Led Id="Keyboard_U" />
<Led Id="I" /> <Led Id="Keyboard_I" />
<Led Id="O" /> <Led Id="Keyboard_O" />
<Led Id="P" /> <Led Id="Keyboard_P" />
<Led Id="BracketLeft" /> <Led Id="Keyboard_BracketLeft" />
<Led Id="BracketRight" /> <Led Id="Keyboard_BracketRight" />
<Led Id="Enter"> <Led Id="Keyboard_Enter">
<Shape>M0,0 L0,0.5 L0.16666666666,0.5 L0.16666666666,1 L1,1 L1,0 Z</Shape> <Shape>M0,0 L0,0.5 L0.16666666666,0.5 L0.16666666666,1 L1,1 L1,0 Z</Shape>
<Width>1.5</Width> <Width>1.5</Width>
<Height>2</Height> <Height>2</Height>
</Led> </Led>
<Led Id="Delete"> <Led Id="Keyboard_Delete">
<X>+5</X> <X>+5</X>
</Led> </Led>
<Led Id="End" /> <Led Id="Keyboard_End" />
<Led Id="PageDown" /> <Led Id="Keyboard_PageDown" />
<Led Id="Keypad7"> <Led Id="Keyboard_Num7">
<X>+5</X> <X>+5</X>
</Led> </Led>
<Led Id="Keypad8" /> <Led Id="Keyboard_Num8" />
<Led Id="Keypad9" /> <Led Id="Keyboard_Num9" />
<Led Id="KeypadPlus"> <Led Id="Keyboard_NumPlus">
<Height>2</Height> <Height>2</Height>
</Led> </Led>
<!-- CapsLock -> Num6 --> <!-- CapsLock -> Num6 -->
<Led Id="CapsLock"> <Led Id="Keyboard_CapsLock">
<X>30</X> <X>30</X>
<Y>~</Y> <Y>~</Y>
<Width>1.75</Width> <Width>1.75</Width>
</Led> </Led>
<Led Id="A" /> <Led Id="Keyboard_A" />
<Led Id="S" /> <Led Id="Keyboard_S" />
<Led Id="D" /> <Led Id="Keyboard_D" />
<Led Id="F" /> <Led Id="Keyboard_F" />
<Led Id="G" /> <Led Id="Keyboard_G" />
<Led Id="H" /> <Led Id="Keyboard_H" />
<Led Id="J" /> <Led Id="Keyboard_J" />
<Led Id="K" /> <Led Id="Keyboard_K" />
<Led Id="L" /> <Led Id="Keyboard_L" />
<Led Id="SemicolonAndColon" /> <Led Id="Keyboard_SemicolonAndColon" />
<Led Id="ApostropheAndDoubleQuote" /> <Led Id="Keyboard_ApostropheAndDoubleQuote" />
<Led Id="NonUsTilde" /> <Led Id="Keyboard_NonUsTilde" />
<Led Id="Keypad4"> <Led Id="Keyboard_Num4">
<X>+90.75</X> <X>+90.75</X>
</Led> </Led>
<Led Id="Keypad5" /> <Led Id="Keyboard_Num5" />
<Led Id="Keypad6" /> <Led Id="Keyboard_Num6" />
<!-- LShift -> NumEnter --> <!-- LShift -> NumEnter -->
<Led Id="LeftShift"> <Led Id="Keyboard_LeftShift">
<X>30</X> <X>30</X>
<Y>+</Y> <Y>+</Y>
<Width>1.25</Width> <Width>1.25</Width>
</Led> </Led>
<Led Id="NonUsBackslash" /> <Led Id="Keyboard_NonUsBackslash" />
<Led Id="Z" /> <Led Id="Keyboard_Z" />
<Led Id="X" /> <Led Id="Keyboard_X" />
<Led Id="C" /> <Led Id="Keyboard_C" />
<Led Id="V" /> <Led Id="Keyboard_V" />
<Led Id="B" /> <Led Id="Keyboard_B" />
<Led Id="N" /> <Led Id="Keyboard_N" />
<Led Id="M" /> <Led Id="Keyboard_M" />
<Led Id="CommaAndLessThan" /> <Led Id="Keyboard_CommaAndLessThan" />
<Led Id="PeriodAndBiggerThan" /> <Led Id="Keyboard_PeriodAndBiggerThan" />
<Led Id="SlashAndQuestionMark" /> <Led Id="Keyboard_SlashAndQuestionMark" />
<Led Id="RightShift"> <Led Id="Keyboard_RightShift">
<Width>2.75</Width> <Width>2.75</Width>
</Led> </Led>
<Led Id="UpArrow"> <Led Id="Keyboard_ArrowUp">
<X>+24</X> <X>+24</X>
</Led> </Led>
<Led Id="Keypad1"> <Led Id="Keyboard_Num1">
<X>+24</X> <X>+24</X>
</Led> </Led>
<Led Id="Keypad2" /> <Led Id="Keyboard_Num2" />
<Led Id="Keypad3" /> <Led Id="Keyboard_Num3" />
<Led Id="KeypadEnter"> <Led Id="Keyboard_NumEnter">
<Height>2</Height> <Height>2</Height>
</Led> </Led>
<!-- LCtrl -> NumPeriod --> <!-- LCtrl -> NumPeriod -->
<Led Id="LeftCtrl"> <Led Id="Keyboard_LeftCtrl">
<X>30</X> <X>30</X>
<Y>~</Y> <Y>~</Y>
<Width>1.5</Width> <Width>1.5</Width>
</Led> </Led>
<Led Id="LeftGui" /> <Led Id="Keyboard_LeftGui" />
<Led Id="LeftAlt"> <Led Id="Keyboard_LeftAlt">
<Width>1.25</Width> <Width>1.25</Width>
</Led> </Led>
<Led Id="Space"> <Led Id="Keyboard_Space">
<Width>6.5</Width> <Width>6.5</Width>
</Led> </Led>
<Led Id="RightAlt"> <Led Id="Keyboard_RightAlt">
<Width>1.25</Width> <Width>1.25</Width>
</Led> </Led>
<Led Id="RightGui" /> <Led Id="Keyboard_RightGui" />
<Led Id="Application" /> <Led Id="Keyboard_Application" />
<Led Id="RightCtrl"> <Led Id="Keyboard_RightCtrl">
<Width>1.5</Width> <Width>1.5</Width>
</Led> </Led>
<Led Id="LeftArrow"> <Led Id="Keyboard_ArrowLeft">
<X>+5</X> <X>+5</X>
</Led> </Led>
<Led Id="DownArrow" /> <Led Id="Keyboard_ArrowDown" />
<Led Id="RightArrow" /> <Led Id="Keyboard_ArrowRight" />
<Led Id="Keypad0"> <Led Id="Keyboard_Num0">
<X>+5</X> <X>+5</X>
<Width>2</Width> <Width>2</Width>
</Led> </Led>
<Led Id="KeypadPeriodAndDelete" /> <Led Id="Keyboard_NumPeriodAndDelete" />
<!-- G-Keys --> <!-- G-Keys -->
<Led Id="G3"> <Led Id="Keyboard_Programmable3">
<X>7</X> <X>7</X>
<Y>32</Y> <Y>32</Y>
</Led> </Led>
<Led Id="G6"> <Led Id="Keyboard_Programmable6">
<X>7</X> <X>7</X>
<Y>+</Y> <Y>+</Y>
</Led> </Led>
<Led Id="G9"> <Led Id="Keyboard_Programmable9">
<X>7</X> <X>7</X>
<Y>+1</Y> <Y>+1</Y>
</Led> </Led>
<Led Id="G12"> <Led Id="Keyboard_Programmable12">
<X>7</X> <X>7</X>
<Y>+</Y> <Y>+</Y>
</Led> </Led>
<Led Id="G15"> <Led Id="Keyboard_Programmable15">
<X>7</X> <X>7</X>
<Y>+1</Y> <Y>+1</Y>
</Led> </Led>
@ -351,131 +351,131 @@
<LedImageLayouts> <LedImageLayouts>
<LedImageLayout Layout="DE"> <LedImageLayout Layout="DE">
<LedImages> <LedImages>
<LedImage Id="Brightness" Image="Strafe_Keys\Brightness.png" /> <LedImage Id="Keyboard_Brightness" Image="Strafe_Keys\Brightness.png" />
<LedImage Id="WinLock" Image="Strafe_Keys\WinLock.png" /> <LedImage Id="Keyboard_WinLock" Image="Strafe_Keys\WinLock.png" />
<LedImage Id="Mute" Image="Strafe_Keys\Mute.png" /> <LedImage Id="Keyboard_MediaMute" Image="Strafe_Keys\Mute.png" />
<LedImage Id="Escape" Image="Strafe_Keys\Escape.png" /> <LedImage Id="Keyboard_Escape" Image="Strafe_Keys\Escape.png" />
<LedImage Id="F1" Image="Strafe_Keys\F1.png" /> <LedImage Id="Keyboard_F1" Image="Strafe_Keys\F1.png" />
<LedImage Id="F2" Image="Strafe_Keys\F2.png" /> <LedImage Id="Keyboard_F2" Image="Strafe_Keys\F2.png" />
<LedImage Id="F3" Image="Strafe_Keys\F3.png" /> <LedImage Id="Keyboard_F3" Image="Strafe_Keys\F3.png" />
<LedImage Id="F4" Image="Strafe_Keys\F4.png" /> <LedImage Id="Keyboard_F4" Image="Strafe_Keys\F4.png" />
<LedImage Id="F5" Image="Strafe_Keys\F5.png" /> <LedImage Id="Keyboard_F5" Image="Strafe_Keys\F5.png" />
<LedImage Id="F6" Image="Strafe_Keys\F6.png" /> <LedImage Id="Keyboard_F6" Image="Strafe_Keys\F6.png" />
<LedImage Id="F7" Image="Strafe_Keys\F7.png" /> <LedImage Id="Keyboard_F7" Image="Strafe_Keys\F7.png" />
<LedImage Id="F8" Image="Strafe_Keys\F8.png" /> <LedImage Id="Keyboard_F8" Image="Strafe_Keys\F8.png" />
<LedImage Id="F9" Image="Strafe_Keys\F9.png" /> <LedImage Id="Keyboard_F9" Image="Strafe_Keys\F9.png" />
<LedImage Id="F10" Image="Strafe_Keys\F10.png" /> <LedImage Id="Keyboard_F10" Image="Strafe_Keys\F10.png" />
<LedImage Id="F11" Image="Strafe_Keys\F11.png" /> <LedImage Id="Keyboard_F11" Image="Strafe_Keys\F11.png" />
<LedImage Id="F12" Image="Strafe_Keys\F12.png" /> <LedImage Id="Keyboard_F12" Image="Strafe_Keys\F12.png" />
<LedImage Id="PrintScreen" Image="Strafe_Keys\Drucken.png" /> <LedImage Id="Keyboard_PrintScreen" Image="Strafe_Keys\Drucken.png" />
<LedImage Id="ScrollLock" Image="Strafe_Keys\Rollen.png" /> <LedImage Id="Keyboard_ScrollLock" Image="Strafe_Keys\Rollen.png" />
<LedImage Id="PauseBreak" Image="Strafe_Keys\PauseUntbr.png" /> <LedImage Id="Keyboard_PauseBreak" Image="Strafe_Keys\PauseUntbr.png" />
<LedImage Id="Stop" Image="Strafe_Keys\Stop.png" /> <LedImage Id="Keyboard_MediaStop" Image="Strafe_Keys\Stop.png" />
<LedImage Id="ScanPreviousTrack" Image="Strafe_Keys\PreviousTrack.png" /> <LedImage Id="Keyboard_MediaPreviousTrack" Image="Strafe_Keys\PreviousTrack.png" />
<LedImage Id="PlayPause" Image="Strafe_Keys\PlayPause.png" /> <LedImage Id="Keyboard_MediaPlay" Image="Strafe_Keys\PlayPause.png" />
<LedImage Id="ScanNextTrack" Image="Strafe_Keys\NextTrack.png" /> <LedImage Id="Keyboard_MediaNextTrack" Image="Strafe_Keys\NextTrack.png" />
<LedImage Id="GraveAccentAndTilde" Image="Strafe_Keys\Circumflex_Degree.png" /> <LedImage Id="Keyboard_GraveAccentAndTilde" Image="Strafe_Keys\Circumflex_Degree.png" />
<LedImage Id="D1" Image="Strafe_Keys\1_ExclamationMark.png" /> <LedImage Id="Keyboard_1" Image="Strafe_Keys\1_ExclamationMark.png" />
<LedImage Id="D2" Image="Strafe_Keys\2_QuotationMark_Exponent2.png" /> <LedImage Id="Keyboard_2" Image="Strafe_Keys\2_QuotationMark_Exponent2.png" />
<LedImage Id="D3" Image="Strafe_Keys\3_SectionSign_Exponent3.png" /> <LedImage Id="Keyboard_3" Image="Strafe_Keys\3_SectionSign_Exponent3.png" />
<LedImage Id="D4" Image="Strafe_Keys\4_Dollar.png" /> <LedImage Id="Keyboard_4" Image="Strafe_Keys\4_Dollar.png" />
<LedImage Id="D5" Image="Strafe_Keys\5_Percent.png" /> <LedImage Id="Keyboard_5" Image="Strafe_Keys\5_Percent.png" />
<LedImage Id="D6" Image="Strafe_Keys\6_Ampersand.png" /> <LedImage Id="Keyboard_6" Image="Strafe_Keys\6_Ampersand.png" />
<LedImage Id="D7" Image="Strafe_Keys\7_Slash_CurlyBracketLeft.png" /> <LedImage Id="Keyboard_7" Image="Strafe_Keys\7_Slash_CurlyBracketLeft.png" />
<LedImage Id="D8" Image="Strafe_Keys\8_BracketLeft_SquareBracketLeft.png" /> <LedImage Id="Keyboard_8" Image="Strafe_Keys\8_BracketLeft_SquareBracketLeft.png" />
<LedImage Id="D9" Image="Strafe_Keys\9_BracketRight_SquareBracketRight.png" /> <LedImage Id="Keyboard_9" Image="Strafe_Keys\9_BracketRight_SquareBracketRight.png" />
<LedImage Id="D0" Image="Strafe_Keys\0_Equals_CurlyBracketRight.png" /> <LedImage Id="Keyboard_0" Image="Strafe_Keys\0_Equals_CurlyBracketRight.png" />
<LedImage Id="MinusAndUnderscore" Image="Strafe_Keys\QuestionMark_SharpS_Backslash.png" /> <LedImage Id="Keyboard_MinusAndUnderscore" Image="Strafe_Keys\QuestionMark_SharpS_Backslash.png" />
<LedImage Id="EqualsAndPlus" Image="Strafe_Keys\AccentGrave_AccentAcute.png" /> <LedImage Id="Keyboard_EqualsAndPlus" Image="Strafe_Keys\AccentGrave_AccentAcute.png" />
<LedImage Id="Backspace" Image="Strafe_Keys\Backspace.png" /> <LedImage Id="Keyboard_Backspace" Image="Strafe_Keys\Backspace.png" />
<LedImage Id="Insert" Image="Strafe_Keys\Einfg.png" /> <LedImage Id="Keyboard_Insert" Image="Strafe_Keys\Einfg.png" />
<LedImage Id="Home" Image="Strafe_Keys\Pos1.png" /> <LedImage Id="Keyboard_Home" Image="Strafe_Keys\Pos1.png" />
<LedImage Id="PageUp" Image="Strafe_Keys\BildUp.png" /> <LedImage Id="Keyboard_PageUp" Image="Strafe_Keys\BildUp.png" />
<LedImage Id="NumLock" Image="Strafe_Keys\Num.png" /> <LedImage Id="Keyboard_NumLock" Image="Strafe_Keys\Num.png" />
<LedImage Id="KeypadSlash" Image="Strafe_Keys\Slash.png" /> <LedImage Id="Keyboard_NumSlash" Image="Strafe_Keys\Slash.png" />
<LedImage Id="KeypadAsterisk" Image="Strafe_Keys\Asterisk.png" /> <LedImage Id="Keyboard_NumAsterisk" Image="Strafe_Keys\Asterisk.png" />
<LedImage Id="KeypadMinus" Image="Strafe_Keys\Minus.png" /> <LedImage Id="Keyboard_NumMinus" Image="Strafe_Keys\Minus.png" />
<LedImage Id="Tab" Image="Strafe_Keys\Tab.png" /> <LedImage Id="Keyboard_Tab" Image="Strafe_Keys\Tab.png" />
<LedImage Id="Q" Image="Strafe_Keys\Q_At.png" /> <LedImage Id="Keyboard_Q" Image="Strafe_Keys\Q_At.png" />
<LedImage Id="W" Image="Strafe_Keys\W.png" /> <LedImage Id="Keyboard_W" Image="Strafe_Keys\W.png" />
<LedImage Id="E" Image="Strafe_Keys\E_Euro.png" /> <LedImage Id="Keyboard_E" Image="Strafe_Keys\E_Euro.png" />
<LedImage Id="R" Image="Strafe_Keys\R.png" /> <LedImage Id="Keyboard_R" Image="Strafe_Keys\R.png" />
<LedImage Id="T" Image="Strafe_Keys\T.png" /> <LedImage Id="Keyboard_T" Image="Strafe_Keys\T.png" />
<LedImage Id="Y" Image="Strafe_Keys\Z.png" /> <LedImage Id="Keyboard_Y" Image="Strafe_Keys\Z.png" />
<LedImage Id="U" Image="Strafe_Keys\U.png" /> <LedImage Id="Keyboard_U" Image="Strafe_Keys\U.png" />
<LedImage Id="I" Image="Strafe_Keys\I.png" /> <LedImage Id="Keyboard_I" Image="Strafe_Keys\I.png" />
<LedImage Id="O" Image="Strafe_Keys\O.png" /> <LedImage Id="Keyboard_O" Image="Strafe_Keys\O.png" />
<LedImage Id="P" Image="Strafe_Keys\P.png" /> <LedImage Id="Keyboard_P" Image="Strafe_Keys\P.png" />
<LedImage Id="BracketLeft" Image="Strafe_Keys\UE.png" /> <LedImage Id="Keyboard_BracketLeft" Image="Strafe_Keys\UE.png" />
<LedImage Id="BracketRight" Image="Strafe_Keys\Plus_Asterisk_Tilde.png" /> <LedImage Id="Keyboard_BracketRight" Image="Strafe_Keys\Plus_Asterisk_Tilde.png" />
<LedImage Id="Enter" Image="Strafe_Keys\Enter.png" /> <LedImage Id="Keyboard_Enter" Image="Strafe_Keys\Enter.png" />
<LedImage Id="Delete" Image="Strafe_Keys\Entf.png" /> <LedImage Id="Keyboard_Delete" Image="Strafe_Keys\Entf.png" />
<LedImage Id="End" Image="Strafe_Keys\Ende.png" /> <LedImage Id="Keyboard_End" Image="Strafe_Keys\Ende.png" />
<LedImage Id="PageDown" Image="Strafe_Keys\BildDown.png" /> <LedImage Id="Keyboard_PageDown" Image="Strafe_Keys\BildDown.png" />
<LedImage Id="Keypad7" Image="Strafe_Keys\Num7_Pos1.png" /> <LedImage Id="Keyboard_Num7" Image="Strafe_Keys\Num7_Pos1.png" />
<LedImage Id="Keypad8" Image="Strafe_Keys\Num8_ArrowUp.png" /> <LedImage Id="Keyboard_Num8" Image="Strafe_Keys\Num8_ArrowUp.png" />
<LedImage Id="Keypad9" Image="Strafe_Keys\Num9_BildUp.png" /> <LedImage Id="Keyboard_Num9" Image="Strafe_Keys\Num9_BildUp.png" />
<LedImage Id="KeypadPlus" Image="Strafe_Keys\NumPlus.png" /> <LedImage Id="Keyboard_NumPlus" Image="Strafe_Keys\NumPlus.png" />
<LedImage Id="CapsLock" Image="Strafe_Keys\CapsLock.png" /> <LedImage Id="Keyboard_CapsLock" Image="Strafe_Keys\CapsLock.png" />
<LedImage Id="A" Image="Strafe_Keys\A.png" /> <LedImage Id="Keyboard_A" Image="Strafe_Keys\A.png" />
<LedImage Id="S" Image="Strafe_Keys\S.png" /> <LedImage Id="Keyboard_S" Image="Strafe_Keys\S.png" />
<LedImage Id="D" Image="Strafe_Keys\D.png" /> <LedImage Id="Keyboard_D" Image="Strafe_Keys\D.png" />
<LedImage Id="F" Image="Strafe_Keys\F.png" /> <LedImage Id="Keyboard_F" Image="Strafe_Keys\F.png" />
<LedImage Id="G" Image="Strafe_Keys\G.png" /> <LedImage Id="Keyboard_G" Image="Strafe_Keys\G.png" />
<LedImage Id="H" Image="Strafe_Keys\H.png" /> <LedImage Id="Keyboard_H" Image="Strafe_Keys\H.png" />
<LedImage Id="J" Image="Strafe_Keys\J.png" /> <LedImage Id="Keyboard_J" Image="Strafe_Keys\J.png" />
<LedImage Id="K" Image="Strafe_Keys\K.png" /> <LedImage Id="Keyboard_K" Image="Strafe_Keys\K.png" />
<LedImage Id="L" Image="Strafe_Keys\L.png" /> <LedImage Id="Keyboard_L" Image="Strafe_Keys\L.png" />
<LedImage Id="SemicolonAndColon" Image="Strafe_Keys\OE.png" /> <LedImage Id="Keyboard_SemicolonAndColon" Image="Strafe_Keys\OE.png" />
<LedImage Id="ApostropheAndDoubleQuote" Image="Strafe_Keys\AE.png" /> <LedImage Id="Keyboard_ApostropheAndDoubleQuote" Image="Strafe_Keys\AE.png" />
<LedImage Id="NonUsTilde" Image="Strafe_Keys\Hash_Apostrophe.png" /> <LedImage Id="Keyboard_NonUsTilde" Image="Strafe_Keys\Hash_Apostrophe.png" />
<LedImage Id="Keypad4" Image="Strafe_Keys\Num4_ArrowLeft.png" /> <LedImage Id="Keyboard_Num4" Image="Strafe_Keys\Num4_ArrowLeft.png" />
<LedImage Id="Keypad5" Image="Strafe_Keys\Num5.png" /> <LedImage Id="Keyboard_Num5" Image="Strafe_Keys\Num5.png" />
<LedImage Id="Keypad6" Image="Strafe_Keys\Num6_ArrowRight.png" /> <LedImage Id="Keyboard_Num6" Image="Strafe_Keys\Num6_ArrowRight.png" />
<LedImage Id="LeftShift" Image="Strafe_Keys\Shift.png" /> <LedImage Id="Keyboard_LeftShift" Image="Strafe_Keys\Shift.png" />
<LedImage Id="NonUsBackslash" Image="Strafe_Keys\LessThan_GreaterThan_Pipe.png" /> <LedImage Id="Keyboard_NonUsBackslash" Image="Strafe_Keys\LessThan_GreaterThan_Pipe.png" />
<LedImage Id="Z" Image="Strafe_Keys\Y.png" /> <LedImage Id="Keyboard_Z" Image="Strafe_Keys\Y.png" />
<LedImage Id="X" Image="Strafe_Keys\X.png" /> <LedImage Id="Keyboard_X" Image="Strafe_Keys\X.png" />
<LedImage Id="C" Image="Strafe_Keys\C.png" /> <LedImage Id="Keyboard_C" Image="Strafe_Keys\C.png" />
<LedImage Id="V" Image="Strafe_Keys\V.png" /> <LedImage Id="Keyboard_V" Image="Strafe_Keys\V.png" />
<LedImage Id="B" Image="Strafe_Keys\B.png" /> <LedImage Id="Keyboard_B" Image="Strafe_Keys\B.png" />
<LedImage Id="N" Image="Strafe_Keys\N.png" /> <LedImage Id="Keyboard_N" Image="Strafe_Keys\N.png" />
<LedImage Id="M" Image="Strafe_Keys\M_Mu.png" /> <LedImage Id="Keyboard_M" Image="Strafe_Keys\M_Mu.png" />
<LedImage Id="CommaAndLessThan" Image="Strafe_Keys\Comma_Semicolon.png" /> <LedImage Id="Keyboard_CommaAndLessThan" Image="Strafe_Keys\Comma_Semicolon.png" />
<LedImage Id="PeriodAndBiggerThan" Image="Strafe_Keys\Dot_Colon.png" /> <LedImage Id="Keyboard_PeriodAndBiggerThan" Image="Strafe_Keys\Dot_Colon.png" />
<LedImage Id="SlashAndQuestionMark" Image="Strafe_Keys\Hyphen_Underscore.png" /> <LedImage Id="Keyboard_SlashAndQuestionMark" Image="Strafe_Keys\Hyphen_Underscore.png" />
<LedImage Id="RightShift" Image="Strafe_Keys\ShiftBig.png" /> <LedImage Id="Keyboard_RightShift" Image="Strafe_Keys\ShiftBig.png" />
<LedImage Id="UpArrow" Image="Strafe_Keys\CaretUp.png" /> <LedImage Id="Keyboard_ArrowUp" Image="Strafe_Keys\CaretUp.png" />
<LedImage Id="Keypad1" Image="Strafe_Keys\Num1_Ende.png" /> <LedImage Id="Keyboard_Num1" Image="Strafe_Keys\Num1_Ende.png" />
<LedImage Id="Keypad2" Image="Strafe_Keys\Num2_ArrowDown.png" /> <LedImage Id="Keyboard_Num2" Image="Strafe_Keys\Num2_ArrowDown.png" />
<LedImage Id="Keypad3" Image="Strafe_Keys\Num3_BildDown.png" /> <LedImage Id="Keyboard_Num3" Image="Strafe_Keys\Num3_BildDown.png" />
<LedImage Id="KeypadEnter" Image="Strafe_Keys\NumEnter.png" /> <LedImage Id="Keyboard_NumEnter" Image="Strafe_Keys\NumEnter.png" />
<LedImage Id="LeftCtrl" Image="Strafe_Keys\Strg.png" /> <LedImage Id="Keyboard_LeftCtrl" Image="Strafe_Keys\Strg.png" />
<LedImage Id="LeftGui" Image="Strafe_Keys\Windows.png" /> <LedImage Id="Keyboard_LeftGui" Image="Strafe_Keys\Windows.png" />
<LedImage Id="LeftAlt" Image="Strafe_Keys\Alt.png" /> <LedImage Id="Keyboard_LeftAlt" Image="Strafe_Keys\Alt.png" />
<LedImage Id="Space" Image="Strafe_Keys\Space.png" /> <LedImage Id="Keyboard_Space" Image="Strafe_Keys\Space.png" />
<LedImage Id="RightAlt" Image="Strafe_Keys\AltGr.png" /> <LedImage Id="Keyboard_RightAlt" Image="Strafe_Keys\AltGr.png" />
<LedImage Id="RightGui" Image="Strafe_Keys\Windows.png" /> <LedImage Id="Keyboard_RightGui" Image="Strafe_Keys\Windows.png" />
<LedImage Id="Application" Image="Strafe_Keys\Menu.png" /> <LedImage Id="Keyboard_Application" Image="Strafe_Keys\Menu.png" />
<LedImage Id="RightCtrl" Image="Strafe_Keys\Strg.png" /> <LedImage Id="Keyboard_RightCtrl" Image="Strafe_Keys\Strg.png" />
<LedImage Id="LeftArrow" Image="Strafe_Keys\CaretLeft.png" /> <LedImage Id="Keyboard_ArrowLeft" Image="Strafe_Keys\CaretLeft.png" />
<LedImage Id="DownArrow" Image="Strafe_Keys\CaretDown.png" /> <LedImage Id="Keyboard_ArrowDown" Image="Strafe_Keys\CaretDown.png" />
<LedImage Id="RightArrow" Image="Strafe_Keys\CaretRight.png" /> <LedImage Id="Keyboard_ArrowRight" Image="Strafe_Keys\CaretRight.png" />
<LedImage Id="Keypad0" Image="Strafe_Keys\Num0_Einfg.png" /> <LedImage Id="Keyboard_Num0" Image="Strafe_Keys\Num0_Einfg.png" />
<LedImage Id="KeypadPeriodAndDelete" Image="Strafe_Keys\Comma_Entf.png" /> <LedImage Id="Keyboard_NumPeriodAndDelete" Image="Strafe_Keys\Comma_Entf.png" />
<LedImage Id="G3" Image="Strafe_Keys\G1.png" /> <LedImage Id="Keyboard_Programmable3" Image="Strafe_Keys\G1.png" />
<LedImage Id="G6" Image="Strafe_Keys\G2.png" /> <LedImage Id="Keyboard_Programmable6" Image="Strafe_Keys\G2.png" />
<LedImage Id="G9" Image="Strafe_Keys\G3.png" /> <LedImage Id="Keyboard_Programmable9" Image="Strafe_Keys\G3.png" />
<LedImage Id="G12" Image="Strafe_Keys\G4.png" /> <LedImage Id="Keyboard_Programmable12" Image="Strafe_Keys\G4.png" />
<LedImage Id="G15" Image="Strafe_Keys\G5.png" /> <LedImage Id="Keyboard_Programmable15" Image="Strafe_Keys\G5.png" />
<LedImage Id="G18" Image="Strafe_Keys\G6.png" /> <LedImage Id="Keyboard_Programmable18" Image="Strafe_Keys\G6.png" />
<LedImage Id="Lightbar1" Image="Empty.png" /> <LedImage Id="Lightbar1" Image="Empty.png" />
<LedImage Id="Lightbar2" Image="Empty.png" /> <LedImage Id="Lightbar2" Image="Empty.png" />
@ -500,131 +500,131 @@
</LedImageLayout> </LedImageLayout>
<LedImageLayout Layout="EU_Int"> <LedImageLayout Layout="EU_Int">
<LedImages> <LedImages>
<LedImage Id="Brightness" Image="Strafe_Keys\Brightness.png" /> <LedImage Id="Keyboard_Brightness" Image="Strafe_Keys\Brightness.png" />
<LedImage Id="WinLock" Image="Strafe_Keys\WinLock.png" /> <LedImage Id="Keyboard_WinLock" Image="Strafe_Keys\WinLock.png" />
<LedImage Id="Mute" Image="Strafe_Keys\Mute.png" /> <LedImage Id="Keyboard_MediaMute" Image="Strafe_Keys\Mute.png" />
<LedImage Id="Escape" Image="Strafe_Keys\Escape.png" /> <LedImage Id="Keyboard_Escape" Image="Strafe_Keys\Escape.png" />
<LedImage Id="F1" Image="Strafe_Keys\F1.png" /> <LedImage Id="Keyboard_F1" Image="Strafe_Keys\F1.png" />
<LedImage Id="F2" Image="Strafe_Keys\F2.png" /> <LedImage Id="Keyboard_F2" Image="Strafe_Keys\F2.png" />
<LedImage Id="F3" Image="Strafe_Keys\F3.png" /> <LedImage Id="Keyboard_F3" Image="Strafe_Keys\F3.png" />
<LedImage Id="F4" Image="Strafe_Keys\F4.png" /> <LedImage Id="Keyboard_F4" Image="Strafe_Keys\F4.png" />
<LedImage Id="F5" Image="Strafe_Keys\F5.png" /> <LedImage Id="Keyboard_F5" Image="Strafe_Keys\F5.png" />
<LedImage Id="F6" Image="Strafe_Keys\F6.png" /> <LedImage Id="Keyboard_F6" Image="Strafe_Keys\F6.png" />
<LedImage Id="F7" Image="Strafe_Keys\F7.png" /> <LedImage Id="Keyboard_F7" Image="Strafe_Keys\F7.png" />
<LedImage Id="F8" Image="Strafe_Keys\F8.png" /> <LedImage Id="Keyboard_F8" Image="Strafe_Keys\F8.png" />
<LedImage Id="F9" Image="Strafe_Keys\F9.png" /> <LedImage Id="Keyboard_F9" Image="Strafe_Keys\F9.png" />
<LedImage Id="F10" Image="Strafe_Keys\F10.png" /> <LedImage Id="Keyboard_F10" Image="Strafe_Keys\F10.png" />
<LedImage Id="F11" Image="Strafe_Keys\F11.png" /> <LedImage Id="Keyboard_F11" Image="Strafe_Keys\F11.png" />
<LedImage Id="F12" Image="Strafe_Keys\F12.png" /> <LedImage Id="Keyboard_F12" Image="Strafe_Keys\F12.png" />
<LedImage Id="PrintScreen" Image="Strafe_Keys\PrintScreen.png" /> <LedImage Id="Keyboard_PrintScreen" Image="Strafe_Keys\PrintScreen.png" />
<LedImage Id="ScrollLock" Image="Strafe_Keys\ScrollLock.png" /> <LedImage Id="Keyboard_ScrollLock" Image="Strafe_Keys\ScrollLock.png" />
<LedImage Id="PauseBreak" Image="Strafe_Keys\PauseBreak.png" /> <LedImage Id="Keyboard_PauseBreak" Image="Strafe_Keys\PauseBreak.png" />
<LedImage Id="Stop" Image="Strafe_Keys\Stop.png" /> <LedImage Id="Keyboard_MediaStop" Image="Strafe_Keys\Stop.png" />
<LedImage Id="ScanPreviousTrack" Image="Strafe_Keys\PreviousTrack.png" /> <LedImage Id="Keyboard_MediaPreviousTrack" Image="Strafe_Keys\PreviousTrack.png" />
<LedImage Id="PlayPause" Image="Strafe_Keys\PlayPause.png" /> <LedImage Id="Keyboard_MediaPlay" Image="Strafe_Keys\PlayPause.png" />
<LedImage Id="ScanNextTrack" Image="Strafe_Keys\NextTrack.png" /> <LedImage Id="Keyboard_MediaNextTrack" Image="Strafe_Keys\NextTrack.png" />
<LedImage Id="GraveAccentAndTilde" Image="Strafe_Keys\AccentGrave_Tilde.png" /> <LedImage Id="Keyboard_GraveAccentAndTilde" Image="Strafe_Keys\AccentGrave_Tilde.png" />
<LedImage Id="D1" Image="Strafe_Keys\1_ExclamationMark.png" /> <LedImage Id="Keyboard_1" Image="Strafe_Keys\1_ExclamationMark.png" />
<LedImage Id="D2" Image="Strafe_Keys\2_At.png" /> <LedImage Id="Keyboard_2" Image="Strafe_Keys\2_At.png" />
<LedImage Id="D3" Image="Strafe_Keys\3_Hash.png" /> <LedImage Id="Keyboard_3" Image="Strafe_Keys\3_Hash.png" />
<LedImage Id="D4" Image="Strafe_Keys\4_Dollar.png" /> <LedImage Id="Keyboard_4" Image="Strafe_Keys\4_Dollar.png" />
<LedImage Id="D5" Image="Strafe_Keys\5_Percent_Euro.png" /> <LedImage Id="Keyboard_5" Image="Strafe_Keys\5_Percent_Euro.png" />
<LedImage Id="D6" Image="Strafe_Keys\6_Circumflex.png" /> <LedImage Id="Keyboard_6" Image="Strafe_Keys\6_Circumflex.png" />
<LedImage Id="D7" Image="Strafe_Keys\7_Ampersand.png" /> <LedImage Id="Keyboard_7" Image="Strafe_Keys\7_Ampersand.png" />
<LedImage Id="D8" Image="Strafe_Keys\8_Asterisk.png" /> <LedImage Id="Keyboard_8" Image="Strafe_Keys\8_Asterisk.png" />
<LedImage Id="D9" Image="Strafe_Keys\9_BracketRight.png" /> <LedImage Id="Keyboard_9" Image="Strafe_Keys\9_BracketRight.png" />
<LedImage Id="D0" Image="Strafe_Keys\0_BracketRight.png" /> <LedImage Id="Keyboard_0" Image="Strafe_Keys\0_BracketRight.png" />
<LedImage Id="MinusAndUnderscore" Image="Strafe_Keys\Hyphen_Underscore.png" /> <LedImage Id="Keyboard_MinusAndUnderscore" Image="Strafe_Keys\Hyphen_Underscore.png" />
<LedImage Id="EqualsAndPlus" Image="Strafe_Keys\Equals_Plus.png" /> <LedImage Id="Keyboard_EqualsAndPlus" Image="Strafe_Keys\Equals_Plus.png" />
<LedImage Id="Backspace" Image="Strafe_Keys\Backspace.png" /> <LedImage Id="Keyboard_Backspace" Image="Strafe_Keys\Backspace.png" />
<LedImage Id="Insert" Image="Strafe_Keys\Insert.png" /> <LedImage Id="Keyboard_Insert" Image="Strafe_Keys\Insert.png" />
<LedImage Id="Home" Image="Strafe_Keys\Home.png" /> <LedImage Id="Keyboard_Home" Image="Strafe_Keys\Home.png" />
<LedImage Id="PageUp" Image="Strafe_Keys\PageUp.png" /> <LedImage Id="Keyboard_PageUp" Image="Strafe_Keys\PageUp.png" />
<LedImage Id="NumLock" Image="Strafe_Keys\NumLock.png" /> <LedImage Id="Keyboard_NumLock" Image="Strafe_Keys\NumLock.png" />
<LedImage Id="KeypadSlash" Image="Strafe_Keys\Slash.png" /> <LedImage Id="Keyboard_NumSlash" Image="Strafe_Keys\Slash.png" />
<LedImage Id="KeypadAsterisk" Image="Strafe_Keys\Asterisk.png" /> <LedImage Id="Keyboard_NumAsterisk" Image="Strafe_Keys\Asterisk.png" />
<LedImage Id="KeypadMinus" Image="Strafe_Keys\Minus.png" /> <LedImage Id="Keyboard_NumMinus" Image="Strafe_Keys\Minus.png" />
<LedImage Id="Tab" Image="Strafe_Keys\Tab.png" /> <LedImage Id="Keyboard_Tab" Image="Strafe_Keys\Tab.png" />
<LedImage Id="Q" Image="Strafe_Keys\Q.png" /> <LedImage Id="Keyboard_Q" Image="Strafe_Keys\Q.png" />
<LedImage Id="W" Image="Strafe_Keys\W.png" /> <LedImage Id="Keyboard_W" Image="Strafe_Keys\W.png" />
<LedImage Id="E" Image="Strafe_Keys\E.png" /> <LedImage Id="Keyboard_E" Image="Strafe_Keys\E.png" />
<LedImage Id="R" Image="Strafe_Keys\R.png" /> <LedImage Id="Keyboard_R" Image="Strafe_Keys\R.png" />
<LedImage Id="T" Image="Strafe_Keys\T.png" /> <LedImage Id="Keyboard_T" Image="Strafe_Keys\T.png" />
<LedImage Id="Y" Image="Strafe_Keys\Y.png" /> <LedImage Id="Keyboard_Y" Image="Strafe_Keys\Y.png" />
<LedImage Id="U" Image="Strafe_Keys\U.png" /> <LedImage Id="Keyboard_U" Image="Strafe_Keys\U.png" />
<LedImage Id="I" Image="Strafe_Keys\I.png" /> <LedImage Id="Keyboard_I" Image="Strafe_Keys\I.png" />
<LedImage Id="O" Image="Strafe_Keys\O.png" /> <LedImage Id="Keyboard_O" Image="Strafe_Keys\O.png" />
<LedImage Id="P" Image="Strafe_Keys\P.png" /> <LedImage Id="Keyboard_P" Image="Strafe_Keys\P.png" />
<LedImage Id="BracketLeft" Image="Strafe_Keys\SquareBracketLeft_CurlyBracketLeft.png" /> <LedImage Id="Keyboard_BracketLeft" Image="Strafe_Keys\SquareBracketLeft_CurlyBracketLeft.png" />
<LedImage Id="BracketRight" Image="Strafe_Keys\SquareBracketRight_CurlyBracketRight.png" /> <LedImage Id="Keyboard_BracketRight" Image="Strafe_Keys\SquareBracketRight_CurlyBracketRight.png" />
<LedImage Id="Enter" Image="Strafe_Keys\Enter.png" /> <LedImage Id="Keyboard_Enter" Image="Strafe_Keys\Enter.png" />
<LedImage Id="Delete" Image="Strafe_Keys\Delete.png" /> <LedImage Id="Keyboard_Delete" Image="Strafe_Keys\Delete.png" />
<LedImage Id="End" Image="Strafe_Keys\End.png" /> <LedImage Id="Keyboard_End" Image="Strafe_Keys\End.png" />
<LedImage Id="PageDown" Image="Strafe_Keys\PageDown.png" /> <LedImage Id="Keyboard_PageDown" Image="Strafe_Keys\PageDown.png" />
<LedImage Id="Keypad7" Image="Strafe_Keys\Num7_Home.png" /> <LedImage Id="Keyboard_Num7" Image="Strafe_Keys\Num7_Home.png" />
<LedImage Id="Keypad8" Image="Strafe_Keys\Num8_ArrowUp.png" /> <LedImage Id="Keyboard_Num8" Image="Strafe_Keys\Num8_ArrowUp.png" />
<LedImage Id="Keypad9" Image="Strafe_Keys\Num9_PgUp.png" /> <LedImage Id="Keyboard_Num9" Image="Strafe_Keys\Num9_PgUp.png" />
<LedImage Id="KeypadPlus" Image="Strafe_Keys\NumPlus.png" /> <LedImage Id="Keyboard_NumPlus" Image="Strafe_Keys\NumPlus.png" />
<LedImage Id="CapsLock" Image="Strafe_Keys\CapsLock.png" /> <LedImage Id="Keyboard_CapsLock" Image="Strafe_Keys\CapsLock.png" />
<LedImage Id="A" Image="Strafe_Keys\A.png" /> <LedImage Id="Keyboard_A" Image="Strafe_Keys\A.png" />
<LedImage Id="S" Image="Strafe_Keys\S.png" /> <LedImage Id="Keyboard_S" Image="Strafe_Keys\S.png" />
<LedImage Id="D" Image="Strafe_Keys\D.png" /> <LedImage Id="Keyboard_D" Image="Strafe_Keys\D.png" />
<LedImage Id="F" Image="Strafe_Keys\F.png" /> <LedImage Id="Keyboard_F" Image="Strafe_Keys\F.png" />
<LedImage Id="G" Image="Strafe_Keys\G.png" /> <LedImage Id="Keyboard_G" Image="Strafe_Keys\G.png" />
<LedImage Id="H" Image="Strafe_Keys\H.png" /> <LedImage Id="Keyboard_H" Image="Strafe_Keys\H.png" />
<LedImage Id="J" Image="Strafe_Keys\J.png" /> <LedImage Id="Keyboard_J" Image="Strafe_Keys\J.png" />
<LedImage Id="K" Image="Strafe_Keys\K.png" /> <LedImage Id="Keyboard_K" Image="Strafe_Keys\K.png" />
<LedImage Id="L" Image="Strafe_Keys\L.png" /> <LedImage Id="Keyboard_L" Image="Strafe_Keys\L.png" />
<LedImage Id="SemicolonAndColon" Image="Strafe_Keys\Semicolon_Colon.png" /> <LedImage Id="Keyboard_SemicolonAndColon" Image="Strafe_Keys\Semicolon_Colon.png" />
<LedImage Id="ApostropheAndDoubleQuote" Image="Strafe_Keys\Apostrophe_QuotationMark.png" /> <LedImage Id="Keyboard_ApostropheAndDoubleQuote" Image="Strafe_Keys\Apostrophe_QuotationMark.png" />
<LedImage Id="NonUsTilde" Image="Strafe_Keys\Blackslash_Pipe.png" /> <LedImage Id="Keyboard_NonUsTilde" Image="Strafe_Keys\Blackslash_Pipe.png" />
<LedImage Id="Keypad4" Image="Strafe_Keys\Num4_ArrowLeft.png" /> <LedImage Id="Keyboard_Num4" Image="Strafe_Keys\Num4_ArrowLeft.png" />
<LedImage Id="Keypad5" Image="Strafe_Keys\Num5.png" /> <LedImage Id="Keyboard_Num5" Image="Strafe_Keys\Num5.png" />
<LedImage Id="Keypad6" Image="Strafe_Keys\Num6_ArrowRight.png" /> <LedImage Id="Keyboard_Num6" Image="Strafe_Keys\Num6_ArrowRight.png" />
<LedImage Id="LeftShift" Image="Strafe_Keys\Shift.png" /> <LedImage Id="Keyboard_LeftShift" Image="Strafe_Keys\Shift.png" />
<LedImage Id="NonUsBackslash" Image="Strafe_Keys\Blackslash_Pipe.png" /> <LedImage Id="Keyboard_NonUsBackslash" Image="Strafe_Keys\Blackslash_Pipe.png" />
<LedImage Id="Z" Image="Strafe_Keys\Z.png" /> <LedImage Id="Keyboard_Z" Image="Strafe_Keys\Z.png" />
<LedImage Id="X" Image="Strafe_Keys\X.png" /> <LedImage Id="Keyboard_X" Image="Strafe_Keys\X.png" />
<LedImage Id="C" Image="Strafe_Keys\C.png" /> <LedImage Id="Keyboard_C" Image="Strafe_Keys\C.png" />
<LedImage Id="V" Image="Strafe_Keys\V.png" /> <LedImage Id="Keyboard_V" Image="Strafe_Keys\V.png" />
<LedImage Id="B" Image="Strafe_Keys\B.png" /> <LedImage Id="Keyboard_B" Image="Strafe_Keys\B.png" />
<LedImage Id="N" Image="Strafe_Keys\N.png" /> <LedImage Id="Keyboard_N" Image="Strafe_Keys\N.png" />
<LedImage Id="M" Image="Strafe_Keys\M.png" /> <LedImage Id="Keyboard_M" Image="Strafe_Keys\M.png" />
<LedImage Id="CommaAndLessThan" Image="Strafe_Keys\LessThan_Comma.png" /> <LedImage Id="Keyboard_CommaAndLessThan" Image="Strafe_Keys\LessThan_Comma.png" />
<LedImage Id="PeriodAndBiggerThan" Image="Strafe_Keys\GreaterThan_Dot.png" /> <LedImage Id="Keyboard_PeriodAndBiggerThan" Image="Strafe_Keys\GreaterThan_Dot.png" />
<LedImage Id="SlashAndQuestionMark" Image="Strafe_Keys\QuestionMark_Slash.png" /> <LedImage Id="Keyboard_SlashAndQuestionMark" Image="Strafe_Keys\QuestionMark_Slash.png" />
<LedImage Id="RightShift" Image="Strafe_Keys\ShiftBig.png" /> <LedImage Id="Keyboard_RightShift" Image="Strafe_Keys\ShiftBig.png" />
<LedImage Id="UpArrow" Image="Strafe_Keys\CaretUp.png" /> <LedImage Id="Keyboard_ArrowUp" Image="Strafe_Keys\CaretUp.png" />
<LedImage Id="Keypad1" Image="Strafe_Keys\Num1_End.png" /> <LedImage Id="Keyboard_Num1" Image="Strafe_Keys\Num1_End.png" />
<LedImage Id="Keypad2" Image="Strafe_Keys\Num2_ArrowDown.png" /> <LedImage Id="Keyboard_Num2" Image="Strafe_Keys\Num2_ArrowDown.png" />
<LedImage Id="Keypad3" Image="Strafe_Keys\Num3_PgDwn.png" /> <LedImage Id="Keyboard_Num3" Image="Strafe_Keys\Num3_PgDwn.png" />
<LedImage Id="KeypadEnter" Image="Strafe_Keys\NumEnter.png" /> <LedImage Id="Keyboard_NumEnter" Image="Strafe_Keys\NumEnter.png" />
<LedImage Id="LeftCtrl" Image="Strafe_Keys\Ctrl.png" /> <LedImage Id="Keyboard_LeftCtrl" Image="Strafe_Keys\Ctrl.png" />
<LedImage Id="LeftGui" Image="Strafe_Keys\Windows.png" /> <LedImage Id="Keyboard_LeftGui" Image="Strafe_Keys\Windows.png" />
<LedImage Id="LeftAlt" Image="Strafe_Keys\Alt.png" /> <LedImage Id="Keyboard_LeftAlt" Image="Strafe_Keys\Alt.png" />
<LedImage Id="Space" Image="Strafe_Keys\Space.png" /> <LedImage Id="Keyboard_Space" Image="Strafe_Keys\Space.png" />
<LedImage Id="RightAlt" Image="Strafe_Keys\AltGr.png" /> <LedImage Id="Keyboard_RightAlt" Image="Strafe_Keys\AltGr.png" />
<LedImage Id="RightGui" Image="Strafe_Keys\Windows.png" /> <LedImage Id="Keyboard_RightGui" Image="Strafe_Keys\Windows.png" />
<LedImage Id="Application" Image="Strafe_Keys\Menu.png" /> <LedImage Id="Keyboard_Application" Image="Strafe_Keys\Menu.png" />
<LedImage Id="RightCtrl" Image="Strafe_Keys\Ctrl.png" /> <LedImage Id="Keyboard_RightCtrl" Image="Strafe_Keys\Ctrl.png" />
<LedImage Id="LeftArrow" Image="Strafe_Keys\CaretLeft.png" /> <LedImage Id="Keyboard_ArrowLeft" Image="Strafe_Keys\CaretLeft.png" />
<LedImage Id="DownArrow" Image="Strafe_Keys\CaretDown.png" /> <LedImage Id="Keyboard_ArrowDown" Image="Strafe_Keys\CaretDown.png" />
<LedImage Id="RightArrow" Image="Strafe_Keys\CaretRight.png" /> <LedImage Id="Keyboard_ArrowRight" Image="Strafe_Keys\CaretRight.png" />
<LedImage Id="Keypad0" Image="Strafe_Keys\Num0_Ins.png" /> <LedImage Id="Keyboard_Num0" Image="Strafe_Keys\Num0_Ins.png" />
<LedImage Id="KeypadPeriodAndDelete" Image="Strafe_Keys\Dot_Del.png" /> <LedImage Id="Keyboard_NumPeriodAndDelete" Image="Strafe_Keys\Dot_Del.png" />
<LedImage Id="G3" Image="Strafe_Keys\G1.png" /> <LedImage Id="Keyboard_Programmable3" Image="Strafe_Keys\G1.png" />
<LedImage Id="G6" Image="Strafe_Keys\G2.png" /> <LedImage Id="Keyboard_Programmable6" Image="Strafe_Keys\G2.png" />
<LedImage Id="G9" Image="Strafe_Keys\G3.png" /> <LedImage Id="Keyboard_Programmable9" Image="Strafe_Keys\G3.png" />
<LedImage Id="G12" Image="Strafe_Keys\G4.png" /> <LedImage Id="Keyboard_Programmable12" Image="Strafe_Keys\G4.png" />
<LedImage Id="G15" Image="Strafe_Keys\G5.png" /> <LedImage Id="Keyboard_Programmable15" Image="Strafe_Keys\G5.png" />
<LedImage Id="G18" Image="Strafe_Keys\G6.png" /> <LedImage Id="Keyboard_Programmable18" Image="Strafe_Keys\G6.png" />
<LedImage Id="Lightbar1" Image="Empty.png" /> <LedImage Id="Lightbar1" Image="Empty.png" />
<LedImage Id="Lightbar2" Image="Empty.png" /> <LedImage Id="Lightbar2" Image="Empty.png" />

View File

@ -1,6 +1,7 @@
// ReSharper disable MemberCanBePrivate.Global // ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedMember.Global // ReSharper disable UnusedMember.Global
using System;
using RGB.NET.Core; using RGB.NET.Core;
using RGB.NET.Core.Exceptions; using RGB.NET.Core.Exceptions;
@ -33,31 +34,40 @@ namespace RGB.NET.Devices.Corsair
switch (DeviceInfo.PhysicalLayout) switch (DeviceInfo.PhysicalLayout)
{ {
case CorsairPhysicalMouseLayout.Zones1: case CorsairPhysicalMouseLayout.Zones1:
InitializeLed(new CorsairLedId(this, CorsairLedIds.B1), new Rectangle(0, 0, 10, 10)); InitializeLed(LedId.Mouse1, new Rectangle(0, 0, 10, 10));
break; break;
case CorsairPhysicalMouseLayout.Zones2: case CorsairPhysicalMouseLayout.Zones2:
InitializeLed(new CorsairLedId(this, CorsairLedIds.B1), new Rectangle(0, 0, 10, 10)); InitializeLed(LedId.Mouse1, new Rectangle(0, 0, 10, 10));
InitializeLed(new CorsairLedId(this, CorsairLedIds.B2), new Rectangle(10, 0, 10, 10)); InitializeLed(LedId.Mouse2, new Rectangle(10, 0, 10, 10));
break; break;
case CorsairPhysicalMouseLayout.Zones3: case CorsairPhysicalMouseLayout.Zones3:
InitializeLed(new CorsairLedId(this, CorsairLedIds.B1), new Rectangle(0, 0, 10, 10)); InitializeLed(LedId.Mouse1, new Rectangle(0, 0, 10, 10));
InitializeLed(new CorsairLedId(this, CorsairLedIds.B2), new Rectangle(10, 0, 10, 10)); InitializeLed(LedId.Mouse2, new Rectangle(10, 0, 10, 10));
InitializeLed(new CorsairLedId(this, CorsairLedIds.B3), new Rectangle(20, 0, 10, 10)); InitializeLed(LedId.Mouse3, new Rectangle(20, 0, 10, 10));
break; break;
case CorsairPhysicalMouseLayout.Zones4: case CorsairPhysicalMouseLayout.Zones4:
InitializeLed(new CorsairLedId(this, CorsairLedIds.B1), new Rectangle(0, 0, 10, 10)); InitializeLed(LedId.Mouse1, new Rectangle(0, 0, 10, 10));
InitializeLed(new CorsairLedId(this, CorsairLedIds.B2), new Rectangle(10, 0, 10, 10)); InitializeLed(LedId.Mouse2, new Rectangle(10, 0, 10, 10));
InitializeLed(new CorsairLedId(this, CorsairLedIds.B3), new Rectangle(20, 0, 10, 10)); InitializeLed(LedId.Mouse3, new Rectangle(20, 0, 10, 10));
InitializeLed(new CorsairLedId(this, CorsairLedIds.B4), new Rectangle(30, 0, 10, 10)); InitializeLed(LedId.Mouse4, new Rectangle(30, 0, 10, 10));
break; break;
default: default:
throw new RGBDeviceException($"Can't initial mouse with layout '{DeviceInfo.PhysicalLayout}'"); throw new RGBDeviceException($"Can't initialize mouse with layout '{DeviceInfo.PhysicalLayout}'");
} }
ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Corsair\Mice\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Corsair\Mice\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"),
null, PathHelper.GetAbsolutePath(@"Images\Corsair\Mice")); null, PathHelper.GetAbsolutePath(@"Images\Corsair\Mice"));
} }
/// <inheritdoc />
protected override object CreateLedCustomData(LedId ledId)
{
if (string.Equals(DeviceInfo.Model, "GLAIVE RGB", StringComparison.OrdinalIgnoreCase))
return MouseIdMapping.GLAIVE.TryGetValue(ledId, out CorsairLedId id) ? id : CorsairLedId.Invalid;
else
return MouseIdMapping.DEFAULT.TryGetValue(ledId, out CorsairLedId id) ? id : CorsairLedId.Invalid;
}
#endregion #endregion
} }
} }

View File

@ -0,0 +1,25 @@
using System.Collections.Generic;
using RGB.NET.Core;
namespace RGB.NET.Devices.Corsair
{
internal static class MouseIdMapping
{
internal static readonly Dictionary<LedId, CorsairLedId> DEFAULT = new Dictionary<LedId, CorsairLedId>
{
{ LedId.Mouse1, CorsairLedId.B1 },
{ LedId.Mouse2, CorsairLedId.B2 },
{ LedId.Mouse3, CorsairLedId.B3 },
{ LedId.Mouse4, CorsairLedId.B4 },
{ LedId.Mouse5, CorsairLedId.B5 },
{ LedId.Mouse6, CorsairLedId.B6 },
};
internal static readonly Dictionary<LedId, CorsairLedId> GLAIVE = new Dictionary<LedId, CorsairLedId>
{
{ LedId.Mouse1, CorsairLedId.B1 },
{ LedId.Mouse2, CorsairLedId.B2 },
{ LedId.Mouse3, CorsairLedId.B5 },
};
}
}

View File

@ -47,14 +47,17 @@ namespace RGB.NET.Devices.Corsair
positions.Add(ledPosition); positions.Add(ledPosition);
} }
foreach (_CorsairLedPosition ledPosition in positions.OrderBy(p => p.ledId)) Dictionary<CorsairLedId, LedId> mapping = MousepadIdMapping.DEFAULT.SwapKeyValue();
InitializeLed(new CorsairLedId(this, ledPosition.ledId), foreach (_CorsairLedPosition ledPosition in positions.OrderBy(p => p.LedId))
new Rectangle(ledPosition.left, ledPosition.top, ledPosition.width, ledPosition.height)); InitializeLed(mapping.TryGetValue(ledPosition.LedId, out LedId ledId) ? ledId : LedId.Invalid, new Rectangle(ledPosition.left, ledPosition.top, ledPosition.width, ledPosition.height));
ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Corsair\Mousepads\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Corsair\Mousepads\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"),
null, PathHelper.GetAbsolutePath(@"Images\Corsair\Mousepads")); null, PathHelper.GetAbsolutePath(@"Images\Corsair\Mousepads"));
} }
/// <inheritdoc />
protected override object CreateLedCustomData(LedId ledId) => MousepadIdMapping.DEFAULT.TryGetValue(ledId, out CorsairLedId id) ? id : CorsairLedId.Invalid;
#endregion #endregion
} }
} }

View File

@ -0,0 +1,27 @@
using System.Collections.Generic;
using RGB.NET.Core;
namespace RGB.NET.Devices.Corsair
{
internal static class MousepadIdMapping
{
internal static readonly Dictionary<LedId, CorsairLedId> DEFAULT = new Dictionary<LedId, CorsairLedId>
{
{ LedId.Mousepad1, CorsairLedId.Zone1 },
{ LedId.Mousepad2, CorsairLedId.Zone2 },
{ LedId.Mousepad3, CorsairLedId.Zone3 },
{ LedId.Mousepad4, CorsairLedId.Zone4 },
{ LedId.Mousepad5, CorsairLedId.Zone5 },
{ LedId.Mousepad6, CorsairLedId.Zone6 },
{ LedId.Mousepad7, CorsairLedId.Zone7 },
{ LedId.Mousepad8, CorsairLedId.Zone8 },
{ LedId.Mousepad9, CorsairLedId.Zone9 },
{ LedId.Mousepad10, CorsairLedId.Zone10 },
{ LedId.Mousepad11, CorsairLedId.Zone11 },
{ LedId.Mousepad12, CorsairLedId.Zone12 },
{ LedId.Mousepad13, CorsairLedId.Zone13 },
{ LedId.Mousepad14, CorsairLedId.Zone14 },
{ LedId.Mousepad15, CorsairLedId.Zone15 }
};
}
}

View File

@ -114,7 +114,7 @@ namespace RGB.NET.Devices.Corsair.Native
private delegate IntPtr CorsairGetLedPositionsByDeviceIndexPointer(int deviceIndex); private delegate IntPtr CorsairGetLedPositionsByDeviceIndexPointer(int deviceIndex);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate CorsairLedIds CorsairGetLedIdForKeyNamePointer(char keyName); private delegate CorsairLedId CorsairGetLedIdForKeyNamePointer(char keyName);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate bool CorsairRequestControlPointer(CorsairAccessMode accessMode); private delegate bool CorsairRequestControlPointer(CorsairAccessMode accessMode);
@ -165,7 +165,7 @@ namespace RGB.NET.Devices.Corsair.Native
/// <summary> /// <summary>
/// CUE-SDK: retrieves led id for key name taking logical layout into account. /// CUE-SDK: retrieves led id for key name taking logical layout into account.
/// </summary> /// </summary>
internal static CorsairLedIds CorsairGetLedIdForKeyName(char keyName) => _corsairGetLedIdForKeyNamePointer(keyName); internal static CorsairLedId CorsairGetLedIdForKeyName(char keyName) => _corsairGetLedIdForKeyNamePointer(keyName);
/// <summary> /// <summary>
/// CUE-SDK: requestes control using specified access mode. /// CUE-SDK: requestes control using specified access mode.

View File

@ -17,7 +17,7 @@ namespace RGB.NET.Devices.Corsair.Native
/// <summary> /// <summary>
/// CUE-SDK: identifier of led /// CUE-SDK: identifier of led
/// </summary> /// </summary>
internal CorsairLedIds ledId; internal CorsairLedId LedId;
/// <summary> /// <summary>
/// CUE-SDK: values in mm /// CUE-SDK: values in mm

View File

@ -50,26 +50,31 @@
<Compile Include="Enum\CorsairDeviceCaps.cs" /> <Compile Include="Enum\CorsairDeviceCaps.cs" />
<Compile Include="Enum\CorsairDeviceType.cs" /> <Compile Include="Enum\CorsairDeviceType.cs" />
<Compile Include="Enum\CorsairError.cs" /> <Compile Include="Enum\CorsairError.cs" />
<Compile Include="Enum\CorsairLedIds.cs" /> <Compile Include="Enum\CorsairLedId.cs" />
<Compile Include="Enum\CorsairLogicalKeyboardLayout.cs" /> <Compile Include="Enum\CorsairLogicalKeyboardLayout.cs" />
<Compile Include="Enum\CorsairPhysicalKeyboardLayout.cs" /> <Compile Include="Enum\CorsairPhysicalKeyboardLayout.cs" />
<Compile Include="Enum\CorsairPhysicalMouseLayout.cs" /> <Compile Include="Enum\CorsairPhysicalMouseLayout.cs" />
<Compile Include="Exceptions\CUEException.cs" /> <Compile Include="Exceptions\CUEException.cs" />
<Compile Include="Generic\CorsairLedId.cs" />
<Compile Include="Generic\CorsairProtocolDetails.cs" /> <Compile Include="Generic\CorsairProtocolDetails.cs" />
<Compile Include="Generic\CorsairRGBDeviceInfo.cs" /> <Compile Include="Generic\CorsairRGBDeviceInfo.cs" />
<Compile Include="Generic\CorsairRGBDevice.cs" /> <Compile Include="Generic\CorsairRGBDevice.cs" />
<Compile Include="Generic\ICorsairRGBDevice.cs" /> <Compile Include="Generic\ICorsairRGBDevice.cs" />
<Compile Include="HeadsetStand\CorsairHeadsetStandRGBDevice.cs" /> <Compile Include="HeadsetStand\CorsairHeadsetStandRGBDevice.cs" />
<Compile Include="HeadsetStand\CorsairHeadsetStandRGBDeviceInfo.cs" /> <Compile Include="HeadsetStand\CorsairHeadsetStandRGBDeviceInfo.cs" />
<Compile Include="HeadsetStand\HeadsetStandIdMapping.cs" />
<Compile Include="Headset\CorsairHeadsetRGBDevice.cs" /> <Compile Include="Headset\CorsairHeadsetRGBDevice.cs" />
<Compile Include="Headset\CorsairHeadsetRGBDeviceInfo.cs" /> <Compile Include="Headset\CorsairHeadsetRGBDeviceInfo.cs" />
<Compile Include="Headset\HeadsetIdMapping.cs" />
<Compile Include="Helper\DictionaryExtension.cs" />
<Compile Include="Keyboard\CorsairKeyboardRGBDevice.cs" /> <Compile Include="Keyboard\CorsairKeyboardRGBDevice.cs" />
<Compile Include="Keyboard\CorsairKeyboardRGBDeviceInfo.cs" /> <Compile Include="Keyboard\CorsairKeyboardRGBDeviceInfo.cs" />
<Compile Include="Keyboard\KeyboardIdMapping.cs" />
<Compile Include="Mousepad\MousepadIdMapping.cs" />
<Compile Include="Mouse\CorsairMouseRGBDevice.cs" /> <Compile Include="Mouse\CorsairMouseRGBDevice.cs" />
<Compile Include="Mouse\CorsairMouseRGBDeviceInfo.cs" /> <Compile Include="Mouse\CorsairMouseRGBDeviceInfo.cs" />
<Compile Include="Mousepad\CorsairMousepadRGBDevice.cs" /> <Compile Include="Mousepad\CorsairMousepadRGBDevice.cs" />
<Compile Include="Mousepad\CorsairMousepadRGBDeviceInfo.cs" /> <Compile Include="Mousepad\CorsairMousepadRGBDeviceInfo.cs" />
<Compile Include="Mouse\MouseIdMapping.cs" />
<Compile Include="Native\_CorsairDeviceInfo.cs" /> <Compile Include="Native\_CorsairDeviceInfo.cs" />
<Compile Include="Native\_CorsairLedColor.cs" /> <Compile Include="Native\_CorsairLedColor.cs" />
<Compile Include="Native\_CorsairLedPosition.cs" /> <Compile Include="Native\_CorsairLedPosition.cs" />

View File

@ -1,5 +1,6 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> <wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=headsetstand/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=headsetstand/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=helper/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=libs/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=libs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=mousepad/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=mousepad/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=native/@EntryIndexedValue">False</s:Boolean> <s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=native/@EntryIndexedValue">False</s:Boolean>

View File

@ -50,10 +50,10 @@ namespace RGB.NET.Devices.Corsair.SpecialParts
/// <param name="device">The device associated with this <see cref="IRGBDeviceSpecialPart"/>.</param> /// <param name="device">The device associated with this <see cref="IRGBDeviceSpecialPart"/>.</param>
public LightbarSpecialPart(IRGBDevice device) public LightbarSpecialPart(IRGBDevice device)
{ {
_leds = device.Where(led => (((CorsairLedId)led.Id).LedId >= CorsairLedIds.Lightbar1) && (((CorsairLedId)led.Id).LedId <= CorsairLedIds.Lightbar19)).ToList(); _leds = device.Where(led => ((CorsairLedId)led.CustomData >= CorsairLedId.Lightbar1) && ((CorsairLedId)led.CustomData <= CorsairLedId.Lightbar19)).ToList();
_left = _leds.Where(led => ((CorsairLedId)led.Id).LedId < CorsairLedIds.Lightbar10).ToList(); _left = _leds.Where(led => (CorsairLedId)led.CustomData < CorsairLedId.Lightbar10).ToList();
_right = _leds.Where(led => ((CorsairLedId)led.Id).LedId > CorsairLedIds.Lightbar10).ToList(); _right = _leds.Where(led => (CorsairLedId)led.CustomData > CorsairLedId.Lightbar10).ToList();
Center = _leds.FirstOrDefault(led => ((CorsairLedId)led.Id).LedId == CorsairLedIds.Lightbar10); Center = _leds.FirstOrDefault(led => (CorsairLedId)led.CustomData == CorsairLedId.Lightbar10);
} }
#endregion #endregion

View File

@ -7,7 +7,7 @@ namespace RGB.NET.Devices.Logitech
/// <summary> /// <summary>
/// Contains list of all LEDs available for all logitech devices. /// Contains list of all LEDs available for all logitech devices.
/// </summary> /// </summary>
public enum LogitechLedIds public enum LogitechLedId
{ {
Invalid = 0, Invalid = 0,
ESC = 0x01, ESC = 0x01,

View File

@ -1,108 +0,0 @@
using System.Diagnostics;
using RGB.NET.Core;
namespace RGB.NET.Devices.Logitech
{
/// <inheritdoc />
/// <summary>
/// Represents a Id of a <see cref="T:RGB.NET.Core.Led" /> on a <see cref="T:RGB.NET.Devices.Logitech.LogitechRGBDevice" />.
/// </summary>
[DebuggerDisplay("{" + nameof(LedId) + "}")]
public class LogitechLedId : ILedId
{
#region Properties & Fields
internal readonly LogitechLedIds LedId;
/// <inheritdoc />
public IRGBDevice Device { get; }
/// <inheritdoc />
public bool IsValid => LedId != LogitechLedIds.Invalid;
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="LogitechLedId"/> class.
/// </summary>
/// <param name="device">The <see cref="IRGBDevice"/> the <see cref="ILedId"/> belongs to.</param>
/// <param name="ledId">The <see cref="LogitechLedId"/> of the represented <see cref="Led"/>.</param>
public LogitechLedId(IRGBDevice device, LogitechLedIds ledId)
{
this.Device = device;
this.LedId = ledId;
}
#endregion
#region Methods
/// <summary>
/// Converts the Id of this <see cref="LogitechLedId"/> to a human-readable string.
/// </summary>
/// <returns>A string that contains the Id of this <see cref="LogitechLedId"/>. For example "Enter".</returns>
public override string ToString()
{
return LedId.ToString();
}
/// <summary>
/// Tests whether the specified object is a <see cref="LogitechLedId" /> and is equivalent to this <see cref="LogitechLedId" />.
/// </summary>
/// <param name="obj">The object to test.</param>
/// <returns><c>true</c> if <paramref name="obj" /> is a <see cref="LogitechLedId" /> equivalent to this <see cref="LogitechLedId" />; otherwise, <c>false</c>.</returns>
public override bool Equals(object obj)
{
LogitechLedId compareLedId = obj as LogitechLedId;
if (ReferenceEquals(compareLedId, null))
return false;
if (ReferenceEquals(this, compareLedId))
return true;
if (GetType() != compareLedId.GetType())
return false;
return compareLedId.LedId == LedId;
}
/// <summary>
/// Returns a hash code for this <see cref="LogitechLedId" />.
/// </summary>
/// <returns>An integer value that specifies the hash code for this <see cref="LogitechLedId" />.</returns>
public override int GetHashCode()
{
return LedId.GetHashCode();
}
#endregion
#region Operators
/// <summary>
/// Returns a value that indicates whether two specified <see cref="LogitechLedId" /> are equal.
/// </summary>
/// <param name="ledId1">The first <see cref="LogitechLedId" /> to compare.</param>
/// <param name="ledId2">The second <see cref="LogitechLedId" /> to compare.</param>
/// <returns><c>true</c> if <paramref name="ledId1" /> and <paramref name="ledId2" /> are equal; otherwise, <c>false</c>.</returns>
public static bool operator ==(LogitechLedId ledId1, LogitechLedId ledId2)
{
return ReferenceEquals(ledId1, null) ? ReferenceEquals(ledId2, null) : ledId1.Equals(ledId2);
}
/// <summary>
/// Returns a value that indicates whether two specified <see cref="LogitechLedId" /> are equal.
/// </summary>
/// <param name="ledId1">The first <see cref="LogitechLedId" /> to compare.</param>
/// <param name="ledId2">The second <see cref="LogitechLedId" /> to compare.</param>
/// <returns><c>true</c> if <paramref name="ledId1" /> and <paramref name="ledId2" /> are not equal; otherwise, <c>false</c>.</returns>
public static bool operator !=(LogitechLedId ledId1, LogitechLedId ledId2)
{
return !(ledId1 == ledId2);
}
#endregion
}
}

View File

@ -1,8 +1,5 @@
using System; using System.Linq;
using System.IO;
using System.Linq;
using RGB.NET.Core; using RGB.NET.Core;
using RGB.NET.Core.Layout;
namespace RGB.NET.Devices.Logitech namespace RGB.NET.Devices.Logitech
{ {
@ -62,46 +59,7 @@ namespace RGB.NET.Devices.Logitech
string basePath = info.ImageBasePath; string basePath = info.ImageBasePath;
string layout = info.ImageLayout; string layout = info.ImageLayout;
string layoutPath = info.LayoutPath; string layoutPath = info.LayoutPath;
ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Logitech\{layoutPath}.xml"), layout, PathHelper.GetAbsolutePath($@"Images\Logitech\{basePath}")); ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Logitech\{layoutPath}.xml"), layout, PathHelper.GetAbsolutePath($@"Images\Logitech\{basePath}"), true);
}
/// <summary>
/// Applies the given layout.
/// </summary>
/// <param name="layoutPath">The file containing the layout.</param>
/// <param name="imageLayout">The name of the layout used to get the images of the leds.</param>
/// <param name="imageBasePath">The path images for this device are collected in.</param>
protected void ApplyLayoutFromFile(string layoutPath, string imageLayout, string imageBasePath)
{
DeviceLayout layout = DeviceLayout.Load(layoutPath);
if (layout != null)
{
LedImageLayout ledImageLayout = layout.LedImageLayouts.FirstOrDefault(x => string.Equals(x.Layout, imageLayout, StringComparison.OrdinalIgnoreCase));
Size = new Size(layout.Width, layout.Height);
if (layout.Leds != null)
foreach (LedLayout layoutLed in layout.Leds)
{
if (Enum.TryParse(layoutLed.Id, true, out LogitechLedIds ledId))
{
LogitechLedId id = new LogitechLedId(this, ledId);
if (!LedMapping.TryGetValue(id, out Led led))
led = InitializeLed(id, new Rectangle());
led.LedRectangle.Location = new Point(layoutLed.X, layoutLed.Y);
led.LedRectangle.Size = new Size(layoutLed.Width, layoutLed.Height);
led.Shape = layoutLed.Shape;
led.ShapeData = layoutLed.ShapeData;
LedImage image = ledImageLayout?.LedImages.FirstOrDefault(x => x.Id == layoutLed.Id);
led.Image = (!string.IsNullOrEmpty(image?.Image))
? new Uri(Path.Combine(imageBasePath, image.Image), UriKind.Absolute)
: new Uri(Path.Combine(imageBasePath, "Missing.png"), UriKind.Absolute);
}
}
}
} }
#endregion #endregion

View File

@ -1,169 +0,0 @@
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using RGB.NET.Core;
namespace RGB.NET.Devices.Logitech
{
internal static class BitmapMapping
{
#region Constants
private const int BITMAP_SIZE = 21 * 6 * 4;
#endregion
#region Properties & Fields
internal static Dictionary<LogitechLedIds, int> BitmapOffset { get; } = new Dictionary<LogitechLedIds, int>
{
{ LogitechLedIds.ESC, 0 },
{ LogitechLedIds.F1, 4 },
{ LogitechLedIds.F2, 8 },
{ LogitechLedIds.F3, 12 },
{ LogitechLedIds.F4, 16 },
{ LogitechLedIds.F5, 20 },
{ LogitechLedIds.F6, 24 },
{ LogitechLedIds.F7, 28 },
{ LogitechLedIds.F8, 32 },
{ LogitechLedIds.F9, 36 },
{ LogitechLedIds.F10, 40 },
{ LogitechLedIds.F11, 44 },
{ LogitechLedIds.F12, 48 },
{ LogitechLedIds.PRINT_SCREEN, 52 },
{ LogitechLedIds.SCROLL_LOCK, 56 },
{ LogitechLedIds.PAUSE_BREAK, 60 },
// { LogitechLedIds.?, 64 },
// { LogitechLedIds.?, 68 },
// { LogitechLedIds.?, 72 },
// { LogitechLedIds.?, 76 },
// { LogitechLedIds.?, 80 },
{ LogitechLedIds.TILDE, 84 },
{ LogitechLedIds.ONE, 88 },
{ LogitechLedIds.TWO, 92 },
{ LogitechLedIds.THREE, 96 },
{ LogitechLedIds.FOUR, 100 },
{ LogitechLedIds.FIVE, 104 },
{ LogitechLedIds.SIX, 108 },
{ LogitechLedIds.SEVEN, 112 },
{ LogitechLedIds.EIGHT, 116 },
{ LogitechLedIds.NINE, 120 },
{ LogitechLedIds.ZERO, 124 },
{ LogitechLedIds.MINUS, 128 },
{ LogitechLedIds.EQUALS, 132 },
{ LogitechLedIds.BACKSPACE, 136 },
{ LogitechLedIds.INSERT, 140 },
{ LogitechLedIds.HOME, 144 },
{ LogitechLedIds.PAGE_UP, 148 },
{ LogitechLedIds.NUM_LOCK, 152 },
{ LogitechLedIds.NUM_SLASH, 156 },
{ LogitechLedIds.NUM_ASTERISK, 160 },
{ LogitechLedIds.NUM_MINUS, 164 },
{ LogitechLedIds.TAB, 168 },
{ LogitechLedIds.Q, 172 },
{ LogitechLedIds.W, 176 },
{ LogitechLedIds.E, 180 },
{ LogitechLedIds.R, 184 },
{ LogitechLedIds.T, 188 },
{ LogitechLedIds.Y, 192 },
{ LogitechLedIds.U, 196 },
{ LogitechLedIds.I, 200 },
{ LogitechLedIds.O, 204 },
{ LogitechLedIds.P, 208 },
{ LogitechLedIds.OPEN_BRACKET, 212 },
{ LogitechLedIds.CLOSE_BRACKET, 216 },
// { LogitechLedIds.?, 220 },
{ LogitechLedIds.KEYBOARD_DELETE, 224 },
{ LogitechLedIds.END, 228 },
{ LogitechLedIds.PAGE_DOWN, 232 },
{ LogitechLedIds.NUM_SEVEN, 236 },
{ LogitechLedIds.NUM_EIGHT, 240 },
{ LogitechLedIds.NUM_NINE, 244 },
{ LogitechLedIds.NUM_PLUS, 248 },
{ LogitechLedIds.CAPS_LOCK, 252 },
{ LogitechLedIds.A, 256 },
{ LogitechLedIds.S, 260 },
{ LogitechLedIds.D, 264 },
{ LogitechLedIds.F, 268 },
{ LogitechLedIds.G, 272 },
{ LogitechLedIds.H, 276 },
{ LogitechLedIds.J, 280 },
{ LogitechLedIds.K, 284 },
{ LogitechLedIds.L, 288 },
{ LogitechLedIds.SEMICOLON, 292 },
{ LogitechLedIds.APOSTROPHE, 296 },
{ LogitechLedIds.NonUsTilde, 300 }, //TODO DarthAffe 26.03.2017: Find the real ID/Name of this key - it's not documented ...
{ LogitechLedIds.ENTER, 304 },
// { LogitechLedIds.?, 308 },
// { LogitechLedIds.?, 312 },
// { LogitechLedIds.?, 316 },
{ LogitechLedIds.NUM_FOUR, 320 },
{ LogitechLedIds.NUM_FIVE, 324 },
{ LogitechLedIds.NUM_SIX, 328 },
// { LogitechLedIds.?, 332 },
{ LogitechLedIds.LEFT_SHIFT, 336 },
{ LogitechLedIds.BACKSLASH, 340 },
{ LogitechLedIds.Z, 344 },
{ LogitechLedIds.X, 348 },
{ LogitechLedIds.C, 352 },
{ LogitechLedIds.V, 356 },
{ LogitechLedIds.B, 360 },
{ LogitechLedIds.N, 364 },
{ LogitechLedIds.M, 368 },
{ LogitechLedIds.COMMA, 372 },
{ LogitechLedIds.PERIOD, 376 },
{ LogitechLedIds.FORWARD_SLASH, 380 },
{ LogitechLedIds.RIGHT_SHIFT, 388 },
// { LogitechLedIds.?, 392 },
{ LogitechLedIds.ARROW_UP, 396 },
// { LogitechLedIds.?, 400 },
{ LogitechLedIds.NUM_ONE, 404 },
{ LogitechLedIds.NUM_TWO, 408 },
{ LogitechLedIds.NUM_THREE, 412 },
{ LogitechLedIds.NUM_ENTER, 416 },
{ LogitechLedIds.LEFT_CONTROL, 420 },
{ LogitechLedIds.LEFT_WINDOWS, 424 },
{ LogitechLedIds.LEFT_ALT, 428 },
// { LogitechLedIds.?, 432 },
// { LogitechLedIds.?, 436 },
{ LogitechLedIds.SPACE, 440 },
// { LogitechLedIds.?, 444 },
// { LogitechLedIds.?, 448 },
// { LogitechLedIds.?, 452 },
// { LogitechLedIds.?, 456 },
// { LogitechLedIds.?, 460 },
{ LogitechLedIds.RIGHT_ALT, 464 },
{ LogitechLedIds.RIGHT_WINDOWS, 468 },
{ LogitechLedIds.APPLICATION_SELECT, 472 },
{ LogitechLedIds.RIGHT_CONTROL, 476 },
{ LogitechLedIds.ARROW_LEFT, 480 },
{ LogitechLedIds.ARROW_DOWN, 484 },
{ LogitechLedIds.ARROW_RIGHT, 488 },
{ LogitechLedIds.NUM_ZERO, 492 },
{ LogitechLedIds.NUM_PERIOD, 496 },
// { LogitechLedIds.?, 500 },
};
#endregion
#region Methods
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static byte[] CreateBitmap() => new byte[BITMAP_SIZE];
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static void SetColor(ref byte[] bitmap, int offset, Color color)
{
bitmap[offset] = color.B;
bitmap[offset + 1] = color.G;
bitmap[offset + 2] = color.R;
bitmap[offset + 3] = color.A;
}
#endregion
}
}

View File

@ -33,9 +33,12 @@ namespace RGB.NET.Devices.Logitech
base.InitializeLayout(); base.InitializeLayout();
if (LedMapping.Count == 0) if (LedMapping.Count == 0)
InitializeLed(new LogitechLedId(this, LogitechLedIds.DEVICE), new Rectangle(0, 0, 10, 10)); InitializeLed(LedId.Custom1, new Rectangle(0, 0, 10, 10));
} }
/// <inheritdoc />
protected override object CreateLedCustomData(LedId ledId) => LogitechLedId.DEVICE;
/// <inheritdoc /> /// <inheritdoc />
protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate) protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate)
{ {

View File

@ -0,0 +1,169 @@
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using RGB.NET.Core;
namespace RGB.NET.Devices.Logitech
{
internal static class BitmapMapping
{
#region Constants
private const int BITMAP_SIZE = 21 * 6 * 4;
#endregion
#region Properties & Fields
internal static Dictionary<LedId, int> BitmapOffset { get; } = new Dictionary<LedId, int>
{
{ LedId.Keyboard_Escape, 0 },
{ LedId.Keyboard_F1, 4 },
{ LedId.Keyboard_F2, 8 },
{ LedId.Keyboard_F3, 12 },
{ LedId.Keyboard_F4, 16 },
{ LedId.Keyboard_F5, 20 },
{ LedId.Keyboard_F6, 24 },
{ LedId.Keyboard_F7, 28 },
{ LedId.Keyboard_F8, 32 },
{ LedId.Keyboard_F9, 36 },
{ LedId.Keyboard_F10, 40 },
{ LedId.Keyboard_F11, 44 },
{ LedId.Keyboard_F12, 48 },
{ LedId.Keyboard_PrintScreen, 52 },
{ LedId.Keyboard_ScrollLock, 56 },
{ LedId.Keyboard_PauseBreak, 60 },
// { LedId.Keyboard_?, 64 },
// { LedId.Keyboard_?, 68 },
// { LedId.Keyboard_?, 72 },
// { LedId.Keyboard_?, 76 },
// { LedId.Keyboard_?, 80 },
{ LedId.Keyboard_GraveAccentAndTilde, 84 },
{ LedId.Keyboard_1, 88 },
{ LedId.Keyboard_2, 92 },
{ LedId.Keyboard_3, 96 },
{ LedId.Keyboard_4, 100 },
{ LedId.Keyboard_5, 104 },
{ LedId.Keyboard_6, 108 },
{ LedId.Keyboard_7, 112 },
{ LedId.Keyboard_8, 116 },
{ LedId.Keyboard_9, 120 },
{ LedId.Keyboard_0, 124 },
{ LedId.Keyboard_MinusAndUnderscore, 128 },
{ LedId.Keyboard_EqualsAndPlus, 132 },
{ LedId.Keyboard_Backspace, 136 },
{ LedId.Keyboard_Insert, 140 },
{ LedId.Keyboard_Home, 144 },
{ LedId.Keyboard_PageUp, 148 },
{ LedId.Keyboard_NumLock, 152 },
{ LedId.Keyboard_NumSlash, 156 },
{ LedId.Keyboard_NumAsterisk, 160 },
{ LedId.Keyboard_NumMinus, 164 },
{ LedId.Keyboard_Tab, 168 },
{ LedId.Keyboard_Q, 172 },
{ LedId.Keyboard_W, 176 },
{ LedId.Keyboard_E, 180 },
{ LedId.Keyboard_R, 184 },
{ LedId.Keyboard_T, 188 },
{ LedId.Keyboard_Y, 192 },
{ LedId.Keyboard_U, 196 },
{ LedId.Keyboard_I, 200 },
{ LedId.Keyboard_O, 204 },
{ LedId.Keyboard_P, 208 },
{ LedId.Keyboard_BracketLeft, 212 },
{ LedId.Keyboard_BracketRight, 216 },
// { LedId.Keyboard_?, 220 },
{ LedId.Keyboard_Delete, 224 },
{ LedId.Keyboard_End, 228 },
{ LedId.Keyboard_PageDown, 232 },
{ LedId.Keyboard_Num7, 236 },
{ LedId.Keyboard_Num8, 240 },
{ LedId.Keyboard_Num9, 244 },
{ LedId.Keyboard_NumPlus, 248 },
{ LedId.Keyboard_CapsLock, 252 },
{ LedId.Keyboard_A, 256 },
{ LedId.Keyboard_S, 260 },
{ LedId.Keyboard_D, 264 },
{ LedId.Keyboard_F, 268 },
{ LedId.Keyboard_G, 272 },
{ LedId.Keyboard_H, 276 },
{ LedId.Keyboard_J, 280 },
{ LedId.Keyboard_K, 284 },
{ LedId.Keyboard_L, 288 },
{ LedId.Keyboard_SemicolonAndColon, 292 },
{ LedId.Keyboard_ApostropheAndDoubleQuote, 296 },
{ LedId.Keyboard_NonUsTilde, 300 }, //TODO DarthAffe 26.03.2017: Find the real ID/Name of this key - it's not documented ...
{ LedId.Keyboard_Enter, 304 },
// { LedId.Keyboard_?, 308 },
// { LedId.Keyboard_?, 312 },
// { LedId.Keyboard_?, 316 },
{ LedId.Keyboard_Num4, 320 },
{ LedId.Keyboard_Num5, 324 },
{ LedId.Keyboard_Num6, 328 },
// { LedId.Keyboard_?, 332 },
{ LedId.Keyboard_LeftShift, 336 },
{ LedId.Keyboard_Backslash, 340 },
{ LedId.Keyboard_Z, 344 },
{ LedId.Keyboard_X, 348 },
{ LedId.Keyboard_C, 352 },
{ LedId.Keyboard_V, 356 },
{ LedId.Keyboard_B, 360 },
{ LedId.Keyboard_N, 364 },
{ LedId.Keyboard_M, 368 },
{ LedId.Keyboard_CommaAndLessThan, 372 },
{ LedId.Keyboard_PeriodAndBiggerThan, 376 },
{ LedId.Keyboard_SlashAndQuestionMark, 380 },
{ LedId.Keyboard_RightShift, 388 },
// { LedId.Keyboard_?, 392 },
{ LedId.Keyboard_ArrowUp, 396 },
// { LedId.Keyboard_?, 400 },
{ LedId.Keyboard_Num1, 404 },
{ LedId.Keyboard_Num2, 408 },
{ LedId.Keyboard_Num3, 412 },
{ LedId.Keyboard_NumEnter, 416 },
{ LedId.Keyboard_LeftCtrl, 420 },
{ LedId.Keyboard_LeftGui, 424 },
{ LedId.Keyboard_LeftAlt, 428 },
// { LedId.Keyboard_?, 432 },
// { LedId.Keyboard_?, 436 },
{ LedId.Keyboard_Space, 440 },
// { LedId.Keyboard_?, 444 },
// { LedId.Keyboard_?, 448 },
// { LedId.Keyboard_?, 452 },
// { LedId.Keyboard_?, 456 },
// { LedId.Keyboard_?, 460 },
{ LedId.Keyboard_RightAlt, 464 },
{ LedId.Keyboard_RightGui, 468 },
{ LedId.Keyboard_Application, 472 },
{ LedId.Keyboard_RightCtrl, 476 },
{ LedId.Keyboard_ArrowLeft, 480 },
{ LedId.Keyboard_ArrowDown, 484 },
{ LedId.Keyboard_ArrowRight, 488 },
{ LedId.Keyboard_Num0, 492 },
{ LedId.Keyboard_NumPeriodAndDelete, 496 },
// { LedId.Keyboard_?, 500 },
};
#endregion
#region Methods
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static byte[] CreateBitmap() => new byte[BITMAP_SIZE];
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static void SetColor(ref byte[] bitmap, int offset, Color color)
{
bitmap[offset] = color.B;
bitmap[offset + 1] = color.G;
bitmap[offset + 2] = color.R;
bitmap[offset + 3] = color.A;
}
#endregion
}
}

View File

@ -27,6 +27,9 @@ namespace RGB.NET.Devices.Logitech
#region Methods #region Methods
/// <inheritdoc />
protected override object CreateLedCustomData(LedId ledId) => PerKeyIdMapping.DEFAULT[ledId];
/// <inheritdoc /> /// <inheritdoc />
protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate) protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate)
{ {
@ -39,7 +42,7 @@ namespace RGB.NET.Devices.Logitech
foreach (Led led in leds) foreach (Led led in leds)
{ {
// DarthAffe 26.03.2017: This is only needed since update by name doesn't work as expected for all keys ... // DarthAffe 26.03.2017: This is only needed since update by name doesn't work as expected for all keys ...
if (BitmapMapping.BitmapOffset.TryGetValue(((LogitechLedId)led.Id).LedId, out int bitmapOffset)) if (BitmapMapping.BitmapOffset.TryGetValue(led.Id, out int bitmapOffset))
{ {
if (bitmap == null) if (bitmap == null)
bitmap = BitmapMapping.CreateBitmap(); bitmap = BitmapMapping.CreateBitmap();
@ -47,7 +50,7 @@ namespace RGB.NET.Devices.Logitech
BitmapMapping.SetColor(ref bitmap, bitmapOffset, led.Color); BitmapMapping.SetColor(ref bitmap, bitmapOffset, led.Color);
} }
else else
_LogitechGSDK.LogiLedSetLightingForKeyWithKeyName((int)((LogitechLedId)led.Id).LedId, _LogitechGSDK.LogiLedSetLightingForKeyWithKeyName((int)led.CustomData,
(int)Math.Round(led.Color.RPercent * 100), (int)Math.Round(led.Color.RPercent * 100),
(int)Math.Round(led.Color.GPercent * 100), (int)Math.Round(led.Color.GPercent * 100),
(int)Math.Round(led.Color.BPercent * 100)); (int)Math.Round(led.Color.BPercent * 100));

View File

@ -0,0 +1,127 @@
using System.Collections.Generic;
using RGB.NET.Core;
namespace RGB.NET.Devices.Logitech
{
internal static class PerKeyIdMapping
{
internal static readonly Dictionary<LedId, LogitechLedId> DEFAULT = new Dictionary<LedId, LogitechLedId>
{
{ LedId.Invalid, LogitechLedId.Invalid },
{ LedId.Keyboard_Escape, LogitechLedId.ESC },
{ LedId.Keyboard_F1, LogitechLedId.F1 },
{ LedId.Keyboard_F2, LogitechLedId.F2 },
{ LedId.Keyboard_F3, LogitechLedId.F3 },
{ LedId.Keyboard_F4, LogitechLedId.F4 },
{ LedId.Keyboard_F5, LogitechLedId.F5 },
{ LedId.Keyboard_F6, LogitechLedId.F6 },
{ LedId.Keyboard_F7, LogitechLedId.F7 },
{ LedId.Keyboard_F8, LogitechLedId.F8 },
{ LedId.Keyboard_F9, LogitechLedId.F9 },
{ LedId.Keyboard_F10, LogitechLedId.F10 },
{ LedId.Keyboard_F11, LogitechLedId.F11 },
{ LedId.Keyboard_GraveAccentAndTilde, LogitechLedId.TILDE },
{ LedId.Keyboard_1, LogitechLedId.ONE },
{ LedId.Keyboard_2, LogitechLedId.TWO },
{ LedId.Keyboard_3, LogitechLedId.THREE },
{ LedId.Keyboard_4, LogitechLedId.FOUR },
{ LedId.Keyboard_5, LogitechLedId.FIVE },
{ LedId.Keyboard_6, LogitechLedId.SIX },
{ LedId.Keyboard_7, LogitechLedId.SEVEN },
{ LedId.Keyboard_8, LogitechLedId.EIGHT },
{ LedId.Keyboard_9, LogitechLedId.NINE },
{ LedId.Keyboard_0, LogitechLedId.ZERO },
{ LedId.Keyboard_MinusAndUnderscore, LogitechLedId.MINUS },
{ LedId.Keyboard_Tab, LogitechLedId.TAB },
{ LedId.Keyboard_Q, LogitechLedId.Q },
{ LedId.Keyboard_W, LogitechLedId.W },
{ LedId.Keyboard_E, LogitechLedId.E },
{ LedId.Keyboard_R, LogitechLedId.R },
{ LedId.Keyboard_T, LogitechLedId.T },
{ LedId.Keyboard_Y, LogitechLedId.Y },
{ LedId.Keyboard_U, LogitechLedId.U },
{ LedId.Keyboard_I, LogitechLedId.I },
{ LedId.Keyboard_O, LogitechLedId.O },
{ LedId.Keyboard_P, LogitechLedId.P },
{ LedId.Keyboard_BracketLeft, LogitechLedId.OPEN_BRACKET },
{ LedId.Keyboard_CapsLock, LogitechLedId.CAPS_LOCK },
{ LedId.Keyboard_A, LogitechLedId.A },
{ LedId.Keyboard_S, LogitechLedId.S },
{ LedId.Keyboard_D, LogitechLedId.D },
{ LedId.Keyboard_F, LogitechLedId.F },
{ LedId.Keyboard_G, LogitechLedId.G },
{ LedId.Keyboard_H, LogitechLedId.H },
{ LedId.Keyboard_J, LogitechLedId.J },
{ LedId.Keyboard_K, LogitechLedId.K },
{ LedId.Keyboard_L, LogitechLedId.L },
{ LedId.Keyboard_SemicolonAndColon, LogitechLedId.SEMICOLON },
{ LedId.Keyboard_ApostropheAndDoubleQuote, LogitechLedId.APOSTROPHE },
{ LedId.Keyboard_LeftShift, LogitechLedId.LEFT_SHIFT },
{ LedId.Keyboard_Z, LogitechLedId.Z },
{ LedId.Keyboard_X, LogitechLedId.X },
{ LedId.Keyboard_C, LogitechLedId.C },
{ LedId.Keyboard_V, LogitechLedId.V },
{ LedId.Keyboard_B, LogitechLedId.B },
{ LedId.Keyboard_N, LogitechLedId.N },
{ LedId.Keyboard_M, LogitechLedId.M },
{ LedId.Keyboard_CommaAndLessThan, LogitechLedId.COMMA },
{ LedId.Keyboard_PeriodAndBiggerThan, LogitechLedId.PERIOD },
{ LedId.Keyboard_SlashAndQuestionMark, LogitechLedId.FORWARD_SLASH },
{ LedId.Keyboard_LeftCtrl, LogitechLedId.LEFT_CONTROL },
{ LedId.Keyboard_LeftGui, LogitechLedId.LEFT_WINDOWS },
{ LedId.Keyboard_LeftAlt, LogitechLedId.LEFT_ALT },
{ LedId.Keyboard_Space, LogitechLedId.SPACE },
{ LedId.Keyboard_RightAlt, LogitechLedId.RIGHT_ALT },
{ LedId.Keyboard_RightGui, LogitechLedId.RIGHT_WINDOWS },
{ LedId.Keyboard_Application, LogitechLedId.APPLICATION_SELECT },
{ LedId.Keyboard_F12, LogitechLedId.F12 },
{ LedId.Keyboard_PrintScreen, LogitechLedId.PRINT_SCREEN },
{ LedId.Keyboard_ScrollLock, LogitechLedId.SCROLL_LOCK },
{ LedId.Keyboard_PauseBreak, LogitechLedId.PAUSE_BREAK },
{ LedId.Keyboard_Insert, LogitechLedId.INSERT },
{ LedId.Keyboard_Home, LogitechLedId.HOME },
{ LedId.Keyboard_PageUp, LogitechLedId.PAGE_UP },
{ LedId.Keyboard_BracketRight, LogitechLedId.CLOSE_BRACKET },
{ LedId.Keyboard_Backslash, LogitechLedId.BACKSLASH },
{ LedId.Keyboard_NonUsTilde, LogitechLedId.NonUsTilde },
{ LedId.Keyboard_Enter, LogitechLedId.ENTER },
{ LedId.Keyboard_EqualsAndPlus, LogitechLedId.EQUALS },
{ LedId.Keyboard_Backspace, LogitechLedId.BACKSPACE },
{ LedId.Keyboard_Delete, LogitechLedId.KEYBOARD_DELETE },
{ LedId.Keyboard_End, LogitechLedId.END },
{ LedId.Keyboard_PageDown, LogitechLedId.PAGE_DOWN },
{ LedId.Keyboard_RightShift, LogitechLedId.RIGHT_SHIFT },
{ LedId.Keyboard_RightCtrl, LogitechLedId.RIGHT_CONTROL },
{ LedId.Keyboard_ArrowUp, LogitechLedId.ARROW_UP },
{ LedId.Keyboard_ArrowLeft, LogitechLedId.ARROW_LEFT },
{ LedId.Keyboard_ArrowDown, LogitechLedId.ARROW_DOWN },
{ LedId.Keyboard_ArrowRight, LogitechLedId.ARROW_RIGHT },
{ LedId.Keyboard_NumLock, LogitechLedId.NUM_LOCK },
{ LedId.Keyboard_NumSlash, LogitechLedId.NUM_SLASH },
{ LedId.Keyboard_NumAsterisk, LogitechLedId.NUM_ASTERISK },
{ LedId.Keyboard_NumMinus, LogitechLedId.NUM_MINUS },
{ LedId.Keyboard_NumPlus, LogitechLedId.NUM_PLUS },
{ LedId.Keyboard_NumEnter, LogitechLedId.NUM_ENTER },
{ LedId.Keyboard_Num7, LogitechLedId.NUM_SEVEN },
{ LedId.Keyboard_Num8, LogitechLedId.NUM_EIGHT },
{ LedId.Keyboard_Num9, LogitechLedId.NUM_NINE },
{ LedId.Keyboard_Num4, LogitechLedId.NUM_FOUR },
{ LedId.Keyboard_Num5, LogitechLedId.NUM_FIVE },
{ LedId.Keyboard_Num6, LogitechLedId.NUM_SIX },
{ LedId.Keyboard_Num1, LogitechLedId.NUM_ONE },
{ LedId.Keyboard_Num2, LogitechLedId.NUM_TWO },
{ LedId.Keyboard_Num3, LogitechLedId.NUM_THREE },
{ LedId.Keyboard_Num0, LogitechLedId.NUM_ZERO },
{ LedId.Keyboard_NumPeriodAndDelete, LogitechLedId.NUM_PERIOD },
{ LedId.Keyboard_Programmable1, LogitechLedId.G_1 },
{ LedId.Keyboard_Programmable2, LogitechLedId.G_2 },
{ LedId.Keyboard_Programmable3, LogitechLedId.G_3 },
{ LedId.Keyboard_Programmable4, LogitechLedId.G_4 },
{ LedId.Keyboard_Programmable5, LogitechLedId.G_5 },
{ LedId.Keyboard_Programmable6, LogitechLedId.G_6 },
{ LedId.Keyboard_Programmable7, LogitechLedId.G_7 },
{ LedId.Keyboard_Programmable8, LogitechLedId.G_8 },
{ LedId.Keyboard_Programmable9, LogitechLedId.G_9 },
};
}
}

View File

@ -52,16 +52,16 @@
<Compile Include="Enum\LogitechLogicalKeyboardLayout.cs" /> <Compile Include="Enum\LogitechLogicalKeyboardLayout.cs" />
<Compile Include="Enum\LogitechPhysicalKeyboardLayout.cs" /> <Compile Include="Enum\LogitechPhysicalKeyboardLayout.cs" />
<Compile Include="Enum\LogitechDeviceCaps.cs" /> <Compile Include="Enum\LogitechDeviceCaps.cs" />
<Compile Include="Enum\LogitechLedIds.cs" /> <Compile Include="Enum\LogitechLedId.cs" />
<Compile Include="Generic\ILogitechRGBDevice.cs" /> <Compile Include="Generic\ILogitechRGBDevice.cs" />
<Compile Include="Generic\LogitechLedId.cs" />
<Compile Include="Generic\LogitechRGBDevice.cs" /> <Compile Include="Generic\LogitechRGBDevice.cs" />
<Compile Include="Generic\LogitechRGBDeviceInfo.cs" /> <Compile Include="Generic\LogitechRGBDeviceInfo.cs" />
<Compile Include="Helper\BitmapMapping.cs" /> <Compile Include="PerKey\BitmapMapping.cs" />
<Compile Include="HID\DeviceChecker.cs" /> <Compile Include="HID\DeviceChecker.cs" />
<Compile Include="LogitechDeviceProvider.cs" /> <Compile Include="LogitechDeviceProvider.cs" />
<Compile Include="Native\_LogitechGSDK.cs" /> <Compile Include="Native\_LogitechGSDK.cs" />
<Compile Include="PerDevice\LogitechPerDeviceRGBDevice.cs" /> <Compile Include="PerDevice\LogitechPerDeviceRGBDevice.cs" />
<Compile Include="PerKey\PerKeyIdMapping.cs" />
<Compile Include="PerKey\LogitechPerKeyRGBDevice.cs" /> <Compile Include="PerKey\LogitechPerKeyRGBDevice.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>

View File

@ -1,16 +0,0 @@
// ReSharper disable InconsistentNaming
#pragma warning disable 1591 // Missing XML comment for publicly visible type or member
namespace RGB.NET.Devices.Msi
{
/// <summary>
/// Contains list of all LEDs available for all Msi devices.
/// </summary>
public enum MsiLedIds
{
Invalid = -1,
//TODO DarthAffe 11.11.2017: Create useful Ids for all devices
}
}

View File

@ -1,111 +0,0 @@
using System.Diagnostics;
using RGB.NET.Core;
namespace RGB.NET.Devices.Msi
{
/// <inheritdoc />
/// <summary>
/// Represents a Id of a <see cref="T:RGB.NET.Core.Led" /> on a <see cref="T:RGB.NET.Devices.Msi.MsiRGBDevice" />.
/// </summary>
[DebuggerDisplay("{" + nameof(LedId) + "}")]
public class MsiLedId : ILedId
{
#region Properties & Fields
internal readonly MsiLedIds LedId;
internal readonly int Index;
/// <inheritdoc />
public IRGBDevice Device { get; }
/// <inheritdoc />
public bool IsValid => LedId != MsiLedIds.Invalid;
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="MsiLedId"/> class.
/// </summary>
/// <param name="device">The <see cref="IRGBDevice"/> the <see cref="ILedId"/> belongs to.</param>
/// <param name="ledId">The <see cref="MsiLedId"/> of the represented <see cref="Led"/>.</param>
public MsiLedId(IRGBDevice device, MsiLedIds ledId)
{
this.Device = device;
this.LedId = ledId;
}
/// <summary>
/// Initializes a new instance of the <see cref="MsiLedId"/> class.
/// </summary>
/// <param name="device">The <see cref="IRGBDevice"/> the <see cref="ILedId"/> belongs to.</param>
/// <param name="ledId">The <see cref="MsiLedId"/> of the represented <see cref="Led"/>.</param>
/// <param name="index">The index in the mapping array of the device.</param>
public MsiLedId(IRGBDevice device, MsiLedIds ledId, int index)
{
this.Device = device;
this.LedId = ledId;
this.Index = index;
}
#endregion
#region Methods
/// <summary>
/// Converts the Id of this <see cref="MsiLedId"/> to a human-readable string.
/// </summary>
/// <returns>A string that contains the Id of this <see cref="MsiLedId"/>. For example "Enter".</returns>
public override string ToString() => LedId.ToString();
/// <summary>
/// Tests whether the specified object is a <see cref="MsiLedId" /> and is equivalent to this <see cref="MsiLedId" />.
/// </summary>
/// <param name="obj">The object to test.</param>
/// <returns><c>true</c> if <paramref name="obj" /> is a <see cref="MsiLedId" /> equivalent to this <see cref="MsiLedId" />; otherwise, <c>false</c>.</returns>
public override bool Equals(object obj)
{
MsiLedId compareLedId = obj as MsiLedId;
if (ReferenceEquals(compareLedId, null))
return false;
if (ReferenceEquals(this, compareLedId))
return true;
if (GetType() != compareLedId.GetType())
return false;
return compareLedId.LedId == LedId;
}
/// <summary>
/// Returns a hash code for this <see cref="MsiLedId" />.
/// </summary>
/// <returns>An integer value that specifies the hash code for this <see cref="MsiLedId" />.</returns>
public override int GetHashCode() => LedId.GetHashCode();
#endregion
#region Operators
/// <summary>
/// Returns a value that indicates whether two specified <see cref="MsiLedId" /> are equal.
/// </summary>
/// <param name="ledId1">The first <see cref="MsiLedId" /> to compare.</param>
/// <param name="ledId2">The second <see cref="MsiLedId" /> to compare.</param>
/// <returns><c>true</c> if <paramref name="ledId1" /> and <paramref name="ledId2" /> are equal; otherwise, <c>false</c>.</returns>
public static bool operator ==(MsiLedId ledId1, MsiLedId ledId2) => ReferenceEquals(ledId1, null) ? ReferenceEquals(ledId2, null) : ledId1.Equals(ledId2);
/// <summary>
/// Returns a value that indicates whether two specified <see cref="MsiLedId" /> are equal.
/// </summary>
/// <param name="ledId1">The first <see cref="MsiLedId" /> to compare.</param>
/// <param name="ledId2">The second <see cref="MsiLedId" /> to compare.</param>
/// <returns><c>true</c> if <paramref name="ledId1" /> and <paramref name="ledId2" /> are not equal; otherwise, <c>false</c>.</returns>
public static bool operator !=(MsiLedId ledId1, MsiLedId ledId2) => !(ledId1 == ledId2);
#endregion
}
}

View File

@ -1,9 +1,6 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using RGB.NET.Core; using RGB.NET.Core;
using RGB.NET.Core.Layout;
using RGB.NET.Devices.Msi.Native; using RGB.NET.Devices.Msi.Native;
namespace RGB.NET.Devices.Msi namespace RGB.NET.Devices.Msi
@ -60,44 +57,6 @@ namespace RGB.NET.Devices.Msi
/// </summary> /// </summary>
protected abstract void InitializeLayout(); protected abstract void InitializeLayout();
/// <summary>
/// Applies the given layout.
/// </summary>
/// <param name="layoutPath">The file containing the layout.</param>
/// <param name="imageLayout">The name of the layout used to get the images of the leds.</param>
/// <param name="imageBasePath">The path images for this device are collected in.</param>
protected void ApplyLayoutFromFile(string layoutPath, string imageLayout, string imageBasePath)
{
DeviceLayout layout = DeviceLayout.Load(layoutPath);
if (layout != null)
{
LedImageLayout ledImageLayout = layout.LedImageLayouts.FirstOrDefault(x => string.Equals(x.Layout, imageLayout, StringComparison.OrdinalIgnoreCase));
Size = new Size(layout.Width, layout.Height);
if (layout.Leds != null)
foreach (LedLayout layoutLed in layout.Leds)
{
if (Enum.TryParse(layoutLed.Id, true, out MsiLedIds ledId))
{
if (LedMapping.TryGetValue(new MsiLedId(this, ledId), out Led led))
{
led.LedRectangle.Location = new Point(layoutLed.X, layoutLed.Y);
led.LedRectangle.Size = new Size(layoutLed.Width, layoutLed.Height);
led.Shape = layoutLed.Shape;
led.ShapeData = layoutLed.ShapeData;
LedImage image = ledImageLayout?.LedImages.FirstOrDefault(x => x.Id == layoutLed.Id);
led.Image = (!string.IsNullOrEmpty(image?.Image))
? new Uri(Path.Combine(imageBasePath, image.Image), UriKind.Absolute)
: new Uri(Path.Combine(imageBasePath, "Missing.png"), UriKind.Absolute);
}
}
}
}
}
/// <inheritdoc /> /// <inheritdoc />
protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate) protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate)
{ {
@ -107,7 +66,7 @@ namespace RGB.NET.Devices.Msi
{ {
string deviceType = DeviceInfo.MsiDeviceType; string deviceType = DeviceInfo.MsiDeviceType;
foreach (Led led in leds) foreach (Led led in leds)
_MsiSDK.SetLedColor(deviceType, ((MsiLedId)led.Id).Index, led.Color.R, led.Color.G, led.Color.B); _MsiSDK.SetLedColor(deviceType, (int)led.CustomData, led.Color.R, led.Color.G, led.Color.B);
} }
} }

View File

@ -45,10 +45,8 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Enum\MsiLedIds.cs" />
<Compile Include="Exceptions\MysticLightException.cs" /> <Compile Include="Exceptions\MysticLightException.cs" />
<Compile Include="Generic\IMsiRGBDevice.cs" /> <Compile Include="Generic\IMsiRGBDevice.cs" />
<Compile Include="Generic\MsiLedId.cs" />
<Compile Include="Generic\MsiRGBDevice.cs" /> <Compile Include="Generic\MsiRGBDevice.cs" />
<Compile Include="Generic\MsiRGBDeviceInfo.cs" /> <Compile Include="Generic\MsiRGBDeviceInfo.cs" />
<Compile Include="MsiDeviceProvider.cs" /> <Compile Include="MsiDeviceProvider.cs" />

View File

@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Novation
/// They are represented as Hex 0x[00][11] where [00] is the status flag, [1] the id of the led. /// They are represented as Hex 0x[00][11] where [00] is the status flag, [1] the id of the led.
/// </summary> /// </summary>
//TODO DarthAffe 15.08.2017: Check if this is really correct for all devices //TODO DarthAffe 15.08.2017: Check if this is really correct for all devices
public enum NovationLedIds public enum NovationLedId
{ {
Invalid = -1, Invalid = -1,

View File

@ -1,108 +0,0 @@
using System.Diagnostics;
using RGB.NET.Core;
namespace RGB.NET.Devices.Novation
{
/// <inheritdoc />
/// <summary>
/// Represents a Id of a <see cref="T:RGB.NET.Core.Led" /> on a <see cref="T:RGB.NET.Devices.Novation.NovationRGBDevice" />.
/// </summary>
[DebuggerDisplay("{" + nameof(LedId) + "}")]
public class NovationLedId : ILedId
{
#region Properties & Fields
internal readonly NovationLedIds LedId;
/// <inheritdoc />
public IRGBDevice Device { get; }
/// <inheritdoc />
public bool IsValid => LedId != NovationLedIds.Invalid;
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="NovationLedId"/> class.
/// </summary>
/// <param name="device">The <see cref="IRGBDevice"/> the <see cref="ILedId"/> belongs to.</param>
/// <param name="ledId">The <see cref="NovationLedId"/> of the represented <see cref="Led"/>.</param>
public NovationLedId(IRGBDevice device, NovationLedIds ledId)
{
this.Device = device;
this.LedId = ledId;
}
#endregion
#region Methods
/// <summary>
/// Converts the Id of this <see cref="NovationLedId"/> to a human-readable string.
/// </summary>
/// <returns>A string that contains the Id of this <see cref="NovationLedId"/>. For example "Enter".</returns>
public override string ToString()
{
return LedId.ToString();
}
/// <summary>
/// Tests whether the specified object is a <see cref="NovationLedId" /> and is equivalent to this <see cref="NovationLedId" />.
/// </summary>
/// <param name="obj">The object to test.</param>
/// <returns><c>true</c> if <paramref name="obj" /> is a <see cref="NovationLedId" /> equivalent to this <see cref="NovationLedId" />; otherwise, <c>false</c>.</returns>
public override bool Equals(object obj)
{
NovationLedId compareLedId = obj as NovationLedId;
if (ReferenceEquals(compareLedId, null))
return false;
if (ReferenceEquals(this, compareLedId))
return true;
if (GetType() != compareLedId.GetType())
return false;
return compareLedId.LedId == LedId;
}
/// <summary>
/// Returns a hash code for this <see cref="NovationLedId" />.
/// </summary>
/// <returns>An integer value that specifies the hash code for this <see cref="NovationLedId" />.</returns>
public override int GetHashCode()
{
return LedId.GetHashCode();
}
#endregion
#region Operators
/// <summary>
/// Returns a value that indicates whether two specified <see cref="NovationLedId" /> are equal.
/// </summary>
/// <param name="ledId1">The first <see cref="NovationLedId" /> to compare.</param>
/// <param name="ledId2">The second <see cref="NovationLedId" /> to compare.</param>
/// <returns><c>true</c> if <paramref name="ledId1" /> and <paramref name="ledId2" /> are equal; otherwise, <c>false</c>.</returns>
public static bool operator ==(NovationLedId ledId1, NovationLedId ledId2)
{
return ReferenceEquals(ledId1, null) ? ReferenceEquals(ledId2, null) : ledId1.Equals(ledId2);
}
/// <summary>
/// Returns a value that indicates whether two specified <see cref="NovationLedId" /> are equal.
/// </summary>
/// <param name="ledId1">The first <see cref="NovationLedId" /> to compare.</param>
/// <param name="ledId2">The second <see cref="NovationLedId" /> to compare.</param>
/// <returns><c>true</c> if <paramref name="ledId1" /> and <paramref name="ledId2" /> are not equal; otherwise, <c>false</c>.</returns>
public static bool operator !=(NovationLedId ledId1, NovationLedId ledId2)
{
return !(ledId1 == ledId2);
}
#endregion
}
}

View File

@ -1,9 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using RGB.NET.Core; using RGB.NET.Core;
using RGB.NET.Core.Layout;
using Sanford.Multimedia.Midi; using Sanford.Multimedia.Midi;
namespace RGB.NET.Devices.Novation namespace RGB.NET.Devices.Novation
@ -66,44 +64,6 @@ namespace RGB.NET.Devices.Novation
/// </summary> /// </summary>
protected abstract void InitializeLayout(); protected abstract void InitializeLayout();
/// <summary>
/// Applies the given layout.
/// </summary>
/// <param name="layoutPath">The file containing the layout.</param>
/// <param name="imageLayout">The name of the layout used to get the images of the leds.</param>
/// <param name="imageBasePath">The path images for this device are collected in.</param>
protected void ApplyLayoutFromFile(string layoutPath, string imageLayout, string imageBasePath)
{
DeviceLayout layout = DeviceLayout.Load(layoutPath);
if (layout != null)
{
LedImageLayout ledImageLayout = layout.LedImageLayouts.FirstOrDefault(x => string.Equals(x.Layout, imageLayout, StringComparison.OrdinalIgnoreCase));
Size = new Size(layout.Width, layout.Height);
if (layout.Leds != null)
foreach (LedLayout layoutLed in layout.Leds)
{
if (Enum.TryParse(layoutLed.Id, true, out NovationLedIds ledId))
{
if (LedMapping.TryGetValue(new NovationLedId(this, ledId), out Led led))
{
led.LedRectangle.Location = new Point(layoutLed.X, layoutLed.Y);
led.LedRectangle.Size = new Size(layoutLed.Width, layoutLed.Height);
led.Shape = layoutLed.Shape;
led.ShapeData = layoutLed.ShapeData;
LedImage image = ledImageLayout?.LedImages.FirstOrDefault(x => x.Id == layoutLed.Id);
led.Image = (!string.IsNullOrEmpty(image?.Image))
? new Uri(Path.Combine(imageBasePath, image.Image), UriKind.Absolute)
: new Uri(Path.Combine(imageBasePath, "Missing.png"), UriKind.Absolute);
}
}
}
}
}
/// <inheritdoc /> /// <inheritdoc />
protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate) protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate)
{ {
@ -113,11 +73,10 @@ namespace RGB.NET.Devices.Novation
{ {
foreach (Led led in leds) foreach (Led led in leds)
{ {
NovationLedId ledId = led.Id as NovationLedId; NovationLedId ledId = (NovationLedId)led.CustomData;
if (ledId == null) continue;
int color = ConvertColor(led.Color); int color = ConvertColor(led.Color);
SendMessage(ledId.LedId.GetStatus(), ledId.LedId.GetId(), color); SendMessage(ledId.GetStatus(), ledId.GetId(), color);
} }
} }
} }

View File

@ -0,0 +1,10 @@
using System.Collections.Generic;
using System.Linq;
namespace RGB.NET.Devices.Novation
{
internal static class DictionaryExtension
{
public static Dictionary<TValue, TKey> SwapKeyValue<TKey, TValue>(this Dictionary<TKey, TValue> dictionary) => dictionary.ToDictionary(x => x.Value, x => x.Key);
}
}

View File

@ -0,0 +1,47 @@
namespace RGB.NET.Devices.Novation
{
/// <summary>
/// Offers some extensions and helper-methods for NovationLedId related things.
/// </summary>
public static class NovationLedIdExtension
{
#region Methods
/// <summary>
/// Gets the status-flag associated with the id.
/// </summary>
/// <param name="ledId">The <see cref="NovationLedId"/> whose status-flag should be determinated.</param>
/// <returns>The status-flag of the <see cref="NovationLedId"/>.</returns>
public static int GetStatus(this NovationLedId ledId) => ((int)ledId & 0xFF00) >> 8;
/// <summary>
/// Gets the id associated with the id.
/// </summary>
/// <param name="ledId">The <see cref="NovationLedId"/> whose idshould be determinated.</param>
/// <returns>The id of the <see cref="NovationLedId"/>.</returns>
public static int GetId(this NovationLedId ledId) => (int)ledId & 0x00FF;
/// <summary>
/// Tests if the given <see cref="NovationLedId"/> is a grid-button.
/// </summary>
/// <param name="ledId">the <see cref="NovationLedId"/> to test.</param>
/// <returns><c>true</c> if <paramref name="ledId" /> is a grid-button; otherwise, <c>false</c>.</returns>
public static bool IsGrid(this NovationLedId ledId) => (ledId.GetStatus() == 0x90) && ((ledId.GetId() / 0x10) < 0x08) && ((ledId.GetId() % 0x10) < 0x08);
/// <summary>
/// Tests if the given <see cref="NovationLedId"/> is a scene-button.
/// </summary>
/// <param name="ledId">the <see cref="NovationLedId"/> to test.</param>
/// <returns><c>true</c> if <paramref name="ledId" /> is a scene-button; otherwise, <c>false</c>.</returns>
public static bool IsScene(this NovationLedId ledId) => (ledId.GetStatus() == 0x90) && ((ledId.GetId() / 0x10) < 0x08) && ((ledId.GetId() % 0x10) == 0x09);
/// <summary>
/// Tests if the given <see cref="NovationLedId"/> is custom-button.
/// </summary>
/// <param name="ledId">the <see cref="NovationLedId"/> to test.</param>
/// <returns><c>true</c> if <paramref name="ledId" /> is a custom-button; otherwise, <c>false</c>.</returns>
public static bool IsCustom(this NovationLedId ledId) => (ledId.GetStatus() == 0xB0) && ((ledId.GetId() / 0x10) == 0x06) && ((ledId.GetId() % 0x10) > 0x07);
#endregion
}
}

View File

@ -1,47 +0,0 @@
namespace RGB.NET.Devices.Novation
{
/// <summary>
/// Offers some extensions and helper-methods for NovationLedIds related things.
/// </summary>
public static class NovationLedIdsExtension
{
#region Methods
/// <summary>
/// Gets the status-flag associated with the id.
/// </summary>
/// <param name="ledId">The <see cref="NovationLedIds"/> whose status-flag should be determinated.</param>
/// <returns>The status-flag of the <see cref="NovationLedIds"/>.</returns>
public static int GetStatus(this NovationLedIds ledId) => ((int)ledId & 0xFF00) >> 8;
/// <summary>
/// Gets the id associated with the id.
/// </summary>
/// <param name="ledId">The <see cref="NovationLedIds"/> whose idshould be determinated.</param>
/// <returns>The id of the <see cref="NovationLedIds"/>.</returns>
public static int GetId(this NovationLedIds ledId) => (int)ledId & 0x00FF;
/// <summary>
/// Tests if the given <see cref="NovationLedIds"/> is a grid-button.
/// </summary>
/// <param name="ledId">the <see cref="NovationLedIds"/> to test.</param>
/// <returns><c>true</c> if <paramref name="ledId" /> is a grid-button; otherwise, <c>false</c>.</returns>
public static bool IsGrid(this NovationLedIds ledId) => (ledId.GetStatus() == 0x90) && ((ledId.GetId() / 0x10) < 0x08) && ((ledId.GetId() % 0x10) < 0x08);
/// <summary>
/// Tests if the given <see cref="NovationLedIds"/> is a scene-button.
/// </summary>
/// <param name="ledId">the <see cref="NovationLedIds"/> to test.</param>
/// <returns><c>true</c> if <paramref name="ledId" /> is a scene-button; otherwise, <c>false</c>.</returns>
public static bool IsScene(this NovationLedIds ledId) => (ledId.GetStatus() == 0x90) && ((ledId.GetId() / 0x10) < 0x08) && ((ledId.GetId() % 0x10) == 0x09);
/// <summary>
/// Tests if the given <see cref="NovationLedIds"/> is custom-button.
/// </summary>
/// <param name="ledId">the <see cref="NovationLedIds"/> to test.</param>
/// <returns><c>true</c> if <paramref name="ledId" /> is a custom-button; otherwise, <c>false</c>.</returns>
public static bool IsCustom(this NovationLedIds ledId) => (ledId.GetStatus() == 0xB0) && ((ledId.GetId() / 0x10) == 0x06) && ((ledId.GetId() % 0x10) > 0x07);
#endregion
}
}

View File

@ -0,0 +1,96 @@
using System.Collections.Generic;
using RGB.NET.Core;
namespace RGB.NET.Devices.Novation
{
internal static class LaunchpadIdMapping
{
internal static readonly Dictionary<LedId, NovationLedId> DEFAULT = new Dictionary<LedId, NovationLedId>
{
{ LedId.Invalid, NovationLedId.Invalid },
{ LedId.LedMatrix1, NovationLedId.Grid1 },
{ LedId.LedMatrix2, NovationLedId.Grid2 },
{ LedId.LedMatrix3, NovationLedId.Grid3 },
{ LedId.LedMatrix4, NovationLedId.Grid4 },
{ LedId.LedMatrix5, NovationLedId.Grid5 },
{ LedId.LedMatrix6, NovationLedId.Grid6 },
{ LedId.LedMatrix7, NovationLedId.Grid7 },
{ LedId.LedMatrix8, NovationLedId.Grid8 },
{ LedId.LedMatrix9, NovationLedId.Grid9 },
{ LedId.LedMatrix10, NovationLedId.Grid10 },
{ LedId.LedMatrix11, NovationLedId.Grid11 },
{ LedId.LedMatrix12, NovationLedId.Grid12 },
{ LedId.LedMatrix13, NovationLedId.Grid13 },
{ LedId.LedMatrix14, NovationLedId.Grid14 },
{ LedId.LedMatrix15, NovationLedId.Grid15 },
{ LedId.LedMatrix16, NovationLedId.Grid16 },
{ LedId.LedMatrix17, NovationLedId.Grid17 },
{ LedId.LedMatrix18, NovationLedId.Grid18 },
{ LedId.LedMatrix19, NovationLedId.Grid19 },
{ LedId.LedMatrix20, NovationLedId.Grid20 },
{ LedId.LedMatrix21, NovationLedId.Grid21 },
{ LedId.LedMatrix22, NovationLedId.Grid22 },
{ LedId.LedMatrix23, NovationLedId.Grid23 },
{ LedId.LedMatrix24, NovationLedId.Grid24 },
{ LedId.LedMatrix25, NovationLedId.Grid25 },
{ LedId.LedMatrix26, NovationLedId.Grid26 },
{ LedId.LedMatrix27, NovationLedId.Grid27 },
{ LedId.LedMatrix28, NovationLedId.Grid28 },
{ LedId.LedMatrix29, NovationLedId.Grid29 },
{ LedId.LedMatrix30, NovationLedId.Grid30 },
{ LedId.LedMatrix31, NovationLedId.Grid31 },
{ LedId.LedMatrix32, NovationLedId.Grid32 },
{ LedId.LedMatrix33, NovationLedId.Grid33 },
{ LedId.LedMatrix34, NovationLedId.Grid34 },
{ LedId.LedMatrix35, NovationLedId.Grid35 },
{ LedId.LedMatrix36, NovationLedId.Grid36 },
{ LedId.LedMatrix37, NovationLedId.Grid37 },
{ LedId.LedMatrix38, NovationLedId.Grid38 },
{ LedId.LedMatrix39, NovationLedId.Grid39 },
{ LedId.LedMatrix40, NovationLedId.Grid40 },
{ LedId.LedMatrix41, NovationLedId.Grid41 },
{ LedId.LedMatrix42, NovationLedId.Grid42 },
{ LedId.LedMatrix43, NovationLedId.Grid43 },
{ LedId.LedMatrix44, NovationLedId.Grid44 },
{ LedId.LedMatrix45, NovationLedId.Grid45 },
{ LedId.LedMatrix46, NovationLedId.Grid46 },
{ LedId.LedMatrix47, NovationLedId.Grid47 },
{ LedId.LedMatrix48, NovationLedId.Grid48 },
{ LedId.LedMatrix49, NovationLedId.Grid49 },
{ LedId.LedMatrix50, NovationLedId.Grid50 },
{ LedId.LedMatrix51, NovationLedId.Grid51 },
{ LedId.LedMatrix52, NovationLedId.Grid52 },
{ LedId.LedMatrix53, NovationLedId.Grid53 },
{ LedId.LedMatrix54, NovationLedId.Grid54 },
{ LedId.LedMatrix55, NovationLedId.Grid55 },
{ LedId.LedMatrix56, NovationLedId.Grid56 },
{ LedId.LedMatrix57, NovationLedId.Grid57 },
{ LedId.LedMatrix58, NovationLedId.Grid58 },
{ LedId.LedMatrix59, NovationLedId.Grid59 },
{ LedId.LedMatrix60, NovationLedId.Grid60 },
{ LedId.LedMatrix61, NovationLedId.Grid61 },
{ LedId.LedMatrix62, NovationLedId.Grid62 },
{ LedId.LedMatrix63, NovationLedId.Grid63 },
{ LedId.LedMatrix64, NovationLedId.Grid64 },
{ LedId.Custom1, NovationLedId.Up },
{ LedId.Custom2, NovationLedId.Down },
{ LedId.Custom3, NovationLedId.Left },
{ LedId.Custom4, NovationLedId.Right },
{ LedId.Custom5, NovationLedId.Session },
{ LedId.Custom6, NovationLedId.User1 },
{ LedId.Custom7, NovationLedId.User2 },
{ LedId.Custom8, NovationLedId.Mix },
{ LedId.Custom9, NovationLedId.Scene1 },
{ LedId.Custom10, NovationLedId.Scene2 },
{ LedId.Custom11, NovationLedId.Scene3 },
{ LedId.Custom12, NovationLedId.Scene4 },
{ LedId.Custom13, NovationLedId.Scene5 },
{ LedId.Custom14, NovationLedId.Scene6 },
{ LedId.Custom15, NovationLedId.Scene7 },
{ LedId.Custom16, NovationLedId.Scene8 },
};
}
}

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using RGB.NET.Core; using RGB.NET.Core;
namespace RGB.NET.Devices.Novation namespace RGB.NET.Devices.Novation
@ -27,9 +28,11 @@ namespace RGB.NET.Devices.Novation
/// <inheritdoc /> /// <inheritdoc />
protected override void InitializeLayout() protected override void InitializeLayout()
{ {
Dictionary<NovationLedId, LedId> mapping = LaunchpadIdMapping.DEFAULT.SwapKeyValue();
//TODO DarthAffe 15.08.2017: Check if all launchpads are using the same basic layout //TODO DarthAffe 15.08.2017: Check if all launchpads are using the same basic layout
const int BUTTON_SIZE = 20; const int BUTTON_SIZE = 20;
foreach (NovationLedIds ledId in Enum.GetValues(typeof(NovationLedIds))) foreach (NovationLedId ledId in Enum.GetValues(typeof(NovationLedId)))
{ {
Rectangle rectangle; Rectangle rectangle;
if (ledId.IsCustom()) if (ledId.IsCustom())
@ -40,7 +43,7 @@ namespace RGB.NET.Devices.Novation
rectangle = new Rectangle(BUTTON_SIZE * ((int)ledId.GetId() % 0x10), BUTTON_SIZE * (((int)ledId.GetId() / 0x10) + 1), BUTTON_SIZE, BUTTON_SIZE); rectangle = new Rectangle(BUTTON_SIZE * ((int)ledId.GetId() % 0x10), BUTTON_SIZE * (((int)ledId.GetId() / 0x10) + 1), BUTTON_SIZE, BUTTON_SIZE);
else continue; else continue;
InitializeLed(new NovationLedId(this, ledId), rectangle); InitializeLed(mapping[ledId], rectangle);
} }
string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper(); string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper();
@ -48,6 +51,9 @@ namespace RGB.NET.Devices.Novation
$@"Layouts\Novation\Launchpads\{model.ToUpper()}.xml"), "Default", PathHelper.GetAbsolutePath(@"Images\Novation\Launchpads")); $@"Layouts\Novation\Launchpads\{model.ToUpper()}.xml"), "Default", PathHelper.GetAbsolutePath(@"Images\Novation\Launchpads"));
} }
/// <inheritdoc />
protected override object CreateLedCustomData(LedId ledId) => LaunchpadIdMapping.DEFAULT[ledId];
#endregion #endregion
} }
} }

View File

@ -12,50 +12,50 @@
<LedUnitHeight>20</LedUnitHeight> <LedUnitHeight>20</LedUnitHeight>
<Leds> <Leds>
<!-- Custom-buttons --> <!-- Custom-buttons -->
<Led Id="Up"> <Led Id="Custom1">
<Shape>Circle</Shape> <Shape>Circle</Shape>
<X>16</X> <X>16</X>
<Y>18</Y> <Y>18</Y>
<Width>16mm</Width> <Width>16mm</Width>
<Height>16mm</Height> <Height>16mm</Height>
</Led> </Led>
<Led Id="Down"> <Led Id="Custom2">
<Shape>Circle</Shape> <Shape>Circle</Shape>
<X>+8</X> <X>+8</X>
<Width>16mm</Width> <Width>16mm</Width>
<Height>16mm</Height> <Height>16mm</Height>
</Led> </Led>
<Led Id="Left"> <Led Id="Custom3">
<Shape>Circle</Shape> <Shape>Circle</Shape>
<X>+8</X> <X>+8</X>
<Width>16mm</Width> <Width>16mm</Width>
<Height>16mm</Height> <Height>16mm</Height>
</Led> </Led>
<Led Id="Right"> <Led Id="Custom4">
<Shape>Circle</Shape> <Shape>Circle</Shape>
<X>+8</X> <X>+8</X>
<Width>16mm</Width> <Width>16mm</Width>
<Height>16mm</Height> <Height>16mm</Height>
</Led> </Led>
<Led Id="Session"> <Led Id="Custom5">
<Shape>Circle</Shape> <Shape>Circle</Shape>
<X>+8</X> <X>+8</X>
<Width>16mm</Width> <Width>16mm</Width>
<Height>16mm</Height> <Height>16mm</Height>
</Led> </Led>
<Led Id="User1"> <Led Id="Custom6">
<Shape>Circle</Shape> <Shape>Circle</Shape>
<X>+8</X> <X>+8</X>
<Width>16mm</Width> <Width>16mm</Width>
<Height>16mm</Height> <Height>16mm</Height>
</Led> </Led>
<Led Id="User2"> <Led Id="Custom7">
<Shape>Circle</Shape> <Shape>Circle</Shape>
<X>+8</X> <X>+8</X>
<Width>16mm</Width> <Width>16mm</Width>
<Height>16mm</Height> <Height>16mm</Height>
</Led> </Led>
<Led Id="Mix"> <Led Id="Custom8">
<Shape>Circle</Shape> <Shape>Circle</Shape>
<X>+8</X> <X>+8</X>
<Width>16mm</Width> <Width>16mm</Width>
@ -63,269 +63,269 @@
</Led> </Led>
<!-- Grid --> <!-- Grid -->
<Led Id="Grid1"> <Led Id="LedMatrix1">
<X>14</X> <X>14</X>
<Y>+4</Y> <Y>+4</Y>
</Led> </Led>
<Led Id="Grid2"> <Led Id="LedMatrix2">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid3"> <Led Id="LedMatrix3">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid4"> <Led Id="LedMatrix4">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid5"> <Led Id="LedMatrix5">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid6"> <Led Id="LedMatrix6">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid7"> <Led Id="LedMatrix7">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid8"> <Led Id="LedMatrix8">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid9"> <Led Id="LedMatrix9">
<X>14</X> <X>14</X>
<Y>+4</Y> <Y>+4</Y>
</Led> </Led>
<Led Id="Grid10"> <Led Id="LedMatrix10">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid11"> <Led Id="LedMatrix11">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid12"> <Led Id="LedMatrix12">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid13"> <Led Id="LedMatrix13">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid14"> <Led Id="LedMatrix14">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid15"> <Led Id="LedMatrix15">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid16"> <Led Id="LedMatrix16">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid17"> <Led Id="LedMatrix17">
<X>14</X> <X>14</X>
<Y>+4</Y> <Y>+4</Y>
</Led> </Led>
<Led Id="Grid18"> <Led Id="LedMatrix18">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid19"> <Led Id="LedMatrix19">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid20"> <Led Id="LedMatrix20">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid21"> <Led Id="LedMatrix21">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid22"> <Led Id="LedMatrix22">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid23"> <Led Id="LedMatrix23">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid24"> <Led Id="LedMatrix24">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid25"> <Led Id="LedMatrix25">
<X>14</X> <X>14</X>
<Y>+4</Y> <Y>+4</Y>
</Led> </Led>
<Led Id="Grid26"> <Led Id="LedMatrix26">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid27"> <Led Id="LedMatrix27">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid28"> <Led Id="LedMatrix28">
<X>+4</X> <X>+4</X>
<Shape>M0,0 L0,1 L0.75,1 L1,0.75 L1,0 Z</Shape> <Shape>M0,0 L0,1 L0.75,1 L1,0.75 L1,0 Z</Shape>
</Led> </Led>
<Led Id="Grid29"> <Led Id="LedMatrix29">
<X>+4</X> <X>+4</X>
<Shape>M0,0 L0,0.75 L0.25,1 L1,1 L1,0 Z</Shape> <Shape>M0,0 L0,0.75 L0.25,1 L1,1 L1,0 Z</Shape>
</Led> </Led>
<Led Id="Grid30"> <Led Id="LedMatrix30">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid31"> <Led Id="LedMatrix31">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid32"> <Led Id="LedMatrix32">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid33"> <Led Id="LedMatrix33">
<X>14</X> <X>14</X>
<Y>+4</Y> <Y>+4</Y>
</Led> </Led>
<Led Id="Grid34"> <Led Id="LedMatrix34">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid35"> <Led Id="LedMatrix35">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid36"> <Led Id="LedMatrix36">
<X>+4</X> <X>+4</X>
<Shape>M0,0 L0,1 L1,1 L1,0.25 L0.75,0 Z</Shape> <Shape>M0,0 L0,1 L1,1 L1,0.25 L0.75,0 Z</Shape>
</Led> </Led>
<Led Id="Grid37"> <Led Id="LedMatrix37">
<X>+4</X> <X>+4</X>
<Shape>M0,0.25 L0,1 L1,1 L1,0 L0.25,0 Z</Shape> <Shape>M0,0.25 L0,1 L1,1 L1,0 L0.25,0 Z</Shape>
</Led> </Led>
<Led Id="Grid38"> <Led Id="LedMatrix38">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid39"> <Led Id="LedMatrix39">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid40"> <Led Id="LedMatrix40">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid41"> <Led Id="LedMatrix41">
<X>14</X> <X>14</X>
<Y>+4</Y> <Y>+4</Y>
</Led> </Led>
<Led Id="Grid42"> <Led Id="LedMatrix42">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid43"> <Led Id="LedMatrix43">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid44"> <Led Id="LedMatrix44">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid45"> <Led Id="LedMatrix45">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid46"> <Led Id="LedMatrix46">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid47"> <Led Id="LedMatrix47">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid48"> <Led Id="LedMatrix48">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid49"> <Led Id="LedMatrix49">
<X>14</X> <X>14</X>
<Y>+4</Y> <Y>+4</Y>
</Led> </Led>
<Led Id="Grid50"> <Led Id="LedMatrix50">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid51"> <Led Id="LedMatrix51">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid52"> <Led Id="LedMatrix52">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid53"> <Led Id="LedMatrix53">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid54"> <Led Id="LedMatrix54">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid55"> <Led Id="LedMatrix55">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid56"> <Led Id="LedMatrix56">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid57"> <Led Id="LedMatrix57">
<X>14</X> <X>14</X>
<Y>+4</Y> <Y>+4</Y>
</Led> </Led>
<Led Id="Grid58"> <Led Id="LedMatrix58">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid59"> <Led Id="LedMatrix59">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid60"> <Led Id="LedMatrix60">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid61"> <Led Id="LedMatrix61">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid62"> <Led Id="LedMatrix62">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid63"> <Led Id="LedMatrix63">
<X>+4</X> <X>+4</X>
</Led> </Led>
<Led Id="Grid64"> <Led Id="LedMatrix64">
<X>+4</X> <X>+4</X>
</Led> </Led>
<!-- Scene-buttons --> <!-- Scene-buttons -->
<Led Id="Scene1"> <Led Id="Custom9">
<Shape>Circle</Shape> <Shape>Circle</Shape>
<X>+4</X> <X>+4</X>
<Y>40</Y> <Y>40</Y>
<Width>16mm</Width> <Width>16mm</Width>
<Height>16mm</Height> <Height>16mm</Height>
</Led> </Led>
<Led Id="Scene2"> <Led Id="Custom10">
<Shape>Circle</Shape> <Shape>Circle</Shape>
<X>~</X> <X>~</X>
<Y>+8</Y> <Y>+8</Y>
<Width>16mm</Width> <Width>16mm</Width>
<Height>16mm</Height> <Height>16mm</Height>
</Led> </Led>
<Led Id="Scene3"> <Led Id="Custom11">
<Shape>Circle</Shape> <Shape>Circle</Shape>
<X>~</X> <X>~</X>
<Y>+8</Y> <Y>+8</Y>
<Width>16mm</Width> <Width>16mm</Width>
<Height>16mm</Height> <Height>16mm</Height>
</Led> </Led>
<Led Id="Scene4"> <Led Id="Custom12">
<Shape>Circle</Shape> <Shape>Circle</Shape>
<X>~</X> <X>~</X>
<Y>+8</Y> <Y>+8</Y>
<Width>16mm</Width> <Width>16mm</Width>
<Height>16mm</Height> <Height>16mm</Height>
</Led> </Led>
<Led Id="Scene5"> <Led Id="Custom13">
<Shape>Circle</Shape> <Shape>Circle</Shape>
<X>~</X> <X>~</X>
<Y>+8</Y> <Y>+8</Y>
<Width>16mm</Width> <Width>16mm</Width>
<Height>16mm</Height> <Height>16mm</Height>
</Led> </Led>
<Led Id="Scene6"> <Led Id="Custom14">
<Shape>Circle</Shape> <Shape>Circle</Shape>
<X>~</X> <X>~</X>
<Y>+8</Y> <Y>+8</Y>
<Width>16mm</Width> <Width>16mm</Width>
<Height>16mm</Height> <Height>16mm</Height>
</Led> </Led>
<Led Id="Scene7"> <Led Id="Custom15">
<Shape>Circle</Shape> <Shape>Circle</Shape>
<X>~</X> <X>~</X>
<Y>+8</Y> <Y>+8</Y>
<Width>16mm</Width> <Width>16mm</Width>
<Height>16mm</Height> <Height>16mm</Height>
</Led> </Led>
<Led Id="Scene8"> <Led Id="Custom16">
<Shape>Circle</Shape> <Shape>Circle</Shape>
<X>~</X> <X>~</X>
<Y>+8</Y> <Y>+8</Y>
@ -337,88 +337,88 @@
<LedImageLayouts> <LedImageLayouts>
<LedImageLayout Layout="Default"> <LedImageLayout Layout="Default">
<LedImages> <LedImages>
<LedImage Id="Up" Image="Buttons\Round.png" /> <LedImage Id="Custom1" Image="Buttons\Round.png" />
<LedImage Id="Down" Image="Buttons\Round.png" /> <LedImage Id="Custom2" Image="Buttons\Round.png" />
<LedImage Id="Left" Image="Buttons\Round.png" /> <LedImage Id="Custom3" Image="Buttons\Round.png" />
<LedImage Id="Right" Image="Buttons\Round.png" /> <LedImage Id="Custom4" Image="Buttons\Round.png" />
<LedImage Id="Session" Image="Buttons\Round.png" /> <LedImage Id="Custom5" Image="Buttons\Round.png" />
<LedImage Id="User1" Image="Buttons\Round.png" /> <LedImage Id="Custom6" Image="Buttons\Round.png" />
<LedImage Id="User2" Image="Buttons\Round.png" /> <LedImage Id="Custom7" Image="Buttons\Round.png" />
<LedImage Id="Mix" Image="Buttons\Round.png" /> <LedImage Id="Custom8" Image="Buttons\Round.png" />
<LedImage Id="Scene1" Image="Buttons\Round.png" /> <LedImage Id="Custom9" Image="Buttons\Round.png" />
<LedImage Id="Scene2" Image="Buttons\Round.png" /> <LedImage Id="Custom10" Image="Buttons\Round.png" />
<LedImage Id="Scene3" Image="Buttons\Round.png" /> <LedImage Id="Custom11" Image="Buttons\Round.png" />
<LedImage Id="Scene4" Image="Buttons\Round.png" /> <LedImage Id="Custom12" Image="Buttons\Round.png" />
<LedImage Id="Scene5" Image="Buttons\Round.png" /> <LedImage Id="Custom13" Image="Buttons\Round.png" />
<LedImage Id="Scene6" Image="Buttons\Round.png" /> <LedImage Id="Custom14" Image="Buttons\Round.png" />
<LedImage Id="Scene7" Image="Buttons\Round.png" /> <LedImage Id="Custom15" Image="Buttons\Round.png" />
<LedImage Id="Scene8" Image="Buttons\Round.png" /> <LedImage Id="Custom16" Image="Buttons\Round.png" />
<LedImage Id="Grid1" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix1" Image="Buttons\Grid.png" />
<LedImage Id="Grid2" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix2" Image="Buttons\Grid.png" />
<LedImage Id="Grid3" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix3" Image="Buttons\Grid.png" />
<LedImage Id="Grid4" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix4" Image="Buttons\Grid.png" />
<LedImage Id="Grid5" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix5" Image="Buttons\Grid.png" />
<LedImage Id="Grid6" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix6" Image="Buttons\Grid.png" />
<LedImage Id="Grid7" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix7" Image="Buttons\Grid.png" />
<LedImage Id="Grid8" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix8" Image="Buttons\Grid.png" />
<LedImage Id="Grid9" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix9" Image="Buttons\Grid.png" />
<LedImage Id="Grid10" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix10" Image="Buttons\Grid.png" />
<LedImage Id="Grid11" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix11" Image="Buttons\Grid.png" />
<LedImage Id="Grid12" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix12" Image="Buttons\Grid.png" />
<LedImage Id="Grid13" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix13" Image="Buttons\Grid.png" />
<LedImage Id="Grid14" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix14" Image="Buttons\Grid.png" />
<LedImage Id="Grid15" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix15" Image="Buttons\Grid.png" />
<LedImage Id="Grid16" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix16" Image="Buttons\Grid.png" />
<LedImage Id="Grid17" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix17" Image="Buttons\Grid.png" />
<LedImage Id="Grid18" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix18" Image="Buttons\Grid.png" />
<LedImage Id="Grid19" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix19" Image="Buttons\Grid.png" />
<LedImage Id="Grid20" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix20" Image="Buttons\Grid.png" />
<LedImage Id="Grid21" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix21" Image="Buttons\Grid.png" />
<LedImage Id="Grid22" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix22" Image="Buttons\Grid.png" />
<LedImage Id="Grid23" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix23" Image="Buttons\Grid.png" />
<LedImage Id="Grid24" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix24" Image="Buttons\Grid.png" />
<LedImage Id="Grid25" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix25" Image="Buttons\Grid.png" />
<LedImage Id="Grid26" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix26" Image="Buttons\Grid.png" />
<LedImage Id="Grid27" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix27" Image="Buttons\Grid.png" />
<LedImage Id="Grid28" Image="Buttons\GridCenter1.png" /> <LedImage Id="LedMatrix28" Image="Buttons\GridCenter1.png" />
<LedImage Id="Grid29" Image="Buttons\GridCenter2.png" /> <LedImage Id="LedMatrix29" Image="Buttons\GridCenter2.png" />
<LedImage Id="Grid30" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix30" Image="Buttons\Grid.png" />
<LedImage Id="Grid31" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix31" Image="Buttons\Grid.png" />
<LedImage Id="Grid32" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix32" Image="Buttons\Grid.png" />
<LedImage Id="Grid33" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix33" Image="Buttons\Grid.png" />
<LedImage Id="Grid34" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix34" Image="Buttons\Grid.png" />
<LedImage Id="Grid35" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix35" Image="Buttons\Grid.png" />
<LedImage Id="Grid36" Image="Buttons\GridCenter3.png" /> <LedImage Id="LedMatrix36" Image="Buttons\GridCenter3.png" />
<LedImage Id="Grid37" Image="Buttons\GridCenter4.png" /> <LedImage Id="LedMatrix37" Image="Buttons\GridCenter4.png" />
<LedImage Id="Grid38" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix38" Image="Buttons\Grid.png" />
<LedImage Id="Grid39" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix39" Image="Buttons\Grid.png" />
<LedImage Id="Grid40" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix40" Image="Buttons\Grid.png" />
<LedImage Id="Grid41" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix41" Image="Buttons\Grid.png" />
<LedImage Id="Grid42" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix42" Image="Buttons\Grid.png" />
<LedImage Id="Grid43" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix43" Image="Buttons\Grid.png" />
<LedImage Id="Grid44" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix44" Image="Buttons\Grid.png" />
<LedImage Id="Grid45" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix45" Image="Buttons\Grid.png" />
<LedImage Id="Grid46" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix46" Image="Buttons\Grid.png" />
<LedImage Id="Grid47" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix47" Image="Buttons\Grid.png" />
<LedImage Id="Grid48" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix48" Image="Buttons\Grid.png" />
<LedImage Id="Grid49" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix49" Image="Buttons\Grid.png" />
<LedImage Id="Grid50" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix50" Image="Buttons\Grid.png" />
<LedImage Id="Grid51" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix51" Image="Buttons\Grid.png" />
<LedImage Id="Grid52" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix52" Image="Buttons\Grid.png" />
<LedImage Id="Grid53" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix53" Image="Buttons\Grid.png" />
<LedImage Id="Grid54" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix54" Image="Buttons\Grid.png" />
<LedImage Id="Grid55" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix55" Image="Buttons\Grid.png" />
<LedImage Id="Grid56" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix56" Image="Buttons\Grid.png" />
<LedImage Id="Grid57" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix57" Image="Buttons\Grid.png" />
<LedImage Id="Grid58" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix58" Image="Buttons\Grid.png" />
<LedImage Id="Grid59" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix59" Image="Buttons\Grid.png" />
<LedImage Id="Grid60" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix60" Image="Buttons\Grid.png" />
<LedImage Id="Grid61" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix61" Image="Buttons\Grid.png" />
<LedImage Id="Grid62" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix62" Image="Buttons\Grid.png" />
<LedImage Id="Grid63" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix63" Image="Buttons\Grid.png" />
<LedImage Id="Grid64" Image="Buttons\Grid.png" /> <LedImage Id="LedMatrix64" Image="Buttons\Grid.png" />
</LedImages> </LedImages>
</LedImageLayout> </LedImageLayout>
</LedImageLayouts> </LedImageLayouts>

View File

@ -53,13 +53,14 @@
<Compile Include="Attributes\DeviceIdAttribute.cs" /> <Compile Include="Attributes\DeviceIdAttribute.cs" />
<Compile Include="Enum\NovationColorCapabilities.cs" /> <Compile Include="Enum\NovationColorCapabilities.cs" />
<Compile Include="Enum\NovationDevices.cs" /> <Compile Include="Enum\NovationDevices.cs" />
<Compile Include="Enum\NovationLedIds.cs" /> <Compile Include="Enum\NovationLedId.cs" />
<Compile Include="Generic\NovationLedId.cs" />
<Compile Include="Generic\NovationRGBDevice.cs" /> <Compile Include="Generic\NovationRGBDevice.cs" />
<Compile Include="Generic\NovationRGBDeviceInfo.cs" /> <Compile Include="Generic\NovationRGBDeviceInfo.cs" />
<Compile Include="Helper\DictionaryExtension.cs" />
<Compile Include="Helper\EnumExtension.cs" /> <Compile Include="Helper\EnumExtension.cs" />
<Compile Include="Helper\NovationLedIdsExtension.cs" /> <Compile Include="Helper\NovationLedIdExtension.cs" />
<Compile Include="Generic\INovationRGBDevice.cs" /> <Compile Include="Generic\INovationRGBDevice.cs" />
<Compile Include="Launchpad\LaunchpadIdMapping.cs" />
<Compile Include="Launchpad\NovationLaunchpadRGBDevice.cs" /> <Compile Include="Launchpad\NovationLaunchpadRGBDevice.cs" />
<Compile Include="Launchpad\NovationLaunchpadRGBDeviceInfo.cs" /> <Compile Include="Launchpad\NovationLaunchpadRGBDeviceInfo.cs" />
<Compile Include="NovationDeviceProvider.cs" /> <Compile Include="NovationDeviceProvider.cs" />

View File

@ -39,16 +39,19 @@ namespace RGB.NET.Devices.Razer
if (LedMapping.Count == 0) if (LedMapping.Count == 0)
for (int i = 0; i < _Defines.CHROMALINK_MAX_LEDS; i++) for (int i = 0; i < _Defines.CHROMALINK_MAX_LEDS; i++)
InitializeLed(new RazerLedId(this, i), new Rectangle(i * 11, 0, 10, 10)); InitializeLed(LedId.Custom1 + i, new Rectangle(i * 11, 0, 10, 10));
} }
/// <inheritdoc />
protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Custom1;
/// <inheritdoc /> /// <inheritdoc />
protected override IntPtr CreateEffectParams(IEnumerable<Led> leds) protected override IntPtr CreateEffectParams(IEnumerable<Led> leds)
{ {
_Color[] colors = new _Color[_Defines.CHROMALINK_MAX_LEDS]; _Color[] colors = new _Color[_Defines.CHROMALINK_MAX_LEDS];
foreach (Led led in leds) foreach (Led led in leds)
colors[((RazerLedId)led.Id).Index] = new _Color(led.Color.R, led.Color.G, led.Color.B); colors[(int)led.CustomData] = new _Color(led.Color.R, led.Color.G, led.Color.B);
_ChromaLinkCustomEffect effectParams = new _ChromaLinkCustomEffect { Color = colors }; _ChromaLinkCustomEffect effectParams = new _ChromaLinkCustomEffect { Color = colors };

View File

@ -1,94 +0,0 @@
using RGB.NET.Core;
namespace RGB.NET.Devices.Razer
{
/// <inheritdoc />
/// <summary>
/// Represents a Id of a <see cref="T:RGB.NET.Core.Led" /> on a <see cref="T:RGB.NET.Devices.Razer.RazerRGBDevice" />.
/// </summary>
public class RazerLedId : ILedId
{
#region Properties & Fields
internal int Index { get; }
/// <inheritdoc />
public IRGBDevice Device { get; }
/// <inheritdoc />
public bool IsValid => true;
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="RazerLedId"/> class.
/// </summary>
/// <param name="device">The <see cref="IRGBDevice"/> the <see cref="ILedId"/> belongs to.</param>
/// <param name="index">The index representing the led-location in the grid.</param>
public RazerLedId(IRGBDevice device, int index)
{
this.Device = device;
this.Index = index;
}
#endregion
#region Methods
/// <summary>
/// Converts the Id of this <see cref="RazerLedId"/> to a human-readable string.
/// </summary>
/// <returns>A string that contains the Id of this <see cref="RazerLedId"/>. For example "Enter".</returns>
public override string ToString() => Index.ToString();
/// <summary>
/// Tests whether the specified object is a <see cref="RazerLedId" /> and is equivalent to this <see cref="RazerLedId" />.
/// </summary>
/// <param name="obj">The object to test.</param>
/// <returns><c>true</c> if <paramref name="obj" /> is a <see cref="RazerLedId" /> equivalent to this <see cref="RazerLedId" />; otherwise, <c>false</c>.</returns>
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (!(obj is RazerLedId other)) return false;
return (Index == other.Index) && Equals(Device, other.Device);
}
/// <summary>
/// Returns a hash code for this <see cref="RazerLedId" />.
/// </summary>
/// <returns>An integer value that specifies the hash code for this <see cref="RazerLedId" />.</returns>
public override int GetHashCode()
{
unchecked
{
return (Index * 397) ^ (Device != null ? Device.GetHashCode() : 0);
}
}
#endregion
#region Operators
/// <summary>
/// Returns a value that indicates whether two specified <see cref="RazerLedId" /> are equal.
/// </summary>
/// <param name="ledId1">The first <see cref="RazerLedId" /> to compare.</param>
/// <param name="ledId2">The second <see cref="RazerLedId" /> to compare.</param>
/// <returns><c>true</c> if <paramref name="ledId1" /> and <paramref name="ledId2" /> are equal; otherwise, <c>false</c>.</returns>
public static bool operator ==(RazerLedId ledId1, RazerLedId ledId2) => ReferenceEquals(ledId1, null) ? ReferenceEquals(ledId2, null) : ledId1.Equals(ledId2);
/// <summary>
/// Returns a value that indicates whether two specified <see cref="RazerLedId" /> are equal.
/// </summary>
/// <param name="ledId1">The first <see cref="RazerLedId" /> to compare.</param>
/// <param name="ledId2">The second <see cref="RazerLedId" /> to compare.</param>
/// <returns><c>true</c> if <paramref name="ledId1" /> and <paramref name="ledId2" /> are not equal; otherwise, <c>false</c>.</returns>
public static bool operator !=(RazerLedId ledId1, RazerLedId ledId2) => !(ledId1 == ledId2);
#endregion
}
}

View File

@ -1,9 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using RGB.NET.Core; using RGB.NET.Core;
using RGB.NET.Core.Layout;
using RGB.NET.Devices.Razer.Native; using RGB.NET.Devices.Razer.Native;
namespace RGB.NET.Devices.Razer namespace RGB.NET.Devices.Razer
@ -61,45 +59,7 @@ namespace RGB.NET.Devices.Razer
/// Initializes the <see cref="Led"/> and <see cref="Size"/> of the device. /// Initializes the <see cref="Led"/> and <see cref="Size"/> of the device.
/// </summary> /// </summary>
protected abstract void InitializeLayout(); protected abstract void InitializeLayout();
/// <summary>
/// Applies the given layout.
/// </summary>
/// <param name="layoutPath">The file containing the layout.</param>
/// <param name="imageLayout">The name of the layout used to get the images of the leds.</param>
/// <param name="imageBasePath">The path images for this device are collected in.</param>
protected void ApplyLayoutFromFile(string layoutPath, string imageLayout, string imageBasePath)
{
DeviceLayout layout = DeviceLayout.Load(layoutPath);
if (layout != null)
{
LedImageLayout ledImageLayout = layout.LedImageLayouts.FirstOrDefault(x => string.Equals(x.Layout, imageLayout, StringComparison.OrdinalIgnoreCase));
Size = new Size(layout.Width, layout.Height);
if (layout.Leds != null)
foreach (LedLayout layoutLed in layout.Leds)
{
if (Enum.TryParse(layoutLed.Id, true, out int ledIndex))
{
if (LedMapping.TryGetValue(new RazerLedId(this, ledIndex), out Led led))
{
led.LedRectangle.Location = new Point(layoutLed.X, layoutLed.Y);
led.LedRectangle.Size = new Size(layoutLed.Width, layoutLed.Height);
led.Shape = layoutLed.Shape;
led.ShapeData = layoutLed.ShapeData;
LedImage image = ledImageLayout?.LedImages.FirstOrDefault(x => x.Id == layoutLed.Id);
led.Image = (!string.IsNullOrEmpty(image?.Image))
? new Uri(Path.Combine(imageBasePath, image.Image), UriKind.Absolute)
: new Uri(Path.Combine(imageBasePath, "Missing.png"), UriKind.Absolute);
}
}
}
}
}
/// <inheritdoc /> /// <inheritdoc />
protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate) protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate)
{ {

View File

@ -39,16 +39,19 @@ namespace RGB.NET.Devices.Razer
if (LedMapping.Count == 0) if (LedMapping.Count == 0)
for (int i = 0; i < _Defines.HEADSET_MAX_LEDS; i++) for (int i = 0; i < _Defines.HEADSET_MAX_LEDS; i++)
InitializeLed(new RazerLedId(this, i), new Rectangle(i * 11, 0, 10, 10)); InitializeLed(LedId.Headset1 + i, new Rectangle(i * 11, 0, 10, 10));
} }
/// <inheritdoc />
protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Headset1;
/// <inheritdoc /> /// <inheritdoc />
protected override IntPtr CreateEffectParams(IEnumerable<Led> leds) protected override IntPtr CreateEffectParams(IEnumerable<Led> leds)
{ {
_Color[] colors = new _Color[_Defines.HEADSET_MAX_LEDS]; _Color[] colors = new _Color[_Defines.HEADSET_MAX_LEDS];
foreach (Led led in leds) foreach (Led led in leds)
colors[((RazerLedId)led.Id).Index] = new _Color(led.Color.R, led.Color.G, led.Color.B); colors[(int)led.CustomData] = new _Color(led.Color.R, led.Color.G, led.Color.B);
_HeadsetCustomEffect effectParams = new _HeadsetCustomEffect { Color = colors }; _HeadsetCustomEffect effectParams = new _HeadsetCustomEffect { Color = colors };

View File

@ -38,21 +38,25 @@ namespace RGB.NET.Devices.Razer
// $@"Layouts\Razer\Keyboards\{model}\{DeviceInfo.PhysicalLayout.ToString().ToUpper()}.xml"), // $@"Layouts\Razer\Keyboards\{model}\{DeviceInfo.PhysicalLayout.ToString().ToUpper()}.xml"),
// DeviceInfo.LogicalLayout.ToString(), PathHelper.GetAbsolutePath(@"Images\Razer\Keyboards")); // DeviceInfo.LogicalLayout.ToString(), PathHelper.GetAbsolutePath(@"Images\Razer\Keyboards"));
//TODO DarthAffe 13.12.2017: Correctly select ids
if (LedMapping.Count == 0) if (LedMapping.Count == 0)
{ {
for (int i = 0; i < _Defines.KEYBOARD_MAX_ROW; i++) for (int i = 0; i < _Defines.KEYBOARD_MAX_ROW; i++)
for (int j = 0; j < _Defines.KEYBOARD_MAX_COLUMN; j++) for (int j = 0; j < _Defines.KEYBOARD_MAX_COLUMN; j++)
InitializeLed(new RazerLedId(this, (i * _Defines.KEYBOARD_MAX_COLUMN) + j), new Rectangle(j * 20, i * 20, 19, 19)); InitializeLed(LedId.Keyboard_Escape + ((i * _Defines.KEYBOARD_MAX_COLUMN) + j), new Rectangle(j * 20, i * 20, 19, 19));
} }
} }
/// <inheritdoc />
protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Keyboard_Escape;
/// <inheritdoc /> /// <inheritdoc />
protected override IntPtr CreateEffectParams(IEnumerable<Led> leds) protected override IntPtr CreateEffectParams(IEnumerable<Led> leds)
{ {
_Color[] colors = new _Color[_Defines.KEYBOARD_MAX_LEDS]; _Color[] colors = new _Color[_Defines.KEYBOARD_MAX_LEDS];
foreach (Led led in leds) foreach (Led led in leds)
colors[((RazerLedId)led.Id).Index] = new _Color(led.Color.R, led.Color.G, led.Color.B); colors[(int)led.CustomData] = new _Color(led.Color.R, led.Color.G, led.Color.B);
_KeyboardCustomEffect effectParams = new _KeyboardCustomEffect { Color = colors }; _KeyboardCustomEffect effectParams = new _KeyboardCustomEffect { Color = colors };

View File

@ -41,17 +41,20 @@ namespace RGB.NET.Devices.Razer
{ {
for (int i = 0; i < _Defines.KEYPAD_MAX_ROW; i++) for (int i = 0; i < _Defines.KEYPAD_MAX_ROW; i++)
for (int j = 0; j < _Defines.KEYPAD_MAX_COLUMN; j++) for (int j = 0; j < _Defines.KEYPAD_MAX_COLUMN; j++)
InitializeLed(new RazerLedId(this, (i * _Defines.KEYPAD_MAX_COLUMN) + j), new Rectangle(j * 20, i * 20, 19, 19)); InitializeLed(LedId.Keypad1 + ((i * _Defines.KEYPAD_MAX_COLUMN) + j), new Rectangle(j * 20, i * 20, 19, 19));
} }
} }
/// <inheritdoc />
protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Keypad1;
/// <inheritdoc /> /// <inheritdoc />
protected override IntPtr CreateEffectParams(IEnumerable<Led> leds) protected override IntPtr CreateEffectParams(IEnumerable<Led> leds)
{ {
_Color[] colors = new _Color[_Defines.KEYPAD_MAX_LEDS]; _Color[] colors = new _Color[_Defines.KEYPAD_MAX_LEDS];
foreach (Led led in leds) foreach (Led led in leds)
colors[((RazerLedId)led.Id).Index] = new _Color(led.Color.R, led.Color.G, led.Color.B); colors[(int)led.CustomData] = new _Color(led.Color.R, led.Color.G, led.Color.B);
_KeypadCustomEffect effectParams = new _KeypadCustomEffect { Color = colors }; _KeypadCustomEffect effectParams = new _KeypadCustomEffect { Color = colors };

View File

@ -41,17 +41,20 @@ namespace RGB.NET.Devices.Razer
{ {
for (int i = 0; i < _Defines.MOUSE_MAX_ROW; i++) for (int i = 0; i < _Defines.MOUSE_MAX_ROW; i++)
for (int j = 0; j < _Defines.MOUSE_MAX_COLUMN; j++) for (int j = 0; j < _Defines.MOUSE_MAX_COLUMN; j++)
InitializeLed(new RazerLedId(this, (i * _Defines.MOUSE_MAX_COLUMN) + j), new Rectangle(j * 11, i * 11, 10, 10)); InitializeLed(LedId.Mouse1 + ((i * _Defines.MOUSE_MAX_COLUMN) + j), new Rectangle(j * 11, i * 11, 10, 10));
} }
} }
/// <inheritdoc />
protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mouse1;
/// <inheritdoc /> /// <inheritdoc />
protected override IntPtr CreateEffectParams(IEnumerable<Led> leds) protected override IntPtr CreateEffectParams(IEnumerable<Led> leds)
{ {
_Color[] colors = new _Color[_Defines.MOUSE_MAX_LEDS]; _Color[] colors = new _Color[_Defines.MOUSE_MAX_LEDS];
foreach (Led led in leds) foreach (Led led in leds)
colors[((RazerLedId)led.Id).Index] = new _Color(led.Color.R, led.Color.G, led.Color.B); colors[(int)led.CustomData] = new _Color(led.Color.R, led.Color.G, led.Color.B);
_MouseCustomEffect effectParams = new _MouseCustomEffect { Color = colors }; _MouseCustomEffect effectParams = new _MouseCustomEffect { Color = colors };

View File

@ -39,16 +39,19 @@ namespace RGB.NET.Devices.Razer
if (LedMapping.Count == 0) if (LedMapping.Count == 0)
for (int i = 0; i < _Defines.MOUSEPAD_MAX_LEDS; i++) for (int i = 0; i < _Defines.MOUSEPAD_MAX_LEDS; i++)
InitializeLed(new RazerLedId(this, i), new Rectangle(i * 11, 0, 10, 10)); InitializeLed(LedId.Mousepad1 + i, new Rectangle(i * 11, 0, 10, 10));
} }
/// <inheritdoc />
protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mousepad1;
/// <inheritdoc /> /// <inheritdoc />
protected override IntPtr CreateEffectParams(IEnumerable<Led> leds) protected override IntPtr CreateEffectParams(IEnumerable<Led> leds)
{ {
_Color[] colors = new _Color[_Defines.MOUSEPAD_MAX_LEDS]; _Color[] colors = new _Color[_Defines.MOUSEPAD_MAX_LEDS];
foreach (Led led in leds) foreach (Led led in leds)
colors[((RazerLedId)led.Id).Index] = new _Color(led.Color.R, led.Color.G, led.Color.B); colors[(int)led.CustomData] = new _Color(led.Color.R, led.Color.G, led.Color.B);
_MousepadCustomEffect effectParams = new _MousepadCustomEffect { Color = colors }; _MousepadCustomEffect effectParams = new _MousepadCustomEffect { Color = colors };

View File

@ -49,7 +49,6 @@
<Compile Include="Enum\RazerPhysicalKeyboardLayout.cs" /> <Compile Include="Enum\RazerPhysicalKeyboardLayout.cs" />
<Compile Include="Enum\DeviceType.cs" /> <Compile Include="Enum\DeviceType.cs" />
<Compile Include="Exceptions\RazerException.cs" /> <Compile Include="Exceptions\RazerException.cs" />
<Compile Include="Generic\RazerLedId.cs" />
<Compile Include="Generic\RazerRGBDevice.cs" /> <Compile Include="Generic\RazerRGBDevice.cs" />
<Compile Include="Generic\RazerRGBDeviceInfo.cs" /> <Compile Include="Generic\RazerRGBDeviceInfo.cs" />
<Compile Include="Generic\Devices.cs" /> <Compile Include="Generic\Devices.cs" />

View File

@ -25,21 +25,7 @@ namespace RGB.NET.Groups
} }
return listLedGroup; return listLedGroup;
} }
/// <summary>
/// Returns a new <see cref="ListLedGroup" /> which contains all <see cref="Led"/> from the given <see cref="ILedGroup"/> excluding the specified ones.
/// </summary>
/// <param name="ledGroup">The base <see cref="ILedGroup"/>.</param>
/// <param name="ledIds">The ids of the <see cref="Led"/> to exclude.</param>
/// <returns>The new <see cref="ListLedGroup" />.</returns>
public static ListLedGroup Exclude(this ILedGroup ledGroup, params ILedId[] ledIds)
{
ListLedGroup listLedGroup = ledGroup.ToListLedGroup();
foreach (ILedId ledId in ledIds)
listLedGroup.RemoveLed(ledId);
return listLedGroup;
}
/// <summary> /// <summary>
/// Returns a new <see cref="ListLedGroup" /> which contains all <see cref="Led"/> from the given <see cref="ILedGroup"/> excluding the specified ones. /// Returns a new <see cref="ListLedGroup" /> which contains all <see cref="Led"/> from the given <see cref="ILedGroup"/> excluding the specified ones.
/// </summary> /// </summary>
@ -60,19 +46,13 @@ namespace RGB.NET.Groups
/// </summary> /// </summary>
/// <param name="ledGroup">The <see cref="ILedGroup"/> to attach.</param> /// <param name="ledGroup">The <see cref="ILedGroup"/> to attach.</param>
/// <returns><c>true</c> if the <see cref="ILedGroup"/> could be attached; otherwise, <c>false</c>.</returns> /// <returns><c>true</c> if the <see cref="ILedGroup"/> could be attached; otherwise, <c>false</c>.</returns>
public static bool Attach(this ILedGroup ledGroup) public static bool Attach(this ILedGroup ledGroup) => RGBSurface.Instance.AttachLedGroup(ledGroup);
{
return RGBSurface.Instance.AttachLedGroup(ledGroup);
}
/// <summary> /// <summary>
/// Detaches the given <see cref="ILedGroup"/> from the <see cref="RGBSurface"/>. /// Detaches the given <see cref="ILedGroup"/> from the <see cref="RGBSurface"/>.
/// </summary> /// </summary>
/// <param name="ledGroup">The <see cref="ILedGroup"/> to attach.</param> /// <param name="ledGroup">The <see cref="ILedGroup"/> to attach.</param>
/// <returns><c>true</c> if the <see cref="ILedGroup"/> could be detached; otherwise, <c>false</c>.</returns> /// <returns><c>true</c> if the <see cref="ILedGroup"/> could be detached; otherwise, <c>false</c>.</returns>
public static bool Detach(this ILedGroup ledGroup) public static bool Detach(this ILedGroup ledGroup) => RGBSurface.Instance.DetachLedGroup(ledGroup);
{
return RGBSurface.Instance.DetachLedGroup(ledGroup);
}
} }
} }

View File

@ -13,7 +13,7 @@ namespace RGB.NET.Groups
public class ListLedGroup : AbstractLedGroup public class ListLedGroup : AbstractLedGroup
{ {
#region Properties & Fields #region Properties & Fields
/// <summary> /// <summary>
/// Gets the list containing the <see cref="Led"/> of this <see cref="ListLedGroup"/>. /// Gets the list containing the <see cref="Led"/> of this <see cref="ListLedGroup"/>.
/// </summary> /// </summary>
@ -74,48 +74,6 @@ namespace RGB.NET.Groups
AddLeds(leds); AddLeds(leds);
} }
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:RGB.NET.Groups.ListLedGroup" /> class.
/// </summary>
/// <param name="leds">The IDs of the initial <see cref="T:RGB.NET.Core.Led" /> of this <see cref="T:RGB.NET.Groups.ListLedGroup" />.</param>
public ListLedGroup(params ILedId[] leds)
: this(true, leds)
{ }
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:RGB.NET.Groups.ListLedGroup" /> class.
/// </summary>
/// <param name="leds">The IDs of the initial <see cref="T:RGB.NET.Core.Led" /> of this <see cref="T:RGB.NET.Groups.ListLedGroup" />.</param>
public ListLedGroup(IEnumerable<ILedId> leds)
: this(true, leds)
{ }
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:RGB.NET.Groups.ListLedGroup" /> class.
/// </summary>
/// <param name="autoAttach">Specifies whether this <see cref="T:RGB.NET.Groups.ListLedGroup" /> should be automatically attached or not.</param>
/// <param name="leds">The IDs of the initial <see cref="T:RGB.NET.Core.Led" /> of this <see cref="T:RGB.NET.Groups.ListLedGroup" />.</param>
public ListLedGroup(bool autoAttach, params ILedId[] leds)
: base(autoAttach)
{
AddLeds(leds);
}
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:RGB.NET.Groups.ListLedGroup" /> class.
/// </summary>
/// <param name="autoAttach">Specifies whether this <see cref="T:RGB.NET.Groups.ListLedGroup" /> should be automatically attached or not.</param>
/// <param name="leds">The IDs of the initial <see cref="T:RGB.NET.Core.Led" /> of this <see cref="T:RGB.NET.Groups.ListLedGroup" />.</param>
public ListLedGroup(bool autoAttach, IEnumerable<ILedId> leds)
: base(autoAttach)
{
AddLeds(leds);
}
#endregion #endregion
#region Methods #region Methods
@ -124,19 +82,7 @@ namespace RGB.NET.Groups
/// Adds the given LED(s) to this <see cref="ListLedGroup"/>. /// Adds the given LED(s) to this <see cref="ListLedGroup"/>.
/// </summary> /// </summary>
/// <param name="leds">The LED(s) to add.</param> /// <param name="leds">The LED(s) to add.</param>
public void AddLed(params Led[] leds) public void AddLed(params Led[] leds) => AddLeds(leds);
{
AddLeds(leds);
}
/// <summary>
/// Adds the given LED(s) to this <see cref="ListLedGroup"/>.
/// </summary>
/// <param name="ledIds">The ID(s) of the LED(s) to add.</param>
public void AddLed(params ILedId[] ledIds)
{
AddLeds(ledIds);
}
/// <summary> /// <summary>
/// Adds the given <see cref="Led"/> to this <see cref="ListLedGroup"/>. /// Adds the given <see cref="Led"/> to this <see cref="ListLedGroup"/>.
@ -151,35 +97,11 @@ namespace RGB.NET.Groups
GroupLeds.Add(led); GroupLeds.Add(led);
} }
/// <summary>
/// Adds the given <see cref="Led"/> to this <see cref="ListLedGroup"/>.
/// </summary>
/// <param name="ledIds">The IDs of the <see cref="Led"/> to add.</param>
public void AddLeds(IEnumerable<ILedId> ledIds)
{
if (ledIds == null) return;
foreach (ILedId ledId in ledIds)
AddLed(ledId.Device[ledId]);
}
/// <summary> /// <summary>
/// Removes the given LED(s) from this <see cref="ListLedGroup"/>. /// Removes the given LED(s) from this <see cref="ListLedGroup"/>.
/// </summary> /// </summary>
/// <param name="leds">The LED(s) to remove.</param> /// <param name="leds">The LED(s) to remove.</param>
public void RemoveLed(params Led[] leds) public void RemoveLed(params Led[] leds) => RemoveLeds(leds);
{
RemoveLeds(leds);
}
/// <summary>
/// Removes the given LED(s) from this <see cref="ListLedGroup"/>.
/// </summary>
/// <param name="ledIds">The ID(s) of the LED(s) to remove.</param>
public void RemoveLed(params ILedId[] ledIds)
{
RemoveLeds(ledIds);
}
/// <summary> /// <summary>
/// Removes the given <see cref="Led"/> from this <see cref="ListLedGroup"/>. /// Removes the given <see cref="Led"/> from this <see cref="ListLedGroup"/>.
@ -194,37 +116,12 @@ namespace RGB.NET.Groups
GroupLeds.Remove(led); GroupLeds.Remove(led);
} }
/// <summary>
/// Removes the given <see cref="Led"/> from this <see cref="ListLedGroup"/>.
/// </summary>
/// <param name="ledIds">The IDs of the <see cref="Led"/> to remove.</param>
public void RemoveLeds(IEnumerable<ILedId> ledIds)
{
if (ledIds == null) return;
foreach (ILedId ledId in ledIds)
RemoveLed(ledId.Device[ledId]);
}
/// <summary> /// <summary>
/// Checks if a given LED is contained by this ledgroup. /// Checks if a given LED is contained by this ledgroup.
/// </summary> /// </summary>
/// <param name="led">The LED which should be checked.</param> /// <param name="led">The LED which should be checked.</param>
/// <returns><c>true</c> if the LED is contained by this ledgroup; otherwise, <c>false</c>.</returns> /// <returns><c>true</c> if the LED is contained by this ledgroup; otherwise, <c>false</c>.</returns>
public bool ContainsLed(Led led) public bool ContainsLed(Led led) => (led != null) && GroupLeds.Contains(led);
{
return (led != null) && GroupLeds.Contains(led);
}
/// <summary>
/// Checks if a given LED is contained by this ledgroup.
/// </summary>
/// <param name="ledId">The ID of the LED which should be checked.</param>
/// <returns><c>true</c> if the LED is contained by this ledgroup; otherwise, <c>false</c>.</returns>
public bool ContainsLed(ILedId ledId)
{
return ContainsLed(ledId.Device[ledId]);
}
/// <summary> /// <summary>
/// Merges the <see cref="Led"/> from the given ledgroup in this ledgroup. /// Merges the <see cref="Led"/> from the given ledgroup in this ledgroup.
@ -242,10 +139,7 @@ namespace RGB.NET.Groups
/// Gets a list containing the <see cref="T:RGB.NET.Core.Led" /> from this group. /// Gets a list containing the <see cref="T:RGB.NET.Core.Led" /> from this group.
/// </summary> /// </summary>
/// <returns>The list containing the <see cref="T:RGB.NET.Core.Led" />.</returns> /// <returns>The list containing the <see cref="T:RGB.NET.Core.Led" />.</returns>
public override IEnumerable<Led> GetLeds() public override IEnumerable<Led> GetLeds() => GroupLeds;
{
return GroupLeds;
}
#endregion #endregion
} }

View File

@ -60,18 +60,6 @@ namespace RGB.NET.Groups
#region Constructors #region Constructors
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:RGB.NET.Groups.RectangleLedGroup" /> class.
/// </summary>
/// <param name="fromLed">They ID of the first <see cref="T:RGB.NET.Core.Led" /> to calculate the <see cref="T:RGB.NET.Core.Rectangle" /> of this <see cref="T:RGB.NET.Groups.RectangleLedGroup" /> from.</param>
/// <param name="toLed">They ID of the second <see cref="T:RGB.NET.Core.Led" /> to calculate the <see cref="T:RGB.NET.Core.Rectangle" /> of this <see cref="T:RGB.NET.Groups.RectangleLedGroup" /> from.</param>
/// <param name="minOverlayPercentage">(optional) The minimal percentage overlay a <see cref="T:RGB.NET.Core.Led" /> must have with the <see cref="P:RGB.NET.Groups.RectangleLedGroup.Rectangle" /> to be taken into the <see cref="T:RGB.NET.Groups.RectangleLedGroup" />. (default: 0.5)</param>
/// <param name="autoAttach">(optional) Specifies whether this <see cref="T:RGB.NET.Groups.RectangleLedGroup" /> should be automatically attached or not. (default: true)</param>
public RectangleLedGroup(ILedId fromLed, ILedId toLed, double minOverlayPercentage = 0.5, bool autoAttach = true)
: this(fromLed.Device[fromLed], toLed.Device[toLed], minOverlayPercentage, autoAttach)
{ }
/// <inheritdoc /> /// <inheritdoc />
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="T:RGB.NET.Groups.RectangleLedGroup" /> class. /// Initializes a new instance of the <see cref="T:RGB.NET.Groups.RectangleLedGroup" /> class.