1
0
mirror of https://github.com/DarthAffe/RGB.NET.git synced 2025-12-13 10:08:31 +00:00

OpenRGB - Switch to file scoped namespaces

This commit is contained in:
Diogo Trindade 2022-09-25 15:37:43 +01:00
parent 2d203d31ab
commit 7954b876ef
14 changed files with 562 additions and 607 deletions

View File

@ -1,14 +1,14 @@
using RGB.NET.Core;
namespace RGB.NET.Devices.OpenRGB
namespace RGB.NET.Devices.OpenRGB;
/// <inheritdoc cref="AbstractRGBDevice{TDeviceInfo}" />
/// <summary>
/// Represents a generic OpenRGB Device.
/// </summary>
public abstract class AbstractOpenRGBDevice<TDeviceInfo> : AbstractRGBDevice<TDeviceInfo>, IOpenRGBDevice
where TDeviceInfo : OpenRGBDeviceInfo
{
/// <inheritdoc cref="AbstractRGBDevice{TDeviceInfo}" />
/// <summary>
/// Represents a generic OpenRGB Device.
/// </summary>
public abstract class AbstractOpenRGBDevice<TDeviceInfo> : AbstractRGBDevice<TDeviceInfo>, IOpenRGBDevice
where TDeviceInfo : AbstractOpenRGBDeviceInfo
{
#region Constructors
/// <summary>
@ -21,5 +21,4 @@ namespace RGB.NET.Devices.OpenRGB
{ }
#endregion
}
}

View File

@ -1,45 +0,0 @@
using RGB.NET.Core;
using System.Collections.Generic;
using OpenRGBDevice = OpenRGB.NET.Models.Device;
namespace RGB.NET.Devices.OpenRGB
{
/// <summary>
/// Represents generic information for an OpenRGB Device
/// </summary>
public abstract class AbstractOpenRGBDeviceInfo : IRGBDeviceInfo
{
/// <inheritdoc />
public RGBDeviceType DeviceType { get; }
/// <inheritdoc />
public string DeviceName { get; }
/// <inheritdoc />
public string Manufacturer { get; }
/// <inheritdoc />
public string Model { get; }
/// <inheritdoc />
public object? LayoutMetadata { get; set; }
/// <summary>
/// Gets the OpenRGB device.
/// </summary>
public OpenRGBDevice OpenRGBDevice { get; }
/// <summary>
/// Initializes a new instance of <see cref="AbstractOpenRGBDeviceInfo"/>.
/// </summary>
/// <param name="openRGBDevice">The OpenRGB device to extract information from.</param>
protected AbstractOpenRGBDeviceInfo(OpenRGBDevice openRGBDevice)
{
OpenRGBDevice = openRGBDevice;
DeviceType = Helper.GetRgbNetDeviceType(openRGBDevice.Type);
Manufacturer = Helper.GetVendorName(openRGBDevice);
Model = Helper.GetModelName(openRGBDevice);
DeviceName = DeviceHelper.CreateDeviceName(Manufacturer, Model);
}
}
}

View File

@ -1,7 +1,9 @@
using RGB.NET.Core;
namespace RGB.NET.Devices.OpenRGB
{
internal interface IOpenRGBDevice : IRGBDevice
{ }
}
namespace RGB.NET.Devices.OpenRGB;
/// <summary>
/// Represents a generic OpenRGB Device.
/// </summary>
public interface IOpenRGBDevice : IRGBDevice
{ }

View File

@ -0,0 +1,44 @@
using RGB.NET.Core;
using System.Collections.Generic;
using OpenRGBDevice = OpenRGB.NET.Models.Device;
namespace RGB.NET.Devices.OpenRGB;
/// <summary>
/// Represents generic information for an OpenRGB Device
/// </summary>
public class OpenRGBDeviceInfo : IRGBDeviceInfo
{
/// <inheritdoc />
public RGBDeviceType DeviceType { get; }
/// <inheritdoc />
public string DeviceName { get; }
/// <inheritdoc />
public string Manufacturer { get; }
/// <inheritdoc />
public string Model { get; }
/// <inheritdoc />
public object? LayoutMetadata { get; set; }
/// <summary>
/// Gets the OpenRGB device.
/// </summary>
public OpenRGBDevice OpenRGBDevice { get; }
/// <summary>
/// Initializes a new instance of <see cref="OpenRGBDeviceInfo"/>.
/// </summary>
/// <param name="openRGBDevice">The OpenRGB device to extract information from.</param>
internal OpenRGBDeviceInfo(OpenRGBDevice openRGBDevice)
{
OpenRGBDevice = openRGBDevice;
DeviceType = Helper.GetRgbNetDeviceType(openRGBDevice.Type);
Manufacturer = Helper.GetVendorName(openRGBDevice);
Model = Helper.GetModelName(openRGBDevice);
DeviceName = DeviceHelper.CreateDeviceName(Manufacturer, Model);
}
}

