mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-13 01:58:30 +00:00
Merge
This commit is contained in:
commit
28d8335ee0
@ -73,7 +73,7 @@ namespace RGB.NET.Devices.Logitech
|
||||
{ LedId.Keyboard_P, 208 },
|
||||
{ LedId.Keyboard_BracketLeft, 212 },
|
||||
{ LedId.Keyboard_BracketRight, 216 },
|
||||
// { LedId.Keyboard_?, 220 },
|
||||
{ LedId.Keyboard_Backslash, 220 },
|
||||
{ LedId.Keyboard_Delete, 224 },
|
||||
{ LedId.Keyboard_End, 228 },
|
||||
{ LedId.Keyboard_PageDown, 232 },
|
||||
@ -105,7 +105,7 @@ namespace RGB.NET.Devices.Logitech
|
||||
// { LedId.Keyboard_?, 332 },
|
||||
|
||||
{ LedId.Keyboard_LeftShift, 336 },
|
||||
{ LedId.Keyboard_Backslash, 340 },
|
||||
{ LedId.Keyboard_NonUsBackslash, 340 },
|
||||
{ LedId.Keyboard_Z, 344 },
|
||||
{ LedId.Keyboard_X, 348 },
|
||||
{ LedId.Keyboard_C, 352 },
|
||||
|
||||
@ -82,6 +82,7 @@ namespace RGB.NET.Devices.Logitech
|
||||
{ LedId.Keyboard_Home, LogitechLedId.HOME },
|
||||
{ LedId.Keyboard_PageUp, LogitechLedId.PAGE_UP },
|
||||
{ LedId.Keyboard_BracketRight, LogitechLedId.CLOSE_BRACKET },
|
||||
{ LedId.Keyboard_NonUsBackslash, LogitechLedId.BACKSLASH },
|
||||
{ LedId.Keyboard_Backslash, LogitechLedId.BACKSLASH },
|
||||
{ LedId.Keyboard_NonUsTilde, LogitechLedId.NonUsTilde },
|
||||
{ LedId.Keyboard_Enter, LogitechLedId.ENTER },
|
||||
|
||||
@ -6,11 +6,11 @@ using RGB.NET.Devices.Razer.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Razer
|
||||
{
|
||||
/// <inheritdoc cref="RazerRGBDevice{TDeviceInfo}" />
|
||||
/// <inheritdoc cref="RazerRGBDevice" />
|
||||
/// <summary>
|
||||
/// Represents a razer chroma link.
|
||||
/// </summary>
|
||||
public class RazerChromaLinkRGBDevice : RazerRGBDevice<RazerChromaLinkRGBDeviceInfo>, ILedStripe
|
||||
public class RazerChromaLinkRGBDevice : RazerRGBDevice, IUnknownDevice
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
@ -19,8 +19,8 @@ namespace RGB.NET.Devices.Razer
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Razer.RazerChromaLinkRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by CUE for the chroma link.</param>
|
||||
internal RazerChromaLinkRGBDevice(RazerChromaLinkRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, new RazerChromaLinkUpdateQueue(updateTrigger, info.DeviceId))
|
||||
internal RazerChromaLinkRGBDevice(RazerRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, new RazerChromaLinkUpdateQueue(updateTrigger))
|
||||
{
|
||||
InitializeLayout();
|
||||
}
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
using System;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.Razer
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Razer.RazerChromaLinkRGBDevice" />.
|
||||
/// </summary>
|
||||
public class RazerChromaLinkRGBDeviceInfo : RazerRGBDeviceInfo
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Internal constructor of managed <see cref="T:RGB.NET.Devices.Razer.RazerChromaLinkRGBDeviceInfo" />.
|
||||
/// </summary>
|
||||
/// <param name="deviceId">The Id of the <see cref="IRGBDevice"/>.</param>
|
||||
/// <param name="model">The model of the <see cref="IRGBDevice"/>.</param>
|
||||
internal RazerChromaLinkRGBDeviceInfo(Guid deviceId, string model)
|
||||
: base(deviceId, RGBDeviceType.LedStripe, model)
|
||||
{ }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -16,9 +16,8 @@ namespace RGB.NET.Devices.Razer
|
||||
/// Initializes a new instance of the <see cref="RazerChromaLinkUpdateQueue" /> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used to update this queue.</param>
|
||||
/// <param name="deviceId">The id of the device updated by this queue.</param>
|
||||
public RazerChromaLinkUpdateQueue(IDeviceUpdateTrigger updateTrigger, Guid deviceId)
|
||||
: base(updateTrigger, deviceId)
|
||||
public RazerChromaLinkUpdateQueue(IDeviceUpdateTrigger updateTrigger)
|
||||
: base(updateTrigger)
|
||||
{ }
|
||||
|
||||
#endregion
|
||||
|
||||
@ -3,21 +3,20 @@ using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.Razer
|
||||
{
|
||||
/// <inheritdoc cref="AbstractRGBDevice{TDeviceInfo}" />
|
||||
/// <inheritdoc cref="AbstractRGBDevice{RazerRGBDeviceInfo}" />
|
||||
/// <inheritdoc cref="IRazerRGBDevice" />
|
||||
/// <summary>
|
||||
/// Represents a generic razer-device. (keyboard, mouse, headset, mousepad).
|
||||
/// </summary>
|
||||
public abstract class RazerRGBDevice<TDeviceInfo> : AbstractRGBDevice<TDeviceInfo>, IRazerRGBDevice
|
||||
where TDeviceInfo : RazerRGBDeviceInfo
|
||||
public abstract class RazerRGBDevice : AbstractRGBDevice<RazerRGBDeviceInfo>, IRazerRGBDevice
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RazerRGBDevice{TDeviceInfo}"/> class.
|
||||
/// Initializes a new instance of the <see cref="RazerRGBDevice"/> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The generic information provided by razer for the device.</param>
|
||||
protected RazerRGBDevice(TDeviceInfo info, IUpdateQueue updateQueue)
|
||||
protected RazerRGBDevice(RazerRGBDeviceInfo info, IUpdateQueue updateQueue)
|
||||
: base(info, updateQueue)
|
||||
{
|
||||
RequiresFlush = true;
|
||||
|
||||
@ -11,11 +11,6 @@ namespace RGB.NET.Devices.Razer
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Id of the <see cref="RazerRGBDevice{TDeviceInfo}"/>.
|
||||
/// </summary>
|
||||
public Guid DeviceId { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public RGBDeviceType DeviceType { get; }
|
||||
|
||||
@ -38,12 +33,10 @@ namespace RGB.NET.Devices.Razer
|
||||
/// <summary>
|
||||
/// Internal constructor of managed <see cref="RazerRGBDeviceInfo"/>.
|
||||
/// </summary>
|
||||
/// <param name="deviceId">The Id of the <see cref="IRGBDevice"/>.</param>
|
||||
/// <param name="deviceType">The type of the <see cref="IRGBDevice"/>.</param>
|
||||
/// <param name="model">The model of the <see cref="IRGBDevice"/>.</param>
|
||||
internal RazerRGBDeviceInfo(Guid deviceId, RGBDeviceType deviceType, string model)
|
||||
internal RazerRGBDeviceInfo(RGBDeviceType deviceType, string model)
|
||||
{
|
||||
this.DeviceId = deviceId;
|
||||
this.DeviceType = deviceType;
|
||||
this.Model = model;
|
||||
|
||||
|
||||
@ -10,8 +10,7 @@ namespace RGB.NET.Devices.Razer
|
||||
public abstract class RazerUpdateQueue : UpdateQueue
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private readonly Guid _deviceId;
|
||||
|
||||
private Guid? _lastEffect;
|
||||
|
||||
#endregion
|
||||
@ -22,11 +21,9 @@ namespace RGB.NET.Devices.Razer
|
||||
/// Initializes a new instance of the <see cref="RazerUpdateQueue" /> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used to update this queue.</param>
|
||||
/// <param name="deviceId">The id of the device updated by this queue.</param>
|
||||
protected RazerUpdateQueue(IDeviceUpdateTrigger updateTrigger, Guid deviceId)
|
||||
protected RazerUpdateQueue(IDeviceUpdateTrigger updateTrigger)
|
||||
: base(updateTrigger)
|
||||
{
|
||||
this._deviceId = deviceId;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -53,7 +50,7 @@ namespace RGB.NET.Devices.Razer
|
||||
/// </summary>
|
||||
/// <param name="effectParams">The parameters of the effect.</param>
|
||||
/// <param name="effectId">The id this effect is created with.</param>
|
||||
protected virtual void CreateEffect(IntPtr effectParams, ref Guid effectId) => _RazerSDK.CreateEffect(_deviceId, _Defines.EFFECT_ID, effectParams, ref effectId);
|
||||
protected abstract void CreateEffect(IntPtr effectParams, ref Guid effectId);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Reset()
|
||||
|
||||
184
RGB.NET.Devices.Razer/HID/DeviceChecker.cs
Normal file
184
RGB.NET.Devices.Razer/HID/DeviceChecker.cs
Normal file
@ -0,0 +1,184 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using HidSharp;
|
||||
using RGB.NET.Core;
|
||||
using DeviceDataList = System.Collections.Generic.List<(string model, RGB.NET.Core.RGBDeviceType deviceType, int id)>;
|
||||
|
||||
namespace RGB.NET.Devices.Razer.HID
|
||||
{
|
||||
internal static class DeviceChecker
|
||||
{
|
||||
#region Constants
|
||||
|
||||
private const int VENDOR_ID = 0x1532;
|
||||
|
||||
private static readonly DeviceDataList DEVICES
|
||||
= new()
|
||||
{
|
||||
// Keyboards
|
||||
("BlackWidow Ultimate 2012", RGBDeviceType.Keyboard, 0x010D),
|
||||
("BlackWidow Classic (Alternate)", RGBDeviceType.Keyboard, 0x010E),
|
||||
("Anansi", RGBDeviceType.Keyboard, 0x010F),
|
||||
("BlackWidow Ultimate 2013", RGBDeviceType.Keyboard, 0x011A),
|
||||
("BlackWidow Stealth", RGBDeviceType.Keyboard, 0x011B),
|
||||
("DeathStalker Expert", RGBDeviceType.Keyboard, 0x0202),
|
||||
("BlackWidow Chroma", RGBDeviceType.Keyboard, 0x0203),
|
||||
("DeathStalker Chroma", RGBDeviceType.Keyboard, 0x0204),
|
||||
("Blade Stealth", RGBDeviceType.Keyboard, 0x0205),
|
||||
("BlackWidow Tournament Edition Chroma", RGBDeviceType.Keyboard, 0x0209),
|
||||
("Blade QHD", RGBDeviceType.Keyboard, 0x020F),
|
||||
("Blade Pro (Late 2016)", RGBDeviceType.Keyboard, 0x0210),
|
||||
("BlackWidow Chroma (Overwatch)", RGBDeviceType.Keyboard, 0x0211),
|
||||
("BlackWidow Ultimate 2016", RGBDeviceType.Keyboard, 0x0214),
|
||||
("BlackWidow X Chroma", RGBDeviceType.Keyboard, 0x0216),
|
||||
("BlackWidow X Ultimate", RGBDeviceType.Keyboard, 0x0217),
|
||||
("BlackWidow X Tournament Edition Chroma", RGBDeviceType.Keyboard, 0x021A),
|
||||
("Ornata Chroma", RGBDeviceType.Keyboard, 0x021E),
|
||||
("Ornata", RGBDeviceType.Keyboard, 0x021F),
|
||||
("Blade Stealth (Late 2016)", RGBDeviceType.Keyboard, 0x0220),
|
||||
("BlackWidow Chroma V2", RGBDeviceType.Keyboard, 0x0221),
|
||||
("Blade (Late 2016)", RGBDeviceType.Keyboard, 0x0224),
|
||||
("Blade Pro (2017)", RGBDeviceType.Keyboard, 0x0225),
|
||||
("Huntsman Elite", RGBDeviceType.Keyboard, 0x0226),
|
||||
("Huntsman", RGBDeviceType.Keyboard, 0x0227),
|
||||
("BlackWidow Elite", RGBDeviceType.Keyboard, 0x0228),
|
||||
("Cynosa Chroma", RGBDeviceType.Keyboard, 0x022A),
|
||||
("Blade Stealth (Mid 2017)", RGBDeviceType.Keyboard, 0x022D),
|
||||
("Blade Pro FullHD (2017)", RGBDeviceType.Keyboard, 0x022F),
|
||||
("Blade Stealth (Late 2017)", RGBDeviceType.Keyboard, 0x0232),
|
||||
("Blade 15 (2018)", RGBDeviceType.Keyboard, 0x0233),
|
||||
("Blade Pro 17 (2019)", RGBDeviceType.Keyboard, 0x0234),
|
||||
("BlackWidow Lite (2018)", RGBDeviceType.Keyboard, 0x0235),
|
||||
("BlackWidow Essential", RGBDeviceType.Keyboard, 0x0237),
|
||||
("Blade Stealth (2019)", RGBDeviceType.Keyboard, 0x0239),
|
||||
("Blade 15 (2019) Advanced", RGBDeviceType.Keyboard, 0x023A),
|
||||
("Blade 15 (2018) Base Model", RGBDeviceType.Keyboard, 0x023B),
|
||||
("Cynosa Lite", RGBDeviceType.Keyboard, 0x023F),
|
||||
("Blade 15 (2018) Mercury", RGBDeviceType.Keyboard, 0x0240),
|
||||
("BlackWidow (2019)", RGBDeviceType.Keyboard, 0x0241),
|
||||
("Huntsman Tournament Edition", RGBDeviceType.Keyboard, 0x0243),
|
||||
("Blade 15 (Mid 2019) Mercury", RGBDeviceType.Keyboard, 0x0245),
|
||||
("Blade 15 (Mid 2019) Base", RGBDeviceType.Keyboard, 0x0246),
|
||||
("Blade Stealth (Late 2019)", RGBDeviceType.Keyboard, 0x024A),
|
||||
("Blade Pro (Late 2019)", RGBDeviceType.Keyboard, 0x024C),
|
||||
("Blade 15 Studio Edition (2019)", RGBDeviceType.Keyboard, 0x024D),
|
||||
("Blade Stealth (Early 2020)", RGBDeviceType.Keyboard, 0x0252),
|
||||
("Blade 15 Advanced (2020)", RGBDeviceType.Keyboard, 0x0253),
|
||||
("Blade 15 (Early 2020) Base", RGBDeviceType.Keyboard, 0x0255),
|
||||
("Blade Stealth (Late 2020)", RGBDeviceType.Keyboard, 0x0259),
|
||||
("Ornata Chroma V2", RGBDeviceType.Keyboard, 0x025D),
|
||||
("Cynosa V2", RGBDeviceType.Keyboard, 0x025E),
|
||||
|
||||
// Mice
|
||||
("Orochi 2011", RGBDeviceType.Mouse, 0x0013),
|
||||
("DeathAdder 3.5G", RGBDeviceType.Mouse, 0x0016),
|
||||
("Abyssus 1800", RGBDeviceType.Mouse, 0x0020),
|
||||
("Mamba 2012 (Wired)", RGBDeviceType.Mouse, 0x0024),
|
||||
("Mamba 2012 (Wireless)", RGBDeviceType.Mouse, 0x0025),
|
||||
("Naga 2012", RGBDeviceType.Mouse, 0x002E),
|
||||
("Imperator 2012", RGBDeviceType.Mouse, 0x002F),
|
||||
("Ouroboros 2012", RGBDeviceType.Mouse, 0x0032),
|
||||
("Taipan", RGBDeviceType.Mouse, 0x0034),
|
||||
("Naga Hex (Red)", RGBDeviceType.Mouse, 0x0036),
|
||||
("DeathAdder 2013", RGBDeviceType.Mouse, 0x0037),
|
||||
("DeathAdder 1800", RGBDeviceType.Mouse, 0x0038),
|
||||
("Orochi 2013", RGBDeviceType.Mouse, 0x0039),
|
||||
("Naga 2014", RGBDeviceType.Mouse, 0x0040),
|
||||
("Naga Hex", RGBDeviceType.Mouse, 0x0041),
|
||||
("Abyssus 2014", RGBDeviceType.Mouse, 0x0042),
|
||||
("DeathAdder Chroma", RGBDeviceType.Mouse, 0x0043),
|
||||
("Mamba (Wired)", RGBDeviceType.Mouse, 0x0044),
|
||||
("Mamba (Wireless)", RGBDeviceType.Mouse, 0x0045),
|
||||
("Mamba Tournament Edition", RGBDeviceType.Mouse, 0x0046),
|
||||
("Orochi (Wired)", RGBDeviceType.Mouse, 0x0048),
|
||||
("Diamondback Chroma", RGBDeviceType.Mouse, 0x004C),
|
||||
("DeathAdder 2000", RGBDeviceType.Mouse, 0x004F),
|
||||
("Naga Hex V2", RGBDeviceType.Mouse, 0x0050),
|
||||
("Naga Chroma", RGBDeviceType.Mouse, 0x0053),
|
||||
("DeathAdder 3500", RGBDeviceType.Mouse, 0x0054),
|
||||
("Lancehead (Wired)", RGBDeviceType.Mouse, 0x0059),
|
||||
("Lancehead (Wireless)", RGBDeviceType.Mouse, 0x005A),
|
||||
("Abyssus V2", RGBDeviceType.Mouse, 0x005B),
|
||||
("DeathAdder Elite", RGBDeviceType.Mouse, 0x005C),
|
||||
("Abyssus 2000", RGBDeviceType.Mouse, 0x005E),
|
||||
("Lancehead Tournament Edition", RGBDeviceType.Mouse, 0x0060),
|
||||
("Atheris (Receiver)", RGBDeviceType.Mouse, 0x0062),
|
||||
("Basilisk", RGBDeviceType.Mouse, 0x0064),
|
||||
("Naga Trinity", RGBDeviceType.Mouse, 0x0067),
|
||||
("Abyssus Elite (D.Va Edition)", RGBDeviceType.Mouse, 0x006A),
|
||||
("Abyssus Essential", RGBDeviceType.Mouse, 0x006B),
|
||||
("Mamba Elite (Wired)", RGBDeviceType.Mouse, 0x006C),
|
||||
("DeathAdder Essential", RGBDeviceType.Mouse, 0x006E),
|
||||
("Lancehead Wireless (Receiver)", RGBDeviceType.Mouse, 0x006F),
|
||||
("Lancehead Wireless (Wired)", RGBDeviceType.Mouse, 0x0070),
|
||||
("DeathAdder Essential (White Edition)", RGBDeviceType.Mouse, 0x0071),
|
||||
("Mamba Wireless (Receiver)", RGBDeviceType.Mouse, 0x0072),
|
||||
("Mamba Wireless (Wired)", RGBDeviceType.Mouse, 0x0073),
|
||||
("Viper", RGBDeviceType.Mouse, 0x0078),
|
||||
("Viper Ultimate (Wired)", RGBDeviceType.Mouse, 0x007A),
|
||||
("Viper Ultimate (Wireless)", RGBDeviceType.Mouse, 0x007B),
|
||||
("DeathAdder V2 Pro (Wired)", RGBDeviceType.Mouse, 0x007C),
|
||||
("DeathAdder V2 Pro (Wireless)", RGBDeviceType.Mouse, 0x007D),
|
||||
("Basilisk X HyperSpeed", RGBDeviceType.Mouse, 0x0083),
|
||||
("Basilisk Ultimate", RGBDeviceType.Mouse, 0x0088),
|
||||
("DeathAdder V2", RGBDeviceType.Mouse, 0x0084),
|
||||
("Viper Mini", RGBDeviceType.Mouse, 0x008A),
|
||||
|
||||
// Mousepads
|
||||
("Firefly Hyperflux", RGBDeviceType.Mousepad, 0x0068),
|
||||
("Firefly", RGBDeviceType.Mousepad, 0x0C00),
|
||||
("Goliathus", RGBDeviceType.Mousepad, 0x0C01),
|
||||
("Goliathus Extended", RGBDeviceType.Mousepad, 0x0C02),
|
||||
("Firefly v2", RGBDeviceType.Mousepad, 0x0C04),
|
||||
|
||||
// Headsets
|
||||
("Kraken 7.1", RGBDeviceType.Headset, 0x0501),
|
||||
("Kraken 7.1 Chroma", RGBDeviceType.Headset, 0x0504),
|
||||
("Kraken 7.1", RGBDeviceType.Headset, 0x0506),
|
||||
("Kraken 7.1 V2", RGBDeviceType.Headset, 0x0510),
|
||||
("Kraken Ultimate", RGBDeviceType.Headset, 0x0527),
|
||||
("Kraken Kitty Edition", RGBDeviceType.Headset, 0x0F19),
|
||||
|
||||
// Keypads
|
||||
("Nostromo", RGBDeviceType.Keypad, 0x0111),
|
||||
("Orbweaver", RGBDeviceType.Keypad, 0x0113),
|
||||
("Tartarus", RGBDeviceType.Keypad, 0x0201),
|
||||
("Orbweaver Chroma", RGBDeviceType.Keypad, 0x0207),
|
||||
("Tartarus Chroma", RGBDeviceType.Keypad, 0x0208),
|
||||
("Tartarus V2", RGBDeviceType.Keypad, 0x022B),
|
||||
("Tartarus Pro", RGBDeviceType.Keypad, 0x0244),
|
||||
|
||||
// Misc - unsupported through the effects API
|
||||
// ("Core", RGBDeviceType.GraphicsCard, 0x0215),
|
||||
// ("Base Station Chroma", RGBDeviceType.HeadsetStand, 0x0F08),
|
||||
// ("Nommo Chroma", RGBDeviceType.Unknown, 0x0517),
|
||||
// ("Nommo Pro", RGBDeviceType.Unknown, 0x0518),
|
||||
// ("Chroma Mug Holder", RGBDeviceType.Unknown, 0x0F07),
|
||||
// ("Chroma Hardware Development Kit (HDK)", RGBDeviceType.Unknown, 0x0F09),
|
||||
// ("Mouse Bungee V3 Chroma", RGBDeviceType.Unknown, 0x0F1D),
|
||||
// ("Base Station V2 Chroma", RGBDeviceType.Unknown, 0x0F20)
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties & Fields
|
||||
|
||||
public static DeviceDataList ConnectedDevices { get; } = new();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
internal static void LoadDeviceList(RGBDeviceType loadFilter)
|
||||
{
|
||||
ConnectedDevices.Clear();
|
||||
|
||||
HashSet<int> ids = new(DeviceList.Local.GetHidDevices(VENDOR_ID).Select(x => x.ProductID).Distinct());
|
||||
DeviceDataList connectedDevices = DEVICES.Where(d => ids.Contains(d.id) && loadFilter.HasFlag(d.deviceType)).ToList();
|
||||
|
||||
ConnectedDevices.AddRange(connectedDevices);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -6,11 +6,11 @@ using RGB.NET.Devices.Razer.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Razer
|
||||
{
|
||||
/// <inheritdoc cref="RazerRGBDevice{TDeviceInfo}" />
|
||||
/// <inheritdoc cref="RazerRGBDevice" />
|
||||
/// <summary>
|
||||
/// Represents a razer headset.
|
||||
/// </summary>
|
||||
public class RazerHeadsetRGBDevice : RazerRGBDevice<RazerHeadsetRGBDeviceInfo>, IHeadset
|
||||
public class RazerHeadsetRGBDevice : RazerRGBDevice, IHeadset
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
@ -19,8 +19,8 @@ namespace RGB.NET.Devices.Razer
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Razer.RazerHeadsetRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by CUE for the headset.</param>
|
||||
internal RazerHeadsetRGBDevice(RazerHeadsetRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, new RazerHeadsetUpdateQueue(updateTrigger, info.DeviceId))
|
||||
internal RazerHeadsetRGBDevice(RazerRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, new RazerHeadsetUpdateQueue(updateTrigger))
|
||||
{
|
||||
InitializeLayout();
|
||||
}
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
using System;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.Razer
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Razer.RazerHeadsetRGBDevice" />.
|
||||
/// </summary>
|
||||
public class RazerHeadsetRGBDeviceInfo : RazerRGBDeviceInfo
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Internal constructor of managed <see cref="T:RGB.NET.Devices.Razer.RazerHeadsetRGBDeviceInfo" />.
|
||||
/// </summary>
|
||||
/// <param name="deviceId">The Id of the <see cref="IRGBDevice"/>.</param>
|
||||
/// <param name="model">The model of the <see cref="IRGBDevice"/>.</param>
|
||||
internal RazerHeadsetRGBDeviceInfo(Guid deviceId, string model)
|
||||
: base(deviceId, RGBDeviceType.Headset, model)
|
||||
{ }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -16,9 +16,8 @@ namespace RGB.NET.Devices.Razer
|
||||
/// Initializes a new instance of the <see cref="RazerHeadsetUpdateQueue" /> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used to update this queue.</param>
|
||||
/// <param name="deviceId">The id of the device updated by this queue.</param>
|
||||
public RazerHeadsetUpdateQueue(IDeviceUpdateTrigger updateTrigger, Guid deviceId)
|
||||
: base(updateTrigger, deviceId)
|
||||
public RazerHeadsetUpdateQueue(IDeviceUpdateTrigger updateTrigger)
|
||||
: base(updateTrigger)
|
||||
{ }
|
||||
|
||||
#endregion
|
||||
|
||||
@ -6,15 +6,15 @@ using RGB.NET.Devices.Razer.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Razer
|
||||
{
|
||||
/// <inheritdoc cref="RazerRGBDevice{TDeviceInfo}" />
|
||||
/// <inheritdoc cref="RazerRGBDevice" />
|
||||
/// <summary>
|
||||
/// Represents a razer keyboard.
|
||||
/// </summary>
|
||||
public class RazerKeyboardRGBDevice : RazerRGBDevice<RazerKeyboardRGBDeviceInfo>, IKeyboard
|
||||
public class RazerKeyboardRGBDevice : RazerRGBDevice, IKeyboard
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
IKeyboardDeviceInfo IKeyboard.DeviceInfo => DeviceInfo;
|
||||
IKeyboardDeviceInfo IKeyboard.DeviceInfo => (IKeyboardDeviceInfo) DeviceInfo;
|
||||
|
||||
#endregion
|
||||
|
||||
@ -26,7 +26,7 @@ namespace RGB.NET.Devices.Razer
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by CUE for the keyboard.</param>
|
||||
internal RazerKeyboardRGBDevice(RazerKeyboardRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, new RazerKeyboardUpdateQueue(updateTrigger, info.DeviceId))
|
||||
: base(info, new RazerKeyboardUpdateQueue(updateTrigger))
|
||||
{
|
||||
InitializeLayout();
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable UnusedMember.Global
|
||||
|
||||
using System;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.Razer
|
||||
@ -24,10 +23,9 @@ namespace RGB.NET.Devices.Razer
|
||||
/// <summary>
|
||||
/// Internal constructor of managed <see cref="T:RGB.NET.Devices.Razer.RazerKeyboardRGBDeviceInfo" />.
|
||||
/// </summary>
|
||||
/// <param name="deviceId">The Id of the <see cref="IRGBDevice"/>.</param>
|
||||
/// <param name="model">The model of the <see cref="IRGBDevice"/>.</param>
|
||||
internal RazerKeyboardRGBDeviceInfo(Guid deviceId, string model)
|
||||
: base(deviceId, RGBDeviceType.Keyboard, model)
|
||||
internal RazerKeyboardRGBDeviceInfo(string model)
|
||||
: base(RGBDeviceType.Keyboard, model)
|
||||
{ }
|
||||
|
||||
#endregion
|
||||
|
||||
@ -16,9 +16,8 @@ namespace RGB.NET.Devices.Razer
|
||||
/// Initializes a new instance of the <see cref="RazerKeyboardUpdateQueue" /> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used to update this queue.</param>
|
||||
/// <param name="deviceId">The id of the device updated by this queue.</param>
|
||||
public RazerKeyboardUpdateQueue(IDeviceUpdateTrigger updateTrigger, Guid deviceId)
|
||||
: base(updateTrigger, deviceId)
|
||||
public RazerKeyboardUpdateQueue(IDeviceUpdateTrigger updateTrigger)
|
||||
: base(updateTrigger)
|
||||
{ }
|
||||
|
||||
#endregion
|
||||
|
||||
@ -6,11 +6,11 @@ using RGB.NET.Devices.Razer.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Razer
|
||||
{
|
||||
/// <inheritdoc cref="RazerRGBDevice{TDeviceInfo}" />
|
||||
/// <inheritdoc cref="RazerRGBDevice" />
|
||||
/// <summary>
|
||||
/// Represents a razer keypad.
|
||||
/// </summary>
|
||||
public class RazerKeypadRGBDevice : RazerRGBDevice<RazerKeypadRGBDeviceInfo>, IKeypad
|
||||
public class RazerKeypadRGBDevice : RazerRGBDevice, IKeypad
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
@ -19,8 +19,8 @@ namespace RGB.NET.Devices.Razer
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Razer.RazerKeypadRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by CUE for the keypad.</param>
|
||||
internal RazerKeypadRGBDevice(RazerKeypadRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, new RazerKeypadUpdateQueue(updateTrigger, info.DeviceId))
|
||||
internal RazerKeypadRGBDevice(RazerRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, new RazerKeypadUpdateQueue(updateTrigger))
|
||||
{
|
||||
InitializeLayout();
|
||||
}
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
using System;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.Razer
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Razer.RazerKeypadRGBDevice" />.
|
||||
/// </summary>
|
||||
public class RazerKeypadRGBDeviceInfo : RazerRGBDeviceInfo
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Internal constructor of managed <see cref="T:RGB.NET.Devices.Razer.RazerKeypadRGBDeviceInfo" />.
|
||||
/// </summary>
|
||||
/// <param name="deviceId">The Id of the <see cref="IRGBDevice"/>.</param>
|
||||
/// <param name="model">The model of the <see cref="IRGBDevice"/>.</param>
|
||||
internal RazerKeypadRGBDeviceInfo(Guid deviceId, string model)
|
||||
: base(deviceId, RGBDeviceType.Keypad, model)
|
||||
{ }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -16,9 +16,8 @@ namespace RGB.NET.Devices.Razer
|
||||
/// Initializes a new instance of the <see cref="RazerKeypadUpdateQueue" /> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used to update this queue.</param>
|
||||
/// <param name="deviceId">The id of the device updated by this queue.</param>
|
||||
public RazerKeypadUpdateQueue(IDeviceUpdateTrigger updateTrigger, Guid deviceId)
|
||||
: base(updateTrigger, deviceId)
|
||||
public RazerKeypadUpdateQueue(IDeviceUpdateTrigger updateTrigger)
|
||||
: base(updateTrigger)
|
||||
{ }
|
||||
|
||||
#endregion
|
||||
@ -41,6 +40,9 @@ namespace RGB.NET.Devices.Razer
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void CreateEffect(IntPtr effectParams, ref Guid effectId) => _RazerSDK.CreateKeypadEffect(_Defines.KEYPAD_EFFECT_ID, effectParams, ref effectId);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,11 +6,11 @@ using RGB.NET.Devices.Razer.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Razer
|
||||
{
|
||||
/// <inheritdoc cref="RazerRGBDevice{TDeviceInfo}" />
|
||||
/// <inheritdoc cref="RazerRGBDevice" />
|
||||
/// <summary>
|
||||
/// Represents a razer mouse.
|
||||
/// </summary>
|
||||
public class RazerMouseRGBDevice : RazerRGBDevice<RazerMouseRGBDeviceInfo>, IMouse
|
||||
public class RazerMouseRGBDevice : RazerRGBDevice, IMouse
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
@ -19,8 +19,8 @@ namespace RGB.NET.Devices.Razer
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Razer.RazerMouseRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by CUE for the mouse.</param>
|
||||
internal RazerMouseRGBDevice(RazerMouseRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, new RazerMouseUpdateQueue(updateTrigger, info.DeviceId))
|
||||
internal RazerMouseRGBDevice(RazerRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, new RazerMouseUpdateQueue(updateTrigger))
|
||||
{
|
||||
InitializeLayout();
|
||||
}
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
using System;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.Razer
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Razer.RazerMouseRGBDevice" />.
|
||||
/// </summary>
|
||||
public class RazerMouseRGBDeviceInfo : RazerRGBDeviceInfo
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Internal constructor of managed <see cref="T:RGB.NET.Devices.Razer.RazerMouseRGBDeviceInfo" />.
|
||||
/// </summary>
|
||||
/// <param name="deviceId">The Id of the <see cref="IRGBDevice"/>.</param>
|
||||
/// <param name="model">The model of the <see cref="IRGBDevice"/>.</param>
|
||||
internal RazerMouseRGBDeviceInfo(Guid deviceId, string model)
|
||||
: base(deviceId, RGBDeviceType.Mouse, model)
|
||||
{ }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -16,9 +16,8 @@ namespace RGB.NET.Devices.Razer
|
||||
/// Initializes a new instance of the <see cref="RazerMouseUpdateQueue" /> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used to update this queue.</param>
|
||||
/// <param name="deviceId">The id of the device updated by this queue.</param>
|
||||
public RazerMouseUpdateQueue(IDeviceUpdateTrigger updateTrigger, Guid deviceId)
|
||||
: base(updateTrigger, deviceId)
|
||||
public RazerMouseUpdateQueue(IDeviceUpdateTrigger updateTrigger)
|
||||
: base(updateTrigger)
|
||||
{ }
|
||||
|
||||
#endregion
|
||||
@ -41,6 +40,10 @@ namespace RGB.NET.Devices.Razer
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void CreateEffect(IntPtr effectParams, ref Guid effectId) => _RazerSDK.CreateMouseEffect(_Defines.MOUSE_EFFECT_ID, effectParams, ref effectId);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,11 +6,11 @@ using RGB.NET.Devices.Razer.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Razer
|
||||
{
|
||||
/// <inheritdoc cref="RazerRGBDevice{TDeviceInfo}" />
|
||||
/// <inheritdoc cref="RazerRGBDevice" />
|
||||
/// <summary>
|
||||
/// Represents a razer mousepad.
|
||||
/// </summary>
|
||||
public class RazerMousepadRGBDevice : RazerRGBDevice<RazerMousepadRGBDeviceInfo>, IMousepad
|
||||
public class RazerMousepadRGBDevice : RazerRGBDevice, IMousepad
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
@ -19,8 +19,8 @@ namespace RGB.NET.Devices.Razer
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Razer.RazerMousepadRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by CUE for the mousepad.</param>
|
||||
internal RazerMousepadRGBDevice(RazerMousepadRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, new RazerMousepadUpdateQueue(updateTrigger, info.DeviceId))
|
||||
internal RazerMousepadRGBDevice(RazerRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, new RazerMousepadUpdateQueue(updateTrigger))
|
||||
{
|
||||
InitializeLayout();
|
||||
}
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
using System;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.Razer
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Razer.RazerMousepadRGBDevice" />.
|
||||
/// </summary>
|
||||
public class RazerMousepadRGBDeviceInfo : RazerRGBDeviceInfo
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Internal constructor of managed <see cref="T:RGB.NET.Devices.Razer.RazerMousepadRGBDeviceInfo" />.
|
||||
/// </summary>
|
||||
/// <param name="deviceId">The Id of the <see cref="IRGBDevice"/>.</param>
|
||||
/// <param name="model">The model of the <see cref="IRGBDevice"/>.</param>
|
||||
internal RazerMousepadRGBDeviceInfo(Guid deviceId, string model)
|
||||
: base(deviceId, RGBDeviceType.Mousepad, model)
|
||||
{ }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -16,9 +16,8 @@ namespace RGB.NET.Devices.Razer
|
||||
/// Initializes a new instance of the <see cref="RazerMousepadUpdateQueue" /> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used to update this queue.</param>
|
||||
/// <param name="deviceId">The id of the device updated by this queue.</param>
|
||||
public RazerMousepadUpdateQueue(IDeviceUpdateTrigger updateTrigger, Guid deviceId)
|
||||
: base(updateTrigger, deviceId)
|
||||
public RazerMousepadUpdateQueue(IDeviceUpdateTrigger updateTrigger)
|
||||
: base(updateTrigger)
|
||||
{ }
|
||||
|
||||
#endregion
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
internal const int CHROMALINK_EFFECT_ID = 1;
|
||||
internal const int KEYBOARD_EFFECT_ID = 9;
|
||||
internal const int MOUSEPAD_EFFECT_ID = 6;
|
||||
internal const int MOUSE_EFFECT_ID = 3;
|
||||
internal const int KEYPAD_EFFECT_ID = 2;
|
||||
|
||||
internal const int KEYBOARD_MAX_ROW = 8;
|
||||
internal const int KEYBOARD_MAX_COLUMN = 24;
|
||||
|
||||
@ -44,6 +44,8 @@ namespace RGB.NET.Devices.Razer.Native
|
||||
_createHeadsetEffectPointer = (CreateHeadsetEffectPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "CreateHeadsetEffect"), typeof(CreateHeadsetEffectPointer));
|
||||
_createChromaLinkEffectPointer = (CreateChromaLinkEffectPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "CreateChromaLinkEffect"), typeof(CreateChromaLinkEffectPointer));
|
||||
_createKeyboardEffectPointer = (CreateKeyboardEffectPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "CreateKeyboardEffect"), typeof(CreateKeyboardEffectPointer));
|
||||
_createKeypadEffectPointer = (CreateKeypadEffectPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "CreateKeypadEffect"), typeof(CreateKeypadEffectPointer));
|
||||
_createMouseEffectPointer = (CreateMouseEffectPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "CreateMouseEffect"), typeof(CreateMouseEffectPointer));
|
||||
_createMousepadEffectPointer = (CreateMousepadEffectPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "CreateMousepadEffect"), typeof(CreateMousepadEffectPointer));
|
||||
_setEffectPointer = (SetEffectPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "SetEffect"), typeof(SetEffectPointer));
|
||||
_deleteEffectPointer = (DeleteEffectPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "DeleteEffect"), typeof(DeleteEffectPointer));
|
||||
@ -80,6 +82,8 @@ namespace RGB.NET.Devices.Razer.Native
|
||||
private static CreateHeadsetEffectPointer? _createHeadsetEffectPointer;
|
||||
private static CreateChromaLinkEffectPointer? _createChromaLinkEffectPointer;
|
||||
private static CreateKeyboardEffectPointer? _createKeyboardEffectPointer;
|
||||
private static CreateKeypadEffectPointer? _createKeypadEffectPointer;
|
||||
private static CreateMouseEffectPointer? _createMouseEffectPointer;
|
||||
private static CreateMousepadEffectPointer? _createMousepadEffectPointer;
|
||||
private static SetEffectPointer? _setEffectPointer;
|
||||
private static DeleteEffectPointer? _deleteEffectPointer;
|
||||
@ -109,6 +113,12 @@ namespace RGB.NET.Devices.Razer.Native
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
private delegate RazerError CreateKeyboardEffectPointer(int effectType, IntPtr param, ref Guid effectId);
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
private delegate RazerError CreateKeypadEffectPointer(int effectType, IntPtr param, ref Guid effectId);
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
private delegate RazerError CreateMouseEffectPointer(int effectType, IntPtr param, ref Guid effectId);
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
private delegate RazerError CreateMousepadEffectPointer(int effectType, IntPtr param, ref Guid effectId);
|
||||
|
||||
@ -151,11 +161,15 @@ namespace RGB.NET.Devices.Razer.Native
|
||||
internal static RazerError CreateEffect(Guid deviceId, int effectType, IntPtr param, ref Guid effectId) => (_createEffectPointer ?? throw new RGBDeviceException("The Razer-SDK is not initialized.")).Invoke(deviceId, effectType, param, ref effectId);
|
||||
|
||||
internal static RazerError CreateHeadsetEffect(int effectType, IntPtr param, ref Guid effectId) => (_createHeadsetEffectPointer ?? throw new RGBDeviceException("The Razer-SDK is not initialized.")).Invoke(effectType, param, ref effectId);
|
||||
|
||||
|
||||
internal static RazerError CreateChromaLinkEffect(int effectType, IntPtr param, ref Guid effectId) => (_createChromaLinkEffectPointer ?? throw new RGBDeviceException("The Razer-SDK is not initialized.")).Invoke(effectType, param, ref effectId);
|
||||
|
||||
|
||||
internal static RazerError CreateKeyboardEffect(int effectType, IntPtr param, ref Guid effectId) => (_createKeyboardEffectPointer ?? throw new RGBDeviceException("The Razer-SDK is not initialized.")).Invoke(effectType, param, ref effectId);
|
||||
|
||||
|
||||
internal static RazerError CreateKeypadEffect(int effectType, IntPtr param, ref Guid effectId) => (_createKeypadEffectPointer ?? throw new RGBDeviceException("The Razer-SDK is not initialized.")).Invoke(effectType, param, ref effectId);
|
||||
|
||||
internal static RazerError CreateMouseEffect(int effectType, IntPtr param, ref Guid effectId) => (_createMouseEffectPointer ?? throw new RGBDeviceException("The Razer-SDK is not initialized.")).Invoke(effectType, param, ref effectId);
|
||||
|
||||
internal static RazerError CreateMousepadEffect(int effectType, IntPtr param, ref Guid effectId) => (_createMousepadEffectPointer ?? throw new RGBDeviceException("The Razer-SDK is not initialized.")).Invoke(effectType, param, ref effectId);
|
||||
|
||||
internal static RazerError SetEffect(Guid effectId) => (_setEffectPointer ?? throw new RGBDeviceException("The Razer-SDK is not initialized.")).Invoke(effectId);
|
||||
|
||||
@ -50,6 +50,10 @@
|
||||
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="HidSharp" Version="2.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\RGB.NET.Core\RGB.NET.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@ -4,9 +4,9 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Devices.Razer.HID;
|
||||
using RGB.NET.Devices.Razer.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Razer
|
||||
@ -67,59 +67,49 @@ namespace RGB.NET.Devices.Razer
|
||||
_RazerSDK.Reload();
|
||||
|
||||
RazerError error;
|
||||
if (((error = _RazerSDK.Init()) != RazerError.Success)
|
||||
&& Enum.IsDefined(typeof(RazerError), error)) //HACK DarthAffe 08.02.2018: The x86-SDK seems to have a problem here ...
|
||||
if (((error = _RazerSDK.Init()) != RazerError.Success) && Enum.IsDefined(typeof(RazerError), error)) //HACK DarthAffe 08.02.2018: The x86-SDK seems to have a problem here ...
|
||||
ThrowRazerError(error);
|
||||
}
|
||||
|
||||
protected override IEnumerable<IRGBDevice> GetLoadedDevices(RGBDeviceType loadFilter)
|
||||
{
|
||||
DeviceChecker.LoadDeviceList(loadFilter);
|
||||
|
||||
IList<IRGBDevice> devices = base.GetLoadedDevices(loadFilter).ToList();
|
||||
|
||||
if (LoadEmulatorDevices)
|
||||
{
|
||||
if (loadFilter.HasFlag(RGBDeviceType.Keyboard) && devices.All(d => d.DeviceInfo.DeviceType != RGBDeviceType.Keyboard))
|
||||
devices.Add(new RazerKeyboardRGBDevice(new RazerKeyboardRGBDeviceInfo("Emulator Keyboard"), GetUpdateTrigger()));
|
||||
if (loadFilter.HasFlag(RGBDeviceType.Mouse) && devices.All(d => d.DeviceInfo.DeviceType != RGBDeviceType.Mouse))
|
||||
devices.Add(new RazerMouseRGBDevice(new RazerRGBDeviceInfo(RGBDeviceType.Mouse, "Emulator Mouse"), GetUpdateTrigger()));
|
||||
if (loadFilter.HasFlag(RGBDeviceType.Headset) && devices.All(d => d.DeviceInfo.DeviceType != RGBDeviceType.Headset))
|
||||
devices.Add(new RazerHeadsetRGBDevice(new RazerRGBDeviceInfo(RGBDeviceType.Headset, "Emulator Headset"), GetUpdateTrigger()));
|
||||
if (loadFilter.HasFlag(RGBDeviceType.Mousepad) && devices.All(d => d.DeviceInfo.DeviceType != RGBDeviceType.Mousepad))
|
||||
devices.Add(new RazerMousepadRGBDevice(new RazerRGBDeviceInfo(RGBDeviceType.Mousepad, "Emulator Mousepad"), GetUpdateTrigger()));
|
||||
if (loadFilter.HasFlag(RGBDeviceType.Keypad) && devices.All(d => d.DeviceInfo.DeviceType != RGBDeviceType.Keypad))
|
||||
devices.Add(new RazerKeypadRGBDevice(new RazerRGBDeviceInfo(RGBDeviceType.Keypad, "Emulator Keypad"), GetUpdateTrigger()));
|
||||
if (loadFilter.HasFlag(RGBDeviceType.Unknown) && devices.All(d => d.DeviceInfo.DeviceType != RGBDeviceType.Unknown))
|
||||
devices.Add(new RazerChromaLinkRGBDevice(new RazerRGBDeviceInfo(RGBDeviceType.Unknown, "Emulator Chroma Link"), GetUpdateTrigger()));
|
||||
}
|
||||
|
||||
return devices;
|
||||
}
|
||||
|
||||
protected override IEnumerable<IRGBDevice> LoadDevices()
|
||||
{
|
||||
foreach ((Guid guid, string model) in Razer.Devices.KEYBOARDS)
|
||||
foreach ((var model, RGBDeviceType deviceType, int _) in DeviceChecker.ConnectedDevices)
|
||||
{
|
||||
if (((_RazerSDK.QueryDevice(guid, out _DeviceInfo deviceInfo) != RazerError.Success) || (deviceInfo.Connected < 1))
|
||||
&& (!LoadEmulatorDevices || (Razer.Devices.KEYBOARDS.FirstOrDefault().guid != guid))) continue;
|
||||
|
||||
yield return new RazerKeyboardRGBDevice(new RazerKeyboardRGBDeviceInfo(guid, model), GetUpdateTrigger());
|
||||
}
|
||||
|
||||
foreach ((Guid guid, string model) in Razer.Devices.MICE)
|
||||
{
|
||||
if (((_RazerSDK.QueryDevice(guid, out _DeviceInfo deviceInfo) != RazerError.Success) || (deviceInfo.Connected < 1))
|
||||
&& (!LoadEmulatorDevices || (Razer.Devices.MICE.FirstOrDefault().guid != guid))) continue;
|
||||
|
||||
yield return new RazerMouseRGBDevice(new RazerMouseRGBDeviceInfo(guid, model), GetUpdateTrigger());
|
||||
}
|
||||
|
||||
foreach ((Guid guid, string model) in Razer.Devices.HEADSETS)
|
||||
{
|
||||
if (((_RazerSDK.QueryDevice(guid, out _DeviceInfo deviceInfo) != RazerError.Success) || (deviceInfo.Connected < 1))
|
||||
&& (!LoadEmulatorDevices || (Razer.Devices.HEADSETS.FirstOrDefault().guid != guid))) continue;
|
||||
|
||||
yield return new RazerHeadsetRGBDevice(new RazerHeadsetRGBDeviceInfo(guid, model), GetUpdateTrigger());
|
||||
}
|
||||
|
||||
foreach ((Guid guid, string model) in Razer.Devices.MOUSEMATS)
|
||||
{
|
||||
if (((_RazerSDK.QueryDevice(guid, out _DeviceInfo deviceInfo) != RazerError.Success) || (deviceInfo.Connected < 1))
|
||||
&& (!LoadEmulatorDevices || (Razer.Devices.MOUSEMATS.FirstOrDefault().guid != guid))) continue;
|
||||
|
||||
yield return new RazerMousepadRGBDevice(new RazerMousepadRGBDeviceInfo(guid, model), GetUpdateTrigger());
|
||||
}
|
||||
|
||||
foreach ((Guid guid, string model) in Razer.Devices.KEYPADS)
|
||||
{
|
||||
if (((_RazerSDK.QueryDevice(guid, out _DeviceInfo deviceInfo) != RazerError.Success) || (deviceInfo.Connected < 1))
|
||||
&& (!LoadEmulatorDevices || (Razer.Devices.KEYPADS.FirstOrDefault().guid != guid))) continue;
|
||||
|
||||
yield return new RazerKeypadRGBDevice(new RazerKeypadRGBDeviceInfo(guid, model), GetUpdateTrigger());
|
||||
}
|
||||
|
||||
foreach ((Guid guid, string model) in Razer.Devices.CHROMALINKS)
|
||||
{
|
||||
if (((_RazerSDK.QueryDevice(guid, out _DeviceInfo deviceInfo) != RazerError.Success) || (deviceInfo.Connected < 1))
|
||||
&& (!LoadEmulatorDevices || (Razer.Devices.CHROMALINKS.FirstOrDefault().guid != guid))) continue;
|
||||
|
||||
yield return new RazerChromaLinkRGBDevice(new RazerChromaLinkRGBDeviceInfo(guid, model), GetUpdateTrigger());
|
||||
yield return deviceType switch
|
||||
{
|
||||
RGBDeviceType.Keyboard => new RazerKeyboardRGBDevice(new RazerKeyboardRGBDeviceInfo(model), GetUpdateTrigger()),
|
||||
RGBDeviceType.Mouse => new RazerMouseRGBDevice(new RazerRGBDeviceInfo(deviceType, model), GetUpdateTrigger()),
|
||||
RGBDeviceType.Headset => new RazerHeadsetRGBDevice(new RazerRGBDeviceInfo(deviceType, model), GetUpdateTrigger()),
|
||||
RGBDeviceType.Mousepad => new RazerMousepadRGBDevice(new RazerRGBDeviceInfo(deviceType, model), GetUpdateTrigger()),
|
||||
RGBDeviceType.Keypad => new RazerKeypadRGBDevice(new RazerRGBDeviceInfo(deviceType, model), GetUpdateTrigger()),
|
||||
RGBDeviceType.Unknown => new RazerChromaLinkRGBDevice(new RazerRGBDeviceInfo(deviceType, model), GetUpdateTrigger()),
|
||||
_ => throw new RGBDeviceException($"Razer SDK does not support {deviceType} devices")
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user