mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Fixed rename duplicating profiles, closes #362
Fixed delete leaving the profile select empty Added a G810-specific keymap
This commit is contained in:
parent
91e7f37d92
commit
7eec19eccf
@ -340,6 +340,7 @@
|
||||
<Compile Include="DeviceProviders\Logitech\G810.cs" />
|
||||
<Compile Include="DeviceProviders\Logitech\LogitechGeneric.cs" />
|
||||
<Compile Include="DeviceProviders\Logitech\LogitechKeyboard.cs" />
|
||||
<Compile Include="DeviceProviders\Logitech\Utilities\KeyMapG810.cs" />
|
||||
<Compile Include="Dialogs\MarkdownDialog.xaml.cs">
|
||||
<DependentUpon>MarkdownDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
||||
@ -102,12 +102,16 @@ namespace Artemis.DAL
|
||||
if (string.IsNullOrEmpty(name))
|
||||
return;
|
||||
|
||||
// Remove the old profile
|
||||
DeleteProfile(profile);
|
||||
// Store the profile path before it is renamed
|
||||
var oldPath = ProfileFolder + $@"\{profile.KeyboardSlug}\{profile.GameName}\{profile.Slug}.json";
|
||||
|
||||
// Update the profile, creating a new file
|
||||
profile.Name = name;
|
||||
AddOrUpdate(profile);
|
||||
|
||||
// Remove the file with the old name
|
||||
if (File.Exists(oldPath))
|
||||
File.Delete(oldPath);
|
||||
}
|
||||
|
||||
public static void DeleteProfile(ProfileModel prof)
|
||||
|
||||
@ -23,9 +23,16 @@ namespace Artemis.DeviceProviders.Corsair
|
||||
|
||||
public override bool TryEnable()
|
||||
{
|
||||
CanUse = CanInitializeSdk();
|
||||
if (CanUse && !CueSDK.IsInitialized)
|
||||
CueSDK.Initialize();
|
||||
try
|
||||
{
|
||||
CanUse = CanInitializeSdk();
|
||||
if (CanUse && !CueSDK.IsInitialized)
|
||||
CueSDK.Initialize();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
CanUse = false;
|
||||
}
|
||||
|
||||
Logger.Debug("Attempted to enable Corsair headset. CanUse: {0}", CanUse);
|
||||
|
||||
@ -69,4 +76,4 @@ namespace Artemis.DeviceProviders.Corsair
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,9 +23,16 @@ namespace Artemis.DeviceProviders.Corsair
|
||||
|
||||
public override bool TryEnable()
|
||||
{
|
||||
CanUse = CanInitializeSdk();
|
||||
if (CanUse && !CueSDK.IsInitialized)
|
||||
CueSDK.Initialize();
|
||||
try
|
||||
{
|
||||
CanUse = CanInitializeSdk();
|
||||
if (CanUse && !CueSDK.IsInitialized)
|
||||
CueSDK.Initialize();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
CanUse = false;
|
||||
}
|
||||
|
||||
Logger.Debug("Attempted to enable Corsair mice. CanUse: {0}", CanUse);
|
||||
|
||||
|
||||
@ -23,9 +23,16 @@ namespace Artemis.DeviceProviders.Corsair
|
||||
|
||||
public override bool TryEnable()
|
||||
{
|
||||
CanUse = CanInitializeSdk();
|
||||
if (CanUse && !CueSDK.IsInitialized)
|
||||
CueSDK.Initialize();
|
||||
try
|
||||
{
|
||||
CanUse = CanInitializeSdk();
|
||||
if (CanUse && !CueSDK.IsInitialized)
|
||||
CueSDK.Initialize();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
CanUse = false;
|
||||
}
|
||||
|
||||
Logger.Debug("Attempted to enable Corsair mousemat. CanUse: {0}", CanUse);
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System.Linq;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
using Artemis.DAL;
|
||||
@ -20,23 +21,68 @@ namespace Artemis.DeviceProviders.Logitech
|
||||
"Please check your cables and updating the Logitech Gaming Software\n" +
|
||||
"A minimum version of 8.81.15 is required.\n\n" +
|
||||
"If needed, you can select a different keyboard in Artemis under settings.";
|
||||
Height = 6;
|
||||
Height = 7;
|
||||
Width = 21;
|
||||
PreviewSettings = new PreviewSettings(new Rect(19, 70, 1010, 269), Resources.g810);
|
||||
PreviewSettings = new PreviewSettings(new Rect(19, 36, 1010, 304), Resources.g810);
|
||||
_generalSettings = SettingsProvider.Load<GeneralSettings>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The G910 also updates the G-logo, G-badge and G-keys
|
||||
/// </summary>
|
||||
/// <param name="bitmap"></param>
|
||||
public override void DrawBitmap(Bitmap bitmap)
|
||||
{
|
||||
using (var croppedBitmap = new Bitmap(21 * 4, 6 * 4))
|
||||
{
|
||||
// Deal with non-standard DPI
|
||||
croppedBitmap.SetResolution(96, 96);
|
||||
// Don't forget that the image is upscaled 4 times
|
||||
using (var g = Graphics.FromImage(croppedBitmap))
|
||||
{
|
||||
g.DrawImage(bitmap, new Rectangle(0, 0, 84, 24), new Rectangle(4, 4, 84, 24), GraphicsUnit.Pixel);
|
||||
}
|
||||
|
||||
LogitechGSDK.LogiLedSetTargetDevice(LogitechGSDK.LOGI_DEVICETYPE_PERKEY_RGB);
|
||||
// TODO: Remapping
|
||||
LogitechGSDK.LogiLedSetLightingFromBitmap(OrionUtilities.BitmapToByteArray(bitmap));
|
||||
}
|
||||
|
||||
using (var resized = OrionUtilities.ResizeImage(bitmap, 21, 7))
|
||||
{
|
||||
// Color G-logo, lets also try some other values to see what happens
|
||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_LOGO, 0, 0);
|
||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_BADGE, 0, 0);
|
||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_1, 0, 0);
|
||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_2, 0, 0);
|
||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_3, 0, 0);
|
||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_4, 0, 0);
|
||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_5, 0, 0);
|
||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_6, 0, 0);
|
||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_7, 0, 0);
|
||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_8, 0, 0);
|
||||
SetLogitechColorFromCoordinates(resized, KeyboardNames.G_9, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public override KeyMatch? GetKeyPosition(Keys keyCode)
|
||||
{
|
||||
KeyMatch value;
|
||||
switch (_generalSettings.Layout)
|
||||
{
|
||||
case "Qwerty":
|
||||
return KeyMap.QwertyLayout.FirstOrDefault(k => k.KeyCode == keyCode);
|
||||
value = KeyMap.QwertyLayout.FirstOrDefault(k => k.KeyCode == keyCode);
|
||||
break;
|
||||
case "Qwertz":
|
||||
return KeyMap.QwertzLayout.FirstOrDefault(k => k.KeyCode == keyCode);
|
||||
value = KeyMap.QwertzLayout.FirstOrDefault(k => k.KeyCode == keyCode);
|
||||
break;
|
||||
default:
|
||||
return KeyMap.AzertyLayout.FirstOrDefault(k => k.KeyCode == keyCode);
|
||||
value = KeyMap.AzertyLayout.FirstOrDefault(k => k.KeyCode == keyCode);
|
||||
break;
|
||||
}
|
||||
|
||||
// Adjust the distance by 1 on y for the G810
|
||||
return new KeyMatch(value.KeyCode, value.X, value.Y + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -64,7 +64,8 @@ namespace Artemis.DeviceProviders.Logitech
|
||||
g.DrawImage(bitmap, new Rectangle(0, 0, 84, 24), new Rectangle(4, 4, 84, 24), GraphicsUnit.Pixel);
|
||||
}
|
||||
|
||||
base.DrawBitmap(croppedBitmap);
|
||||
LogitechGSDK.LogiLedSetTargetDevice(LogitechGSDK.LOGI_DEVICETYPE_PERKEY_RGB);
|
||||
LogitechGSDK.LogiLedSetLightingFromBitmap(OrionUtilities.BitmapToByteArray(bitmap, G910Keymappings));
|
||||
}
|
||||
|
||||
using (var resized = OrionUtilities.ResizeImage(bitmap, 22, 7))
|
||||
@ -88,14 +89,147 @@ namespace Artemis.DeviceProviders.Logitech
|
||||
}
|
||||
}
|
||||
|
||||
private void SetLogitechColorFromCoordinates(Bitmap bitmap, KeyboardNames key, int x, int y)
|
||||
// These mappings are used by the G910 to fix alignments
|
||||
public static OrionUtilities.KeyMapping[] G910Keymappings =
|
||||
{
|
||||
var color = bitmap.GetPixel(x, y);
|
||||
var rPer = (int) Math.Round(color.R / 2.55);
|
||||
var gPer = (int) Math.Round(color.G / 2.55);
|
||||
var bPer = (int) Math.Round(color.B / 2.55);
|
||||
// First row
|
||||
new OrionUtilities.KeyMapping(0, 0),
|
||||
new OrionUtilities.KeyMapping(1, 1),
|
||||
new OrionUtilities.KeyMapping(2, 1),
|
||||
new OrionUtilities.KeyMapping(3, 2),
|
||||
new OrionUtilities.KeyMapping(4, 3),
|
||||
new OrionUtilities.KeyMapping(5, 4),
|
||||
new OrionUtilities.KeyMapping(6, 5),
|
||||
new OrionUtilities.KeyMapping(7, 6),
|
||||
new OrionUtilities.KeyMapping(8, 7),
|
||||
new OrionUtilities.KeyMapping(9, 8),
|
||||
new OrionUtilities.KeyMapping(10, 9),
|
||||
new OrionUtilities.KeyMapping(11, 9),
|
||||
new OrionUtilities.KeyMapping(12, 10),
|
||||
new OrionUtilities.KeyMapping(13, 11),
|
||||
new OrionUtilities.KeyMapping(13, 12),
|
||||
new OrionUtilities.KeyMapping(14, 13),
|
||||
new OrionUtilities.KeyMapping(15, 14),
|
||||
new OrionUtilities.KeyMapping(16, 15),
|
||||
new OrionUtilities.KeyMapping(17, 16),
|
||||
new OrionUtilities.KeyMapping(18, 17),
|
||||
new OrionUtilities.KeyMapping(19, 18),
|
||||
|
||||
LogitechGSDK.LogiLedSetLightingForKeyWithKeyName(key, rPer, gPer, bPer);
|
||||
}
|
||||
// Second row
|
||||
new OrionUtilities.KeyMapping(21, 21),
|
||||
new OrionUtilities.KeyMapping(22, 22),
|
||||
new OrionUtilities.KeyMapping(23, 23),
|
||||
new OrionUtilities.KeyMapping(24, 24),
|
||||
new OrionUtilities.KeyMapping(25, 25),
|
||||
new OrionUtilities.KeyMapping(26, 26),
|
||||
new OrionUtilities.KeyMapping(27, 27),
|
||||
new OrionUtilities.KeyMapping(28, 28),
|
||||
new OrionUtilities.KeyMapping(29, 29),
|
||||
new OrionUtilities.KeyMapping(30, 30),
|
||||
new OrionUtilities.KeyMapping(31, 31),
|
||||
new OrionUtilities.KeyMapping(32, 32),
|
||||
new OrionUtilities.KeyMapping(33, 33),
|
||||
new OrionUtilities.KeyMapping(34, 34),
|
||||
new OrionUtilities.KeyMapping(35, 35),
|
||||
new OrionUtilities.KeyMapping(36, 36),
|
||||
new OrionUtilities.KeyMapping(37, 37),
|
||||
new OrionUtilities.KeyMapping(38, 38),
|
||||
new OrionUtilities.KeyMapping(39, 39),
|
||||
new OrionUtilities.KeyMapping(40, 40),
|
||||
new OrionUtilities.KeyMapping(41, 41),
|
||||
|
||||
// Third row
|
||||
new OrionUtilities.KeyMapping(42, 42),
|
||||
new OrionUtilities.KeyMapping(43, 43),
|
||||
new OrionUtilities.KeyMapping(44, 44),
|
||||
new OrionUtilities.KeyMapping(45, 45),
|
||||
new OrionUtilities.KeyMapping(46, 46),
|
||||
new OrionUtilities.KeyMapping(47, 46),
|
||||
new OrionUtilities.KeyMapping(48, 47),
|
||||
new OrionUtilities.KeyMapping(49, 48),
|
||||
new OrionUtilities.KeyMapping(50, 49),
|
||||
new OrionUtilities.KeyMapping(51, 50),
|
||||
new OrionUtilities.KeyMapping(52, 51),
|
||||
new OrionUtilities.KeyMapping(53, 52),
|
||||
new OrionUtilities.KeyMapping(54, 53),
|
||||
new OrionUtilities.KeyMapping(54, 54),
|
||||
new OrionUtilities.KeyMapping(55, 55),
|
||||
new OrionUtilities.KeyMapping(56, 56),
|
||||
new OrionUtilities.KeyMapping(57, 57),
|
||||
new OrionUtilities.KeyMapping(58, 58),
|
||||
new OrionUtilities.KeyMapping(59, 59),
|
||||
new OrionUtilities.KeyMapping(60, 60),
|
||||
new OrionUtilities.KeyMapping(61, 61),
|
||||
new OrionUtilities.KeyMapping(62, 62),
|
||||
|
||||
// Fourth row
|
||||
new OrionUtilities.KeyMapping(63, 63),
|
||||
new OrionUtilities.KeyMapping(64, 64),
|
||||
new OrionUtilities.KeyMapping(65, 65),
|
||||
new OrionUtilities.KeyMapping(66, 65),
|
||||
new OrionUtilities.KeyMapping(67, 66),
|
||||
new OrionUtilities.KeyMapping(68, 67),
|
||||
new OrionUtilities.KeyMapping(69, 68),
|
||||
new OrionUtilities.KeyMapping(70, 69),
|
||||
new OrionUtilities.KeyMapping(71, 70),
|
||||
new OrionUtilities.KeyMapping(72, 71),
|
||||
new OrionUtilities.KeyMapping(73, 72),
|
||||
new OrionUtilities.KeyMapping(74, 73),
|
||||
new OrionUtilities.KeyMapping(75, 74),
|
||||
new OrionUtilities.KeyMapping(76, 75),
|
||||
new OrionUtilities.KeyMapping(76, 76),
|
||||
new OrionUtilities.KeyMapping(78, 77),
|
||||
new OrionUtilities.KeyMapping(79, 78),
|
||||
new OrionUtilities.KeyMapping(79, 79),
|
||||
new OrionUtilities.KeyMapping(80, 80),
|
||||
new OrionUtilities.KeyMapping(81, 81),
|
||||
new OrionUtilities.KeyMapping(82, 82),
|
||||
|
||||
// Fifth row
|
||||
new OrionUtilities.KeyMapping(84, 84),
|
||||
new OrionUtilities.KeyMapping(85, 85),
|
||||
new OrionUtilities.KeyMapping(86, 86),
|
||||
new OrionUtilities.KeyMapping(87, 87),
|
||||
new OrionUtilities.KeyMapping(88, 88),
|
||||
new OrionUtilities.KeyMapping(89, 89),
|
||||
new OrionUtilities.KeyMapping(90, 90),
|
||||
new OrionUtilities.KeyMapping(91, 91),
|
||||
new OrionUtilities.KeyMapping(92, 92),
|
||||
new OrionUtilities.KeyMapping(93, 93),
|
||||
new OrionUtilities.KeyMapping(94, 94),
|
||||
new OrionUtilities.KeyMapping(95, 95),
|
||||
new OrionUtilities.KeyMapping(96, 96),
|
||||
new OrionUtilities.KeyMapping(97, 97),
|
||||
new OrionUtilities.KeyMapping(98, 98),
|
||||
new OrionUtilities.KeyMapping(99, 99),
|
||||
new OrionUtilities.KeyMapping(100, 100),
|
||||
new OrionUtilities.KeyMapping(101, 101),
|
||||
new OrionUtilities.KeyMapping(102, 102),
|
||||
new OrionUtilities.KeyMapping(103, 103),
|
||||
new OrionUtilities.KeyMapping(104, 104),
|
||||
|
||||
// Sixth row
|
||||
new OrionUtilities.KeyMapping(105, 105),
|
||||
new OrionUtilities.KeyMapping(106, 106),
|
||||
new OrionUtilities.KeyMapping(107, 107),
|
||||
new OrionUtilities.KeyMapping(108, 107),
|
||||
new OrionUtilities.KeyMapping(109, 109),
|
||||
new OrionUtilities.KeyMapping(110, 110),
|
||||
new OrionUtilities.KeyMapping(111, 110),
|
||||
new OrionUtilities.KeyMapping(112, 111),
|
||||
new OrionUtilities.KeyMapping(113, 112),
|
||||
new OrionUtilities.KeyMapping(114, 113),
|
||||
new OrionUtilities.KeyMapping(115, 114),
|
||||
new OrionUtilities.KeyMapping(116, 115),
|
||||
new OrionUtilities.KeyMapping(115, 116), // ALTGR
|
||||
new OrionUtilities.KeyMapping(116, 117),
|
||||
new OrionUtilities.KeyMapping(117, 118),
|
||||
new OrionUtilities.KeyMapping(118, 119),
|
||||
new OrionUtilities.KeyMapping(119, 120),
|
||||
new OrionUtilities.KeyMapping(120, 121),
|
||||
new OrionUtilities.KeyMapping(121, 122),
|
||||
new OrionUtilities.KeyMapping(122, 123),
|
||||
new OrionUtilities.KeyMapping(124, 124)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,55 +1,55 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using Artemis.DeviceProviders.Logitech.Utilities;
|
||||
using Ninject.Extensions.Logging;
|
||||
|
||||
namespace Artemis.DeviceProviders.Logitech
|
||||
{
|
||||
// TODO: Handle shutdown, maybe implement Disable() afterall?
|
||||
public class LogitechGeneric : DeviceProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// A generic Logitech DeviceProvider. Because the Logitech SDK currently doesn't allow specific
|
||||
/// device targeting (only very broad per-key-RGB and full RGB etc..)
|
||||
/// </summary>
|
||||
public LogitechGeneric(ILogger logger)
|
||||
{
|
||||
Logger = logger;
|
||||
Type = DeviceType.Generic;
|
||||
}
|
||||
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
public override void UpdateDevice(Bitmap bitmap)
|
||||
{
|
||||
if (!CanUse || bitmap == null)
|
||||
return;
|
||||
|
||||
var col = bitmap.GetPixel(bitmap.Width/2, bitmap.Height/2);
|
||||
LogitechGSDK.LogiLedSetTargetDevice(LogitechGSDK.LOGI_DEVICETYPE_RGB);
|
||||
LogitechGSDK.LogiLedSetLighting((int) (col.R/2.55), (int) (col.G/2.55), (int) (col.B/2.55));
|
||||
}
|
||||
|
||||
public override bool TryEnable()
|
||||
{
|
||||
var majorNum = 0;
|
||||
var minorNum = 0;
|
||||
var buildNum = 0;
|
||||
|
||||
LogitechGSDK.LogiLedInit();
|
||||
LogitechGSDK.LogiLedGetSdkVersion(ref majorNum, ref minorNum, ref buildNum);
|
||||
|
||||
// Turn it into one long number...
|
||||
var version = int.Parse($"{majorNum}{minorNum}{buildNum}");
|
||||
CanUse = version >= 88115;
|
||||
Logger.Debug("Attempted to enable Logitech generic device. CanUse: {0}", CanUse);
|
||||
|
||||
return CanUse;
|
||||
}
|
||||
|
||||
public override void Disable()
|
||||
{
|
||||
throw new NotSupportedException("Can only disable a keyboard");
|
||||
}
|
||||
}
|
||||
}
|
||||
//using System;
|
||||
//using System.Drawing;
|
||||
//using Artemis.DeviceProviders.Logitech.Utilities;
|
||||
//using Ninject.Extensions.Logging;
|
||||
//
|
||||
//namespace Artemis.DeviceProviders.Logitech
|
||||
//{
|
||||
// // TODO: Handle shutdown, maybe implement Disable() afterall?
|
||||
// public class LogitechGeneric : DeviceProvider
|
||||
// {
|
||||
// /// <summary>
|
||||
// /// A generic Logitech DeviceProvider. Because the Logitech SDK currently doesn't allow specific
|
||||
// /// device targeting (only very broad per-key-RGB and full RGB etc..)
|
||||
// /// </summary>
|
||||
// public LogitechGeneric(ILogger logger)
|
||||
// {
|
||||
// Logger = logger;
|
||||
// Type = DeviceType.Generic;
|
||||
// }
|
||||
//
|
||||
// public ILogger Logger { get; set; }
|
||||
//
|
||||
// public override void UpdateDevice(Bitmap bitmap)
|
||||
// {
|
||||
// if (!CanUse || bitmap == null)
|
||||
// return;
|
||||
//
|
||||
// var col = bitmap.GetPixel(bitmap.Width/2, bitmap.Height/2);
|
||||
// LogitechGSDK.LogiLedSetTargetDevice(LogitechGSDK.LOGI_DEVICETYPE_RGB);
|
||||
// LogitechGSDK.LogiLedSetLighting((int) (col.R/2.55), (int) (col.G/2.55), (int) (col.B/2.55));
|
||||
// }
|
||||
//
|
||||
// public override bool TryEnable()
|
||||
// {
|
||||
// var majorNum = 0;
|
||||
// var minorNum = 0;
|
||||
// var buildNum = 0;
|
||||
//
|
||||
// LogitechGSDK.LogiLedInit();
|
||||
// LogitechGSDK.LogiLedGetSdkVersion(ref majorNum, ref minorNum, ref buildNum);
|
||||
//
|
||||
// // Turn it into one long number...
|
||||
// var version = int.Parse($"{majorNum}{minorNum}{buildNum}");
|
||||
// CanUse = version >= 88115;
|
||||
// Logger.Debug("Attempted to enable Logitech generic device. CanUse: {0}", CanUse);
|
||||
//
|
||||
// return CanUse;
|
||||
// }
|
||||
//
|
||||
// public override void Disable()
|
||||
// {
|
||||
// throw new NotSupportedException("Can only disable a keyboard");
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@ -1,4 +1,5 @@
|
||||
using System.Drawing;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Threading;
|
||||
using Artemis.DeviceProviders.Logitech.Utilities;
|
||||
using Artemis.Utilities.DataReaders;
|
||||
@ -12,18 +13,7 @@ namespace Artemis.DeviceProviders.Logitech
|
||||
{
|
||||
// Just to be sure, restore the Logitech DLL registry key
|
||||
DllManager.RestoreLogitechDll();
|
||||
|
||||
// Check to see if VC++ 2012 x64 is installed.
|
||||
if (Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Classes\Installer\Dependencies\{ca67548a-5ebe-413a-b50c-4b9ceb6d66c6}") == null)
|
||||
{
|
||||
CantEnableText = "Couldn't connect to your Logitech keyboard.\n" +
|
||||
"The Visual C++ 2012 Redistributable v11.0.61030.0 could not be found, which is required.\n" +
|
||||
"Please download it by going to the following URL (link also in wiki):\n\n" +
|
||||
"https://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x64.exe";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
int majorNum = 0, minorNum = 0, buildNum = 0;
|
||||
|
||||
LogitechGSDK.LogiLedInit();
|
||||
@ -58,10 +48,14 @@ namespace Artemis.DeviceProviders.Logitech
|
||||
LogitechGSDK.LogiLedShutdown();
|
||||
}
|
||||
|
||||
public override void DrawBitmap(Bitmap bitmap)
|
||||
protected void SetLogitechColorFromCoordinates(Bitmap bitmap, KeyboardNames key, int x, int y)
|
||||
{
|
||||
LogitechGSDK.LogiLedSetTargetDevice(LogitechGSDK.LOGI_DEVICETYPE_PERKEY_RGB);
|
||||
LogitechGSDK.LogiLedSetLightingFromBitmap(OrionUtilities.BitmapToByteArray(bitmap));
|
||||
var color = bitmap.GetPixel(x, y);
|
||||
var rPer = (int)Math.Round(color.R / 2.55);
|
||||
var gPer = (int)Math.Round(color.G / 2.55);
|
||||
var bPer = (int)Math.Round(color.B / 2.55);
|
||||
|
||||
LogitechGSDK.LogiLedSetLightingForKeyWithKeyName(key, rPer, gPer, bPer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,7 +132,7 @@ namespace Artemis.DeviceProviders.Logitech.Utilities
|
||||
new KeyMatch(Keys.Decimal, 19, 5)
|
||||
};
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Qwertz
|
||||
|
||||
@ -257,7 +257,7 @@ namespace Artemis.DeviceProviders.Logitech.Utilities
|
||||
new KeyMatch(Keys.Decimal, 19, 5)
|
||||
};
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Azerty
|
||||
|
||||
@ -384,9 +384,9 @@ namespace Artemis.DeviceProviders.Logitech.Utilities
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
public static List<KeyMatch> QwertyLayout { get; set; }
|
||||
public static List<KeyMatch> QwertzLayout { get; set; }
|
||||
public static List<KeyMatch> AzertyLayout { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
392
Artemis/Artemis/DeviceProviders/Logitech/Utilities/KeyMapG810.cs
Normal file
392
Artemis/Artemis/DeviceProviders/Logitech/Utilities/KeyMapG810.cs
Normal file
@ -0,0 +1,392 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Artemis.DeviceProviders.Logitech.Utilities
|
||||
{
|
||||
public static class KeyMapG810
|
||||
{
|
||||
static KeyMapG810()
|
||||
{
|
||||
// There are several keyboard layouts
|
||||
|
||||
#region Qwerty
|
||||
|
||||
QwertyLayout = new List<KeyMatch>
|
||||
{
|
||||
// Row 1
|
||||
new KeyMatch(Keys.Escape, 0, 0),
|
||||
new KeyMatch(Keys.F1, 2, 0),
|
||||
new KeyMatch(Keys.F2, 3, 0),
|
||||
new KeyMatch(Keys.F3, 4, 0),
|
||||
new KeyMatch(Keys.F4, 5, 0),
|
||||
new KeyMatch(Keys.F5, 6, 0),
|
||||
new KeyMatch(Keys.F6, 7, 0),
|
||||
new KeyMatch(Keys.F7, 8, 0),
|
||||
new KeyMatch(Keys.F8, 9, 0),
|
||||
new KeyMatch(Keys.F9, 11, 0),
|
||||
new KeyMatch(Keys.F10, 12, 0),
|
||||
new KeyMatch(Keys.F11, 13, 0),
|
||||
new KeyMatch(Keys.F12, 14, 0),
|
||||
new KeyMatch(Keys.PrintScreen, 15, 0),
|
||||
new KeyMatch(Keys.Scroll, 16, 0),
|
||||
new KeyMatch(Keys.Pause, 17, 0),
|
||||
|
||||
// Row 2
|
||||
new KeyMatch(Keys.Oemtilde, 0, 1),
|
||||
new KeyMatch(Keys.D1, 1, 1),
|
||||
new KeyMatch(Keys.D2, 2, 1),
|
||||
new KeyMatch(Keys.D3, 3, 1),
|
||||
new KeyMatch(Keys.D4, 4, 1),
|
||||
new KeyMatch(Keys.D5, 5, 1),
|
||||
new KeyMatch(Keys.D6, 6, 1),
|
||||
new KeyMatch(Keys.D7, 7, 1),
|
||||
new KeyMatch(Keys.D8, 8, 1),
|
||||
new KeyMatch(Keys.D9, 9, 1),
|
||||
new KeyMatch(Keys.D0, 10, 1),
|
||||
new KeyMatch(Keys.OemMinus, 11, 1),
|
||||
new KeyMatch(Keys.Oemplus, 12, 1),
|
||||
new KeyMatch(Keys.Back, 13, 1),
|
||||
new KeyMatch(Keys.Insert, 14, 1),
|
||||
new KeyMatch(Keys.Home, 15, 1),
|
||||
new KeyMatch(Keys.PageUp, 16, 1),
|
||||
new KeyMatch(Keys.NumLock, 17, 1),
|
||||
new KeyMatch(Keys.Divide, 18, 1),
|
||||
new KeyMatch(Keys.Multiply, 19, 1),
|
||||
new KeyMatch(Keys.Subtract, 20, 1),
|
||||
|
||||
// Row 3
|
||||
new KeyMatch(Keys.Tab, 0, 2),
|
||||
new KeyMatch(Keys.Q, 1, 2),
|
||||
new KeyMatch(Keys.W, 2, 2),
|
||||
new KeyMatch(Keys.E, 3, 2),
|
||||
new KeyMatch(Keys.R, 5, 2),
|
||||
new KeyMatch(Keys.T, 6, 2),
|
||||
new KeyMatch(Keys.Y, 7, 2),
|
||||
new KeyMatch(Keys.U, 8, 2),
|
||||
new KeyMatch(Keys.I, 9, 2),
|
||||
new KeyMatch(Keys.O, 10, 2),
|
||||
new KeyMatch(Keys.P, 11, 2),
|
||||
new KeyMatch(Keys.OemOpenBrackets, 12, 2),
|
||||
new KeyMatch(Keys.Oem6, 13, 2),
|
||||
new KeyMatch(Keys.Delete, 14, 2),
|
||||
new KeyMatch(Keys.End, 15, 2),
|
||||
new KeyMatch(Keys.Next, 16, 2),
|
||||
new KeyMatch(Keys.NumPad7, 17, 2),
|
||||
new KeyMatch(Keys.NumPad8, 18, 2),
|
||||
new KeyMatch(Keys.NumPad9, 19, 2),
|
||||
new KeyMatch(Keys.Add, 20, 2),
|
||||
|
||||
// Row 4
|
||||
new KeyMatch(Keys.Capital, 0, 3),
|
||||
new KeyMatch(Keys.A, 1, 3),
|
||||
new KeyMatch(Keys.S, 3, 3),
|
||||
new KeyMatch(Keys.D, 4, 3),
|
||||
new KeyMatch(Keys.F, 5, 3),
|
||||
new KeyMatch(Keys.G, 6, 3),
|
||||
new KeyMatch(Keys.H, 7, 3),
|
||||
new KeyMatch(Keys.J, 8, 3),
|
||||
new KeyMatch(Keys.K, 9, 3),
|
||||
new KeyMatch(Keys.L, 10, 3),
|
||||
new KeyMatch(Keys.Oem1, 11, 3),
|
||||
new KeyMatch(Keys.Oem7, 12, 3),
|
||||
new KeyMatch(Keys.Oem5, 13, 3),
|
||||
new KeyMatch(Keys.Return, 14, 3),
|
||||
new KeyMatch(Keys.NumPad4, 17, 3),
|
||||
new KeyMatch(Keys.NumPad5, 18, 3),
|
||||
new KeyMatch(Keys.NumPad6, 19, 3),
|
||||
|
||||
// Row 5
|
||||
new KeyMatch(Keys.LShiftKey, 1, 4),
|
||||
new KeyMatch(Keys.OemBackslash, 2, 4),
|
||||
new KeyMatch(Keys.Z, 2, 4),
|
||||
new KeyMatch(Keys.X, 3, 4),
|
||||
new KeyMatch(Keys.C, 4, 4),
|
||||
new KeyMatch(Keys.V, 5, 4),
|
||||
new KeyMatch(Keys.B, 6, 4),
|
||||
new KeyMatch(Keys.N, 7, 4),
|
||||
new KeyMatch(Keys.M, 8, 4),
|
||||
new KeyMatch(Keys.Oemcomma, 9, 4),
|
||||
new KeyMatch(Keys.OemPeriod, 10, 4),
|
||||
new KeyMatch(Keys.OemQuestion, 11, 4),
|
||||
new KeyMatch(Keys.RShiftKey, 13, 4),
|
||||
new KeyMatch(Keys.Up, 15, 4),
|
||||
new KeyMatch(Keys.NumPad1, 17, 4),
|
||||
new KeyMatch(Keys.NumPad2, 18, 4),
|
||||
new KeyMatch(Keys.NumPad3, 19, 4),
|
||||
// Both returns return "Return" (Yes...)
|
||||
// new OrionKey(System.Windows.Forms.Keys.Return, 20, 4),
|
||||
|
||||
// Row 6
|
||||
new KeyMatch(Keys.LControlKey, 0, 5),
|
||||
new KeyMatch(Keys.LWin, 1, 5),
|
||||
new KeyMatch(Keys.LMenu, 3, 5),
|
||||
new KeyMatch(Keys.Space, 6, 5),
|
||||
new KeyMatch(Keys.RMenu, 11, 5),
|
||||
new KeyMatch(Keys.RWin, 12, 5),
|
||||
new KeyMatch(Keys.Apps, 13, 5),
|
||||
new KeyMatch(Keys.RControlKey, 14, 5),
|
||||
new KeyMatch(Keys.Left, 15, 5),
|
||||
new KeyMatch(Keys.Down, 16, 5),
|
||||
new KeyMatch(Keys.Right, 17, 5),
|
||||
new KeyMatch(Keys.NumPad0, 18, 5),
|
||||
new KeyMatch(Keys.Decimal, 19, 5)
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
#region Qwertz
|
||||
|
||||
QwertzLayout = new List<KeyMatch>
|
||||
{
|
||||
// Row 1
|
||||
new KeyMatch(Keys.Escape, 0, 0),
|
||||
new KeyMatch(Keys.F1, 2, 0),
|
||||
new KeyMatch(Keys.F2, 3, 0),
|
||||
new KeyMatch(Keys.F3, 4, 0),
|
||||
new KeyMatch(Keys.F4, 5, 0),
|
||||
new KeyMatch(Keys.F5, 6, 0),
|
||||
new KeyMatch(Keys.F6, 7, 0),
|
||||
new KeyMatch(Keys.F7, 8, 0),
|
||||
new KeyMatch(Keys.F8, 9, 0),
|
||||
new KeyMatch(Keys.F9, 11, 0),
|
||||
new KeyMatch(Keys.F10, 12, 0), // returns 'None'
|
||||
new KeyMatch(Keys.F11, 13, 0),
|
||||
new KeyMatch(Keys.F12, 14, 0),
|
||||
new KeyMatch(Keys.PrintScreen, 15, 0),
|
||||
new KeyMatch(Keys.Scroll, 16, 0),
|
||||
new KeyMatch(Keys.Pause, 17, 0),
|
||||
|
||||
// Row 2
|
||||
new KeyMatch(Keys.Oem5, 0, 1),
|
||||
new KeyMatch(Keys.D1, 1, 1),
|
||||
new KeyMatch(Keys.D2, 2, 1),
|
||||
new KeyMatch(Keys.D3, 3, 1),
|
||||
new KeyMatch(Keys.D4, 4, 1),
|
||||
new KeyMatch(Keys.D5, 5, 1),
|
||||
new KeyMatch(Keys.D6, 6, 1),
|
||||
new KeyMatch(Keys.D7, 7, 1),
|
||||
new KeyMatch(Keys.D8, 8, 1),
|
||||
new KeyMatch(Keys.D9, 9, 1),
|
||||
new KeyMatch(Keys.D0, 10, 1),
|
||||
new KeyMatch(Keys.OemOpenBrackets, 11, 1),
|
||||
new KeyMatch(Keys.Oem6, 12, 1),
|
||||
new KeyMatch(Keys.Back, 13, 1),
|
||||
new KeyMatch(Keys.Insert, 14, 1),
|
||||
new KeyMatch(Keys.Home, 15, 1),
|
||||
new KeyMatch(Keys.PageUp, 16, 1),
|
||||
new KeyMatch(Keys.NumLock, 17, 1),
|
||||
new KeyMatch(Keys.Divide, 18, 1),
|
||||
new KeyMatch(Keys.Multiply, 19, 1),
|
||||
new KeyMatch(Keys.Subtract, 20, 1),
|
||||
|
||||
// Row 3
|
||||
new KeyMatch(Keys.Tab, 0, 2),
|
||||
new KeyMatch(Keys.Q, 1, 2),
|
||||
new KeyMatch(Keys.W, 2, 2),
|
||||
new KeyMatch(Keys.E, 3, 2),
|
||||
new KeyMatch(Keys.R, 5, 2),
|
||||
new KeyMatch(Keys.T, 6, 2),
|
||||
new KeyMatch(Keys.Z, 7, 2),
|
||||
new KeyMatch(Keys.U, 8, 2),
|
||||
new KeyMatch(Keys.I, 9, 2),
|
||||
new KeyMatch(Keys.O, 10, 2),
|
||||
new KeyMatch(Keys.P, 11, 2),
|
||||
new KeyMatch(Keys.Oem1, 12, 2),
|
||||
new KeyMatch(Keys.Oemplus, 13, 2),
|
||||
new KeyMatch(Keys.Delete, 14, 2),
|
||||
new KeyMatch(Keys.End, 15, 2),
|
||||
new KeyMatch(Keys.Next, 16, 2),
|
||||
new KeyMatch(Keys.NumPad7, 17, 2),
|
||||
new KeyMatch(Keys.NumPad8, 18, 2),
|
||||
new KeyMatch(Keys.NumPad9, 19, 2),
|
||||
new KeyMatch(Keys.Add, 20, 2),
|
||||
|
||||
// Row 4
|
||||
new KeyMatch(Keys.Capital, 0, 3),
|
||||
new KeyMatch(Keys.A, 1, 3),
|
||||
new KeyMatch(Keys.S, 3, 3),
|
||||
new KeyMatch(Keys.D, 4, 3),
|
||||
new KeyMatch(Keys.F, 5, 3),
|
||||
new KeyMatch(Keys.G, 6, 3),
|
||||
new KeyMatch(Keys.H, 7, 3),
|
||||
new KeyMatch(Keys.J, 8, 3),
|
||||
new KeyMatch(Keys.K, 9, 3),
|
||||
new KeyMatch(Keys.L, 10, 3),
|
||||
new KeyMatch(Keys.Oemtilde, 11, 3),
|
||||
new KeyMatch(Keys.Oem7, 12, 3),
|
||||
new KeyMatch(Keys.OemQuestion, 13, 3),
|
||||
new KeyMatch(Keys.Return, 14, 3),
|
||||
new KeyMatch(Keys.NumPad4, 17, 3),
|
||||
new KeyMatch(Keys.NumPad5, 18, 3),
|
||||
new KeyMatch(Keys.NumPad6, 19, 3),
|
||||
|
||||
// Row 5
|
||||
new KeyMatch(Keys.LShiftKey, 1, 4),
|
||||
new KeyMatch(Keys.OemBackslash, 2, 4),
|
||||
new KeyMatch(Keys.Y, 2, 4),
|
||||
new KeyMatch(Keys.X, 3, 4),
|
||||
new KeyMatch(Keys.C, 4, 4),
|
||||
new KeyMatch(Keys.V, 5, 4),
|
||||
new KeyMatch(Keys.B, 6, 4),
|
||||
new KeyMatch(Keys.N, 7, 4),
|
||||
new KeyMatch(Keys.M, 8, 4),
|
||||
new KeyMatch(Keys.Oemcomma, 9, 4),
|
||||
new KeyMatch(Keys.OemPeriod, 10, 4),
|
||||
new KeyMatch(Keys.OemMinus, 11, 4),
|
||||
new KeyMatch(Keys.RShiftKey, 13, 4),
|
||||
new KeyMatch(Keys.Up, 15, 4),
|
||||
new KeyMatch(Keys.NumPad1, 17, 4),
|
||||
new KeyMatch(Keys.NumPad2, 18, 4),
|
||||
new KeyMatch(Keys.NumPad3, 19, 4),
|
||||
// Both returns return "Return" (Yes...)
|
||||
// new OrionKey(System.Windows.Forms.Keys.Return, 20, 4),
|
||||
|
||||
// Row 6
|
||||
new KeyMatch(Keys.LControlKey, 0, 5),
|
||||
new KeyMatch(Keys.LWin, 1, 5),
|
||||
new KeyMatch(Keys.Menu, 3, 5), // returns 'None'
|
||||
new KeyMatch(Keys.Space, 6, 5),
|
||||
new KeyMatch(Keys.RMenu, 11, 5),
|
||||
new KeyMatch(Keys.RWin, 12, 5),
|
||||
new KeyMatch(Keys.Apps, 13, 5),
|
||||
new KeyMatch(Keys.RControlKey, 14, 5),
|
||||
new KeyMatch(Keys.Left, 15, 5),
|
||||
new KeyMatch(Keys.Down, 16, 5),
|
||||
new KeyMatch(Keys.Right, 17, 5),
|
||||
new KeyMatch(Keys.NumPad0, 18, 5),
|
||||
new KeyMatch(Keys.Decimal, 19, 5)
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
#region Azerty
|
||||
|
||||
AzertyLayout = new List<KeyMatch>
|
||||
{
|
||||
// Row 1
|
||||
new KeyMatch(Keys.Escape, 0, 0),
|
||||
new KeyMatch(Keys.F1, 2, 0),
|
||||
new KeyMatch(Keys.F2, 3, 0),
|
||||
new KeyMatch(Keys.F3, 4, 0),
|
||||
new KeyMatch(Keys.F4, 5, 0),
|
||||
new KeyMatch(Keys.F5, 6, 0),
|
||||
new KeyMatch(Keys.F6, 7, 0),
|
||||
new KeyMatch(Keys.F7, 8, 0),
|
||||
new KeyMatch(Keys.F8, 9, 0),
|
||||
new KeyMatch(Keys.F9, 11, 0),
|
||||
new KeyMatch(Keys.F10, 12, 0),
|
||||
new KeyMatch(Keys.F11, 13, 0),
|
||||
new KeyMatch(Keys.F12, 14, 0),
|
||||
new KeyMatch(Keys.PrintScreen, 15, 0),
|
||||
new KeyMatch(Keys.Scroll, 16, 0),
|
||||
new KeyMatch(Keys.Pause, 17, 0),
|
||||
|
||||
// Row 2
|
||||
new KeyMatch(Keys.Oemtilde, 0, 1),
|
||||
new KeyMatch(Keys.D1, 1, 1),
|
||||
new KeyMatch(Keys.D2, 2, 1),
|
||||
new KeyMatch(Keys.D3, 3, 1),
|
||||
new KeyMatch(Keys.D4, 4, 1),
|
||||
new KeyMatch(Keys.D5, 5, 1),
|
||||
new KeyMatch(Keys.D6, 6, 1),
|
||||
new KeyMatch(Keys.D7, 7, 1),
|
||||
new KeyMatch(Keys.D8, 8, 1),
|
||||
new KeyMatch(Keys.D9, 9, 1),
|
||||
new KeyMatch(Keys.D0, 10, 1),
|
||||
new KeyMatch(Keys.OemMinus, 11, 1),
|
||||
new KeyMatch(Keys.Oemplus, 12, 1),
|
||||
new KeyMatch(Keys.Back, 13, 1),
|
||||
new KeyMatch(Keys.Insert, 14, 1),
|
||||
new KeyMatch(Keys.Home, 15, 1),
|
||||
new KeyMatch(Keys.PageUp, 16, 1),
|
||||
new KeyMatch(Keys.NumLock, 17, 1),
|
||||
new KeyMatch(Keys.Divide, 18, 1),
|
||||
new KeyMatch(Keys.Multiply, 19, 1),
|
||||
new KeyMatch(Keys.Subtract, 20, 1),
|
||||
|
||||
// Row 3
|
||||
new KeyMatch(Keys.Tab, 0, 2),
|
||||
new KeyMatch(Keys.A, 1, 2),
|
||||
new KeyMatch(Keys.Z, 2, 2),
|
||||
new KeyMatch(Keys.E, 3, 2),
|
||||
new KeyMatch(Keys.R, 5, 2),
|
||||
new KeyMatch(Keys.T, 6, 2),
|
||||
new KeyMatch(Keys.Y, 7, 2),
|
||||
new KeyMatch(Keys.U, 8, 2),
|
||||
new KeyMatch(Keys.I, 9, 2),
|
||||
new KeyMatch(Keys.O, 10, 2),
|
||||
new KeyMatch(Keys.P, 11, 2),
|
||||
new KeyMatch(Keys.OemQuotes, 12, 2),
|
||||
new KeyMatch(Keys.Oem6, 13, 2),
|
||||
new KeyMatch(Keys.Delete, 14, 2),
|
||||
new KeyMatch(Keys.End, 15, 2),
|
||||
new KeyMatch(Keys.Next, 16, 2),
|
||||
new KeyMatch(Keys.NumPad7, 17, 2),
|
||||
new KeyMatch(Keys.NumPad8, 18, 2),
|
||||
new KeyMatch(Keys.NumPad9, 19, 2),
|
||||
new KeyMatch(Keys.Add, 20, 2),
|
||||
|
||||
// Row 4
|
||||
new KeyMatch(Keys.Capital, 0, 3),
|
||||
new KeyMatch(Keys.Q, 1, 3),
|
||||
new KeyMatch(Keys.S, 3, 3),
|
||||
new KeyMatch(Keys.D, 4, 3),
|
||||
new KeyMatch(Keys.F, 5, 3),
|
||||
new KeyMatch(Keys.G, 6, 3),
|
||||
new KeyMatch(Keys.H, 7, 3),
|
||||
new KeyMatch(Keys.J, 8, 3),
|
||||
new KeyMatch(Keys.K, 9, 3),
|
||||
new KeyMatch(Keys.L, 10, 3),
|
||||
new KeyMatch(Keys.M, 11, 3),
|
||||
new KeyMatch(Keys.Oem7, 12, 3),
|
||||
new KeyMatch(Keys.Oem5, 13, 3),
|
||||
new KeyMatch(Keys.Return, 14, 3),
|
||||
new KeyMatch(Keys.NumPad4, 17, 3),
|
||||
new KeyMatch(Keys.NumPad5, 18, 3),
|
||||
new KeyMatch(Keys.NumPad6, 19, 3),
|
||||
|
||||
// Row 5
|
||||
new KeyMatch(Keys.LShiftKey, 1, 4),
|
||||
new KeyMatch(Keys.OemBackslash, 2, 4),
|
||||
new KeyMatch(Keys.W, 2, 4),
|
||||
new KeyMatch(Keys.X, 3, 4),
|
||||
new KeyMatch(Keys.C, 4, 4),
|
||||
new KeyMatch(Keys.V, 5, 4),
|
||||
new KeyMatch(Keys.B, 6, 4),
|
||||
new KeyMatch(Keys.N, 7, 4),
|
||||
new KeyMatch(Keys.OemQuestion, 8, 4),
|
||||
new KeyMatch(Keys.Oemcomma, 9, 4),
|
||||
new KeyMatch(Keys.OemPeriod, 10, 4),
|
||||
new KeyMatch(Keys.OemQuestion, 11, 4),
|
||||
new KeyMatch(Keys.RShiftKey, 13, 4),
|
||||
new KeyMatch(Keys.Up, 15, 4),
|
||||
new KeyMatch(Keys.NumPad1, 17, 4),
|
||||
new KeyMatch(Keys.NumPad2, 18, 4),
|
||||
new KeyMatch(Keys.NumPad3, 19, 4),
|
||||
// Both returns return "Return" (Yes...)
|
||||
// new OrionKey(System.Windows.Forms.Keys.Return, 20, 4),
|
||||
|
||||
// Row 6
|
||||
new KeyMatch(Keys.LControlKey, 0, 5),
|
||||
new KeyMatch(Keys.LWin, 1, 5),
|
||||
new KeyMatch(Keys.LMenu, 3, 5),
|
||||
new KeyMatch(Keys.Space, 6, 5),
|
||||
new KeyMatch(Keys.RMenu, 11, 5),
|
||||
new KeyMatch(Keys.RWin, 12, 5),
|
||||
new KeyMatch(Keys.Apps, 13, 5),
|
||||
new KeyMatch(Keys.RControlKey, 14, 5),
|
||||
new KeyMatch(Keys.Left, 15, 5),
|
||||
new KeyMatch(Keys.Down, 16, 5),
|
||||
new KeyMatch(Keys.Right, 17, 5),
|
||||
new KeyMatch(Keys.NumPad0, 18, 5),
|
||||
new KeyMatch(Keys.Decimal, 19, 5)
|
||||
};
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static List<KeyMatch> QwertyLayout { get; set; }
|
||||
public static List<KeyMatch> QwertzLayout { get; set; }
|
||||
public static List<KeyMatch> AzertyLayout { get; set; }
|
||||
}
|
||||
}
|
||||
@ -7,149 +7,7 @@ namespace Artemis.DeviceProviders.Logitech.Utilities
|
||||
{
|
||||
public static class OrionUtilities
|
||||
{
|
||||
public static KeyMapping[] Keymappings =
|
||||
{
|
||||
// First row
|
||||
new KeyMapping(0, 0),
|
||||
new KeyMapping(1, 1),
|
||||
new KeyMapping(2, 1),
|
||||
new KeyMapping(3, 2),
|
||||
new KeyMapping(4, 3),
|
||||
new KeyMapping(5, 4),
|
||||
new KeyMapping(6, 5),
|
||||
new KeyMapping(7, 6),
|
||||
new KeyMapping(8, 7),
|
||||
new KeyMapping(9, 8),
|
||||
new KeyMapping(10, 9),
|
||||
new KeyMapping(11, 9),
|
||||
new KeyMapping(12, 10),
|
||||
new KeyMapping(13, 11),
|
||||
new KeyMapping(13, 12),
|
||||
new KeyMapping(14, 13),
|
||||
new KeyMapping(15, 14),
|
||||
new KeyMapping(16, 15),
|
||||
new KeyMapping(17, 16),
|
||||
new KeyMapping(18, 17),
|
||||
new KeyMapping(19, 18),
|
||||
|
||||
// Second row
|
||||
new KeyMapping(21, 21),
|
||||
new KeyMapping(22, 22),
|
||||
new KeyMapping(23, 23),
|
||||
new KeyMapping(24, 24),
|
||||
new KeyMapping(25, 25),
|
||||
new KeyMapping(26, 26),
|
||||
new KeyMapping(27, 27),
|
||||
new KeyMapping(28, 28),
|
||||
new KeyMapping(29, 29),
|
||||
new KeyMapping(30, 30),
|
||||
new KeyMapping(31, 31),
|
||||
new KeyMapping(32, 32),
|
||||
new KeyMapping(33, 33),
|
||||
new KeyMapping(34, 34),
|
||||
new KeyMapping(35, 35),
|
||||
new KeyMapping(36, 36),
|
||||
new KeyMapping(37, 37),
|
||||
new KeyMapping(38, 38),
|
||||
new KeyMapping(39, 39),
|
||||
new KeyMapping(40, 40),
|
||||
new KeyMapping(41, 41),
|
||||
|
||||
// Third row
|
||||
new KeyMapping(42, 42),
|
||||
new KeyMapping(43, 43),
|
||||
new KeyMapping(44, 44),
|
||||
new KeyMapping(45, 45),
|
||||
new KeyMapping(46, 46),
|
||||
new KeyMapping(47, 46),
|
||||
new KeyMapping(48, 47),
|
||||
new KeyMapping(49, 48),
|
||||
new KeyMapping(50, 49),
|
||||
new KeyMapping(51, 50),
|
||||
new KeyMapping(52, 51),
|
||||
new KeyMapping(53, 52),
|
||||
new KeyMapping(54, 53),
|
||||
new KeyMapping(54, 54),
|
||||
new KeyMapping(55, 55),
|
||||
new KeyMapping(56, 56),
|
||||
new KeyMapping(57, 57),
|
||||
new KeyMapping(58, 58),
|
||||
new KeyMapping(59, 59),
|
||||
new KeyMapping(60, 60),
|
||||
new KeyMapping(61, 61),
|
||||
new KeyMapping(62, 62),
|
||||
|
||||
// Fourth row
|
||||
new KeyMapping(63, 63),
|
||||
new KeyMapping(64, 64),
|
||||
new KeyMapping(65, 65),
|
||||
new KeyMapping(66, 65),
|
||||
new KeyMapping(67, 66),
|
||||
new KeyMapping(68, 67),
|
||||
new KeyMapping(69, 68),
|
||||
new KeyMapping(70, 69),
|
||||
new KeyMapping(71, 70),
|
||||
new KeyMapping(72, 71),
|
||||
new KeyMapping(73, 72),
|
||||
new KeyMapping(74, 73),
|
||||
new KeyMapping(75, 74),
|
||||
new KeyMapping(76, 75),
|
||||
new KeyMapping(76, 76),
|
||||
new KeyMapping(78, 77),
|
||||
new KeyMapping(79, 78),
|
||||
new KeyMapping(79, 79),
|
||||
new KeyMapping(80, 80),
|
||||
new KeyMapping(81, 81),
|
||||
new KeyMapping(82, 82),
|
||||
|
||||
// Fifth row
|
||||
new KeyMapping(84, 84),
|
||||
new KeyMapping(85, 85),
|
||||
new KeyMapping(86, 86),
|
||||
new KeyMapping(87, 87),
|
||||
new KeyMapping(88, 88),
|
||||
new KeyMapping(89, 89),
|
||||
new KeyMapping(90, 90),
|
||||
new KeyMapping(91, 91),
|
||||
new KeyMapping(92, 92),
|
||||
new KeyMapping(93, 93),
|
||||
new KeyMapping(94, 94),
|
||||
new KeyMapping(95, 95),
|
||||
new KeyMapping(96, 96),
|
||||
new KeyMapping(97, 97),
|
||||
new KeyMapping(98, 98),
|
||||
new KeyMapping(99, 99),
|
||||
new KeyMapping(100, 100),
|
||||
new KeyMapping(101, 101),
|
||||
new KeyMapping(102, 102),
|
||||
new KeyMapping(103, 103),
|
||||
new KeyMapping(104, 104),
|
||||
|
||||
// Sixth row
|
||||
new KeyMapping(105, 105),
|
||||
new KeyMapping(106, 106),
|
||||
new KeyMapping(107, 107),
|
||||
new KeyMapping(108, 107),
|
||||
new KeyMapping(109, 109),
|
||||
new KeyMapping(110, 110),
|
||||
new KeyMapping(111, 110),
|
||||
new KeyMapping(112, 111),
|
||||
new KeyMapping(113, 112),
|
||||
new KeyMapping(114, 113),
|
||||
new KeyMapping(115, 114),
|
||||
new KeyMapping(116, 115),
|
||||
new KeyMapping(115, 116), // ALTGR
|
||||
new KeyMapping(116, 117),
|
||||
new KeyMapping(117, 118),
|
||||
new KeyMapping(118, 119),
|
||||
new KeyMapping(119, 120),
|
||||
new KeyMapping(120, 121),
|
||||
new KeyMapping(121, 122),
|
||||
new KeyMapping(122, 123),
|
||||
new KeyMapping(124, 124)
|
||||
};
|
||||
|
||||
public static byte[] BitmapToByteArray(Bitmap b, bool remap = true)
|
||||
public static byte[] BitmapToByteArray(Bitmap b, KeyMapping[] keymappings = null)
|
||||
{
|
||||
if (b.Width > 21 || b.Height > 6)
|
||||
b = ResizeImage(b, 21, 6);
|
||||
@ -158,23 +16,23 @@ namespace Artemis.DeviceProviders.Logitech.Utilities
|
||||
var bitmapData = b.LockBits(rect, ImageLockMode.ReadWrite, b.PixelFormat);
|
||||
|
||||
var depth = Image.GetPixelFormatSize(b.PixelFormat);
|
||||
var step = depth/8;
|
||||
var pixels = new byte[21*6*step];
|
||||
var step = depth / 8;
|
||||
var pixels = new byte[21 * 6 * step];
|
||||
var iptr = bitmapData.Scan0;
|
||||
|
||||
// Copy data from pointer to array
|
||||
Marshal.Copy(iptr, pixels, 0, pixels.Length);
|
||||
|
||||
if (!remap)
|
||||
if (keymappings == null)
|
||||
return pixels;
|
||||
|
||||
var remapped = new byte[pixels.Length];
|
||||
|
||||
// Every key is 4 bytes
|
||||
for (var i = 0; i <= pixels.Length/4; i++)
|
||||
for (var i = 0; i <= pixels.Length / 4; i++)
|
||||
{
|
||||
var firstSByte = Keymappings[i].Source*4;
|
||||
var firstTByte = Keymappings[i].Target*4;
|
||||
var firstSByte = keymappings[i].Source * 4;
|
||||
var firstTByte = keymappings[i].Target * 4;
|
||||
|
||||
for (var j = 0; j < 4; j++)
|
||||
remapped[firstTByte + j] = pixels[firstSByte + j];
|
||||
@ -234,4 +92,4 @@ namespace Artemis.DeviceProviders.Logitech.Utilities
|
||||
public int Target { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -141,15 +141,22 @@ namespace Artemis.Models
|
||||
|
||||
public async Task RenameProfile(ProfileModel profileModel)
|
||||
{
|
||||
// Store the old name
|
||||
var oldName = profileModel.Name;
|
||||
var name = await GetValidProfileName("Rename profile", "Please enter a unique new profile name");
|
||||
// User cancelled
|
||||
if (name == null)
|
||||
return;
|
||||
|
||||
// MakeProfileUnique does a check but also modifies the profile, set the old name back
|
||||
var doRename = await MakeProfileUnique(profileModel, name, profileModel.Name);
|
||||
var newName = profileModel.Name;
|
||||
profileModel.Name = oldName;
|
||||
|
||||
if (!doRename)
|
||||
return;
|
||||
|
||||
ProfileProvider.RenameProfile(profileModel, profileModel.Name);
|
||||
ProfileProvider.RenameProfile(profileModel, newName);
|
||||
}
|
||||
|
||||
public async Task<ProfileModel> DuplicateProfile(ProfileModel selectedProfile)
|
||||
|
||||
@ -96,10 +96,12 @@ namespace Artemis.Modules.Abstract
|
||||
|
||||
public void ChangeProfile(ProfileModel profileModel)
|
||||
{
|
||||
if (!IsInitialized || Equals(profileModel, ProfileModel))
|
||||
if (!IsInitialized)
|
||||
return;
|
||||
|
||||
ProfileModel?.Deactivate(_luaManager);
|
||||
ProfileModel = profileModel;
|
||||
|
||||
if (!IsOverlay)
|
||||
ProfileModel?.Activate(_luaManager);
|
||||
if (ProfileModel != null)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user