View File

@ -0,0 +1,145 @@
using RGB.NET.Core;
using System.Collections.Generic;
namespace RGB.NET.Devices.OpenRGB;
internal static class LedMappings
{
public static readonly Dictionary<string, LedId> Default = new()
{
["Key: A" ] = LedId.Keyboard_A ,
["Key: B" ] = LedId.Keyboard_B ,
["Key: C" ] = LedId.Keyboard_C ,
["Key: D" ] = LedId.Keyboard_D ,
["Key: E" ] = LedId.Keyboard_E ,
["Key: F" ] = LedId.Keyboard_F ,
["Key: G" ] = LedId.Keyboard_G ,
["Key: H" ] = LedId.Keyboard_H ,
["Key: I" ] = LedId.Keyboard_I ,
["Key: J" ] = LedId.Keyboard_J ,
["Key: K" ] = LedId.Keyboard_K ,
["Key: L" ] = LedId.Keyboard_L ,
["Key: M" ] = LedId.Keyboard_M ,
["Key: N" ] = LedId.Keyboard_N ,
["Key: O" ] = LedId.Keyboard_O ,
["Key: P" ] = LedId.Keyboard_P ,
["Key: Q" ] = LedId.Keyboard_Q ,
["Key: R" ] = LedId.Keyboard_R ,
["Key: S" ] = LedId.Keyboard_S ,
["Key: T" ] = LedId.Keyboard_T ,
["Key: U" ] = LedId.Keyboard_U ,
["Key: V" ] = LedId.Keyboard_V ,
["Key: W" ] = LedId.Keyboard_W ,
["Key: X" ] = LedId.Keyboard_X ,
["Key: Y" ] = LedId.Keyboard_Y ,
["Key: Z" ] = LedId.Keyboard_Z ,
["Key: 1" ] = LedId.Keyboard_1 ,
["Key: 2" ] = LedId.Keyboard_2 ,
["Key: 3" ] = LedId.Keyboard_3 ,
["Key: 4" ] = LedId.Keyboard_4 ,
["Key: 5" ] = LedId.Keyboard_5 ,
["Key: 6" ] = LedId.Keyboard_6 ,
["Key: 7" ] = LedId.Keyboard_7 ,
["Key: 8" ] = LedId.Keyboard_8 ,
["Key: 9" ] = LedId.Keyboard_9 ,
["Key: 0" ] = LedId.Keyboard_0 ,
["Key: Enter" ] = LedId.Keyboard_Enter ,
["Key: Enter (ISO)" ] = LedId.Keyboard_Enter ,
["Key: Escape" ] = LedId.Keyboard_Escape ,
["Key: Backspace" ] = LedId.Keyboard_Backspace ,
["Key: Tab" ] = LedId.Keyboard_Tab ,
["Key: Space" ] = LedId.Keyboard_Space ,
["Key: -" ] = LedId.Keyboard_MinusAndUnderscore ,
["Key: =" ] = LedId.Keyboard_EqualsAndPlus ,
["Key: [" ] = LedId.Keyboard_BracketLeft ,
["Key: ]" ] = LedId.Keyboard_BracketRight ,
["Key: \\ (ANSI)" ] = LedId.Keyboard_Backslash ,
["Key: #" ] = LedId.Keyboard_NonUsTilde ,
["Key: ;" ] = LedId.Keyboard_SemicolonAndColon ,
["Key: '" ] = LedId.Keyboard_ApostropheAndDoubleQuote,
["Key: `" ] = LedId.Keyboard_GraveAccentAndTilde ,
["Key: ," ] = LedId.Keyboard_CommaAndLessThan ,
["Key: ." ] = LedId.Keyboard_PeriodAndBiggerThan ,
["Key: /" ] = LedId.Keyboard_SlashAndQuestionMark ,
["Key: Caps Lock" ] = LedId.Keyboard_CapsLock ,
["Key: F1" ] = LedId.Keyboard_F1 ,
["Key: F2" ] = LedId.Keyboard_F2 ,
["Key: F3" ] = LedId.Keyboard_F3 ,
["Key: F4" ] = LedId.Keyboard_F4 ,
["Key: F5" ] = LedId.Keyboard_F5 ,
["Key: F6" ] = LedId.Keyboard_F6 ,
["Key: F7" ] = LedId.Keyboard_F7 ,
["Key: F8" ] = LedId.Keyboard_F8 ,
["Key: F9" ] = LedId.Keyboard_F9 ,
["Key: F10" ] = LedId.Keyboard_F10 ,
["Key: F11" ] = LedId.Keyboard_F11 ,
["Key: F12" ] = LedId.Keyboard_F12 ,
["Key: Print Screen" ] = LedId.Keyboard_PrintScreen ,
["Key: Scroll Lock" ] = LedId.Keyboard_ScrollLock ,
["Key: Pause/Break" ] = LedId.Keyboard_PauseBreak ,
["Key: Insert" ] = LedId.Keyboard_Insert ,
["Key: Home" ] = LedId.Keyboard_Home ,
["Key: Page Up" ] = LedId.Keyboard_PageUp ,
["Key: Delete" ] = LedId.Keyboard_Delete ,
["Key: End" ] = LedId.Keyboard_End ,
["Key: Page Down" ] = LedId.Keyboard_PageDown ,
["Key: Right Arrow" ] = LedId.Keyboard_ArrowRight ,
["Key: Left Arrow" ] = LedId.Keyboard_ArrowLeft ,
["Key: Down Arrow" ] = LedId.Keyboard_ArrowDown ,
["Key: Up Arrow" ] = LedId.Keyboard_ArrowUp ,
["Key: Num Lock" ] = LedId.Keyboard_NumLock ,
["Key: Number Pad /" ] = LedId.Keyboard_NumSlash ,
["Key: Number Pad *" ] = LedId.Keyboard_NumAsterisk ,
["Key: Number Pad -" ] = LedId.Keyboard_NumMinus ,
["Key: Number Pad +" ] = LedId.Keyboard_NumPlus ,
["Key: Number Pad Enter"] = LedId.Keyboard_NumEnter ,
["Key: Number Pad 1" ] = LedId.Keyboard_Num1 ,
["Key: Number Pad 2" ] = LedId.Keyboard_Num2 ,
["Key: Number Pad 3" ] = LedId.Keyboard_Num3 ,
["Key: Number Pad 4" ] = LedId.Keyboard_Num4 ,
["Key: Number Pad 5" ] = LedId.Keyboard_Num5 ,
["Key: Number Pad 6" ] = LedId.Keyboard_Num6 ,
["Key: Number Pad 7" ] = LedId.Keyboard_Num7 ,
["Key: Number Pad 8" ] = LedId.Keyboard_Num8 ,
["Key: Number Pad 9" ] = LedId.Keyboard_Num9 ,
["Key: Number Pad 0" ] = LedId.Keyboard_Num0 ,
["Key: Number Pad ." ] = LedId.Keyboard_NumPeriodAndDelete ,
["Key: Left Fn" ] = LedId.Keyboard_Function ,
["Key: Right Fn" ] = LedId.Keyboard_Function ,
["Key: \\ (ISO)" ] = LedId.Keyboard_NonUsBackslash ,
["Key: Menu" ] = LedId.Keyboard_Application ,
["Key: Left Control" ] = LedId.Keyboard_LeftCtrl ,
["Key: Left Shift" ] = LedId.Keyboard_LeftShift ,
["Key: Left Alt" ] = LedId.Keyboard_LeftAlt ,
["Key: Left Windows" ] = LedId.Keyboard_LeftGui ,
["Key: Right Control" ] = LedId.Keyboard_RightCtrl ,
["Key: Right Shift" ] = LedId.Keyboard_RightShift ,
["Key: Right Alt" ] = LedId.Keyboard_RightAlt ,
["Key: Right Windows" ] = LedId.Keyboard_RightGui ,
["Key: Media Next" ] = LedId.Keyboard_MediaNextTrack ,
["Key: Media Previous" ] = LedId.Keyboard_MediaPreviousTrack ,
["Key: Media Stop" ] = LedId.Keyboard_MediaStop ,
["Key: Media Pause" ] = LedId.Keyboard_MediaPlay ,
["Key: Media Play" ] = LedId.Keyboard_MediaPlay ,
["Key: Media Play/Pause"] = LedId.Keyboard_MediaPlay ,
["Key: Media Mute" ] = LedId.Keyboard_MediaMute ,
["Logo" ] = LedId.Logo ,
["Key: Brightness" ] = LedId.Keyboard_Brightness ,
["Key: M1" ] = LedId.Keyboard_Macro1 ,
["Key: M2" ] = LedId.Keyboard_Macro2 ,
["Key: M3" ] = LedId.Keyboard_Macro3 ,
["Key: M4" ] = LedId.Keyboard_Macro4 ,
["Key: M5" ] = LedId.Keyboard_Macro5 ,
["Key: G1" ] = LedId.Keyboard_Programmable1 ,
["Key: G2" ] = LedId.Keyboard_Programmable2 ,
["Key: G3" ] = LedId.Keyboard_Programmable3 ,
["Key: G4" ] = LedId.Keyboard_Programmable4 ,
["Key: G5" ] = LedId.Keyboard_Programmable5 ,
["Key: G6" ] = LedId.Keyboard_Programmable6 ,
["Key: G7" ] = LedId.Keyboard_Programmable7 ,
["Key: G8" ] = LedId.Keyboard_Programmable8 ,
["Key: G9" ] = LedId.Keyboard_Programmable9 ,
["Lighting" ] = LedId.Keyboard_Brightness ,
["Game Mode" ] = LedId.Keyboard_WinLock ,
};
}

