mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Fixed CUE.NET implementation to actually use the Nuget package
This commit is contained in:
parent
182d710d16
commit
310bd52efc
@ -160,7 +160,6 @@
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="CUE.NET, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\CUE.NET.1.1.1\lib\net45\CUE.NET.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
|
||||
@ -1,80 +1,80 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using CUE.NET;
|
||||
using CUE.NET.Devices.Generic.Enums;
|
||||
using Ninject.Extensions.Logging;
|
||||
|
||||
namespace Artemis.DeviceProviders.Corsair
|
||||
{
|
||||
public class CorsairHeadset : DeviceProvider
|
||||
{
|
||||
public CorsairHeadset(ILogger logger)
|
||||
{
|
||||
Logger = logger;
|
||||
Type = DeviceType.Headset;
|
||||
}
|
||||
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
public override bool TryEnable()
|
||||
{
|
||||
CanUse = CanInitializeSdk();
|
||||
if (CanUse && !CueSDK.IsInitialized)
|
||||
CueSDK.Initialize();
|
||||
|
||||
Logger.Debug("Attempted to enable Corsair headset. CanUse: {0}", CanUse);
|
||||
|
||||
if (CanUse)
|
||||
CueSDK.HeadsetSDK.UpdateMode = UpdateMode.Manual;
|
||||
|
||||
return CanUse;
|
||||
}
|
||||
|
||||
public override void Disable()
|
||||
{
|
||||
throw new NotSupportedException("Can only disable a keyboard");
|
||||
}
|
||||
|
||||
public override void UpdateDevice(Bitmap bitmap)
|
||||
{
|
||||
if (!CanUse || bitmap == null)
|
||||
return;
|
||||
if (bitmap.Width != bitmap.Height)
|
||||
throw new ArgumentException("Bitmap must be a perfect square");
|
||||
|
||||
var leds = CueSDK.HeadsetSDK.Leds.Count();
|
||||
var step = (double) bitmap.Width/leds;
|
||||
|
||||
var ledIndex = 0;
|
||||
// Color each LED according to one of the pixels
|
||||
foreach (var corsairLed in CueSDK.HeadsetSDK.Leds)
|
||||
{
|
||||
var col = ledIndex == 0
|
||||
? bitmap.GetPixel(0, 0)
|
||||
: bitmap.GetPixel((int) ((ledIndex + 1)*step - 1), (int) ((ledIndex + 1)*step - 1));
|
||||
|
||||
corsairLed.Color = col;
|
||||
ledIndex++;
|
||||
}
|
||||
|
||||
CueSDK.HeadsetSDK.Update();
|
||||
}
|
||||
|
||||
private static bool CanInitializeSdk()
|
||||
{
|
||||
// This will skip the check-loop if the SDK is initialized
|
||||
if (CueSDK.IsInitialized)
|
||||
return CueSDK.IsSDKAvailable(CorsairDeviceType.Headset);
|
||||
|
||||
for (var tries = 0; tries < 9; tries++)
|
||||
{
|
||||
if (CueSDK.IsSDKAvailable(CorsairDeviceType.Headset))
|
||||
return true;
|
||||
Thread.Sleep(2000);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using CUE.NET;
|
||||
using CUE.NET.Devices.Generic.Enums;
|
||||
using Ninject.Extensions.Logging;
|
||||
|
||||
namespace Artemis.DeviceProviders.Corsair
|
||||
{
|
||||
public class CorsairHeadset : DeviceProvider
|
||||
{
|
||||
public CorsairHeadset(ILogger logger)
|
||||
{
|
||||
Logger = logger;
|
||||
Type = DeviceType.Headset;
|
||||
}
|
||||
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
public override bool TryEnable()
|
||||
{
|
||||
CanUse = CanInitializeSdk();
|
||||
if (CanUse && !CueSDK.IsInitialized)
|
||||
CueSDK.Initialize();
|
||||
|
||||
Logger.Debug("Attempted to enable Corsair headset. CanUse: {0}", CanUse);
|
||||
|
||||
if (CanUse)
|
||||
CueSDK.UpdateMode = UpdateMode.Manual;
|
||||
|
||||
return CanUse;
|
||||
}
|
||||
|
||||
public override void Disable()
|
||||
{
|
||||
throw new NotSupportedException("Can only disable a keyboard");
|
||||
}
|
||||
|
||||
public override void UpdateDevice(Bitmap bitmap)
|
||||
{
|
||||
if (!CanUse || bitmap == null)
|
||||
return;
|
||||
if (bitmap.Width != bitmap.Height)
|
||||
throw new ArgumentException("Bitmap must be a perfect square");
|
||||
|
||||
var leds = CueSDK.HeadsetSDK.Leds.Count();
|
||||
var step = (double)bitmap.Width / leds;
|
||||
|
||||
var ledIndex = 0;
|
||||
// Color each LED according to one of the pixels
|
||||
foreach (var corsairLed in CueSDK.HeadsetSDK.Leds)
|
||||
{
|
||||
var col = ledIndex == 0
|
||||
? bitmap.GetPixel(0, 0)
|
||||
: bitmap.GetPixel((int)((ledIndex + 1) * step - 1), (int)((ledIndex + 1) * step - 1));
|
||||
|
||||
corsairLed.Color = col;
|
||||
ledIndex++;
|
||||
}
|
||||
|
||||
CueSDK.HeadsetSDK.Update();
|
||||
}
|
||||
|
||||
private static bool CanInitializeSdk()
|
||||
{
|
||||
// This will skip the check-loop if the SDK is initialized
|
||||
if (CueSDK.IsInitialized)
|
||||
return CueSDK.IsSDKAvailable(CorsairDeviceType.Headset);
|
||||
|
||||
for (var tries = 0; tries < 9; tries++)
|
||||
{
|
||||
if (CueSDK.IsSDKAvailable(CorsairDeviceType.Headset))
|
||||
return true;
|
||||
Thread.Sleep(2000);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -8,8 +8,8 @@ using Artemis.Properties;
|
||||
using Artemis.Utilities;
|
||||
using CUE.NET;
|
||||
using CUE.NET.Brushes;
|
||||
using CUE.NET.Devices.Generic;
|
||||
using CUE.NET.Devices.Generic.Enums;
|
||||
using CUE.NET.Devices.Keyboard.Keys;
|
||||
using CUE.NET.Exceptions;
|
||||
using CUE.NET.Helper;
|
||||
using Ninject.Extensions.Logging;
|
||||
@ -47,7 +47,7 @@ namespace Artemis.DeviceProviders.Corsair
|
||||
if (!CueSDK.IsInitialized)
|
||||
CueSDK.Initialize();
|
||||
|
||||
CueSDK.KeyboardSDK.UpdateMode = UpdateMode.Manual;
|
||||
CueSDK.UpdateMode = UpdateMode.Manual;
|
||||
_keyboard = CueSDK.KeyboardSDK;
|
||||
switch (_keyboard.DeviceInfo.Model)
|
||||
{
|
||||
@ -136,25 +136,25 @@ namespace Artemis.DeviceProviders.Corsair
|
||||
|
||||
public override KeyMatch? GetKeyPosition(Keys keyCode)
|
||||
{
|
||||
var widthMultiplier = Width / _keyboard.KeyboardRectangle.Width;
|
||||
var heightMultiplier = Height / _keyboard.KeyboardRectangle.Height;
|
||||
var widthMultiplier = Width / _keyboard.Brush.RenderedRectangle.Width;
|
||||
var heightMultiplier = Height / _keyboard.Brush.RenderedRectangle.Height;
|
||||
|
||||
CorsairKey cueKey = null;
|
||||
CorsairLed cueLed = null;
|
||||
try
|
||||
{
|
||||
cueKey = _keyboard.Keys.FirstOrDefault(k => k.KeyId.ToString() == keyCode.ToString()) ??
|
||||
_keyboard.Keys.FirstOrDefault(k => k.KeyId == KeyMap.FormsKeys[keyCode]);
|
||||
cueLed = _keyboard.Leds.FirstOrDefault(k => k.Id.ToString() == keyCode.ToString()) ??
|
||||
_keyboard.Leds.FirstOrDefault(k => k.Id == KeyMap.FormsKeys[keyCode]);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
if (cueKey == null)
|
||||
if (cueLed == null)
|
||||
return null;
|
||||
|
||||
var center = cueKey.KeyRectangle.GetCenter();
|
||||
return new KeyMatch(keyCode, (int) (center.X * widthMultiplier), (int) (center.Y * heightMultiplier));
|
||||
var center = cueLed.LedRectangle.GetCenter();
|
||||
return new KeyMatch(keyCode, (int)(center.X * widthMultiplier), (int)(center.Y * heightMultiplier));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,80 +1,80 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using CUE.NET;
|
||||
using CUE.NET.Devices.Generic.Enums;
|
||||
using Ninject.Extensions.Logging;
|
||||
|
||||
namespace Artemis.DeviceProviders.Corsair
|
||||
{
|
||||
public class CorsairMouse : DeviceProvider
|
||||
{
|
||||
public CorsairMouse(ILogger logger)
|
||||
{
|
||||
Logger = logger;
|
||||
Type = DeviceType.Mouse;
|
||||
}
|
||||
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
public override bool TryEnable()
|
||||
{
|
||||
CanUse = CanInitializeSdk();
|
||||
if (CanUse && !CueSDK.IsInitialized)
|
||||
CueSDK.Initialize();
|
||||
|
||||
Logger.Debug("Attempted to enable Corsair mice. CanUse: {0}", CanUse);
|
||||
|
||||
if (CanUse)
|
||||
CueSDK.MouseSDK.UpdateMode = UpdateMode.Manual;
|
||||
|
||||
return CanUse;
|
||||
}
|
||||
|
||||
public override void Disable()
|
||||
{
|
||||
throw new NotSupportedException("Can only disable a keyboard");
|
||||
}
|
||||
|
||||
public override void UpdateDevice(Bitmap bitmap)
|
||||
{
|
||||
if (!CanUse || bitmap == null)
|
||||
return;
|
||||
if (bitmap.Width != bitmap.Height)
|
||||
throw new ArgumentException("Bitmap must be a perfect square");
|
||||
|
||||
var leds = CueSDK.MouseSDK.Leds.Count();
|
||||
var step = (double) bitmap.Width/leds;
|
||||
|
||||
var ledIndex = 0;
|
||||
// Color each LED according to one of the pixels
|
||||
foreach (var corsairLed in CueSDK.MouseSDK.Leds)
|
||||
{
|
||||
var col = ledIndex == 0
|
||||
? bitmap.GetPixel(0, 0)
|
||||
: bitmap.GetPixel((int) ((ledIndex + 1)*step - 1), (int) ((ledIndex + 1)*step - 1));
|
||||
|
||||
corsairLed.Color = col;
|
||||
ledIndex++;
|
||||
}
|
||||
|
||||
CueSDK.MouseSDK.Update();
|
||||
}
|
||||
|
||||
private static bool CanInitializeSdk()
|
||||
{
|
||||
// This will skip the check-loop if the SDK is initialized
|
||||
if (CueSDK.IsInitialized)
|
||||
return CueSDK.IsSDKAvailable(CorsairDeviceType.Mouse);
|
||||
|
||||
for (var tries = 0; tries < 9; tries++)
|
||||
{
|
||||
if (CueSDK.IsSDKAvailable(CorsairDeviceType.Mouse))
|
||||
return true;
|
||||
Thread.Sleep(2000);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using CUE.NET;
|
||||
using CUE.NET.Devices.Generic.Enums;
|
||||
using Ninject.Extensions.Logging;
|
||||
|
||||
namespace Artemis.DeviceProviders.Corsair
|
||||
{
|
||||
public class CorsairMouse : DeviceProvider
|
||||
{
|
||||
public CorsairMouse(ILogger logger)
|
||||
{
|
||||
Logger = logger;
|
||||
Type = DeviceType.Mouse;
|
||||
}
|
||||
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
public override bool TryEnable()
|
||||
{
|
||||
CanUse = CanInitializeSdk();
|
||||
if (CanUse && !CueSDK.IsInitialized)
|
||||
CueSDK.Initialize();
|
||||
|
||||
Logger.Debug("Attempted to enable Corsair mice. CanUse: {0}", CanUse);
|
||||
|
||||
if (CanUse)
|
||||
CueSDK.UpdateMode = UpdateMode.Manual;
|
||||
|
||||
return CanUse;
|
||||
}
|
||||
|
||||
public override void Disable()
|
||||
{
|
||||
throw new NotSupportedException("Can only disable a keyboard");
|
||||
}
|
||||
|
||||
public override void UpdateDevice(Bitmap bitmap)
|
||||
{
|
||||
if (!CanUse || bitmap == null)
|
||||
return;
|
||||
if (bitmap.Width != bitmap.Height)
|
||||
throw new ArgumentException("Bitmap must be a perfect square");
|
||||
|
||||
var leds = CueSDK.MouseSDK.Leds.Count();
|
||||
var step = (double)bitmap.Width / leds;
|
||||
|
||||
var ledIndex = 0;
|
||||
// Color each LED according to one of the pixels
|
||||
foreach (var corsairLed in CueSDK.MouseSDK.Leds)
|
||||
{
|
||||
var col = ledIndex == 0
|
||||
? bitmap.GetPixel(0, 0)
|
||||
: bitmap.GetPixel((int)((ledIndex + 1) * step - 1), (int)((ledIndex + 1) * step - 1));
|
||||
|
||||
corsairLed.Color = col;
|
||||
ledIndex++;
|
||||
}
|
||||
|
||||
CueSDK.MouseSDK.Update();
|
||||
}
|
||||
|
||||
private static bool CanInitializeSdk()
|
||||
{
|
||||
// This will skip the check-loop if the SDK is initialized
|
||||
if (CueSDK.IsInitialized)
|
||||
return CueSDK.IsSDKAvailable(CorsairDeviceType.Mouse);
|
||||
|
||||
for (var tries = 0; tries < 9; tries++)
|
||||
{
|
||||
if (CueSDK.IsSDKAvailable(CorsairDeviceType.Mouse))
|
||||
return true;
|
||||
Thread.Sleep(2000);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,100 +1,100 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using CUE.NET;
|
||||
using CUE.NET.Devices.Generic.Enums;
|
||||
using Ninject.Extensions.Logging;
|
||||
|
||||
namespace Artemis.DeviceProviders.Corsair
|
||||
{
|
||||
public class CorsairMousemat : DeviceProvider
|
||||
{
|
||||
public CorsairMousemat(ILogger logger)
|
||||
{
|
||||
Logger = logger;
|
||||
Type = DeviceType.Mousemat;
|
||||
}
|
||||
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
public override bool TryEnable()
|
||||
{
|
||||
CanUse = CanInitializeSdk();
|
||||
if (CanUse && !CueSDK.IsInitialized)
|
||||
CueSDK.Initialize();
|
||||
|
||||
Logger.Debug("Attempted to enable Corsair mousemat. CanUse: {0}", CanUse);
|
||||
|
||||
if (CanUse)
|
||||
CueSDK.MousematSDK.UpdateMode = UpdateMode.Manual;
|
||||
|
||||
return CanUse;
|
||||
}
|
||||
|
||||
public override void Disable()
|
||||
{
|
||||
throw new NotSupportedException("Can only disable a keyboard");
|
||||
}
|
||||
|
||||
public override void UpdateDevice(Bitmap bitmap)
|
||||
{
|
||||
if (!CanUse || (bitmap == null))
|
||||
return;
|
||||
if (bitmap.Width != bitmap.Height)
|
||||
throw new ArgumentException("Bitmap must be a perfect square");
|
||||
|
||||
var yStep = (double) bitmap.Width/4;
|
||||
var xStep = (double) bitmap.Width/6;
|
||||
|
||||
// This approach will break if any mousemats with different LED amounts are released, for now it will do.
|
||||
var ledIndex = 0;
|
||||
// Color each LED according to one of the pixels
|
||||
foreach (var corsairLed in CueSDK.MousematSDK.Leds.OrderBy(l => l.ToString()))
|
||||
{
|
||||
Color col;
|
||||
// Left side
|
||||
if (ledIndex < 5)
|
||||
{
|
||||
col = ledIndex == 0
|
||||
? bitmap.GetPixel(0, (int) (ledIndex*yStep))
|
||||
: bitmap.GetPixel(0, (int) (ledIndex*yStep) - 1);
|
||||
}
|
||||
// Bottom
|
||||
else if (ledIndex < 10)
|
||||
{
|
||||
// Start at index 1 because the corner belongs to the left side
|
||||
var zoneIndex = ledIndex - 4;
|
||||
col = bitmap.GetPixel((int) (zoneIndex*xStep), bitmap.Height - 1);
|
||||
}
|
||||
// Right side
|
||||
else
|
||||
{
|
||||
var zoneIndex = ledIndex - 10;
|
||||
col = zoneIndex == 4
|
||||
? bitmap.GetPixel(bitmap.Height - 1, bitmap.Height - (int) (zoneIndex*yStep))
|
||||
: bitmap.GetPixel(bitmap.Height - 1, bitmap.Height - 1 - (int) (zoneIndex*yStep));
|
||||
}
|
||||
|
||||
corsairLed.Color = col;
|
||||
ledIndex++;
|
||||
}
|
||||
CueSDK.MousematSDK.Update();
|
||||
}
|
||||
|
||||
private static bool CanInitializeSdk()
|
||||
{
|
||||
// This will skip the check-loop if the SDK is initialized
|
||||
if (CueSDK.IsInitialized)
|
||||
return CueSDK.IsSDKAvailable(CorsairDeviceType.Mousemat);
|
||||
|
||||
for (var tries = 0; tries < 9; tries++)
|
||||
{
|
||||
if (CueSDK.IsSDKAvailable(CorsairDeviceType.Mousemat))
|
||||
return true;
|
||||
Thread.Sleep(2000);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using CUE.NET;
|
||||
using CUE.NET.Devices.Generic.Enums;
|
||||
using Ninject.Extensions.Logging;
|
||||
|
||||
namespace Artemis.DeviceProviders.Corsair
|
||||
{
|
||||
public class CorsairMousemat : DeviceProvider
|
||||
{
|
||||
public CorsairMousemat(ILogger logger)
|
||||
{
|
||||
Logger = logger;
|
||||
Type = DeviceType.Mousemat;
|
||||
}
|
||||
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
public override bool TryEnable()
|
||||
{
|
||||
CanUse = CanInitializeSdk();
|
||||
if (CanUse && !CueSDK.IsInitialized)
|
||||
CueSDK.Initialize();
|
||||
|
||||
Logger.Debug("Attempted to enable Corsair mousemat. CanUse: {0}", CanUse);
|
||||
|
||||
if (CanUse)
|
||||
CueSDK.UpdateMode = UpdateMode.Manual;
|
||||
|
||||
return CanUse;
|
||||
}
|
||||
|
||||
public override void Disable()
|
||||
{
|
||||
throw new NotSupportedException("Can only disable a keyboard");
|
||||
}
|
||||
|
||||
public override void UpdateDevice(Bitmap bitmap)
|
||||
{
|
||||
if (!CanUse || (bitmap == null))
|
||||
return;
|
||||
if (bitmap.Width != bitmap.Height)
|
||||
throw new ArgumentException("Bitmap must be a perfect square");
|
||||
|
||||
var yStep = (double)bitmap.Width / 4;
|
||||
var xStep = (double)bitmap.Width / 6;
|
||||
|
||||
// This approach will break if any mousemats with different LED amounts are released, for now it will do.
|
||||
var ledIndex = 0;
|
||||
// Color each LED according to one of the pixels
|
||||
foreach (var corsairLed in CueSDK.MousematSDK.Leds.OrderBy(l => l.ToString()))
|
||||
{
|
||||
Color col;
|
||||
// Left side
|
||||
if (ledIndex < 5)
|
||||
{
|
||||
col = ledIndex == 0
|
||||
? bitmap.GetPixel(0, (int)(ledIndex * yStep))
|
||||
: bitmap.GetPixel(0, (int)(ledIndex * yStep) - 1);
|
||||
}
|
||||
// Bottom
|
||||
else if (ledIndex < 10)
|
||||
{
|
||||
// Start at index 1 because the corner belongs to the left side
|
||||
var zoneIndex = ledIndex - 4;
|
||||
col = bitmap.GetPixel((int)(zoneIndex * xStep), bitmap.Height - 1);
|
||||
}
|
||||
// Right side
|
||||
else
|
||||
{
|
||||
var zoneIndex = ledIndex - 10;
|
||||
col = zoneIndex == 4
|
||||
? bitmap.GetPixel(bitmap.Height - 1, bitmap.Height - (int)(zoneIndex * yStep))
|
||||
: bitmap.GetPixel(bitmap.Height - 1, bitmap.Height - 1 - (int)(zoneIndex * yStep));
|
||||
}
|
||||
|
||||
corsairLed.Color = col;
|
||||
ledIndex++;
|
||||
}
|
||||
CueSDK.MousematSDK.Update();
|
||||
}
|
||||
|
||||
private static bool CanInitializeSdk()
|
||||
{
|
||||
// This will skip the check-loop if the SDK is initialized
|
||||
if (CueSDK.IsInitialized)
|
||||
return CueSDK.IsSDKAvailable(CorsairDeviceType.Mousemat);
|
||||
|
||||
for (var tries = 0; tries < 9; tries++)
|
||||
{
|
||||
if (CueSDK.IsSDKAvailable(CorsairDeviceType.Mousemat))
|
||||
return true;
|
||||
Thread.Sleep(2000);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,71 +1,71 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using CUE.NET.Devices.Keyboard.Enums;
|
||||
|
||||
namespace Artemis.DeviceProviders.Corsair.Utilities
|
||||
{
|
||||
public static class KeyMap
|
||||
{
|
||||
static KeyMap()
|
||||
{
|
||||
FormsKeys = new Dictionary<Keys, CorsairKeyboardKeyId>
|
||||
{
|
||||
{Keys.Scroll, CorsairKeyboardKeyId.ScrollLock},
|
||||
{Keys.Pause, CorsairKeyboardKeyId.PauseBreak},
|
||||
{Keys.Back, CorsairKeyboardKeyId.Backspace},
|
||||
{Keys.Oemtilde, CorsairKeyboardKeyId.GraveAccentAndTilde},
|
||||
{Keys.OemMinus, CorsairKeyboardKeyId.MinusAndUnderscore},
|
||||
{Keys.Oemplus, CorsairKeyboardKeyId.EqualsAndPlus},
|
||||
{Keys.OemOpenBrackets, CorsairKeyboardKeyId.BracketLeft},
|
||||
{Keys.Oem6, CorsairKeyboardKeyId.BracketRight},
|
||||
{Keys.Return, CorsairKeyboardKeyId.Enter},
|
||||
{Keys.Next, CorsairKeyboardKeyId.PageDown},
|
||||
{Keys.Capital, CorsairKeyboardKeyId.CapsLock},
|
||||
{Keys.Oem1, CorsairKeyboardKeyId.SemicolonAndColon},
|
||||
{Keys.Oem7, CorsairKeyboardKeyId.ApostropheAndDoubleQuote},
|
||||
{Keys.OemBackslash, CorsairKeyboardKeyId.Backslash},
|
||||
{Keys.LShiftKey, CorsairKeyboardKeyId.LeftShift},
|
||||
{Keys.Oem5, CorsairKeyboardKeyId.NonUsBackslash},
|
||||
{Keys.Oemcomma, CorsairKeyboardKeyId.CommaAndLessThan},
|
||||
{Keys.OemPeriod, CorsairKeyboardKeyId.PeriodAndBiggerThan},
|
||||
{Keys.OemQuestion, CorsairKeyboardKeyId.SlashAndQuestionMark},
|
||||
{Keys.RShiftKey, CorsairKeyboardKeyId.RightShift},
|
||||
{Keys.LControlKey, CorsairKeyboardKeyId.LeftCtrl},
|
||||
{Keys.LWin, CorsairKeyboardKeyId.LeftGui},
|
||||
{Keys.LMenu, CorsairKeyboardKeyId.LeftAlt},
|
||||
{Keys.RMenu, CorsairKeyboardKeyId.RightAlt},
|
||||
{Keys.RWin, CorsairKeyboardKeyId.RightGui},
|
||||
{Keys.Apps, CorsairKeyboardKeyId.Application},
|
||||
{Keys.RControlKey, CorsairKeyboardKeyId.RightCtrl},
|
||||
{Keys.Left, CorsairKeyboardKeyId.LeftArrow},
|
||||
{Keys.Down, CorsairKeyboardKeyId.DownArrow},
|
||||
{Keys.Right, CorsairKeyboardKeyId.RightArrow},
|
||||
{Keys.Up, CorsairKeyboardKeyId.UpArrow},
|
||||
{Keys.NumPad0, CorsairKeyboardKeyId.Keypad0},
|
||||
{Keys.NumPad1, CorsairKeyboardKeyId.Keypad1},
|
||||
{Keys.NumPad2, CorsairKeyboardKeyId.Keypad2},
|
||||
{Keys.NumPad3, CorsairKeyboardKeyId.Keypad3},
|
||||
{Keys.NumPad4, CorsairKeyboardKeyId.Keypad4},
|
||||
{Keys.NumPad5, CorsairKeyboardKeyId.Keypad5},
|
||||
{Keys.NumPad6, CorsairKeyboardKeyId.Keypad6},
|
||||
{Keys.NumPad7, CorsairKeyboardKeyId.Keypad7},
|
||||
{Keys.NumPad8, CorsairKeyboardKeyId.Keypad8},
|
||||
{Keys.NumPad9, CorsairKeyboardKeyId.Keypad9},
|
||||
{Keys.Divide, CorsairKeyboardKeyId.KeypadSlash},
|
||||
{Keys.Multiply, CorsairKeyboardKeyId.KeypadAsterisk},
|
||||
{Keys.Subtract, CorsairKeyboardKeyId.KeypadMinus},
|
||||
{Keys.Add, CorsairKeyboardKeyId.KeypadPlus},
|
||||
{Keys.Decimal, CorsairKeyboardKeyId.KeypadPeriodAndDelete},
|
||||
{Keys.MediaStop, CorsairKeyboardKeyId.Stop},
|
||||
{Keys.MediaPreviousTrack, CorsairKeyboardKeyId.ScanPreviousTrack},
|
||||
{Keys.MediaNextTrack, CorsairKeyboardKeyId.ScanNextTrack},
|
||||
{Keys.MediaPlayPause, CorsairKeyboardKeyId.PlayPause},
|
||||
{Keys.VolumeMute, CorsairKeyboardKeyId.Mute},
|
||||
{Keys.VolumeUp, CorsairKeyboardKeyId.VolumeUp},
|
||||
{Keys.VolumeDown, CorsairKeyboardKeyId.VolumeDown}
|
||||
};
|
||||
}
|
||||
|
||||
public static Dictionary<Keys, CorsairKeyboardKeyId> FormsKeys { get; set; }
|
||||
}
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using CUE.NET.Devices.Generic.Enums;
|
||||
|
||||
namespace Artemis.DeviceProviders.Corsair.Utilities
|
||||
{
|
||||
public static class KeyMap
|
||||
{
|
||||
static KeyMap()
|
||||
{
|
||||
FormsKeys = new Dictionary<Keys, CorsairLedId>
|
||||
{
|
||||
{Keys.Scroll, CorsairLedId.ScrollLock},
|
||||
{Keys.Pause, CorsairLedId.PauseBreak},
|
||||
{Keys.Back, CorsairLedId.Backspace},
|
||||
{Keys.Oemtilde, CorsairLedId.GraveAccentAndTilde},
|
||||
{Keys.OemMinus, CorsairLedId.MinusAndUnderscore},
|
||||
{Keys.Oemplus, CorsairLedId.EqualsAndPlus},
|
||||
{Keys.OemOpenBrackets, CorsairLedId.BracketLeft},
|
||||
{Keys.Oem6, CorsairLedId.BracketRight},
|
||||
{Keys.Return, CorsairLedId.Enter},
|
||||
{Keys.Next, CorsairLedId.PageDown},
|
||||
{Keys.Capital, CorsairLedId.CapsLock},
|
||||
{Keys.Oem1, CorsairLedId.SemicolonAndColon},
|
||||
{Keys.Oem7, CorsairLedId.ApostropheAndDoubleQuote},
|
||||
{Keys.OemBackslash, CorsairLedId.Backslash},
|
||||
{Keys.LShiftKey, CorsairLedId.LeftShift},
|
||||
{Keys.Oem5, CorsairLedId.NonUsBackslash},
|
||||
{Keys.Oemcomma, CorsairLedId.CommaAndLessThan},
|
||||
{Keys.OemPeriod, CorsairLedId.PeriodAndBiggerThan},
|
||||
{Keys.OemQuestion, CorsairLedId.SlashAndQuestionMark},
|
||||
{Keys.RShiftKey, CorsairLedId.RightShift},
|
||||
{Keys.LControlKey, CorsairLedId.LeftCtrl},
|
||||
{Keys.LWin, CorsairLedId.LeftGui},
|
||||
{Keys.LMenu, CorsairLedId.LeftAlt},
|
||||
{Keys.RMenu, CorsairLedId.RightAlt},
|
||||
{Keys.RWin, CorsairLedId.RightGui},
|
||||
{Keys.Apps, CorsairLedId.Application},
|
||||
{Keys.RControlKey, CorsairLedId.RightCtrl},
|
||||
{Keys.Left, CorsairLedId.LeftArrow},
|
||||
{Keys.Down, CorsairLedId.DownArrow},
|
||||
{Keys.Right, CorsairLedId.RightArrow},
|
||||
{Keys.Up, CorsairLedId.UpArrow},
|
||||
{Keys.NumPad0, CorsairLedId.Keypad0},
|
||||
{Keys.NumPad1, CorsairLedId.Keypad1},
|
||||
{Keys.NumPad2, CorsairLedId.Keypad2},
|
||||
{Keys.NumPad3, CorsairLedId.Keypad3},
|
||||
{Keys.NumPad4, CorsairLedId.Keypad4},
|
||||
{Keys.NumPad5, CorsairLedId.Keypad5},
|
||||
{Keys.NumPad6, CorsairLedId.Keypad6},
|
||||
{Keys.NumPad7, CorsairLedId.Keypad7},
|
||||
{Keys.NumPad8, CorsairLedId.Keypad8},
|
||||
{Keys.NumPad9, CorsairLedId.Keypad9},
|
||||
{Keys.Divide, CorsairLedId.KeypadSlash},
|
||||
{Keys.Multiply, CorsairLedId.KeypadAsterisk},
|
||||
{Keys.Subtract, CorsairLedId.KeypadMinus},
|
||||
{Keys.Add, CorsairLedId.KeypadPlus},
|
||||
{Keys.Decimal, CorsairLedId.KeypadPeriodAndDelete},
|
||||
{Keys.MediaStop, CorsairLedId.Stop},
|
||||
{Keys.MediaPreviousTrack, CorsairLedId.ScanPreviousTrack},
|
||||
{Keys.MediaNextTrack, CorsairLedId.ScanNextTrack},
|
||||
{Keys.MediaPlayPause, CorsairLedId.PlayPause},
|
||||
{Keys.VolumeMute, CorsairLedId.Mute},
|
||||
{Keys.VolumeUp, CorsairLedId.VolumeUp},
|
||||
{Keys.VolumeDown, CorsairLedId.VolumeDown}
|
||||
};
|
||||
}
|
||||
|
||||
public static Dictionary<Keys, CorsairLedId> FormsKeys { get; set; }
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user