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

@@ -1,6 +1,8 @@
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedMember.Global
using System.IO;
using System.Reflection;
using RGB.NET.Core;
using RGB.NET.Core.Exceptions;
@@ -36,10 +38,8 @@ namespace RGB.NET.Devices.Corsair
#region Methods
/// <summary>
/// Initializes the <see cref="Led"/> of the mouse.
/// </summary>
protected override void InitializeLeds()
/// <inheritdoc />
protected override void InitializeLayout()
{
switch (MouseDeviceInfo.PhysicalLayout)
{
@@ -64,6 +64,9 @@ namespace RGB.NET.Devices.Corsair
default:
throw new RGBDeviceException($"Can't initial mouse with layout '{MouseDeviceInfo.PhysicalLayout}'");
}
ApplyLayoutFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location),
$@"Layouts\Corsair\String\{MouseDeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"));
}
#endregion
@@ -1,4 +1,6 @@
using System;
using System.IO;
using System.Reflection;
using RGB.NET.Devices.Corsair.Native;
namespace RGB.NET.Devices.Corsair
@@ -29,7 +31,8 @@ namespace RGB.NET.Devices.Corsair
{
this.PhysicalLayout = (CorsairPhysicalMouseLayout)nativeInfo.physicalLayout;
Image = new Uri($"pack://application:,,,/RGB.NET.Devices.Corsair;component/Images/Mice/{Model.Replace(" ", string.Empty).ToUpper()}.png", UriKind.Absolute);
Image = new Uri(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location),
$@"Images\Corsair\Mice\{Model.Replace(" ", string.Empty).ToUpper()}.png"), UriKind.Relative);
}
#endregion