mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2026-11-11 04:57:15 +00:00
Refactoring
This commit is contained in:
1 parent
7264731eb1
commit
59e0344c68
32 files changed
+82
-176
No files matched your search
@@ -2,7 +2,6 @@
|
||||
// ReSharper disable UnusedMember.Global
|
||||
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Devices.Corsair.Helper;
|
||||
|
||||
namespace RGB.NET.Devices.Corsair
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using RGB.NET.Devices.Corsair.Helper;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Devices.Corsair.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Corsair
|
||||
@@ -17,7 +17,7 @@ namespace RGB.NET.Devices.Corsair
|
||||
/// <param name="deviceIndex">The index of the <see cref="CorsairHeadsetRGBDevice"/>.</param>
|
||||
/// <param name="nativeInfo">The native <see cref="_CorsairDeviceInfo" />-struct</param>
|
||||
internal CorsairHeadsetRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo)
|
||||
: base(deviceIndex, Core.RGBDeviceType.Headset, nativeInfo)
|
||||
: base(deviceIndex, RGBDeviceType.Headset, nativeInfo)
|
||||
{
|
||||
Image = new Uri(PathHelper.GetAbsolutePath($@"Images\Corsair\Headsets\{Model.Replace(" ", string.Empty).ToUpper()}.png"), UriKind.Absolute);
|
||||
}
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
namespace RGB.NET.Devices.Corsair.Helper
|
||||
{
|
||||
/// <summary>
|
||||
/// Offers some helper-methods for file-path related things.
|
||||
/// </summary>
|
||||
internal static class PathHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns an absolute path created from an relative path relatvie to the location of the executung assembly.
|
||||
/// </summary>
|
||||
/// <param name="relativePath">The relative path to convert.</param>
|
||||
/// <returns>The absolute path.</returns>
|
||||
internal static string GetAbsolutePath(string relativePath)
|
||||
{
|
||||
string assemblyLocation = Assembly.GetEntryAssembly()?.Location;
|
||||
if (assemblyLocation == null) return relativePath;
|
||||
|
||||
return Path.Combine(Path.GetDirectoryName(assemblyLocation), relativePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Devices.Corsair.Helper;
|
||||
using RGB.NET.Devices.Corsair.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Corsair
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ReSharper disable UnusedMember.Global
|
||||
|
||||
using System;
|
||||
using RGB.NET.Devices.Corsair.Helper;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Devices.Corsair.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Corsair
|
||||
@@ -34,7 +34,7 @@ namespace RGB.NET.Devices.Corsair
|
||||
/// <param name="deviceIndex">The index of the <see cref="CorsairKeyboardRGBDevice"/>.</param>
|
||||
/// <param name="nativeInfo">The native <see cref="_CorsairDeviceInfo" />-struct</param>
|
||||
internal CorsairKeyboardRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo)
|
||||
: base(deviceIndex, Core.RGBDeviceType.Keyboard, nativeInfo)
|
||||
: base(deviceIndex, RGBDeviceType.Keyboard, nativeInfo)
|
||||
{
|
||||
this.PhysicalLayout = (CorsairPhysicalKeyboardLayout)nativeInfo.physicalLayout;
|
||||
this.LogicalLayout = (CorsairLogicalKeyboardLayout)nativeInfo.logicalLayout;
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Core.Exceptions;
|
||||
using RGB.NET.Devices.Corsair.Helper;
|
||||
|
||||
namespace RGB.NET.Devices.Corsair
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using RGB.NET.Devices.Corsair.Helper;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Devices.Corsair.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Corsair
|
||||
@@ -26,7 +26,7 @@ namespace RGB.NET.Devices.Corsair
|
||||
/// <param name="deviceIndex">The index of the <see cref="CorsairMouseRGBDevice"/>.</param>
|
||||
/// <param name="nativeInfo">The native <see cref="_CorsairDeviceInfo" />-struct</param>
|
||||
internal CorsairMouseRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo)
|
||||
: base(deviceIndex, Core.RGBDeviceType.Mouse, nativeInfo)
|
||||
: base(deviceIndex, RGBDeviceType.Mouse, nativeInfo)
|
||||
{
|
||||
this.PhysicalLayout = (CorsairPhysicalMouseLayout)nativeInfo.physicalLayout;
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Devices.Corsair.Helper;
|
||||
using RGB.NET.Devices.Corsair.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Corsair
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using RGB.NET.Devices.Corsair.Helper;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Devices.Corsair.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Corsair
|
||||
@@ -17,7 +17,7 @@ namespace RGB.NET.Devices.Corsair
|
||||
/// <param name="deviceIndex">The index if the <see cref="CorsairMousematRGBDevice"/>.</param>
|
||||
/// <param name="nativeInfo">The native <see cref="_CorsairDeviceInfo" />-struct</param>
|
||||
internal CorsairMousematRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo)
|
||||
: base(deviceIndex, Core.RGBDeviceType.Mousemat, nativeInfo)
|
||||
: base(deviceIndex, RGBDeviceType.Mousemat, nativeInfo)
|
||||
{
|
||||
Image = new Uri(PathHelper.GetAbsolutePath($@"Images\Corsair\Mousemat\{Model.Replace(" ", string.Empty).ToUpper()}.png"), UriKind.Absolute);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,6 @@
|
||||
<Compile Include="Generic\CorsairRGBDevice.cs" />
|
||||
<Compile Include="Headset\CorsairHeadsetRGBDevice.cs" />
|
||||
<Compile Include="Headset\CorsairHeadsetRGBDeviceInfo.cs" />
|
||||
<Compile Include="Helper\PathHelper.cs" />
|
||||
<Compile Include="Keyboard\CorsairKeyboardRGBDevice.cs" />
|
||||
<Compile Include="Keyboard\CorsairKeyboardRGBDeviceInfo.cs" />
|
||||
<Compile Include="Mouse\CorsairMouseRGBDevice.cs" />
|
||||
|
||||
Reference in new issue
Block a user