View File

@ -1,17 +1,17 @@
using OpenRGB.NET.Enums;
using RGB.NET.Core;
namespace RGB.NET.Devices.OpenRGB.Generic
namespace RGB.NET.Devices.OpenRGB.Generic;
/// <inheritdoc />
public class OpenRGBGenericDevice : AbstractOpenRGBDevice<OpenRGBDeviceInfo>
{
/// <inheritdoc />
public class OpenRGBGenericDevice : AbstractOpenRGBDevice<OpenRGBGenericDeviceInfo>
{
/// <summary>
/// Initializes a new instance of the <see cref="OpenRGBGenericDevice"/> class.
/// </summary>
/// <param name="info">Generic information for the device.</param>
/// <param name="updateQueue">The queue used to update the device.</param>
public OpenRGBGenericDevice(OpenRGBGenericDeviceInfo info, IUpdateQueue updateQueue)
public OpenRGBGenericDevice(OpenRGBDeviceInfo info, IUpdateQueue updateQueue)
: base(info, updateQueue)
{
InitializeLayout();
@ -43,7 +43,7 @@ namespace RGB.NET.Devices.OpenRGB.Generic
if (index == uint.MaxValue)
continue;
LedId ledId = StandardKeyNames.Default.TryGetValue(DeviceInfo.OpenRGBDevice.Leds[zoneLedIndex + index].Name, out LedId l)
LedId ledId = LedMappings.Default.TryGetValue(DeviceInfo.OpenRGBDevice.Leds[zoneLedIndex + index].Name, out LedId l)
? l
: initial++;
@ -73,5 +73,4 @@ namespace RGB.NET.Devices.OpenRGB.Generic
zoneLedIndex += (int)zone.LedCount;
}
}
}
}

