Added layout-functionality to corsair devices

This commit is contained in:
DarthAffe committed 2017-01-31 22:06:22 +01:00
1 parent cedd220789
commit f83b08af5e
12 files changed
+99 -31

No files matched your search

@@ -2,6 +2,8 @@
// ReSharper disable UnusedMember.Global
using System;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using RGB.NET.Core;
using RGB.NET.Devices.Corsair.Native;
@@ -38,10 +40,8 @@ namespace RGB.NET.Devices.Corsair
#region Methods
/// <summary>
/// Initializes the <see cref="Led"/> of the keyboard.
/// </summary>
protected override void InitializeLeds()
/// <inheritdoc />
protected override void InitializeLayout()
{
_CorsairLedPositions nativeLedPositions =
(_CorsairLedPositions)Marshal.PtrToStructure(_CUESDK.CorsairGetLedPositions(), typeof(_CorsairLedPositions));
@@ -57,6 +57,9 @@ namespace RGB.NET.Devices.Corsair
ptr = new IntPtr(ptr.ToInt64() + structSize);
}
ApplyLayoutFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location),
$@"Layouts\Corsair\Keyboards\{KeyboardDeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}\{KeyboardDeviceInfo.LogicalLayout.ToString().ToUpper()}.xml"));
}
#endregion
@@ -2,6 +2,8 @@
// ReSharper disable UnusedMember.Global
using System;
using System.IO;
using System.Reflection;
using RGB.NET.Devices.Corsair.Native;
namespace RGB.NET.Devices.Corsair
@@ -38,7 +40,8 @@ namespace RGB.NET.Devices.Corsair
this.PhysicalLayout = (CorsairPhysicalKeyboardLayout)nativeInfo.physicalLayout;
this.LogicalLayout = (CorsairLogicalKeyboardLayout)nativeInfo.logicalLayout;
Image = new Uri($"pack://application:,,,/RGB.NET.Devices.Corsair;component/Images/Keyboards/{Model.Replace(" ", string.Empty).ToUpper()}/{LogicalLayout.ToString().ToUpper()}.png", UriKind.Absolute);
Image = new Uri(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location),
$@"Images\Corsair\Keyboards\{Model.Replace(" ", string.Empty).ToUpper()}\{LogicalLayout.ToString().ToUpper()}.png"), UriKind.Absolute);
}
#endregion