View File

@ -1,19 +0,0 @@
using RGB.NET.Core;
using System.Collections.Generic;
using OpenRGBDevice = OpenRGB.NET.Models.Device;
namespace RGB.NET.Devices.OpenRGB
{
/// <summary>
/// Represents generic information for an OpenRGB Device
/// </summary>
public class OpenRGBGenericDeviceInfo : AbstractOpenRGBDeviceInfo
{
/// <summary>
/// Initializes a new instance of <see cref="OpenRGBGenericDeviceInfo"/>.
/// </summary>
/// <param name="device">The OpenRGB device containing device-specific information.</param>
public OpenRGBGenericDeviceInfo(OpenRGBDevice device) : base(device)
{ }
}
}

View File

@ -5,14 +5,14 @@ using System.Linq;
using OpenRGBColor = OpenRGB.NET.Models.Color;
using OpenRGBDevice = OpenRGB.NET.Models.Device;
namespace RGB.NET.Devices.OpenRGB
namespace RGB.NET.Devices.OpenRGB;
/// <inheritdoc />
/// <summary>
/// Represents the update-queue performing updates for OpenRGB devices.
/// </summary>
public class OpenRGBUpdateQueue : UpdateQueue
{
/// <inheritdoc />
/// <summary>
/// Represents the update-queue performing updates for OpenRGB devices.
/// </summary>
public class OpenRGBUpdateQueue : UpdateQueue
{
#region Properties & Fields
private readonly int _deviceid;
@ -57,5 +57,4 @@ namespace RGB.NET.Devices.OpenRGB
}
#endregion
}
}

View File

@ -1,146 +0,0 @@
using RGB.NET.Core;
using System.Collections.Generic;
namespace RGB.NET.Devices.OpenRGB
{
internal static class StandardKeyNames
{
public static readonly Dictionary<string, LedId> Default = new()
{
["Key: A" ] = LedId.Keyboard_A ,
["Key: B" ] = LedId.Keyboard_B ,
["Key: C" ] = LedId.Keyboard_C ,
["Key: D" ] = LedId.Keyboard_D ,
["Key: E" ] = LedId.Keyboard_E ,
["Key: F" ] = LedId.Keyboard_F ,
["Key: G" ] = LedId.Keyboard_G ,
["Key: H" ] = LedId.Keyboard_H ,
["Key: I" ] = LedId.Keyboard_I ,
["Key: J" ] = LedId.Keyboard_J ,
["Key: K" ] = LedId.Keyboard_K ,
["Key: L" ] = LedId.Keyboard_L ,
["Key: M" ] = LedId.Keyboard_M ,
["Key: N" ] = LedId.Keyboard_N ,
["Key: O" ] = LedId.Keyboard_O ,
["Key: P" ] = LedId.Keyboard_P ,
["Key: Q" ] = LedId.Keyboard_Q ,
["Key: R" ] = LedId.Keyboard_R ,
["Key: S" ] = LedId.Keyboard_S ,
["Key: T" ] = LedId.Keyboard_T ,
["Key: U" ] = LedId.Keyboard_U ,
["Key: V" ] = LedId.Keyboard_V ,
["Key: W" ] = LedId.Keyboard_W ,
["Key: X" ] = LedId.Keyboard_X ,
["Key: Y" ] = LedId.Keyboard_Y ,
["Key: Z" ] = LedId.Keyboard_Z ,
["Key: 1" ] = LedId.Keyboard_1 ,
["Key: 2" ] = LedId.Keyboard_2 ,
["Key: 3" ] = LedId.Keyboard_3 ,
["Key: 4" ] = LedId.Keyboard_4 ,
["Key: 5" ] = LedId.Keyboard_5 ,
["Key: 6" ] = LedId.Keyboard_6 ,
["Key: 7" ] = LedId.Keyboard_7 ,
["Key: 8" ] = LedId.Keyboard_8 ,
["Key: 9" ] = LedId.Keyboard_9 ,
["Key: 0" ] = LedId.Keyboard_0 ,
["Key: Enter" ] = LedId.Keyboard_Enter ,
["Key: Enter (ISO)" ] = LedId.Keyboard_Enter ,
["Key: Escape" ] = LedId.Keyboard_Escape ,
["Key: Backspace" ] = LedId.Keyboard_Backspace ,
["Key: Tab" ] = LedId.Keyboard_Tab ,
["Key: Space" ] = LedId.Keyboard_Space ,
["Key: -" ] = LedId.Keyboard_MinusAndUnderscore ,
["Key: =" ] = LedId.Keyboard_EqualsAndPlus ,
["Key: [" ] = LedId.Keyboard_BracketLeft ,
["Key: ]" ] = LedId.Keyboard_BracketRight ,
["Key: \\ (ANSI)" ] = LedId.Keyboard_Backslash ,
["Key: #" ] = LedId.Keyboard_NonUsTilde ,
["Key: ;" ] = LedId.Keyboard_SemicolonAndColon ,
["Key: '" ] = LedId.Keyboard_ApostropheAndDoubleQuote,
["Key: `" ] = LedId.Keyboard_GraveAccentAndTilde ,
["Key: ," ] = LedId.Keyboard_CommaAndLessThan ,
["Key: ." ] = LedId.Keyboard_PeriodAndBiggerThan ,
["Key: /" ] = LedId.Keyboard_SlashAndQuestionMark ,
["Key: Caps Lock" ] = LedId.Keyboard_CapsLock ,
["Key: F1" ] = LedId.Keyboard_F1 ,
["Key: F2" ] = LedId.Keyboard_F2 ,
["Key: F3" ] = LedId.Keyboard_F3 ,
["Key: F4" ] = LedId.Keyboard_F4 ,
["Key: F5" ] = LedId.Keyboard_F5 ,
["Key: F6" ] = LedId.Keyboard_F6 ,
["Key: F7" ] = LedId.Keyboard_F7 ,
["Key: F8" ] = LedId.Keyboard_F8 ,
["Key: F9" ] = LedId.Keyboard_F9 ,
["Key: F10" ] = LedId.Keyboard_F10 ,
["Key: F11" ] = LedId.Keyboard_F11 ,
["Key: F12" ] = LedId.Keyboard_F12 ,
["Key: Print Screen" ] = LedId.Keyboard_PrintScreen ,
["Key: Scroll Lock" ] = LedId.Keyboard_ScrollLock ,
["Key: Pause/Break" ] = LedId.Keyboard_PauseBreak ,
["Key: Insert" ] = LedId.Keyboard_Insert ,
["Key: Home" ] = LedId.Keyboard_Home ,
["Key: Page Up" ] = LedId.Keyboard_PageUp ,
["Key: Delete" ] = LedId.Keyboard_Delete ,
["Key: End" ] = LedId.Keyboard_End ,
["Key: Page Down" ] = LedId.Keyboard_PageDown ,
["Key: Right Arrow" ] = LedId.Keyboard_ArrowRight ,
["Key: Left Arrow" ] = LedId.Keyboard_ArrowLeft ,
["Key: Down Arrow" ] = LedId.Keyboard_ArrowDown ,
["Key: Up Arrow" ] = LedId.Keyboard_ArrowUp ,
["Key: Num Lock" ] = LedId.Keyboard_NumLock ,
["Key: Number Pad /" ] = LedId.Keyboard_NumSlash ,
["Key: Number Pad *" ] = LedId.Keyboard_NumAsterisk ,
["Key: Number Pad -" ] = LedId.Keyboard_NumMinus ,
["Key: Number Pad +" ] = LedId.Keyboard_NumPlus ,
["Key: Number Pad Enter"] = LedId.Keyboard_NumEnter ,
["Key: Number Pad 1" ] = LedId.Keyboard_Num1 ,
["Key: Number Pad 2" ] = LedId.Keyboard_Num2 ,
["Key: Number Pad 3" ] = LedId.Keyboard_Num3 ,
["Key: Number Pad 4" ] = LedId.Keyboard_Num4 ,
["Key: Number Pad 5" ] = LedId.Keyboard_Num5 ,
["Key: Number Pad 6" ] = LedId.Keyboard_Num6 ,
["Key: Number Pad 7" ] = LedId.Keyboard_Num7 ,
["Key: Number Pad 8" ] = LedId.Keyboard_Num8 ,
["Key: Number Pad 9" ] = LedId.Keyboard_Num9 ,
["Key: Number Pad 0" ] = LedId.Keyboard_Num0 ,
["Key: Number Pad ." ] = LedId.Keyboard_NumPeriodAndDelete ,
["Key: Left Fn" ] = LedId.Keyboard_Function ,
["Key: Right Fn" ] = LedId.Keyboard_Function ,
["Key: \\ (ISO)" ] = LedId.Keyboard_NonUsBackslash ,
["Key: Menu" ] = LedId.Keyboard_Application ,
["Key: Left Control" ] = LedId.Keyboard_LeftCtrl ,
["Key: Left Shift" ] = LedId.Keyboard_LeftShift ,
["Key: Left Alt" ] = LedId.Keyboard_LeftAlt ,
["Key: Left Windows" ] = LedId.Keyboard_LeftGui ,
["Key: Right Control" ] = LedId.Keyboard_RightCtrl ,
["Key: Right Shift" ] = LedId.Keyboard_RightShift ,
["Key: Right Alt" ] = LedId.Keyboard_RightAlt ,
["Key: Right Windows" ] = LedId.Keyboard_RightGui ,
["Key: Media Next" ] = LedId.Keyboard_MediaNextTrack ,
["Key: Media Previous" ] = LedId.Keyboard_MediaPreviousTrack ,
["Key: Media Stop" ] = LedId.Keyboard_MediaStop ,
["Key: Media Pause" ] = LedId.Keyboard_MediaPlay ,
["Key: Media Play" ] = LedId.Keyboard_MediaPlay ,
["Key: Media Play/Pause"] = LedId.Keyboard_MediaPlay ,
["Key: Media Mute" ] = LedId.Keyboard_MediaMute ,
["Logo" ] = LedId.Logo ,
["Key: Brightness" ] = LedId.Keyboard_Brightness ,
["Key: M1" ] = LedId.Keyboard_Macro1 ,
["Key: M2" ] = LedId.Keyboard_Macro2 ,
["Key: M3" ] = LedId.Keyboard_Macro3 ,
["Key: M4" ] = LedId.Keyboard_Macro4 ,
["Key: M5" ] = LedId.Keyboard_Macro5 ,
["Key: G1" ] = LedId.Keyboard_Programmable1 ,
["Key: G2" ] = LedId.Keyboard_Programmable2 ,
["Key: G3" ] = LedId.Keyboard_Programmable3 ,
["Key: G4" ] = LedId.Keyboard_Programmable4 ,
["Key: G5" ] = LedId.Keyboard_Programmable5 ,
["Key: G6" ] = LedId.Keyboard_Programmable6 ,
["Key: G7" ] = LedId.Keyboard_Programmable7 ,
["Key: G8" ] = LedId.Keyboard_Programmable8 ,
["Key: G9" ] = LedId.Keyboard_Programmable9 ,
["Lighting" ] = LedId.Keyboard_Brightness ,
["Game Mode" ] = LedId.Keyboard_WinLock ,
};
}
}

View File

@ -2,10 +2,10 @@
using RGB.NET.Core;
using OpenRGBDevice = OpenRGB.NET.Models.Device;
namespace RGB.NET.Devices.OpenRGB
namespace RGB.NET.Devices.OpenRGB;
internal static class Helper
{
internal static class Helper
{
public static LedId GetInitialLedIdForDeviceType(RGBDeviceType type) => type switch
{
RGBDeviceType.Mouse => LedId.Mouse1,
@ -50,5 +50,4 @@ namespace RGB.NET.Devices.OpenRGB
public static string GetModelName(OpenRGBDevice openRGBDevice) => string.IsNullOrWhiteSpace(openRGBDevice.Vendor)
? openRGBDevice.Name
: openRGBDevice.Name.Replace(openRGBDevice.Vendor, "").Trim();
}
}

View File

@ -6,14 +6,14 @@ using System;
using System.Collections.Generic;
using System.Linq;
namespace RGB.NET.Devices.OpenRGB
namespace RGB.NET.Devices.OpenRGB;
/// <inheritdoc />
/// <summary>
/// Represents a device provider responsible for OpenRGB devices.
/// </summary>
public class OpenRGBDeviceProvider : AbstractRGBDeviceProvider
{
/// <inheritdoc />
/// <summary>
/// Represents a device provider responsible for OpenRGB devices.
/// </summary>
public class OpenRGBDeviceProvider : AbstractRGBDeviceProvider
{
#region Properties & Fields
private readonly List<OpenRGBClient> _clients = new List<OpenRGBClient>();
@ -114,13 +114,13 @@ namespace RGB.NET.Devices.OpenRGB
if (zone.LedCount == 0)
continue;
yield return new OpenRGBZoneDevice(new OpenRGBZoneDeviceInfo(device), totalLedCount, zone, updateQueue);
yield return new OpenRGBZoneDevice(new OpenRGBDeviceInfo(device), totalLedCount, zone, updateQueue);
totalLedCount += (int)zone.LedCount;
}
}
else
{
yield return new OpenRGBGenericDevice(new OpenRGBGenericDeviceInfo(device), updateQueue);
yield return new OpenRGBGenericDevice(new OpenRGBDeviceInfo(device), updateQueue);
}
}
}
@ -142,5 +142,4 @@ namespace RGB.NET.Devices.OpenRGB
Devices = Enumerable.Empty<IRGBDevice>();
}
#endregion
}
}

View File

@ -1,10 +1,10 @@
namespace RGB.NET.Devices.OpenRGB
namespace RGB.NET.Devices.OpenRGB;
/// <summary>
/// Represents a definition of an OpenRGB server.
/// </summary>
public class OpenRGBServerDefinition
{
/// <summary>
/// Represents a definition of an OpenRGB server.
/// </summary>
public class OpenRGBServerDefinition
{
/// <summary>
/// The name of the client that will appear in the OpenRGB interface.
/// </summary>
@ -29,5 +29,4 @@
/// The error that occurred when connecting, if this failed.
/// </summary>
public string? LastError { get; set; }
}
}

View File

@ -2,11 +2,11 @@
using OpenRGB.NET.Models;
using RGB.NET.Core;
namespace RGB.NET.Devices.OpenRGB
namespace RGB.NET.Devices.OpenRGB;
/// <inheritdoc />
public class OpenRGBZoneDevice : AbstractOpenRGBDevice<OpenRGBDeviceInfo>
{
/// <inheritdoc />
public class OpenRGBZoneDevice : AbstractOpenRGBDevice<OpenRGBZoneDeviceInfo>
{
private readonly int _initialLed;
private readonly Zone _zone;
@ -16,8 +16,8 @@ namespace RGB.NET.Devices.OpenRGB
/// <param name="info">The information provided by OpenRGB</param>
/// <param name="initialLed">The ledId of the first led in the device that belongs to this zone.</param>
/// <param name="zone">The Zone information provided by OpenRGB.</param>
/// <param name="updateQueue">The queu used to update this zone.</param>
public OpenRGBZoneDevice(OpenRGBZoneDeviceInfo info, int initialLed, Zone zone, IUpdateQueue updateQueue)
/// <param name="updateQueue">The queue used to update this zone.</param>
public OpenRGBZoneDevice(OpenRGBDeviceInfo info, int initialLed, Zone zone, IUpdateQueue updateQueue)
: base(info, updateQueue)
{
_initialLed = initialLed;
@ -44,7 +44,7 @@ namespace RGB.NET.Devices.OpenRGB
if (index == uint.MaxValue)
continue;
LedId ledId = StandardKeyNames.Default.TryGetValue(DeviceInfo.OpenRGBDevice.Leds[_initialLed + index].Name, out LedId l)
LedId ledId = LedMappings.Default.TryGetValue(DeviceInfo.OpenRGBDevice.Leds[_initialLed + index].Name, out LedId l)
? l
: initial++;
@ -64,5 +64,4 @@ namespace RGB.NET.Devices.OpenRGB
}
}
}
}
}

View File

@ -1,19 +0,0 @@
using RGB.NET.Core;
using System.Collections.Generic;
using OpenRGBDevice = OpenRGB.NET.Models.Device;
namespace RGB.NET.Devices.OpenRGB
{
/// <summary>
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Wooting.Keyboard.WootingKeyboardRGBDevice" />.
/// </summary>
public class OpenRGBZoneDeviceInfo : AbstractOpenRGBDeviceInfo
{
/// <summary>
///
/// </summary>
/// <param name="device"></param>
public OpenRGBZoneDeviceInfo(OpenRGBDevice device) : base(device)
{ }
}
}