diff --git a/README.md b/README.md
index 45ae0db..7d7098d 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,10 @@ This is the easiest and therefore preferred way to include RGB.NET in your proje
Since there aren't any release-packages right now you'll have to use the CI-feed from [http://nuget.arge.be](http://nuget.arge.be).
You can include it either by adding ```http://nuget.arge.be/v3/index.json``` to your Visual Studio package sources or by adding this [NuGet.Config](https://github.com/DarthAffe/RGB.NET/tree/master/Documentation/NuGet.Config) to your project (at the same level as your solution).
+### .NET 4.5 Support ###
+At the end of the year with the release of .NET 5 the support for old .NET-Framwork versions will be droppped!
+It's not recommended to use RGB.NET in projects targeting .NET 4.x that aren't planned to be moved to Core/.NET 5 in the future.
+
### Device-Layouts
To be able to have devices with correct LED-locations and sizes they need to be layouted. Pre-created layouts can be found at https://github.com/DarthAffe/RGB.NET-Resources.
diff --git a/RGB.NET.Brushes/RGB.NET.Brushes.csproj b/RGB.NET.Brushes/RGB.NET.Brushes.csproj
index 5264906..d016193 100644
--- a/RGB.NET.Brushes/RGB.NET.Brushes.csproj
+++ b/RGB.NET.Brushes/RGB.NET.Brushes.csproj
@@ -14,8 +14,8 @@
RGB.NET.Brushes
Brushes-Presets of RGB.NET
Brushes-Presets of RGB.NET, a C# (.NET) library for accessing various RGB-peripherals
- Copyright © Wyrez 2017
- Copyright © Wyrez 2017
+ Copyright © Darth Affe 2020
+ Copyright © Darth Affe 2020
http://lib.arge.be/icon.png
https://github.com/DarthAffe/RGB.NET
https://raw.githubusercontent.com/DarthAffe/RGB.NET/master/LICENSE
@@ -63,6 +63,6 @@
-
+
\ No newline at end of file
diff --git a/RGB.NET.Core/Brushes/AbstractBrush.cs b/RGB.NET.Core/Brushes/AbstractBrush.cs
index 7e36afc..7521bf2 100644
--- a/RGB.NET.Core/Brushes/AbstractBrush.cs
+++ b/RGB.NET.Core/Brushes/AbstractBrush.cs
@@ -110,14 +110,20 @@ namespace RGB.NET.Core
/// The finalized color.
protected virtual Color FinalizeColor(Color color)
{
- foreach (IColorCorrection colorCorrection in ColorCorrections)
- color = colorCorrection.ApplyTo(color);
+ if (ColorCorrections.Count > 0)
+ foreach (IColorCorrection colorCorrection in ColorCorrections)
+ color = colorCorrection.ApplyTo(color);
// Since we use HSV to calculate there is no way to make a color 'brighter' than 100%
// Be carefull with the naming: Since we use HSV the correct term is 'value' but outside we call it 'brightness'
// THIS IS NOT A HSB CALCULATION!!!
- return color.MultiplyHSV(value: Brightness.Clamp(0, 1))
- .MultiplyA(Opacity.Clamp(0, 1));
+ if (Brightness < 1)
+ color = color.MultiplyHSV(value: Brightness.Clamp(0, 1));
+
+ if (Opacity < 1)
+ color = color.MultiplyA(Opacity.Clamp(0, 1));
+
+ return color;
}
#endregion
diff --git a/RGB.NET.Core/Decorators/AbstractDecorateable.cs b/RGB.NET.Core/Decorators/AbstractDecorateable.cs
index 94b8f05..d12afcd 100644
--- a/RGB.NET.Core/Decorators/AbstractDecorateable.cs
+++ b/RGB.NET.Core/Decorators/AbstractDecorateable.cs
@@ -12,18 +12,15 @@ namespace RGB.NET.Core
#region Properties & Fields
private readonly List _decorators = new List();
- ///
- /// Gets a readonly-list of all attached to this .
- ///
- protected IReadOnlyCollection Decorators { get; }
- #endregion
-
- #region Constructors
-
- protected AbstractDecoratable()
+ ///
+ public IReadOnlyCollection Decorators
{
- Decorators = new ReadOnlyCollection(_decorators);
+ get
+ {
+ lock (_decorators)
+ return new ReadOnlyCollection(_decorators);
+ }
}
#endregion
diff --git a/RGB.NET.Core/Decorators/AbstractDecorator.cs b/RGB.NET.Core/Decorators/AbstractDecorator.cs
index 381f4f5..50e007c 100644
--- a/RGB.NET.Core/Decorators/AbstractDecorator.cs
+++ b/RGB.NET.Core/Decorators/AbstractDecorator.cs
@@ -1,4 +1,6 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
+using System.Linq;
namespace RGB.NET.Core
{
@@ -42,16 +44,17 @@ namespace RGB.NET.Core
///
/// Detaches the decorator from all it is currently attached to.
///
- /// The type of the this decorator is attached to.
- /// The type of this .
- protected virtual void Detach()
- where TDecoratable : IDecoratable
- where TDecorator : AbstractDecorator
+ protected virtual void Detach()
{
List decoratables = new List(DecoratedObjects);
foreach (IDecoratable decoratable in decoratables)
- if (decoratable is TDecoratable typedDecoratable)
- typedDecoratable.RemoveDecorator((TDecorator)this);
+ {
+ IEnumerable types = decoratable.GetType().GetInterfaces().Where(t => t.IsGenericType
+ && (t.Name == typeof(IDecoratable<>).Name)
+ && t.GenericTypeArguments[0].IsInstanceOfType(this));
+ foreach (Type decoratableType in types)
+ decoratableType.GetMethod(nameof(IDecoratable.RemoveDecorator))?.Invoke(decoratable, new object[] { this });
+ }
}
#endregion
diff --git a/RGB.NET.Core/Decorators/IDecoratable.cs b/RGB.NET.Core/Decorators/IDecoratable.cs
index 9e2a32c..781d9f1 100644
--- a/RGB.NET.Core/Decorators/IDecoratable.cs
+++ b/RGB.NET.Core/Decorators/IDecoratable.cs
@@ -1,4 +1,5 @@
-using System.ComponentModel;
+using System.Collections.Generic;
+using System.ComponentModel;
namespace RGB.NET.Core
{
@@ -13,9 +14,14 @@ namespace RGB.NET.Core
/// Represents a basic decoratable for a specific type of
///
///
- public interface IDecoratable : IDecoratable
+ public interface IDecoratable : IDecoratable
where T : IDecorator
{
+ ///
+ /// Gets a readonly-list of all attached to this .
+ ///
+ IReadOnlyCollection Decorators { get; }
+
///
/// Adds an to the .
///
diff --git a/RGB.NET.Core/Devices/AbstractRGBDevice.cs b/RGB.NET.Core/Devices/AbstractRGBDevice.cs
index 2ed8377..a737f29 100644
--- a/RGB.NET.Core/Devices/AbstractRGBDevice.cs
+++ b/RGB.NET.Core/Devices/AbstractRGBDevice.cs
@@ -157,8 +157,12 @@ namespace RGB.NET.Core
///
public virtual void Dispose()
{
- SpecialDeviceParts.Clear();
- LedMapping.Clear();
+ try
+ {
+ SpecialDeviceParts.Clear();
+ LedMapping.Clear();
+ }
+ catch { /* this really shouldn't happen */ }
}
///
diff --git a/RGB.NET.Core/Devices/TypeInterfaces/ICooler.cs b/RGB.NET.Core/Devices/TypeInterfaces/ICooler.cs
new file mode 100644
index 0000000..6053c40
--- /dev/null
+++ b/RGB.NET.Core/Devices/TypeInterfaces/ICooler.cs
@@ -0,0 +1,8 @@
+namespace RGB.NET.Core
+{
+ ///
+ /// Represents a cooler-device
+ ///
+ public interface ICooler : IRGBDevice
+ { }
+}
diff --git a/RGB.NET.Core/Devices/TypeInterfaces/IDRAM.cs b/RGB.NET.Core/Devices/TypeInterfaces/IDRAM.cs
new file mode 100644
index 0000000..6734e16
--- /dev/null
+++ b/RGB.NET.Core/Devices/TypeInterfaces/IDRAM.cs
@@ -0,0 +1,8 @@
+namespace RGB.NET.Core
+{
+ ///
+ /// Represents a DRAM-device
+ ///
+ public interface IDRAM : IRGBDevice
+ { }
+}
diff --git a/RGB.NET.Core/Devices/TypeInterfaces/IFan.cs b/RGB.NET.Core/Devices/TypeInterfaces/IFan.cs
new file mode 100644
index 0000000..3f9eb57
--- /dev/null
+++ b/RGB.NET.Core/Devices/TypeInterfaces/IFan.cs
@@ -0,0 +1,8 @@
+namespace RGB.NET.Core
+{
+ ///
+ /// represents a fan-device
+ ///
+ public interface IFan : IRGBDevice
+ { }
+}
diff --git a/RGB.NET.Core/Devices/TypeInterfaces/IGraphicsCard.cs b/RGB.NET.Core/Devices/TypeInterfaces/IGraphicsCard.cs
new file mode 100644
index 0000000..30fc9d4
--- /dev/null
+++ b/RGB.NET.Core/Devices/TypeInterfaces/IGraphicsCard.cs
@@ -0,0 +1,8 @@
+namespace RGB.NET.Core
+{
+ ///
+ /// Represents a graphics-card-device
+ ///
+ public interface IGraphicsCard : IRGBDevice
+ { }
+}
diff --git a/RGB.NET.Core/Devices/TypeInterfaces/IHeadset.cs b/RGB.NET.Core/Devices/TypeInterfaces/IHeadset.cs
new file mode 100644
index 0000000..25cde5c
--- /dev/null
+++ b/RGB.NET.Core/Devices/TypeInterfaces/IHeadset.cs
@@ -0,0 +1,8 @@
+namespace RGB.NET.Core
+{
+ ///
+ /// Represents a headset-device
+ ///
+ public interface IHeadset : IRGBDevice
+ { }
+}
diff --git a/RGB.NET.Core/Devices/TypeInterfaces/IHeadsetStand.cs b/RGB.NET.Core/Devices/TypeInterfaces/IHeadsetStand.cs
new file mode 100644
index 0000000..9c5c81a
--- /dev/null
+++ b/RGB.NET.Core/Devices/TypeInterfaces/IHeadsetStand.cs
@@ -0,0 +1,8 @@
+namespace RGB.NET.Core
+{
+ ///
+ /// Represents a headset-stand-device
+ ///
+ public interface IHeadsetStand : IRGBDevice
+ { }
+}
diff --git a/RGB.NET.Core/Devices/TypeInterfaces/IKeyboard.cs b/RGB.NET.Core/Devices/TypeInterfaces/IKeyboard.cs
new file mode 100644
index 0000000..7e32e96
--- /dev/null
+++ b/RGB.NET.Core/Devices/TypeInterfaces/IKeyboard.cs
@@ -0,0 +1,8 @@
+namespace RGB.NET.Core
+{
+ ///
+ /// Represents a keyboard-device
+ ///
+ public interface IKeyboard : IRGBDevice
+ { }
+}
diff --git a/RGB.NET.Core/Devices/TypeInterfaces/IKeypad.cs b/RGB.NET.Core/Devices/TypeInterfaces/IKeypad.cs
new file mode 100644
index 0000000..3030492
--- /dev/null
+++ b/RGB.NET.Core/Devices/TypeInterfaces/IKeypad.cs
@@ -0,0 +1,8 @@
+namespace RGB.NET.Core
+{
+ ///
+ /// Represents a keypad-device
+ ///
+ public interface IKeypad : IRGBDevice
+ { }
+}
diff --git a/RGB.NET.Core/Devices/TypeInterfaces/ILedMatrix.cs b/RGB.NET.Core/Devices/TypeInterfaces/ILedMatrix.cs
new file mode 100644
index 0000000..2ba759d
--- /dev/null
+++ b/RGB.NET.Core/Devices/TypeInterfaces/ILedMatrix.cs
@@ -0,0 +1,8 @@
+namespace RGB.NET.Core
+{
+ ///
+ /// Represents a led-matrix-device
+ ///
+ public interface ILedMatrix : IRGBDevice
+ { }
+}
diff --git a/RGB.NET.Core/Devices/TypeInterfaces/ILedStripe.cs b/RGB.NET.Core/Devices/TypeInterfaces/ILedStripe.cs
new file mode 100644
index 0000000..9c97ab5
--- /dev/null
+++ b/RGB.NET.Core/Devices/TypeInterfaces/ILedStripe.cs
@@ -0,0 +1,8 @@
+namespace RGB.NET.Core
+{
+ ///
+ /// Represents a led-stripe-device
+ ///
+ public interface ILedStripe : IRGBDevice
+ { }
+}
diff --git a/RGB.NET.Core/Devices/TypeInterfaces/IMainboard.cs b/RGB.NET.Core/Devices/TypeInterfaces/IMainboard.cs
new file mode 100644
index 0000000..e043c6f
--- /dev/null
+++ b/RGB.NET.Core/Devices/TypeInterfaces/IMainboard.cs
@@ -0,0 +1,8 @@
+namespace RGB.NET.Core
+{
+ ///
+ /// Represents a mainboard-device
+ ///
+ public interface IMainboard : IRGBDevice
+ { }
+}
diff --git a/RGB.NET.Core/Devices/TypeInterfaces/IMouse.cs b/RGB.NET.Core/Devices/TypeInterfaces/IMouse.cs
new file mode 100644
index 0000000..6064012
--- /dev/null
+++ b/RGB.NET.Core/Devices/TypeInterfaces/IMouse.cs
@@ -0,0 +1,8 @@
+namespace RGB.NET.Core
+{
+ ///
+ /// Represents a mouse-device
+ ///
+ public interface IMouse : IRGBDevice
+ { }
+}
diff --git a/RGB.NET.Core/Devices/TypeInterfaces/IMousepad.cs b/RGB.NET.Core/Devices/TypeInterfaces/IMousepad.cs
new file mode 100644
index 0000000..e6812fc
--- /dev/null
+++ b/RGB.NET.Core/Devices/TypeInterfaces/IMousepad.cs
@@ -0,0 +1,8 @@
+namespace RGB.NET.Core
+{
+ ///
+ /// Represents a mousepad-device
+ ///
+ public interface IMousepad : IRGBDevice
+ { }
+}
diff --git a/RGB.NET.Core/Devices/TypeInterfaces/ISpeaker.cs b/RGB.NET.Core/Devices/TypeInterfaces/ISpeaker.cs
new file mode 100644
index 0000000..6670297
--- /dev/null
+++ b/RGB.NET.Core/Devices/TypeInterfaces/ISpeaker.cs
@@ -0,0 +1,8 @@
+namespace RGB.NET.Core
+{
+ ///
+ /// Represents a speaker-device
+ ///
+ public interface ISpeaker : IRGBDevice
+ { }
+}
diff --git a/RGB.NET.Core/Devices/TypeInterfaces/IUnknownDevice.cs b/RGB.NET.Core/Devices/TypeInterfaces/IUnknownDevice.cs
new file mode 100644
index 0000000..724dc4d
--- /dev/null
+++ b/RGB.NET.Core/Devices/TypeInterfaces/IUnknownDevice.cs
@@ -0,0 +1,8 @@
+namespace RGB.NET.Core
+{
+ ///
+ /// Represents a device with unkown or not specified type.
+ ///
+ public interface IUnknownDevice : IRGBDevice
+ { }
+}
diff --git a/RGB.NET.Core/Extensions/ColorExtensions.cs b/RGB.NET.Core/Extensions/ColorExtensions.cs
new file mode 100644
index 0000000..15d0c80
--- /dev/null
+++ b/RGB.NET.Core/Extensions/ColorExtensions.cs
@@ -0,0 +1,30 @@
+using System;
+
+namespace RGB.NET.Core
+{
+ public static class ColorExtensions
+ {
+ #region Methods
+
+ ///
+ /// Calculates the distance between the two given colors using the redmean algorithm.
+ /// For more infos check https://www.compuphase.com/cmetric.htm
+ ///
+ /// The start color of the distance calculation.
+ /// The end color fot the distance calculation.
+ ///
+ public static double DistanceTo(this Color color1, Color color2)
+ {
+ (_, byte r1, byte g1, byte b1) = color1.GetRGBBytes();
+ (_, byte r2, byte g2, byte b2) = color2.GetRGBBytes();
+
+ long rmean = (r1 + r2) / 2;
+ long r = r1 - r2;
+ long g = g1 - g2;
+ long b = b1 - b2;
+ return Math.Sqrt((((512 + rmean) * r * r) >> 8) + (4 * g * g) + (((767 - rmean) * b * b) >> 8));
+ }
+
+ #endregion
+ }
+}
diff --git a/RGB.NET.Core/Groups/AbstractLedGroup.cs b/RGB.NET.Core/Groups/AbstractLedGroup.cs
index 7007152..eab6803 100644
--- a/RGB.NET.Core/Groups/AbstractLedGroup.cs
+++ b/RGB.NET.Core/Groups/AbstractLedGroup.cs
@@ -36,7 +36,7 @@ namespace RGB.NET.Core
#region Methods
///
- public abstract IEnumerable GetLeds();
+ public abstract IList GetLeds();
///
public virtual void OnAttach()
diff --git a/RGB.NET.Core/Groups/ILedGroup.cs b/RGB.NET.Core/Groups/ILedGroup.cs
index 638f146..5db5e63 100644
--- a/RGB.NET.Core/Groups/ILedGroup.cs
+++ b/RGB.NET.Core/Groups/ILedGroup.cs
@@ -25,7 +25,7 @@ namespace RGB.NET.Core
/// Gets a list containing all of this .
///
/// The list containing all of this .
- IEnumerable GetLeds();
+ IList GetLeds();
///
/// Called when the is attached to the .
diff --git a/RGB.NET.Core/Leds/LedId.cs b/RGB.NET.Core/Leds/LedId.cs
index 6278aae..536263e 100644
--- a/RGB.NET.Core/Leds/LedId.cs
+++ b/RGB.NET.Core/Leds/LedId.cs
@@ -213,6 +213,38 @@ namespace RGB.NET.Core
Keyboard_Custom30 = 0x0000701E,
Keyboard_Custom31 = 0x0000701F,
Keyboard_Custom32 = 0x00007020,
+ Keyboard_Custom33 = 0x00007021,
+ Keyboard_Custom34 = 0x00007022,
+ Keyboard_Custom35 = 0x00007023,
+ Keyboard_Custom36 = 0x00007024,
+ Keyboard_Custom37 = 0x00007025,
+ Keyboard_Custom38 = 0x00007026,
+ Keyboard_Custom39 = 0x00007027,
+ Keyboard_Custom40 = 0x00007028,
+ Keyboard_Custom41 = 0x00007029,
+ Keyboard_Custom42 = 0x0000702A,
+ Keyboard_Custom43 = 0x0000702B,
+ Keyboard_Custom44 = 0x0000702C,
+ Keyboard_Custom45 = 0x0000702D,
+ Keyboard_Custom46 = 0x0000702E,
+ Keyboard_Custom47 = 0x0000702F,
+ Keyboard_Custom48 = 0x00007030,
+ Keyboard_Custom49 = 0x00007031,
+ Keyboard_Custom50 = 0x00007032,
+ Keyboard_Custom51 = 0x00007033,
+ Keyboard_Custom52 = 0x00007034,
+ Keyboard_Custom53 = 0x00007035,
+ Keyboard_Custom54 = 0x00007036,
+ Keyboard_Custom55 = 0x00007037,
+ Keyboard_Custom56 = 0x00007038,
+ Keyboard_Custom57 = 0x00007039,
+ Keyboard_Custom58 = 0x0000703A,
+ Keyboard_Custom59 = 0x0000703B,
+ Keyboard_Custom60 = 0x0000703C,
+ Keyboard_Custom61 = 0x0000703D,
+ Keyboard_Custom62 = 0x0000703E,
+ Keyboard_Custom63 = 0x0000703F,
+ Keyboard_Custom64 = 0x00007040,
/*### Mouse ###*/
Mouse1 = 0x00100001,
diff --git a/RGB.NET.Core/RGB.NET.Core.csproj b/RGB.NET.Core/RGB.NET.Core.csproj
index 5415d59..6fab932 100644
--- a/RGB.NET.Core/RGB.NET.Core.csproj
+++ b/RGB.NET.Core/RGB.NET.Core.csproj
@@ -14,8 +14,8 @@
RGB.NET.Core
Core-Module of RGB.NET
Core-Module of RGB.NET, a C# (.NET) library for accessing various RGB-peripherals
- Copyright © Wyrez 2017
- Copyright © Wyrez 2017
+ Copyright © Darth Affe 2020
+ Copyright © Darth Affe 2020
http://lib.arge.be/icon.png
https://github.com/DarthAffe/RGB.NET
https://raw.githubusercontent.com/DarthAffe/RGB.NET/master/LICENSE
@@ -59,6 +59,6 @@
-
+
\ No newline at end of file
diff --git a/RGB.NET.Core/RGB.NET.Core.csproj.DotSettings b/RGB.NET.Core/RGB.NET.Core.csproj.DotSettings
index d216495..9555e90 100644
--- a/RGB.NET.Core/RGB.NET.Core.csproj.DotSettings
+++ b/RGB.NET.Core/RGB.NET.Core.csproj.DotSettings
@@ -5,6 +5,7 @@
True
True
True
+ True
True
True
True
diff --git a/RGB.NET.Core/RGBSurface.cs b/RGB.NET.Core/RGBSurface.cs
index 7ba3183..74bc882 100644
--- a/RGB.NET.Core/RGBSurface.cs
+++ b/RGB.NET.Core/RGBSurface.cs
@@ -38,7 +38,14 @@ namespace RGB.NET.Core
///
/// Gets a readonly list containing all loaded .
///
- public IEnumerable Devices => new ReadOnlyCollection(_devices);
+ public IEnumerable Devices
+ {
+ get
+ {
+ lock (_devices)
+ return new ReadOnlyCollection(_devices);
+ }
+ }
///
/// Gets a readonly list containing all registered .
@@ -53,7 +60,14 @@ namespace RGB.NET.Core
///
/// Gets a list of all on this .
///
- public IEnumerable Leds => _devices.SelectMany(x => x);
+ public IEnumerable Leds
+ {
+ get
+ {
+ lock (_devices)
+ return _devices.SelectMany(x => x);
+ }
+ }
#endregion
@@ -92,32 +106,33 @@ namespace RGB.NET.Core
bool updateDevices = customData["updateDevices"] as bool? ?? true;
lock (_updateTriggers)
- {
- OnUpdating(updateTrigger, customData);
+ lock (_devices)
+ {
+ OnUpdating(updateTrigger, customData);
- if (syncBack)
- foreach (IRGBDevice device in Devices)
- if (device.UpdateMode.HasFlag(DeviceUpdateMode.SyncBack) && device.DeviceInfo.SupportsSyncBack)
- try { device.SyncBack(); }
- catch (Exception ex) { OnException(ex); }
+ if (syncBack)
+ foreach (IRGBDevice device in _devices)
+ if (device.UpdateMode.HasFlag(DeviceUpdateMode.SyncBack) && device.DeviceInfo.SupportsSyncBack)
+ try { device.SyncBack(); }
+ catch (Exception ex) { OnException(ex); }
- if (render)
- lock (_ledGroups)
- {
- // Render brushes
- foreach (ILedGroup ledGroup in _ledGroups.OrderBy(x => x.ZIndex))
- try { Render(ledGroup); }
- catch (Exception ex) { OnException(ex); }
- }
+ if (render)
+ lock (_ledGroups)
+ {
+ // Render brushes
+ foreach (ILedGroup ledGroup in _ledGroups.OrderBy(x => x.ZIndex))
+ try { Render(ledGroup); }
+ catch (Exception ex) { OnException(ex); }
+ }
- if (updateDevices)
- foreach (IRGBDevice device in Devices)
- if (!device.UpdateMode.HasFlag(DeviceUpdateMode.NoUpdate))
- try { device.Update(flushLeds); }
- catch (Exception ex) { OnException(ex); }
+ if (updateDevices)
+ foreach (IRGBDevice device in _devices)
+ if (!device.UpdateMode.HasFlag(DeviceUpdateMode.NoUpdate))
+ try { device.Update(flushLeds); }
+ catch (Exception ex) { OnException(ex); }
- OnUpdated();
- }
+ OnUpdated();
+ }
}
catch (Exception ex)
{
@@ -128,16 +143,19 @@ namespace RGB.NET.Core
///
public void Dispose()
{
- //if (_updateTokenSource?.IsCancellationRequested == false)
- // _updateTokenSource.Cancel();
+ lock (_devices)
+ foreach (IRGBDevice device in _devices)
+ try { device.Dispose(); }
+ catch { /* We do what we can */}
- foreach (IRGBDevice device in _devices)
- try { device.Dispose(); }
- catch { /* We do what we can */ }
+ lock (_deviceProvider)
+ foreach (IRGBDeviceProvider deviceProvider in _deviceProvider)
+ try { deviceProvider.Dispose(); }
+ catch { /* We do what we can */}
- foreach (IRGBDeviceProvider deviceProvider in _deviceProvider)
- try { deviceProvider.Dispose(); }
- catch { /* We do what we can */ }
+ foreach (IUpdateTrigger updateTrigger in _updateTriggers)
+ try { updateTrigger.Dispose(); }
+ catch { /* We do what we can */}
_ledGroups.Clear();
_devices = null;
@@ -220,8 +238,11 @@ namespace RGB.NET.Core
private void UpdateSurfaceRectangle()
{
- Rectangle devicesRectangle = new Rectangle(_devices.Select(d => d.DeviceRectangle));
- SurfaceRectangle = SurfaceRectangle.SetSize(new Size(devicesRectangle.Location.X + devicesRectangle.Size.Width, devicesRectangle.Location.Y + devicesRectangle.Size.Height));
+ lock (_devices)
+ {
+ Rectangle devicesRectangle = new Rectangle(_devices.Select(d => d.DeviceRectangle));
+ SurfaceRectangle = SurfaceRectangle.SetSize(new Size(devicesRectangle.Location.X + devicesRectangle.Size.Width, devicesRectangle.Location.Y + devicesRectangle.Size.Height));
+ }
}
///
@@ -231,7 +252,10 @@ namespace RGB.NET.Core
/// A list of devices with the specified type.
public IList GetDevices()
where T : class
- => new ReadOnlyCollection(_devices.Select(x => x as T).Where(x => x != null).ToList());
+ {
+ lock (_devices)
+ return new ReadOnlyCollection(_devices.Select(x => x as T).Where(x => x != null).ToList());
+ }
///
/// Gets all devices of the specified .
@@ -239,7 +263,10 @@ namespace RGB.NET.Core
/// The of the devices to get.
/// a list of devices matching the specified .
public IList GetDevices(RGBDeviceType deviceType)
- => new ReadOnlyCollection(_devices.Where(d => deviceType.HasFlag(d.DeviceInfo.DeviceType)).ToList());
+ {
+ lock (_devices)
+ return new ReadOnlyCollection(_devices.Where(d => deviceType.HasFlag(d.DeviceInfo.DeviceType)).ToList());
+ }
///
/// Registers the provided .
diff --git a/RGB.NET.Core/RGBSurfaceDeviceLoader.cs b/RGB.NET.Core/RGBSurfaceDeviceLoader.cs
index f233282..df760c3 100644
--- a/RGB.NET.Core/RGBSurfaceDeviceLoader.cs
+++ b/RGB.NET.Core/RGBSurfaceDeviceLoader.cs
@@ -29,28 +29,31 @@ namespace RGB.NET.Core
/// Specifies whether exception during the initialization sequence should be thrown or not.
public void LoadDevices(IRGBDeviceProvider deviceProvider, RGBDeviceType loadFilter = RGBDeviceType.All, bool exclusiveAccessIfPossible = false, bool throwExceptions = false)
{
- if (_deviceProvider.Contains(deviceProvider) || _deviceProvider.Any(x => x.GetType() == deviceProvider.GetType())) return;
-
- List addedDevices = new List();
- if (deviceProvider.IsInitialized || deviceProvider.Initialize(loadFilter, exclusiveAccessIfPossible, throwExceptions))
+ lock (_deviceProvider)
{
- _deviceProvider.Add(deviceProvider);
+ if (_deviceProvider.Contains(deviceProvider) || _deviceProvider.Any(x => x.GetType() == deviceProvider.GetType())) return;
- foreach (IRGBDevice device in deviceProvider.Devices)
+ List addedDevices = new List();
+ if (deviceProvider.IsInitialized || deviceProvider.Initialize(loadFilter, exclusiveAccessIfPossible, throwExceptions))
{
- if (_devices.Contains(device)) continue;
+ _deviceProvider.Add(deviceProvider);
+ lock (_devices)
+ foreach (IRGBDevice device in deviceProvider.Devices)
+ {
+ if (_devices.Contains(device)) continue;
- addedDevices.Add(device);
+ addedDevices.Add(device);
- device.PropertyChanged += DeviceOnPropertyChanged;
- _devices.Add(device);
+ device.PropertyChanged += DeviceOnPropertyChanged;
+ _devices.Add(device);
+ }
}
- }
- if (addedDevices.Any())
- {
- UpdateSurfaceRectangle();
- SurfaceLayoutChanged?.Invoke(new SurfaceLayoutChangedEventArgs(addedDevices, true, false));
+ if (addedDevices.Any())
+ {
+ UpdateSurfaceRectangle();
+ SurfaceLayoutChanged?.Invoke(new SurfaceLayoutChangedEventArgs(addedDevices, true, false));
+ }
}
}
diff --git a/RGB.NET.Core/Update/AbstractUpdateTrigger.cs b/RGB.NET.Core/Update/AbstractUpdateTrigger.cs
index 3ac5d46..e311037 100644
--- a/RGB.NET.Core/Update/AbstractUpdateTrigger.cs
+++ b/RGB.NET.Core/Update/AbstractUpdateTrigger.cs
@@ -5,7 +5,7 @@ namespace RGB.NET.Core
///
/// Represents a generic update trigger.
///
- public class AbstractUpdateTrigger : AbstractBindable, IUpdateTrigger
+ public abstract class AbstractUpdateTrigger : AbstractBindable, IUpdateTrigger
{
#region Events
@@ -31,8 +31,7 @@ namespace RGB.NET.Core
protected virtual void OnUpdate(CustomUpdateData updateData = null) => Update?.Invoke(this, updateData);
///
- public virtual void Dispose()
- { }
+ public abstract void Dispose();
#endregion
}
diff --git a/RGB.NET.Core/Update/Devices/DeviceUpdateTrigger.cs b/RGB.NET.Core/Update/Devices/DeviceUpdateTrigger.cs
index 04cfb92..8f4beba 100644
--- a/RGB.NET.Core/Update/Devices/DeviceUpdateTrigger.cs
+++ b/RGB.NET.Core/Update/Devices/DeviceUpdateTrigger.cs
@@ -144,6 +144,9 @@ namespace RGB.NET.Core
UpdateFrequency = UpdateRateHardLimit;
}
+ ///
+ public override void Dispose() => Stop();
+
#endregion
}
}
diff --git a/RGB.NET.Core/Update/Devices/UpdateQueue.cs b/RGB.NET.Core/Update/Devices/UpdateQueue.cs
index 05aff8d..da5c82c 100644
--- a/RGB.NET.Core/Update/Devices/UpdateQueue.cs
+++ b/RGB.NET.Core/Update/Devices/UpdateQueue.cs
@@ -100,7 +100,8 @@ namespace RGB.NET.Core
_currentDataSet = null;
}
- public void Dispose()
+ ///
+ public virtual void Dispose()
{
_updateTrigger.Starting -= OnStartup;
_updateTrigger.Update -= OnUpdate;
diff --git a/RGB.NET.Core/Update/TimerUpdateTrigger.cs b/RGB.NET.Core/Update/TimerUpdateTrigger.cs
index 23eaa96..0171ffb 100644
--- a/RGB.NET.Core/Update/TimerUpdateTrigger.cs
+++ b/RGB.NET.Core/Update/TimerUpdateTrigger.cs
@@ -106,6 +106,9 @@ namespace RGB.NET.Core
}
}
+ ///
+ public override void Dispose() => Stop();
+
#endregion
}
}
diff --git a/RGB.NET.Decorators/Brush/FlashDecorator.cs b/RGB.NET.Decorators/Brush/FlashDecorator.cs
index 618b243..580fce4 100644
--- a/RGB.NET.Decorators/Brush/FlashDecorator.cs
+++ b/RGB.NET.Decorators/Brush/FlashDecorator.cs
@@ -129,7 +129,7 @@ namespace RGB.NET.Decorators.Brush
else
{
if ((++_repetitionCount >= Repetitions) && (Repetitions > 0))
- Detach();
+ Detach();
_currentPhaseValue = Attack;
_currentPhase = ADSRPhase.Attack;
}
diff --git a/RGB.NET.Decorators/RGB.NET.Decorators.csproj b/RGB.NET.Decorators/RGB.NET.Decorators.csproj
index 6356878..f76251d 100644
--- a/RGB.NET.Decorators/RGB.NET.Decorators.csproj
+++ b/RGB.NET.Decorators/RGB.NET.Decorators.csproj
@@ -14,8 +14,8 @@
RGB.NET.Decorators
Decorators-Presets of RGB.NET
Decorators-Presets of RGB.NET, a C# (.NET) library for accessing various RGB-peripherals
- Copyright © Wyrez 2017
- Copyright © Wyrez 2017
+ Copyright © Darth Affe 2020
+ Copyright © Darth Affe 2020
http://lib.arge.be/icon.png
https://github.com/DarthAffe/RGB.NET
https://raw.githubusercontent.com/DarthAffe/RGB.NET/master/LICENSE
@@ -64,6 +64,6 @@
-
+
\ No newline at end of file
diff --git a/RGB.NET.Devices.Asus/AsusDeviceProvider.cs b/RGB.NET.Devices.Asus/AsusDeviceProvider.cs
index f8e3834..8547b14 100644
--- a/RGB.NET.Devices.Asus/AsusDeviceProvider.cs
+++ b/RGB.NET.Devices.Asus/AsusDeviceProvider.cs
@@ -90,52 +90,45 @@ namespace RGB.NET.Devices.Asus
{
try
{
- IAsusRGBDevice rgbDevice = null;
- switch (device.Type)
+ IAsusRGBDevice rgbDevice;
+ switch ((AsusDeviceType)device.Type)
{
- case 0x00010000: //Motherboard
+ case AsusDeviceType.MB_RGB:
rgbDevice = new AsusMainboardRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Mainboard, device, WMIHelper.GetMainboardInfo()?.model ?? device.Name));
break;
- case 0x00011000: //Motherboard LED Strip
+ case AsusDeviceType.MB_ADDRESABLE:
rgbDevice = new AsusUnspecifiedRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.LedStripe, device), LedId.LedStripe1);
break;
- case 0x00020000: //VGA
+ case AsusDeviceType.VGA_RGB:
rgbDevice = new AsusGraphicsCardRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.GraphicsCard, device));
break;
- case 0x00040000: //Headset
+ case AsusDeviceType.HEADSET_RGB:
rgbDevice = new AsusHeadsetRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Headset, device));
break;
- case 0x00070000: //DRAM
+ case AsusDeviceType.DRAM_RGB:
rgbDevice = new AsusDramRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.DRAM, device));
break;
- case 0x00080000: //Keyboard
- case 0x00081000: //Notebook Keyboard
- case 0x00081001: //Notebook Keyboard(4 - zone type)
+ case AsusDeviceType.KEYBOARD_RGB:
+ case AsusDeviceType.NB_KB_RGB:
+ case AsusDeviceType.NB_KB_4ZONE_RGB:
rgbDevice = new AsusKeyboardRGBDevice(new AsusKeyboardRGBDeviceInfo(device, CultureInfo.CurrentCulture));
break;
- case 0x00090000: //Mouse
+ case AsusDeviceType.MOUSE_RGB:
rgbDevice = new AsusMouseRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Mouse, device));
break;
- case 0x00000000: //All
- case 0x00012000: //All - In - One PC
- case 0x00030000: //Display
- case 0x00050000: //Microphone
- case 0x00060000: //External HDD
- case 0x00061000: //External BD Drive
- case 0x000B0000: //Chassis
- case 0x000C0000: //Projector
+ default:
rgbDevice = new AsusUnspecifiedRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Unknown, device), LedId.Custom1);
break;
}
- if ((rgbDevice != null) && loadFilter.HasFlag(rgbDevice.DeviceInfo.DeviceType))
+ if (loadFilter.HasFlag(rgbDevice.DeviceInfo.DeviceType))
{
rgbDevice.Initialize(UpdateTrigger);
devices.Add(rgbDevice);
@@ -172,7 +165,12 @@ namespace RGB.NET.Devices.Asus
///
public void Dispose()
{
- _sdk?.ReleaseControl(0);
+ try { UpdateTrigger?.Dispose(); }
+ catch { /* at least we tried */ }
+
+ try { _sdk?.ReleaseControl(0); }
+ catch { /* at least we tried */ }
+
_sdk = null;
}
diff --git a/RGB.NET.Devices.Asus/Dram/AsusDramRGBDevice.cs b/RGB.NET.Devices.Asus/Dram/AsusDramRGBDevice.cs
index 315b1ed..7ee2183 100644
--- a/RGB.NET.Devices.Asus/Dram/AsusDramRGBDevice.cs
+++ b/RGB.NET.Devices.Asus/Dram/AsusDramRGBDevice.cs
@@ -2,11 +2,11 @@
namespace RGB.NET.Devices.Asus
{
- ///
+ ///
///
/// Represents a Asus dram.
///
- public class AsusDramRGBDevice : AsusRGBDevice
+ public class AsusDramRGBDevice : AsusRGBDevice, IDRAM
{
#region Constructors
diff --git a/RGB.NET.Devices.Asus/Enum/AsusDeviceType.cs b/RGB.NET.Devices.Asus/Enum/AsusDeviceType.cs
new file mode 100644
index 0000000..7990bce
--- /dev/null
+++ b/RGB.NET.Devices.Asus/Enum/AsusDeviceType.cs
@@ -0,0 +1,25 @@
+// ReSharper disable InconsistentNaming
+
+namespace RGB.NET.Devices.Asus
+{
+ internal enum AsusDeviceType : uint
+ {
+ ALL = 0,
+ MB_RGB = 0x10000,
+ MB_ADDRESABLE = 0x11000,
+ DESKTOP_RGB = 0x12000,
+ VGA_RGB = 0x20000,
+ DISPLAY_RGB = 0x30000,
+ HEADSET_RGB = 0x40000,
+ MICROPHONE_RGB = 0x50000,
+ EXTERNAL_HARD_DRIVER_RGB = 0x60000,
+ EXTERNAL_BLUE_RAY_RGB = 0x61000,
+ DRAM_RGB = 0x70000,
+ KEYBOARD_RGB = 0x80000,
+ NB_KB_RGB = 0x81000,
+ NB_KB_4ZONE_RGB = 0x81001,
+ MOUSE_RGB = 0x90000,
+ CHASSIS_RGB = 0xB0000,
+ PROJECTOR_RGB = 0xC0000
+ }
+}
diff --git a/RGB.NET.Devices.Asus/Enum/AsusLedId.cs b/RGB.NET.Devices.Asus/Enum/AsusLedId.cs
new file mode 100644
index 0000000..f56d64a
--- /dev/null
+++ b/RGB.NET.Devices.Asus/Enum/AsusLedId.cs
@@ -0,0 +1,160 @@
+// ReSharper disable InconsistentNaming
+
+namespace RGB.NET.Devices.Asus
+{
+ internal enum AsusLedId : ushort
+ {
+ KEY_ESCAPE = 0x01,
+ KEY_1 = 0x02,
+ KEY_2 = 0x03,
+ KEY_3 = 0x04,
+ KEY_4 = 0x05,
+ KEY_5 = 0x06,
+ KEY_6 = 0x07,
+ KEY_7 = 0x08,
+ KEY_8 = 0x09,
+ KEY_9 = 0x0A,
+ KEY_0 = 0x0B,
+ KEY_MINUS = 0x0C, // - on main keyboard
+ KEY_EQUALS = 0x0D,
+ KEY_BACK = 0x0E, // backspace
+ KEY_TAB = 0x0F,
+ KEY_Q = 0x10,
+ KEY_W = 0x11,
+ KEY_E = 0x12,
+ KEY_R = 0x13,
+ KEY_T = 0x14,
+ KEY_Y = 0x15,
+ KEY_U = 0x16,
+ KEY_I = 0x17,
+ KEY_O = 0x18,
+ KEY_P = 0x19,
+ KEY_LBRACKET = 0x1A,
+ KEY_RBRACKET = 0x1B,
+ KEY_RETURN = 0x1C, // Enter on main keyboard
+ KEY_LCONTROL = 0x1D,
+ KEY_A = 0x1E,
+ KEY_S = 0x1F,
+ KEY_D = 0x20,
+ KEY_F = 0x21,
+ KEY_G = 0x22,
+ KEY_H = 0x23,
+ KEY_J = 0x24,
+ KEY_K = 0x25,
+ KEY_L = 0x26,
+ KEY_SEMICOLON = 0x27,
+ KEY_APOSTROPHE = 0x28,
+ KEY_GRAVE = 0x29, // accent grave
+ KEY_LSHIFT = 0x2A,
+ KEY_BACKSLASH = 0x2B,
+ KEY_Z = 0x2C,
+ KEY_X = 0x2D,
+ KEY_C = 0x2E,
+ KEY_V = 0x2F,
+ KEY_B = 0x30,
+ KEY_N = 0x31,
+ KEY_M = 0x32,
+ KEY_COMMA = 0x33,
+ KEY_PERIOD = 0x34, // . on main keyboard
+ KEY_SLASH = 0x35, // / on main keyboard
+ KEY_RSHIFT = 0x36,
+ KEY_MULTIPLY = 0x37, // * on numeric keypad
+ KEY_LMENU = 0x38, // left Alt
+ KEY_SPACE = 0x39,
+ KEY_CAPITAL = 0x3A,
+ KEY_F1 = 0x3B,
+ KEY_F2 = 0x3C,
+ KEY_F3 = 0x3D,
+ KEY_F4 = 0x3E,
+ KEY_F5 = 0x3F,
+ KEY_F6 = 0x40,
+ KEY_F7 = 0x41,
+ KEY_F8 = 0x42,
+ KEY_F9 = 0x43,
+ KEY_F10 = 0x44,
+ KEY_NUMLOCK = 0x45,
+ KEY_SCROLL = 0x46, // Scroll Lock
+ KEY_NUMPAD7 = 0x47,
+ KEY_NUMPAD8 = 0x48,
+ KEY_NUMPAD9 = 0x49,
+ KEY_SUBTRACT = 0x4A, // - on numeric keypad
+ KEY_NUMPAD4 = 0x4B,
+ KEY_NUMPAD5 = 0x4C,
+ KEY_NUMPAD6 = 0x4D,
+ KEY_ADD = 0x4E, // + on numeric keypad
+ KEY_NUMPAD1 = 0x4F,
+ KEY_NUMPAD2 = 0x50,
+ KEY_NUMPAD3 = 0x51,
+ KEY_NUMPAD0 = 0x52,
+ KEY_DECIMAL = 0x53, // . on numeric keypad
+ KEY_OEM_102 = 0x56, // < > | on UK/Germany keyboards
+ KEY_F11 = 0x57,
+ KEY_F12 = 0x58,
+ KEY_F13 = 0x64, // (NEC PC98)
+ KEY_F14 = 0x65, // (NEC PC98)
+ KEY_F15 = 0x66, // (NEC PC98)
+ KEY_KANA = 0x70, // (Japanese keyboard)
+ KEY_ABNT_C1 = 0x73, // / ? on Portugese (Brazilian) keyboards
+ KEY_CONVERT = 0x79, // (Japanese keyboard)
+ KEY_NOCONVERT = 0x7B, // (Japanese keyboard)
+ KEY_YEN = 0x7D, // (Japanese keyboard)
+ KEY_ABNT_C2 = 0x7E, // Numpad . on Portugese (Brazilian) keyboards
+ KEY_NUMPADEQUALS = 0x8D, // = on numeric keypad (NEC PC98)
+ KEY_CIRCUMFLEX = 0x90, // (Japanese keyboard)
+ KEY_AT = 0x91, // (NEC PC98)
+ KEY_COLON = 0x92, // (NEC PC98)
+ KEY_UNDERLINE = 0x93, // (NEC PC98)
+ KEY_KANJI = 0x94, // (Japanese keyboard)
+ KEY_STOP = 0x95, // (NEC PC98)
+ KEY_AX = 0x96, // (Japan AX)
+ KEY_UNLABELED = 0x97, // (J3100)
+ KEY_NEXTTRACK = 0x99, // Next Track
+ KEY_NUMPADENTER = 0x9C, // Enter on numeric keypad
+ KEY_RCONTROL = 0x9D, //
+ KEY_MUTE = 0xA0, // Mute
+ KEY_CALCULATOR = 0xA1, // Calculator
+ KEY_PLAYPAUSE = 0xA2, // Play / Pause
+ KEY_MEDIASTOP = 0xA4, // Media Stop
+ KEY_VOLUMEDOWN = 0xAE, // Volume -
+ KEY_VOLUMEUP = 0xB0, // Volume +
+ KEY_WEBHOME = 0xB2, // Web home
+ KEY_NUMPADCOMMA = 0xB3, // , on numeric keypad (NEC PC98)
+ KEY_DIVIDE = 0xB5, // / on numeric keypad
+ KEY_SYSRQ = 0xB7, //
+ KEY_RMENU = 0xB8, // right Alt
+ KEY_PAUSE = 0xC5, // Pause
+ KEY_HOME = 0xC7, // Home on arrow keypad
+ KEY_UP = 0xC8, // UpArrow on arrow keypad
+ KEY_PRIOR = 0xC9, // PgUp on arrow keypad
+ KEY_LEFT = 0xCB, // LeftArrow on arrow keypad
+ KEY_RIGHT = 0xCD, // RightArrow on arrow keypad
+ KEY_END = 0xCF, // End on arrow keypad
+ KEY_DOWN = 0xD0, // DownArrow on arrow keypad
+ KEY_NEXT = 0xD1, // PgDn on arrow keypad
+ KEY_INSERT = 0xD2, // Insert on arrow keypad
+ KEY_DELETE = 0xD3, // Delete on arrow keypad
+ KEY_LWIN = 0xDB, // Left Windows key
+ KEY_RWIN = 0xDC, // Right Windows key
+ KEY_APPS = 0xDD, // AppMenu key
+ KEY_POWER = 0xDE, //
+ KEY_SLEEP = 0xDF, //
+ KEY_WAKE = 0xE3, // System Wake
+ KEY_WEBSEARCH = 0xE5, // Web Search
+ KEY_WEBFAVORITES = 0xE6, // Web Favorites
+ KEY_WEBREFRESH = 0xE7, // Web Refresh
+ KEY_WEBSTOP = 0xE8, // Web Stop
+ KEY_WEBFORWARD = 0xE9, // Web Forward
+ KEY_WEBBACK = 0xEA, // Web Back
+ KEY_MYCOMPUTER = 0xEB, // My Computer
+ KEY_MAIL = 0xEC, // Mail
+ KEY_MEDIASELECT = 0xED, // Media Select
+ KEY_FN = 0x100, // Function key
+
+ // Undocumented
+ UNDOCUMENTED_1 = 0x59,
+ UNDOCUMENTED_2 = 0x56,
+ UNDOCUMENTED_3 = 0x101,
+ UNDOCUMENTED_4 = 0x102,
+ UNDOCUMENTED_5 = 0x103,
+ }
+}
diff --git a/RGB.NET.Devices.Asus/Generic/AsusRGBDevice.cs b/RGB.NET.Devices.Asus/Generic/AsusRGBDevice.cs
index 0241828..42caff9 100644
--- a/RGB.NET.Devices.Asus/Generic/AsusRGBDevice.cs
+++ b/RGB.NET.Devices.Asus/Generic/AsusRGBDevice.cs
@@ -80,6 +80,15 @@ namespace RGB.NET.Devices.Asus
//}
}
+ ///
+ public override void Dispose()
+ {
+ try { UpdateQueue?.Dispose(); }
+ catch { /* at least we tried */ }
+
+ base.Dispose();
+ }
+
#endregion
}
}
diff --git a/RGB.NET.Devices.Asus/Generic/AsusUnspecifiedRGBDevice.cs b/RGB.NET.Devices.Asus/Generic/AsusUnspecifiedRGBDevice.cs
index 3515596..40eb602 100644
--- a/RGB.NET.Devices.Asus/Generic/AsusUnspecifiedRGBDevice.cs
+++ b/RGB.NET.Devices.Asus/Generic/AsusUnspecifiedRGBDevice.cs
@@ -2,11 +2,11 @@
namespace RGB.NET.Devices.Asus
{
- ///
+ ///
///
/// Represents a Asus headset.
///
- public class AsusUnspecifiedRGBDevice : AsusRGBDevice
+ public class AsusUnspecifiedRGBDevice : AsusRGBDevice, IUnknownDevice
{
#region Properties & Fields
diff --git a/RGB.NET.Devices.Asus/Generic/AsusUpdateQueue.cs b/RGB.NET.Devices.Asus/Generic/AsusUpdateQueue.cs
index fb32a3e..9a3b260 100644
--- a/RGB.NET.Devices.Asus/Generic/AsusUpdateQueue.cs
+++ b/RGB.NET.Devices.Asus/Generic/AsusUpdateQueue.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using AuraServiceLib;
using RGB.NET.Core;
@@ -48,22 +47,57 @@ namespace RGB.NET.Devices.Asus
{
try
{
- foreach (KeyValuePair data in dataSet)
+ if ((Device.Type == (uint)AsusDeviceType.KEYBOARD_RGB) || (Device.Type == (uint)AsusDeviceType.NB_KB_RGB))
{
- int index = (int)data.Key;
- IAuraRgbLight light = Device.Lights[index];
- (_, byte r, byte g, byte b) = data.Value.GetRGBBytes();
- light.Red = r;
- light.Green = g;
- light.Blue = b;
+ foreach (KeyValuePair data in dataSet)
+ {
+ AsusLedId index = (AsusLedId)data.Key;
+ IAuraSyncKeyboard keyboard = (IAuraSyncKeyboard)Device;
+ if (keyboard != null)
+ {
+ IAuraRgbLight light = index switch
+ {
+ //UK keyboard Layout
+ AsusLedId.KEY_OEM_102 => keyboard.Lights[(int)((3 * keyboard.Width) + 13)],
+ AsusLedId.UNDOCUMENTED_1 => keyboard.Lights[(int)((4 * keyboard.Width) + 1)],
+ _ => keyboard.Key[(ushort)index]
+ };
+
+ // Asus Strix Scope
+ if (keyboard.Name == "Charm")
+ light = index switch
+ {
+ AsusLedId.KEY_LWIN => keyboard.Lights[(int)((5 * keyboard.Width) + 2)],
+ AsusLedId.KEY_LMENU => keyboard.Lights[(int)((5 * keyboard.Width) + 3)],
+ _ => light
+ };
+
+ (_, byte r, byte g, byte b) = data.Value.GetRGBBytes();
+ light.Red = r;
+ light.Green = g;
+ light.Blue = b;
+ }
+ }
+ }
+ else
+ {
+ foreach (KeyValuePair data in dataSet)
+ {
+ int index = (int)data.Key;
+ IAuraRgbLight light = Device.Lights[index];
+
+ (_, byte r, byte g, byte b) = data.Value.GetRGBBytes();
+ light.Red = r;
+ light.Green = g;
+ light.Blue = b;
+ }
}
Device.Apply();
}
- catch (Exception ex)
+ catch
{ /* "The server threw an exception." seems to be a thing here ... */ }
}
-
#endregion
}
}
diff --git a/RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDevice.cs b/RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDevice.cs
index de925fb..f50f70f 100644
--- a/RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDevice.cs
+++ b/RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDevice.cs
@@ -2,11 +2,11 @@
namespace RGB.NET.Devices.Asus
{
- ///
+ ///
///
/// Represents a Asus graphicsCard.
///
- public class AsusGraphicsCardRGBDevice : AsusRGBDevice
+ public class AsusGraphicsCardRGBDevice : AsusRGBDevice, IGraphicsCard
{
#region Constructors
diff --git a/RGB.NET.Devices.Asus/Headset/AsusHeadsetRGBDevice.cs b/RGB.NET.Devices.Asus/Headset/AsusHeadsetRGBDevice.cs
index e762d97..a3727d1 100644
--- a/RGB.NET.Devices.Asus/Headset/AsusHeadsetRGBDevice.cs
+++ b/RGB.NET.Devices.Asus/Headset/AsusHeadsetRGBDevice.cs
@@ -2,11 +2,11 @@
namespace RGB.NET.Devices.Asus
{
- ///
+ ///
///
/// Represents a Asus headset.
///
- public class AsusHeadsetRGBDevice : AsusRGBDevice
+ public class AsusHeadsetRGBDevice : AsusRGBDevice, IHeadset
{
#region Constructors
diff --git a/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardLedMapping.cs b/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardLedMapping.cs
new file mode 100644
index 0000000..2b48961
--- /dev/null
+++ b/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardLedMapping.cs
@@ -0,0 +1,161 @@
+using System.Collections.Generic;
+using RGB.NET.Core;
+
+namespace RGB.NET.Devices.Asus
+{
+ internal static class AsusKeyboardLedMapping
+ {
+ public static readonly Dictionary MAPPING = new Dictionary
+ {
+ { LedId.Keyboard_Escape, AsusLedId.KEY_ESCAPE },
+ { LedId.Keyboard_F1, AsusLedId.KEY_F1 },
+ { LedId.Keyboard_F2, AsusLedId.KEY_F2 },
+ { LedId.Keyboard_F3, AsusLedId.KEY_F3 },
+ { LedId.Keyboard_F4, AsusLedId.KEY_F4 },
+ { LedId.Keyboard_F5, AsusLedId.KEY_F5 },
+ { LedId.Keyboard_F6, AsusLedId.KEY_F6 },
+ { LedId.Keyboard_F7, AsusLedId.KEY_F7 },
+ { LedId.Keyboard_F8, AsusLedId.KEY_F8 },
+ { LedId.Keyboard_F9, AsusLedId.KEY_F9 },
+ { LedId.Keyboard_F10, AsusLedId.KEY_F10 },
+ { LedId.Keyboard_F11, AsusLedId.KEY_F11 },
+ { LedId.Keyboard_F12, AsusLedId.KEY_F12 },
+ { LedId.Keyboard_1, AsusLedId.KEY_1 },
+ { LedId.Keyboard_2, AsusLedId.KEY_2 },
+ { LedId.Keyboard_3, AsusLedId.KEY_3 },
+ { LedId.Keyboard_4, AsusLedId.KEY_4 },
+ { LedId.Keyboard_5, AsusLedId.KEY_5 },
+ { LedId.Keyboard_6, AsusLedId.KEY_6 },
+ { LedId.Keyboard_7, AsusLedId.KEY_7 },
+ { LedId.Keyboard_8, AsusLedId.KEY_8 },
+ { LedId.Keyboard_9, AsusLedId.KEY_9 },
+ { LedId.Keyboard_0, AsusLedId.KEY_0 },
+ { LedId.Keyboard_MinusAndUnderscore, AsusLedId.KEY_MINUS },
+ { LedId.Keyboard_EqualsAndPlus, AsusLedId.KEY_EQUALS },
+ { LedId.Keyboard_Backspace, AsusLedId.KEY_BACK },
+ { LedId.Keyboard_Tab, AsusLedId.KEY_TAB },
+ { LedId.Keyboard_Q, AsusLedId.KEY_Q },
+ { LedId.Keyboard_W, AsusLedId.KEY_W },
+ { LedId.Keyboard_E, AsusLedId.KEY_E },
+ { LedId.Keyboard_R, AsusLedId.KEY_R },
+ { LedId.Keyboard_T, AsusLedId.KEY_T },
+ { LedId.Keyboard_Y, AsusLedId.KEY_Y },
+ { LedId.Keyboard_U, AsusLedId.KEY_U },
+ { LedId.Keyboard_I, AsusLedId.KEY_I },
+ { LedId.Keyboard_O, AsusLedId.KEY_O },
+ { LedId.Keyboard_P, AsusLedId.KEY_P },
+ { LedId.Keyboard_BracketLeft, AsusLedId.KEY_LBRACKET },
+ { LedId.Keyboard_BracketRight, AsusLedId.KEY_RBRACKET },
+ { LedId.Keyboard_Enter, AsusLedId.KEY_RETURN },
+ { LedId.Keyboard_CapsLock, AsusLedId.KEY_CAPITAL },
+ { LedId.Keyboard_A, AsusLedId.KEY_A },
+ { LedId.Keyboard_S, AsusLedId.KEY_S },
+ { LedId.Keyboard_D, AsusLedId.KEY_D },
+ { LedId.Keyboard_F, AsusLedId.KEY_F },
+ { LedId.Keyboard_G, AsusLedId.KEY_G },
+ { LedId.Keyboard_H, AsusLedId.KEY_H },
+ { LedId.Keyboard_J, AsusLedId.KEY_J },
+ { LedId.Keyboard_K, AsusLedId.KEY_K },
+ { LedId.Keyboard_L, AsusLedId.KEY_L },
+ { LedId.Keyboard_SemicolonAndColon, AsusLedId.KEY_SEMICOLON },
+ { LedId.Keyboard_ApostropheAndDoubleQuote, AsusLedId.KEY_APOSTROPHE },
+ { LedId.Keyboard_GraveAccentAndTilde, AsusLedId.KEY_GRAVE },
+ { LedId.Keyboard_LeftShift, AsusLedId.KEY_LSHIFT },
+ { LedId.Keyboard_Backslash, AsusLedId.KEY_BACKSLASH },
+ { LedId.Keyboard_Z, AsusLedId.KEY_Z },
+ { LedId.Keyboard_X, AsusLedId.KEY_X },
+ { LedId.Keyboard_C, AsusLedId.KEY_C },
+ { LedId.Keyboard_V, AsusLedId.KEY_V },
+ { LedId.Keyboard_B, AsusLedId.KEY_B },
+ { LedId.Keyboard_N, AsusLedId.KEY_N },
+ { LedId.Keyboard_M, AsusLedId.KEY_M },
+ { LedId.Keyboard_CommaAndLessThan, AsusLedId.KEY_COMMA },
+ { LedId.Keyboard_PeriodAndBiggerThan, AsusLedId.KEY_PERIOD },
+ { LedId.Keyboard_SlashAndQuestionMark, AsusLedId.KEY_SLASH },
+ { LedId.Keyboard_RightShift, AsusLedId.KEY_RSHIFT },
+ { LedId.Keyboard_LeftCtrl, AsusLedId.KEY_LCONTROL },
+ { LedId.Keyboard_LeftGui, AsusLedId.KEY_LWIN },
+ { LedId.Keyboard_LeftAlt, AsusLedId.KEY_LMENU },
+ { LedId.Keyboard_Space, AsusLedId.KEY_SPACE },
+ { LedId.Keyboard_RightAlt, AsusLedId.KEY_RMENU },
+ { LedId.Keyboard_RightGui, AsusLedId.KEY_RWIN },
+ { LedId.Keyboard_Application, AsusLedId.KEY_APPS },
+ { LedId.Keyboard_RightCtrl, AsusLedId.KEY_RCONTROL },
+ { LedId.Keyboard_PrintScreen, AsusLedId.KEY_SYSRQ },
+ { LedId.Keyboard_ScrollLock, AsusLedId.KEY_SCROLL },
+ { LedId.Keyboard_PauseBreak, AsusLedId.KEY_PAUSE },
+ { LedId.Keyboard_Insert, AsusLedId.KEY_INSERT },
+ { LedId.Keyboard_Home, AsusLedId.KEY_HOME },
+ { LedId.Keyboard_PageUp, AsusLedId.KEY_PRIOR },
+ { LedId.Keyboard_Delete, AsusLedId.KEY_DELETE },
+ { LedId.Keyboard_End, AsusLedId.KEY_END },
+ { LedId.Keyboard_PageDown, AsusLedId.KEY_NEXT },
+ { LedId.Keyboard_ArrowUp, AsusLedId.KEY_UP },
+ { LedId.Keyboard_ArrowLeft, AsusLedId.KEY_LEFT },
+ { LedId.Keyboard_ArrowDown, AsusLedId.KEY_DOWN },
+ { LedId.Keyboard_ArrowRight, AsusLedId.KEY_RIGHT },
+ { LedId.Keyboard_NumLock, AsusLedId.KEY_NUMLOCK },
+ { LedId.Keyboard_NumSlash, AsusLedId.KEY_DIVIDE },
+ { LedId.Keyboard_NumAsterisk, AsusLedId.KEY_MULTIPLY },
+ { LedId.Keyboard_NumMinus, AsusLedId.KEY_SUBTRACT },
+ { LedId.Keyboard_Num7, AsusLedId.KEY_NUMPAD7 },
+ { LedId.Keyboard_Num8, AsusLedId.KEY_NUMPAD8 },
+ { LedId.Keyboard_Num9, AsusLedId.KEY_NUMPAD9 },
+ { LedId.Keyboard_NumPeriodAndDelete, AsusLedId.KEY_DECIMAL },
+ { LedId.Keyboard_NumPlus, AsusLedId.KEY_ADD },
+ { LedId.Keyboard_Num4, AsusLedId.KEY_NUMPAD4 },
+ { LedId.Keyboard_Num5, AsusLedId.KEY_NUMPAD5 },
+ { LedId.Keyboard_Num6, AsusLedId.KEY_NUMPAD6 },
+ { LedId.Keyboard_Num1, AsusLedId.KEY_NUMPAD1 },
+ { LedId.Keyboard_Num2, AsusLedId.KEY_NUMPAD2 },
+ { LedId.Keyboard_Num3, AsusLedId.KEY_NUMPAD3 },
+ { LedId.Keyboard_Num0, AsusLedId.KEY_NUMPAD0 },
+ { LedId.Keyboard_NumEnter, AsusLedId.KEY_NUMPADENTER },
+ { LedId.Keyboard_NonUsBackslash, AsusLedId.UNDOCUMENTED_1 },
+ { LedId.Keyboard_NonUsTilde, AsusLedId.UNDOCUMENTED_2 },
+ { LedId.Keyboard_NumComma, AsusLedId.KEY_NUMPADCOMMA },
+ { LedId.Logo, AsusLedId.UNDOCUMENTED_3 },
+ { LedId.Keyboard_Custom1, AsusLedId.UNDOCUMENTED_4 },
+ { LedId.Keyboard_Custom2, AsusLedId.UNDOCUMENTED_5 },
+ { LedId.Keyboard_Custom3, AsusLedId.KEY_F13 },
+ { LedId.Keyboard_Custom4, AsusLedId.KEY_F14 },
+ { LedId.Keyboard_Custom5, AsusLedId.KEY_F15 },
+ { LedId.Keyboard_Custom6, AsusLedId.KEY_KANA },
+ { LedId.Keyboard_Custom7, AsusLedId.KEY_ABNT_C1 },
+ { LedId.Keyboard_Custom8, AsusLedId.KEY_CONVERT },
+ { LedId.Keyboard_Custom9, AsusLedId.KEY_NOCONVERT },
+ { LedId.Keyboard_Custom10, AsusLedId.KEY_YEN },
+ { LedId.Keyboard_Custom11, AsusLedId.KEY_ABNT_C2 },
+ { LedId.Keyboard_Custom12, AsusLedId.KEY_NUMPADEQUALS },
+ { LedId.Keyboard_Custom13, AsusLedId.KEY_CIRCUMFLEX },
+ { LedId.Keyboard_Custom14, AsusLedId.KEY_AT },
+ { LedId.Keyboard_Custom15, AsusLedId.KEY_COLON },
+ { LedId.Keyboard_Custom16, AsusLedId.KEY_UNDERLINE },
+ { LedId.Keyboard_Custom17, AsusLedId.KEY_KANJI },
+ { LedId.Keyboard_Custom18, AsusLedId.KEY_STOP },
+ { LedId.Keyboard_Custom19, AsusLedId.KEY_AX },
+ { LedId.Keyboard_Custom20, AsusLedId.KEY_UNLABELED },
+ { LedId.Keyboard_Custom21, AsusLedId.KEY_NEXTTRACK },
+ { LedId.Keyboard_Custom22, AsusLedId.KEY_CALCULATOR },
+ { LedId.Keyboard_Custom23, AsusLedId.KEY_POWER },
+ { LedId.Keyboard_Custom24, AsusLedId.KEY_SLEEP },
+ { LedId.Keyboard_Custom25, AsusLedId.KEY_WAKE },
+ { LedId.Keyboard_Custom26, AsusLedId.KEY_WEBSEARCH },
+ { LedId.Keyboard_Custom27, AsusLedId.KEY_WEBFAVORITES },
+ { LedId.Keyboard_Custom28, AsusLedId.KEY_WEBREFRESH },
+ { LedId.Keyboard_Custom29, AsusLedId.KEY_WEBSTOP },
+ { LedId.Keyboard_Custom30, AsusLedId.KEY_WEBFORWARD },
+ { LedId.Keyboard_Custom31, AsusLedId.KEY_WEBHOME },
+ { LedId.Keyboard_Custom32, AsusLedId.KEY_WEBBACK },
+ { LedId.Keyboard_Custom33, AsusLedId.KEY_MYCOMPUTER },
+ { LedId.Keyboard_Custom34, AsusLedId.KEY_MAIL },
+ { LedId.Keyboard_Custom35, AsusLedId.KEY_MEDIASELECT },
+ { LedId.Keyboard_Custom36, AsusLedId.KEY_FN },
+ { LedId.Keyboard_MediaMute, AsusLedId.KEY_MUTE },
+ { LedId.Keyboard_MediaPlay, AsusLedId.KEY_PLAYPAUSE },
+ { LedId.Keyboard_MediaStop, AsusLedId.KEY_MEDIASTOP },
+ { LedId.Keyboard_MediaVolumeDown, AsusLedId.KEY_VOLUMEDOWN },
+ { LedId.Keyboard_MediaVolumeUp, AsusLedId.KEY_VOLUMEUP },
+ };
+ }
+}
diff --git a/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDevice.cs b/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDevice.cs
index f16acf4..7c444cf 100644
--- a/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDevice.cs
+++ b/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDevice.cs
@@ -1,12 +1,15 @@
-using RGB.NET.Core;
+using System.Collections.Generic;
+using System.Linq;
+using AuraServiceLib;
+using RGB.NET.Core;
namespace RGB.NET.Devices.Asus
{
- ///
+ ///
///
/// Represents a Asus keyboard.
///
- public class AsusKeyboardRGBDevice : AsusRGBDevice
+ public class AsusKeyboardRGBDevice : AsusRGBDevice, IKeyboard
{
#region Constructors
@@ -26,17 +29,38 @@ namespace RGB.NET.Devices.Asus
///
protected override void InitializeLayout()
{
- //TODO DarthAffe 07.10.2017: This doesn't make sense at all ... Find someone with such a keyboard!
- int ledCount = DeviceInfo.Device.Lights.Count;
- for (int i = 0; i < ledCount; i++)
- InitializeLed(LedId.Keyboard_Escape + i, new Rectangle(i * 19, 0, 19, 19));
+ Dictionary reversedMapping = AsusKeyboardLedMapping.MAPPING.ToDictionary(x => x.Value, x => x.Key);
+
+ if (DeviceInfo.Device.Type != (uint)AsusDeviceType.NB_KB_4ZONE_RGB)
+ {
+ int pos = 0;
+ foreach (IAuraRgbKey key in ((IAuraSyncKeyboard)DeviceInfo.Device).Keys)
+ InitializeLed(reversedMapping[(AsusLedId)key.Code], new Point(pos++ * 19, 0), new Size(19, 19));
+
+ //UK Layout
+ InitializeLed(reversedMapping[AsusLedId.KEY_OEM_102], new Point(pos++ * 19, 0), new Size(19, 19));
+
+ InitializeLed(reversedMapping[AsusLedId.UNDOCUMENTED_1], new Point(pos * 19, 0), new Size(19, 19));
+ }
+ else
+ {
+ int ledCount = DeviceInfo.Device.Lights.Count;
+ for (int i = 0; i < ledCount; i++)
+ InitializeLed(LedId.Keyboard_Custom1 + i, new Point(i * 19, 0), new Size(19, 19));
+ }
string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper();
ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, $@"Layouts\Asus\Keyboards\{model}", $"{DeviceInfo.PhysicalLayout.ToString().ToUpper()}.xml"), DeviceInfo.LogicalLayout.ToString());
}
///
- protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Keyboard_Escape;
+ protected override object CreateLedCustomData(LedId ledId)
+ {
+ if (DeviceInfo.Device.Type == (uint)AsusDeviceType.NB_KB_4ZONE_RGB)
+ return ledId - LedId.Keyboard_Custom1;
+
+ return AsusKeyboardLedMapping.MAPPING[ledId];
+ }
#endregion
}
diff --git a/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs b/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs
index bf020a6..5b8a55e 100644
--- a/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs
+++ b/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs
@@ -33,7 +33,7 @@ namespace RGB.NET.Devices.Asus
/// The backing this RGB.NET device.
/// The of the layout this keyboard is using.
internal AsusKeyboardRGBDeviceInfo(IAuraSyncDevice device, CultureInfo culture)
- : base(RGBDeviceType.Keyboard, device, "Claymore")
+ : base(RGBDeviceType.Keyboard, device, device.Name)
{
SetLayouts(culture.KeyboardLayoutId);
}
diff --git a/RGB.NET.Devices.Asus/Mainboard/AsusMainboardRGBDevice.cs b/RGB.NET.Devices.Asus/Mainboard/AsusMainboardRGBDevice.cs
index df7d419..2109aee 100644
--- a/RGB.NET.Devices.Asus/Mainboard/AsusMainboardRGBDevice.cs
+++ b/RGB.NET.Devices.Asus/Mainboard/AsusMainboardRGBDevice.cs
@@ -2,11 +2,11 @@
namespace RGB.NET.Devices.Asus
{
- ///
+ ///
///
/// Represents a Asus mainboard.
///
- public class AsusMainboardRGBDevice : AsusRGBDevice
+ public class AsusMainboardRGBDevice : AsusRGBDevice, IKeyboard
{
#region Constructors
diff --git a/RGB.NET.Devices.Asus/Mouse/AsusMouseRGBDevice.cs b/RGB.NET.Devices.Asus/Mouse/AsusMouseRGBDevice.cs
index a6a7ea3..030e547 100644
--- a/RGB.NET.Devices.Asus/Mouse/AsusMouseRGBDevice.cs
+++ b/RGB.NET.Devices.Asus/Mouse/AsusMouseRGBDevice.cs
@@ -2,11 +2,11 @@
namespace RGB.NET.Devices.Asus
{
- ///
+ ///
///
/// Represents a Asus mouse.
///
- public class AsusMouseRGBDevice : AsusRGBDevice
+ public class AsusMouseRGBDevice : AsusRGBDevice, IMouse
{
#region Constructors
diff --git a/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj b/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj
index f941ad4..fb26c95 100644
--- a/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj
+++ b/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj
@@ -14,8 +14,8 @@
RGB.NET.Devices.Asus
Asus-Device-Implementations of RGB.NET
Asus-Device-Implementations of RGB.NET, a C# (.NET) library for accessing various RGB-peripherals
- Copyright © Wyrez 2017
- Copyright © Wyrez 2017
+ Copyright © Darth Affe 2020
+ Copyright © Darth Affe 2020
http://lib.arge.be/icon.png
https://github.com/DarthAffe/RGB.NET
https://raw.githubusercontent.com/DarthAffe/RGB.NET/master/LICENSE
@@ -77,8 +77,8 @@
-
-
+
+
diff --git a/RGB.NET.Devices.Asus_Legacy/AsusDeviceProvider.cs b/RGB.NET.Devices.Asus_Legacy/AsusDeviceProvider.cs
index 4ca979a..6dbae09 100644
--- a/RGB.NET.Devices.Asus_Legacy/AsusDeviceProvider.cs
+++ b/RGB.NET.Devices.Asus_Legacy/AsusDeviceProvider.cs
@@ -228,7 +228,7 @@ namespace RGB.NET.Devices.Asus
catch { if (throwExceptions) throw; }
#endregion
-
+
UpdateTrigger?.Start();
Devices = new ReadOnlyCollection(devices);
@@ -267,7 +267,13 @@ namespace RGB.NET.Devices.Asus
///
public void Dispose()
- { }
+ {
+ try { UpdateTrigger?.Dispose(); }
+ catch { /* at least we tried */ }
+
+ try { _AsusSDK.UnloadAsusSDK(); }
+ catch { /* at least we tried */ }
+ }
#endregion
}
diff --git a/RGB.NET.Devices.Asus_Legacy/Generic/AsusRGBDevice.cs b/RGB.NET.Devices.Asus_Legacy/Generic/AsusRGBDevice.cs
index 083cafd..011383b 100644
--- a/RGB.NET.Devices.Asus_Legacy/Generic/AsusRGBDevice.cs
+++ b/RGB.NET.Devices.Asus_Legacy/Generic/AsusRGBDevice.cs
@@ -80,6 +80,9 @@ namespace RGB.NET.Devices.Asus
///
public override void Dispose()
{
+ try { UpdateQueue?.Dispose(); }
+ catch { /* at least we tried */ }
+
if ((DeviceInfo is AsusRGBDeviceInfo deviceInfo) && (deviceInfo.Handle != IntPtr.Zero))
Marshal.FreeHGlobal(deviceInfo.Handle);
diff --git a/RGB.NET.Devices.Asus_Legacy/GraphicsCard/AsusGraphicsCardRGBDevice.cs b/RGB.NET.Devices.Asus_Legacy/GraphicsCard/AsusGraphicsCardRGBDevice.cs
index be0c0b2..67a4988 100644
--- a/RGB.NET.Devices.Asus_Legacy/GraphicsCard/AsusGraphicsCardRGBDevice.cs
+++ b/RGB.NET.Devices.Asus_Legacy/GraphicsCard/AsusGraphicsCardRGBDevice.cs
@@ -4,11 +4,11 @@ using RGB.NET.Devices.Asus.Native;
namespace RGB.NET.Devices.Asus
{
- ///
+ ///
///
/// Represents a Asus graphicsCard.
///
- public class AsusGraphicsCardRGBDevice : AsusRGBDevice
+ public class AsusGraphicsCardRGBDevice : AsusRGBDevice, IGraphicsCard
{
#region Constructors
diff --git a/RGB.NET.Devices.Asus_Legacy/Keyboard/AsusKeyboardRGBDevice.cs b/RGB.NET.Devices.Asus_Legacy/Keyboard/AsusKeyboardRGBDevice.cs
index d92d4d7..8b72fb5 100644
--- a/RGB.NET.Devices.Asus_Legacy/Keyboard/AsusKeyboardRGBDevice.cs
+++ b/RGB.NET.Devices.Asus_Legacy/Keyboard/AsusKeyboardRGBDevice.cs
@@ -4,11 +4,11 @@ using RGB.NET.Devices.Asus.Native;
namespace RGB.NET.Devices.Asus
{
- ///
+ ///
///
/// Represents a Asus keyboard.
///
- public class AsusKeyboardRGBDevice : AsusRGBDevice
+ public class AsusKeyboardRGBDevice : AsusRGBDevice, IKeyboard
{
#region Constructors
diff --git a/RGB.NET.Devices.Asus_Legacy/Mainboard/AsusMainboardRGBDevice.cs b/RGB.NET.Devices.Asus_Legacy/Mainboard/AsusMainboardRGBDevice.cs
index 4ea1c60..52035f0 100644
--- a/RGB.NET.Devices.Asus_Legacy/Mainboard/AsusMainboardRGBDevice.cs
+++ b/RGB.NET.Devices.Asus_Legacy/Mainboard/AsusMainboardRGBDevice.cs
@@ -4,11 +4,11 @@ using RGB.NET.Devices.Asus.Native;
namespace RGB.NET.Devices.Asus
{
- ///
+ ///
///
/// Represents a Asus mainboard.
///
- public class AsusMainboardRGBDevice : AsusRGBDevice
+ public class AsusMainboardRGBDevice : AsusRGBDevice, IMainboard
{
#region Constructors
diff --git a/RGB.NET.Devices.Asus_Legacy/Mouse/AsusMouseRGBDevice.cs b/RGB.NET.Devices.Asus_Legacy/Mouse/AsusMouseRGBDevice.cs
index d318cae..e238b0c 100644
--- a/RGB.NET.Devices.Asus_Legacy/Mouse/AsusMouseRGBDevice.cs
+++ b/RGB.NET.Devices.Asus_Legacy/Mouse/AsusMouseRGBDevice.cs
@@ -4,11 +4,11 @@ using RGB.NET.Devices.Asus.Native;
namespace RGB.NET.Devices.Asus
{
- ///
+ ///
///
/// Represents a Asus mouse.
///
- public class AsusMouseRGBDevice : AsusRGBDevice
+ public class AsusMouseRGBDevice : AsusRGBDevice, IMouse
{
#region Constructors
diff --git a/RGB.NET.Devices.Asus_Legacy/Native/_AsusSDK.cs b/RGB.NET.Devices.Asus_Legacy/Native/_AsusSDK.cs
index 830dadd..437a3ea 100644
--- a/RGB.NET.Devices.Asus_Legacy/Native/_AsusSDK.cs
+++ b/RGB.NET.Devices.Asus_Legacy/Native/_AsusSDK.cs
@@ -75,7 +75,7 @@ namespace RGB.NET.Devices.Asus.Native
//_getDramColorPointer = (GetDramColorPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "GetDramColor"), typeof(GetDramColorPointer));
}
- private static void UnloadAsusSDK()
+ internal static void UnloadAsusSDK()
{
if (_dllHandle == IntPtr.Zero) return;
diff --git a/RGB.NET.Devices.Asus_Legacy/RGB.NET.Devices.Asus_Legacy.csproj b/RGB.NET.Devices.Asus_Legacy/RGB.NET.Devices.Asus_Legacy.csproj
index 3be7e47..dacc703 100644
--- a/RGB.NET.Devices.Asus_Legacy/RGB.NET.Devices.Asus_Legacy.csproj
+++ b/RGB.NET.Devices.Asus_Legacy/RGB.NET.Devices.Asus_Legacy.csproj
@@ -14,8 +14,8 @@
RGB.NET.Devices.Asus
Asus-Device-Implementations of RGB.NET based on the v2-SDK
Asus-Device-Implementations of RGB.NET, a C# (.NET) library for accessing various RGB-peripherals
- Copyright © Wyrez 2017
- Copyright © Wyrez 2017
+ Copyright © Darth Affe 2020
+ Copyright © Darth Affe 2020
http://lib.arge.be/icon.png
https://github.com/DarthAffe/RGB.NET
https://raw.githubusercontent.com/DarthAffe/RGB.NET/master/LICENSE
@@ -63,7 +63,7 @@
-
-
+
+
\ No newline at end of file
diff --git a/RGB.NET.Devices.CoolerMaster/CoolerMasterDeviceProvider.cs b/RGB.NET.Devices.CoolerMaster/CoolerMasterDeviceProvider.cs
index f091ed3..05546aa 100644
--- a/RGB.NET.Devices.CoolerMaster/CoolerMasterDeviceProvider.cs
+++ b/RGB.NET.Devices.CoolerMaster/CoolerMasterDeviceProvider.cs
@@ -108,7 +108,7 @@ namespace RGB.NET.Devices.CoolerMaster
{
RGBDeviceType deviceType = index.GetDeviceType();
if (deviceType == RGBDeviceType.None) continue;
-
+
if (_CoolerMasterSDK.IsDevicePlugged(index))
{
if (!loadFilter.HasFlag(deviceType)) continue;
@@ -132,7 +132,8 @@ namespace RGB.NET.Devices.CoolerMaster
continue;
}
- _CoolerMasterSDK.EnableLedControl(true, index);
+ if (!_CoolerMasterSDK.EnableLedControl(true, index))
+ throw new RGBDeviceException("Failed to enable LED control for device " + index);
device.Initialize(UpdateTrigger);
devices.Add(device);
@@ -175,6 +176,9 @@ namespace RGB.NET.Devices.CoolerMaster
///
public void Dispose()
{
+ try { UpdateTrigger?.Dispose(); }
+ catch { /* at least we tried */ }
+
if (IsInitialized)
foreach (IRGBDevice device in Devices)
{
@@ -185,6 +189,10 @@ namespace RGB.NET.Devices.CoolerMaster
}
catch {/* shit happens */}
}
+
+ // DarthAffe 03.03.2020: Should be done but isn't possible due to an weird winodws-hook inside the sdk which corrupts the stack when unloading the dll
+ //try { _CoolerMasterSDK.UnloadCMSDK(); }
+ //catch { /* at least we tried */ }
}
#endregion
diff --git a/RGB.NET.Devices.CoolerMaster/Enum/CoolerMasterDevicesIndexes.cs b/RGB.NET.Devices.CoolerMaster/Enum/CoolerMasterDevicesIndexes.cs
index cf84cbc..45d8ae2 100644
--- a/RGB.NET.Devices.CoolerMaster/Enum/CoolerMasterDevicesIndexes.cs
+++ b/RGB.NET.Devices.CoolerMaster/Enum/CoolerMasterDevicesIndexes.cs
@@ -69,6 +69,18 @@ namespace RGB.NET.Devices.CoolerMaster
[DeviceType(RGBDeviceType.Keyboard)]
CK551 = 13,
+ [Description("MM830")]
+ [DeviceType(RGBDeviceType.Mouse)]
+ MM830 = 14,
+
+ [Description("CK530")]
+ [DeviceType(RGBDeviceType.Keyboard)]
+ CK530 = 15,
+
+ [Description("MK850")]
+ [DeviceType(RGBDeviceType.Keyboard)]
+ MK850 = 16,
+
[DeviceType(RGBDeviceType.None)]
Default = 0xFFFF
}
diff --git a/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterRGBDevice.cs b/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterRGBDevice.cs
index c35676e..d33351f 100644
--- a/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterRGBDevice.cs
+++ b/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterRGBDevice.cs
@@ -74,6 +74,9 @@ namespace RGB.NET.Devices.CoolerMaster
///
public override void Dispose()
{
+ try { UpdateQueue?.Dispose(); }
+ catch { /* at least we tried */ }
+
_CoolerMasterSDK.EnableLedControl(false, DeviceInfo.DeviceIndex);
base.Dispose();
diff --git a/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterUpdateQueue.cs b/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterUpdateQueue.cs
index ecc4cd6..21b26ce 100644
--- a/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterUpdateQueue.cs
+++ b/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterUpdateQueue.cs
@@ -13,6 +13,7 @@ namespace RGB.NET.Devices.CoolerMaster
#region Properties & Fields
private CoolerMasterDevicesIndexes _deviceIndex;
+ private readonly _CoolerMasterColorMatrix _deviceMatrix;
#endregion
@@ -27,6 +28,9 @@ namespace RGB.NET.Devices.CoolerMaster
: base(updateTrigger)
{
this._deviceIndex = deviceIndex;
+
+ _deviceMatrix = new _CoolerMasterColorMatrix();
+ _deviceMatrix.KeyColor = new _CoolerMasterKeyColor[_CoolerMasterColorMatrix.ROWS, _CoolerMasterColorMatrix.COLUMNS];
}
#endregion
@@ -39,10 +43,10 @@ namespace RGB.NET.Devices.CoolerMaster
foreach (KeyValuePair data in dataSet)
{
(int row, int column) = ((int, int))data.Key;
- _CoolerMasterSDK.SetLedColor(row, column, data.Value.GetR(), data.Value.GetG(), data.Value.GetB(), _deviceIndex);
+ _deviceMatrix.KeyColor[row, column] = new _CoolerMasterKeyColor(data.Value.GetR(), data.Value.GetG(), data.Value.GetB());
}
- _CoolerMasterSDK.RefreshLed(false, _deviceIndex);
+ _CoolerMasterSDK.SetAllLedColor(_deviceMatrix, _deviceIndex);
}
#endregion
diff --git a/RGB.NET.Devices.CoolerMaster/Keyboard/CoolerMasterKeyboardRGBDevice.cs b/RGB.NET.Devices.CoolerMaster/Keyboard/CoolerMasterKeyboardRGBDevice.cs
index e8906e3..8a8c17a 100644
--- a/RGB.NET.Devices.CoolerMaster/Keyboard/CoolerMasterKeyboardRGBDevice.cs
+++ b/RGB.NET.Devices.CoolerMaster/Keyboard/CoolerMasterKeyboardRGBDevice.cs
@@ -3,11 +3,11 @@ using RGB.NET.Core;
namespace RGB.NET.Devices.CoolerMaster
{
- ///
+ ///
///
/// Represents a CoolerMaster keyboard.
///
- public class CoolerMasterKeyboardRGBDevice : CoolerMasterRGBDevice
+ public class CoolerMasterKeyboardRGBDevice : CoolerMasterRGBDevice, IKeyboard
{
#region Constructors
@@ -27,8 +27,11 @@ namespace RGB.NET.Devices.CoolerMaster
///
protected override void InitializeLayout()
{
- Dictionary mapping = CoolerMasterKeyboardLedMappings.Mapping[DeviceInfo.DeviceIndex][DeviceInfo.PhysicalLayout];
-
+ if (!CoolerMasterKeyboardLedMappings.Mapping.TryGetValue(DeviceInfo.DeviceIndex, out Dictionary> deviceMappings))
+ throw new RGBDeviceException($"Failed to find a CoolerMasterKeyboardLedMapping for device index {DeviceInfo.DeviceIndex}");
+ if (!deviceMappings.TryGetValue(DeviceInfo.PhysicalLayout, out Dictionary mapping))
+ throw new RGBDeviceException($"Failed to find a CoolerMasterKeyboardLedMapping for device index {DeviceInfo.DeviceIndex} with physical layout {DeviceInfo.PhysicalLayout}");
+
foreach (KeyValuePair led in mapping)
InitializeLed(led.Key, new Rectangle(led.Value.column * 19, led.Value.row * 19, 19, 19));
diff --git a/RGB.NET.Devices.CoolerMaster/Mouse/CoolerMasterMouseRGBDevice.cs b/RGB.NET.Devices.CoolerMaster/Mouse/CoolerMasterMouseRGBDevice.cs
index 4281706..a59b1ce 100644
--- a/RGB.NET.Devices.CoolerMaster/Mouse/CoolerMasterMouseRGBDevice.cs
+++ b/RGB.NET.Devices.CoolerMaster/Mouse/CoolerMasterMouseRGBDevice.cs
@@ -3,11 +3,11 @@ using RGB.NET.Core;
namespace RGB.NET.Devices.CoolerMaster
{
- ///
+ ///
///
/// Represents a CoolerMaster mouse.
///
- public class CoolerMasterMouseRGBDevice : CoolerMasterRGBDevice
+ public class CoolerMasterMouseRGBDevice : CoolerMasterRGBDevice, IMouse
{
#region Constructors
diff --git a/RGB.NET.Devices.CoolerMaster/Native/_CoolerMasterSDK.cs b/RGB.NET.Devices.CoolerMaster/Native/_CoolerMasterSDK.cs
index 00e89c8..ac23587 100644
--- a/RGB.NET.Devices.CoolerMaster/Native/_CoolerMasterSDK.cs
+++ b/RGB.NET.Devices.CoolerMaster/Native/_CoolerMasterSDK.cs
@@ -52,7 +52,7 @@ namespace RGB.NET.Devices.CoolerMaster.Native
_setAllLedColorPointer = (SetAllLedColorPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "SetAllLedColor"), typeof(SetAllLedColorPointer));
}
- private static void UnloadCMSDK()
+ internal static void UnloadCMSDK()
{
if (_dllHandle == IntPtr.Zero) return;
diff --git a/RGB.NET.Devices.CoolerMaster/RGB.NET.Devices.CoolerMaster.csproj b/RGB.NET.Devices.CoolerMaster/RGB.NET.Devices.CoolerMaster.csproj
index a471d52..aa5d87f 100644
--- a/RGB.NET.Devices.CoolerMaster/RGB.NET.Devices.CoolerMaster.csproj
+++ b/RGB.NET.Devices.CoolerMaster/RGB.NET.Devices.CoolerMaster.csproj
@@ -14,8 +14,8 @@
RGB.NET.Devices.CoolerMaster
Cooler Master-Device-Implementations of RGB.NET
Cooler Master-Device-Implementations of RGB.NET, a C# (.NET) library for accessing various RGB-peripherals
- Copyright © Wyrez 2017
- Copyright © Wyrez 2017
+ Copyright © Darth Affe 2020
+ Copyright © Darth Affe 2020
http://lib.arge.be/icon.png
https://github.com/DarthAffe/RGB.NET
https://raw.githubusercontent.com/DarthAffe/RGB.NET/master/LICENSE
@@ -63,6 +63,6 @@
-
+
\ No newline at end of file
diff --git a/RGB.NET.Devices.Corsair/CorsairDeviceProvider.cs b/RGB.NET.Devices.Corsair/CorsairDeviceProvider.cs
index d048397..74ac4ec 100644
--- a/RGB.NET.Devices.Corsair/CorsairDeviceProvider.cs
+++ b/RGB.NET.Devices.Corsair/CorsairDeviceProvider.cs
@@ -227,7 +227,7 @@ namespace RGB.NET.Devices.Corsair
{
_CorsairChannelDeviceInfo channelDeviceInfo = (_CorsairChannelDeviceInfo)Marshal.PtrToStructure(channelDeviceInfoPtr, typeof(_CorsairChannelDeviceInfo));
- yield return new CorsairCustomRGBDevice(new CorsairCustomRGBDeviceInfo(info.CorsairDeviceIndex, nativeDeviceInfo, channelDeviceInfo, referenceLed, modelCounter));
+ yield return new CorsairCustomRGBDevice(new CorsairCustomRGBDeviceInfo(info, nativeDeviceInfo, channelDeviceInfo, referenceLed, modelCounter));
referenceLed += channelDeviceInfo.deviceLedCount;
channelDeviceInfoPtr = new IntPtr(channelDeviceInfoPtr.ToInt64() + channelDeviceInfoStructSize);
@@ -292,7 +292,13 @@ namespace RGB.NET.Devices.Corsair
///
public void Dispose()
- { }
+ {
+ try { UpdateTrigger?.Dispose(); }
+ catch { /* at least we tried */ }
+
+ try { _CUESDK.UnloadCUESDK(); }
+ catch { /* at least we tried */ }
+ }
#endregion
}
diff --git a/RGB.NET.Devices.Corsair/Custom/CorsairCustomRGBDevice.cs b/RGB.NET.Devices.Corsair/Custom/CorsairCustomRGBDevice.cs
index 711d97c..5854623 100644
--- a/RGB.NET.Devices.Corsair/Custom/CorsairCustomRGBDevice.cs
+++ b/RGB.NET.Devices.Corsair/Custom/CorsairCustomRGBDevice.cs
@@ -6,11 +6,11 @@ using RGB.NET.Core;
namespace RGB.NET.Devices.Corsair
{
- ///
+ ///
///
/// Represents a corsair custom.
///
- public class CorsairCustomRGBDevice : CorsairRGBDevice
+ public class CorsairCustomRGBDevice : CorsairRGBDevice, IUnknownDevice
{
#region Properties & Fields
diff --git a/RGB.NET.Devices.Corsair/Custom/CorsairCustomRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Custom/CorsairCustomRGBDeviceInfo.cs
index 4fa6b07..72485be 100644
--- a/RGB.NET.Devices.Corsair/Custom/CorsairCustomRGBDeviceInfo.cs
+++ b/RGB.NET.Devices.Corsair/Custom/CorsairCustomRGBDeviceInfo.cs
@@ -28,15 +28,16 @@ namespace RGB.NET.Devices.Corsair
///
/// Internal constructor of managed .
///
- /// The index of the .
+ /// The info describing the the .
/// The native -struct
/// The native representing this device.
/// The id of the first led of this device.
/// A dictionary containing counters to create unique names for equal devices models.
- internal CorsairCustomRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo, _CorsairChannelDeviceInfo channelDeviceInfo,
+ internal CorsairCustomRGBDeviceInfo(CorsairRGBDeviceInfo info, _CorsairDeviceInfo nativeInfo,
+ _CorsairChannelDeviceInfo channelDeviceInfo,
CorsairLedId referenceCorsairLed, Dictionary modelCounter)
- : base(deviceIndex, GetDeviceType(channelDeviceInfo.type), nativeInfo,
- GetModelName(channelDeviceInfo.type), modelCounter)
+ : base(info.CorsairDeviceIndex, GetDeviceType(channelDeviceInfo.type), nativeInfo,
+ GetModelName(info, channelDeviceInfo), modelCounter)
{
this.ReferenceCorsairLed = referenceCorsairLed;
@@ -59,6 +60,7 @@ namespace RGB.NET.Devices.Corsair
case CorsairChannelDeviceType.FanLL:
case CorsairChannelDeviceType.FanML:
case CorsairChannelDeviceType.DAP:
+ case CorsairChannelDeviceType.FanQL:
return RGBDeviceType.Fan;
case CorsairChannelDeviceType.Strip:
@@ -72,9 +74,9 @@ namespace RGB.NET.Devices.Corsair
}
}
- private static string GetModelName(CorsairChannelDeviceType deviceType)
+ private static string GetModelName(IRGBDeviceInfo info, _CorsairChannelDeviceInfo channelDeviceInfo)
{
- switch (deviceType)
+ switch (channelDeviceInfo.type)
{
case CorsairChannelDeviceType.Invalid:
return "Invalid";
@@ -92,7 +94,19 @@ namespace RGB.NET.Devices.Corsair
return "ML Fan";
case CorsairChannelDeviceType.Strip:
- return "Led Strip";
+ // LS100 Led Strips are reported as one big strip if configured in monitor mode in iCUE, 138 LEDs for dual monitor, 84 for single
+ if ((info.Model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 138))
+ return "LS100 LED Strip (dual monitor)";
+ else if ((info.Model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 84))
+ return "LS100 LED Strip (single monitor)";
+ // Any other value means an "External LED Strip" in iCUE, these are reported per-strip, 15 for short strips, 27 for long
+ else if ((info.Model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 15))
+ return "LS100 LED Strip (short)";
+ else if ((info.Model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 27))
+ return "LS100 LED Strip (long)";
+ // Device model is "Commander Pro" for regular LED strips
+ else
+ return "LED Strip";
case CorsairChannelDeviceType.DAP:
return "DAP Fan";
@@ -100,8 +114,11 @@ namespace RGB.NET.Devices.Corsair
case CorsairChannelDeviceType.Pump:
return "Pump";
+ case CorsairChannelDeviceType.FanQL:
+ return "QL Fan";
+
default:
- throw new ArgumentOutOfRangeException(nameof(deviceType), deviceType, null);
+ throw new ArgumentOutOfRangeException(nameof(channelDeviceInfo.type), channelDeviceInfo.type, null);
}
}
diff --git a/RGB.NET.Devices.Corsair/Enum/CorsairChannelDeviceType.cs b/RGB.NET.Devices.Corsair/Enum/CorsairChannelDeviceType.cs
index b20a2d1..f57e5b2 100644
--- a/RGB.NET.Devices.Corsair/Enum/CorsairChannelDeviceType.cs
+++ b/RGB.NET.Devices.Corsair/Enum/CorsairChannelDeviceType.cs
@@ -18,6 +18,7 @@ namespace RGB.NET.Devices.Corsair
FanML = 4,
Strip = 5,
DAP = 6,
- Pump = 7
+ Pump = 7,
+ FanQL = 8
};
}
diff --git a/RGB.NET.Devices.Corsair/Enum/CorsairDeviceType.cs b/RGB.NET.Devices.Corsair/Enum/CorsairDeviceType.cs
index 966dbfb..52bb851 100644
--- a/RGB.NET.Devices.Corsair/Enum/CorsairDeviceType.cs
+++ b/RGB.NET.Devices.Corsair/Enum/CorsairDeviceType.cs
@@ -20,6 +20,8 @@ namespace RGB.NET.Devices.Corsair
CommanderPro = 6,
LightningNodePro = 7,
MemoryModule = 8,
- Cooler = 9
+ Cooler = 9,
+ Mainboard = 10,
+ GraphicsCard = 11
};
}
diff --git a/RGB.NET.Devices.Corsair/Enum/CorsairLedId.cs b/RGB.NET.Devices.Corsair/Enum/CorsairLedId.cs
index 95e702e..acbca2f 100644
--- a/RGB.NET.Devices.Corsair/Enum/CorsairLedId.cs
+++ b/RGB.NET.Devices.Corsair/Enum/CorsairLedId.cs
@@ -933,5 +933,644 @@ namespace RGB.NET.Devices.Corsair
CustomLiquidCoolerChannel1Led148 = 909,
CustomLiquidCoolerChannel1Led149 = 910,
CustomLiquidCoolerChannel1Led150 = 911,
+
+ CustomDeviceChannel1Led151 = 912,
+ CustomDeviceChannel1Led152 = 913,
+ CustomDeviceChannel1Led153 = 914,
+ CustomDeviceChannel1Led154 = 915,
+ CustomDeviceChannel1Led155 = 916,
+ CustomDeviceChannel1Led156 = 917,
+ CustomDeviceChannel1Led157 = 918,
+ CustomDeviceChannel1Led158 = 919,
+ CustomDeviceChannel1Led159 = 920,
+ CustomDeviceChannel1Led160 = 921,
+ CustomDeviceChannel1Led161 = 922,
+ CustomDeviceChannel1Led162 = 923,
+ CustomDeviceChannel1Led163 = 924,
+ CustomDeviceChannel1Led164 = 925,
+ CustomDeviceChannel1Led165 = 926,
+ CustomDeviceChannel1Led166 = 927,
+ CustomDeviceChannel1Led167 = 928,
+ CustomDeviceChannel1Led168 = 929,
+ CustomDeviceChannel1Led169 = 930,
+ CustomDeviceChannel1Led170 = 931,
+ CustomDeviceChannel1Led171 = 932,
+ CustomDeviceChannel1Led172 = 933,
+ CustomDeviceChannel1Led173 = 934,
+ CustomDeviceChannel1Led174 = 935,
+ CustomDeviceChannel1Led175 = 936,
+ CustomDeviceChannel1Led176 = 937,
+ CustomDeviceChannel1Led177 = 938,
+ CustomDeviceChannel1Led178 = 939,
+ CustomDeviceChannel1Led179 = 940,
+ CustomDeviceChannel1Led180 = 941,
+ CustomDeviceChannel1Led181 = 942,
+ CustomDeviceChannel1Led182 = 943,
+ CustomDeviceChannel1Led183 = 944,
+ CustomDeviceChannel1Led184 = 945,
+ CustomDeviceChannel1Led185 = 946,
+ CustomDeviceChannel1Led186 = 947,
+ CustomDeviceChannel1Led187 = 948,
+ CustomDeviceChannel1Led188 = 949,
+ CustomDeviceChannel1Led189 = 950,
+ CustomDeviceChannel1Led190 = 951,
+ CustomDeviceChannel1Led191 = 952,
+ CustomDeviceChannel1Led192 = 953,
+ CustomDeviceChannel1Led193 = 954,
+ CustomDeviceChannel1Led194 = 955,
+ CustomDeviceChannel1Led195 = 956,
+ CustomDeviceChannel1Led196 = 957,
+ CustomDeviceChannel1Led197 = 958,
+ CustomDeviceChannel1Led198 = 959,
+ CustomDeviceChannel1Led199 = 960,
+ CustomDeviceChannel1Led200 = 961,
+ CustomDeviceChannel1Led201 = 962,
+ CustomDeviceChannel1Led202 = 963,
+ CustomDeviceChannel1Led203 = 964,
+ CustomDeviceChannel1Led204 = 965,
+ CustomDeviceChannel1Led205 = 966,
+ CustomDeviceChannel1Led206 = 967,
+ CustomDeviceChannel1Led207 = 968,
+ CustomDeviceChannel1Led208 = 969,
+ CustomDeviceChannel1Led209 = 970,
+ CustomDeviceChannel1Led210 = 971,
+ CustomDeviceChannel1Led211 = 972,
+ CustomDeviceChannel1Led212 = 973,
+ CustomDeviceChannel1Led213 = 974,
+ CustomDeviceChannel1Led214 = 975,
+ CustomDeviceChannel1Led215 = 976,
+ CustomDeviceChannel1Led216 = 977,
+ CustomDeviceChannel1Led217 = 978,
+ CustomDeviceChannel1Led218 = 979,
+ CustomDeviceChannel1Led219 = 980,
+ CustomDeviceChannel1Led220 = 981,
+ CustomDeviceChannel1Led221 = 982,
+ CustomDeviceChannel1Led222 = 983,
+ CustomDeviceChannel1Led223 = 984,
+ CustomDeviceChannel1Led224 = 985,
+ CustomDeviceChannel1Led225 = 986,
+ CustomDeviceChannel1Led226 = 987,
+ CustomDeviceChannel1Led227 = 988,
+ CustomDeviceChannel1Led228 = 989,
+ CustomDeviceChannel1Led229 = 990,
+ CustomDeviceChannel1Led230 = 991,
+ CustomDeviceChannel1Led231 = 992,
+ CustomDeviceChannel1Led232 = 993,
+ CustomDeviceChannel1Led233 = 994,
+ CustomDeviceChannel1Led234 = 995,
+ CustomDeviceChannel1Led235 = 996,
+ CustomDeviceChannel1Led236 = 997,
+ CustomDeviceChannel1Led237 = 998,
+ CustomDeviceChannel1Led238 = 999,
+ CustomDeviceChannel1Led239 = 1000,
+ CustomDeviceChannel1Led240 = 1001,
+ CustomDeviceChannel1Led241 = 1002,
+ CustomDeviceChannel1Led242 = 1003,
+ CustomDeviceChannel1Led243 = 1004,
+ CustomDeviceChannel1Led244 = 1005,
+ CustomDeviceChannel1Led245 = 1006,
+ CustomDeviceChannel1Led246 = 1007,
+ CustomDeviceChannel1Led247 = 1008,
+ CustomDeviceChannel1Led248 = 1009,
+ CustomDeviceChannel1Led249 = 1010,
+ CustomDeviceChannel1Led250 = 1011,
+ CustomDeviceChannel1Led251 = 1012,
+ CustomDeviceChannel1Led252 = 1013,
+ CustomDeviceChannel1Led253 = 1014,
+ CustomDeviceChannel1Led254 = 1015,
+ CustomDeviceChannel1Led255 = 1016,
+ CustomDeviceChannel1Led256 = 1017,
+ CustomDeviceChannel1Led257 = 1018,
+ CustomDeviceChannel1Led258 = 1019,
+ CustomDeviceChannel1Led259 = 1020,
+ CustomDeviceChannel1Led260 = 1021,
+ CustomDeviceChannel1Led261 = 1022,
+ CustomDeviceChannel1Led262 = 1023,
+ CustomDeviceChannel1Led263 = 1024,
+ CustomDeviceChannel1Led264 = 1025,
+ CustomDeviceChannel1Led265 = 1026,
+ CustomDeviceChannel1Led266 = 1027,
+ CustomDeviceChannel1Led267 = 1028,
+ CustomDeviceChannel1Led268 = 1029,
+ CustomDeviceChannel1Led269 = 1030,
+ CustomDeviceChannel1Led270 = 1031,
+ CustomDeviceChannel1Led271 = 1032,
+ CustomDeviceChannel1Led272 = 1033,
+ CustomDeviceChannel1Led273 = 1034,
+ CustomDeviceChannel1Led274 = 1035,
+ CustomDeviceChannel1Led275 = 1036,
+ CustomDeviceChannel1Led276 = 1037,
+ CustomDeviceChannel1Led277 = 1038,
+ CustomDeviceChannel1Led278 = 1039,
+ CustomDeviceChannel1Led279 = 1040,
+ CustomDeviceChannel1Led280 = 1041,
+ CustomDeviceChannel1Led281 = 1042,
+ CustomDeviceChannel1Led282 = 1043,
+ CustomDeviceChannel1Led283 = 1044,
+ CustomDeviceChannel1Led284 = 1045,
+ CustomDeviceChannel1Led285 = 1046,
+ CustomDeviceChannel1Led286 = 1047,
+ CustomDeviceChannel1Led287 = 1048,
+ CustomDeviceChannel1Led288 = 1049,
+ CustomDeviceChannel1Led289 = 1050,
+ CustomDeviceChannel1Led290 = 1051,
+ CustomDeviceChannel1Led291 = 1052,
+ CustomDeviceChannel1Led292 = 1053,
+ CustomDeviceChannel1Led293 = 1054,
+ CustomDeviceChannel1Led294 = 1055,
+ CustomDeviceChannel1Led295 = 1056,
+ CustomDeviceChannel1Led296 = 1057,
+ CustomDeviceChannel1Led297 = 1058,
+ CustomDeviceChannel1Led298 = 1059,
+ CustomDeviceChannel1Led299 = 1060,
+ CustomDeviceChannel1Led300 = 1061,
+
+ CustomDeviceChannel2Led151 = 1062,
+ CustomDeviceChannel2Led152 = 1063,
+ CustomDeviceChannel2Led153 = 1064,
+ CustomDeviceChannel2Led154 = 1065,
+ CustomDeviceChannel2Led155 = 1066,
+ CustomDeviceChannel2Led156 = 1067,
+ CustomDeviceChannel2Led157 = 1068,
+ CustomDeviceChannel2Led158 = 1069,
+ CustomDeviceChannel2Led159 = 1070,
+ CustomDeviceChannel2Led160 = 1071,
+ CustomDeviceChannel2Led161 = 1072,
+ CustomDeviceChannel2Led162 = 1073,
+ CustomDeviceChannel2Led163 = 1074,
+ CustomDeviceChannel2Led164 = 1075,
+ CustomDeviceChannel2Led165 = 1076,
+ CustomDeviceChannel2Led166 = 1077,
+ CustomDeviceChannel2Led167 = 1078,
+ CustomDeviceChannel2Led168 = 1079,
+ CustomDeviceChannel2Led169 = 1080,
+ CustomDeviceChannel2Led170 = 1081,
+ CustomDeviceChannel2Led171 = 1082,
+ CustomDeviceChannel2Led172 = 1083,
+ CustomDeviceChannel2Led173 = 1084,
+ CustomDeviceChannel2Led174 = 1085,
+ CustomDeviceChannel2Led175 = 1086,
+ CustomDeviceChannel2Led176 = 1087,
+ CustomDeviceChannel2Led177 = 1088,
+ CustomDeviceChannel2Led178 = 1089,
+ CustomDeviceChannel2Led179 = 1090,
+ CustomDeviceChannel2Led180 = 1091,
+ CustomDeviceChannel2Led181 = 1092,
+ CustomDeviceChannel2Led182 = 1093,
+ CustomDeviceChannel2Led183 = 1094,
+ CustomDeviceChannel2Led184 = 1095,
+ CustomDeviceChannel2Led185 = 1096,
+ CustomDeviceChannel2Led186 = 1097,
+ CustomDeviceChannel2Led187 = 1098,
+ CustomDeviceChannel2Led188 = 1099,
+ CustomDeviceChannel2Led189 = 1100,
+ CustomDeviceChannel2Led190 = 1101,
+ CustomDeviceChannel2Led191 = 1102,
+ CustomDeviceChannel2Led192 = 1103,
+ CustomDeviceChannel2Led193 = 1104,
+ CustomDeviceChannel2Led194 = 1105,
+ CustomDeviceChannel2Led195 = 1106,
+ CustomDeviceChannel2Led196 = 1107,
+ CustomDeviceChannel2Led197 = 1108,
+ CustomDeviceChannel2Led198 = 1109,
+ CustomDeviceChannel2Led199 = 1110,
+ CustomDeviceChannel2Led200 = 1111,
+ CustomDeviceChannel2Led201 = 1112,
+ CustomDeviceChannel2Led202 = 1113,
+ CustomDeviceChannel2Led203 = 1114,
+ CustomDeviceChannel2Led204 = 1115,
+ CustomDeviceChannel2Led205 = 1116,
+ CustomDeviceChannel2Led206 = 1117,
+ CustomDeviceChannel2Led207 = 1118,
+ CustomDeviceChannel2Led208 = 1119,
+ CustomDeviceChannel2Led209 = 1120,
+ CustomDeviceChannel2Led210 = 1121,
+ CustomDeviceChannel2Led211 = 1122,
+ CustomDeviceChannel2Led212 = 1123,
+ CustomDeviceChannel2Led213 = 1124,
+ CustomDeviceChannel2Led214 = 1125,
+ CustomDeviceChannel2Led215 = 1126,
+ CustomDeviceChannel2Led216 = 1127,
+ CustomDeviceChannel2Led217 = 1128,
+ CustomDeviceChannel2Led218 = 1129,
+ CustomDeviceChannel2Led219 = 1130,
+ CustomDeviceChannel2Led220 = 1131,
+ CustomDeviceChannel2Led221 = 1132,
+ CustomDeviceChannel2Led222 = 1133,
+ CustomDeviceChannel2Led223 = 1134,
+ CustomDeviceChannel2Led224 = 1135,
+ CustomDeviceChannel2Led225 = 1136,
+ CustomDeviceChannel2Led226 = 1137,
+ CustomDeviceChannel2Led227 = 1138,
+ CustomDeviceChannel2Led228 = 1139,
+ CustomDeviceChannel2Led229 = 1140,
+ CustomDeviceChannel2Led230 = 1141,
+ CustomDeviceChannel2Led231 = 1142,
+ CustomDeviceChannel2Led232 = 1143,
+ CustomDeviceChannel2Led233 = 1144,
+ CustomDeviceChannel2Led234 = 1145,
+ CustomDeviceChannel2Led235 = 1146,
+ CustomDeviceChannel2Led236 = 1147,
+ CustomDeviceChannel2Led237 = 1148,
+ CustomDeviceChannel2Led238 = 1149,
+ CustomDeviceChannel2Led239 = 1150,
+ CustomDeviceChannel2Led240 = 1151,
+ CustomDeviceChannel2Led241 = 1152,
+ CustomDeviceChannel2Led242 = 1153,
+ CustomDeviceChannel2Led243 = 1154,
+ CustomDeviceChannel2Led244 = 1155,
+ CustomDeviceChannel2Led245 = 1156,
+ CustomDeviceChannel2Led246 = 1157,
+ CustomDeviceChannel2Led247 = 1158,
+ CustomDeviceChannel2Led248 = 1159,
+ CustomDeviceChannel2Led249 = 1160,
+ CustomDeviceChannel2Led250 = 1161,
+ CustomDeviceChannel2Led251 = 1162,
+ CustomDeviceChannel2Led252 = 1163,
+ CustomDeviceChannel2Led253 = 1164,
+ CustomDeviceChannel2Led254 = 1165,
+ CustomDeviceChannel2Led255 = 1166,
+ CustomDeviceChannel2Led256 = 1167,
+ CustomDeviceChannel2Led257 = 1168,
+ CustomDeviceChannel2Led258 = 1169,
+ CustomDeviceChannel2Led259 = 1170,
+ CustomDeviceChannel2Led260 = 1171,
+ CustomDeviceChannel2Led261 = 1172,
+ CustomDeviceChannel2Led262 = 1173,
+ CustomDeviceChannel2Led263 = 1174,
+ CustomDeviceChannel2Led264 = 1175,
+ CustomDeviceChannel2Led265 = 1176,
+ CustomDeviceChannel2Led266 = 1177,
+ CustomDeviceChannel2Led267 = 1178,
+ CustomDeviceChannel2Led268 = 1179,
+ CustomDeviceChannel2Led269 = 1180,
+ CustomDeviceChannel2Led270 = 1181,
+ CustomDeviceChannel2Led271 = 1182,
+ CustomDeviceChannel2Led272 = 1183,
+ CustomDeviceChannel2Led273 = 1184,
+ CustomDeviceChannel2Led274 = 1185,
+ CustomDeviceChannel2Led275 = 1186,
+ CustomDeviceChannel2Led276 = 1187,
+ CustomDeviceChannel2Led277 = 1188,
+ CustomDeviceChannel2Led278 = 1189,
+ CustomDeviceChannel2Led279 = 1190,
+ CustomDeviceChannel2Led280 = 1191,
+ CustomDeviceChannel2Led281 = 1192,
+ CustomDeviceChannel2Led282 = 1193,
+ CustomDeviceChannel2Led283 = 1194,
+ CustomDeviceChannel2Led284 = 1195,
+ CustomDeviceChannel2Led285 = 1196,
+ CustomDeviceChannel2Led286 = 1197,
+ CustomDeviceChannel2Led287 = 1198,
+ CustomDeviceChannel2Led288 = 1199,
+ CustomDeviceChannel2Led289 = 1200,
+ CustomDeviceChannel2Led290 = 1201,
+ CustomDeviceChannel2Led291 = 1202,
+ CustomDeviceChannel2Led292 = 1203,
+ CustomDeviceChannel2Led293 = 1204,
+ CustomDeviceChannel2Led294 = 1205,
+ CustomDeviceChannel2Led295 = 1206,
+ CustomDeviceChannel2Led296 = 1207,
+ CustomDeviceChannel2Led297 = 1208,
+ CustomDeviceChannel2Led298 = 1209,
+ CustomDeviceChannel2Led299 = 1210,
+ CustomDeviceChannel2Led300 = 1211,
+
+ CustomDeviceChannel3Led151 = 1212,
+ CustomDeviceChannel3Led152 = 1213,
+ CustomDeviceChannel3Led153 = 1214,
+ CustomDeviceChannel3Led154 = 1215,
+ CustomDeviceChannel3Led155 = 1216,
+ CustomDeviceChannel3Led156 = 1217,
+ CustomDeviceChannel3Led157 = 1218,
+ CustomDeviceChannel3Led158 = 1219,
+ CustomDeviceChannel3Led159 = 1220,
+ CustomDeviceChannel3Led160 = 1221,
+ CustomDeviceChannel3Led161 = 1222,
+ CustomDeviceChannel3Led162 = 1223,
+ CustomDeviceChannel3Led163 = 1224,
+ CustomDeviceChannel3Led164 = 1225,
+ CustomDeviceChannel3Led165 = 1226,
+ CustomDeviceChannel3Led166 = 1227,
+ CustomDeviceChannel3Led167 = 1228,
+ CustomDeviceChannel3Led168 = 1229,
+ CustomDeviceChannel3Led169 = 1230,
+ CustomDeviceChannel3Led170 = 1231,
+ CustomDeviceChannel3Led171 = 1232,
+ CustomDeviceChannel3Led172 = 1233,
+ CustomDeviceChannel3Led173 = 1234,
+ CustomDeviceChannel3Led174 = 1235,
+ CustomDeviceChannel3Led175 = 1236,
+ CustomDeviceChannel3Led176 = 1237,
+ CustomDeviceChannel3Led177 = 1238,
+ CustomDeviceChannel3Led178 = 1239,
+ CustomDeviceChannel3Led179 = 1240,
+ CustomDeviceChannel3Led180 = 1241,
+ CustomDeviceChannel3Led181 = 1242,
+ CustomDeviceChannel3Led182 = 1243,
+ CustomDeviceChannel3Led183 = 1244,
+ CustomDeviceChannel3Led184 = 1245,
+ CustomDeviceChannel3Led185 = 1246,
+ CustomDeviceChannel3Led186 = 1247,
+ CustomDeviceChannel3Led187 = 1248,
+ CustomDeviceChannel3Led188 = 1249,
+ CustomDeviceChannel3Led189 = 1250,
+ CustomDeviceChannel3Led190 = 1251,
+ CustomDeviceChannel3Led191 = 1252,
+ CustomDeviceChannel3Led192 = 1253,
+ CustomDeviceChannel3Led193 = 1254,
+ CustomDeviceChannel3Led194 = 1255,
+ CustomDeviceChannel3Led195 = 1256,
+ CustomDeviceChannel3Led196 = 1257,
+ CustomDeviceChannel3Led197 = 1258,
+ CustomDeviceChannel3Led198 = 1259,
+ CustomDeviceChannel3Led199 = 1260,
+ CustomDeviceChannel3Led200 = 1261,
+ CustomDeviceChannel3Led201 = 1262,
+ CustomDeviceChannel3Led202 = 1263,
+ CustomDeviceChannel3Led203 = 1264,
+ CustomDeviceChannel3Led204 = 1265,
+ CustomDeviceChannel3Led205 = 1266,
+ CustomDeviceChannel3Led206 = 1267,
+ CustomDeviceChannel3Led207 = 1268,
+ CustomDeviceChannel3Led208 = 1269,
+ CustomDeviceChannel3Led209 = 1270,
+ CustomDeviceChannel3Led210 = 1271,
+ CustomDeviceChannel3Led211 = 1272,
+ CustomDeviceChannel3Led212 = 1273,
+ CustomDeviceChannel3Led213 = 1274,
+ CustomDeviceChannel3Led214 = 1275,
+ CustomDeviceChannel3Led215 = 1276,
+ CustomDeviceChannel3Led216 = 1277,
+ CustomDeviceChannel3Led217 = 1278,
+ CustomDeviceChannel3Led218 = 1279,
+ CustomDeviceChannel3Led219 = 1280,
+ CustomDeviceChannel3Led220 = 1281,
+ CustomDeviceChannel3Led221 = 1282,
+ CustomDeviceChannel3Led222 = 1283,
+ CustomDeviceChannel3Led223 = 1284,
+ CustomDeviceChannel3Led224 = 1285,
+ CustomDeviceChannel3Led225 = 1286,
+ CustomDeviceChannel3Led226 = 1287,
+ CustomDeviceChannel3Led227 = 1288,
+ CustomDeviceChannel3Led228 = 1289,
+ CustomDeviceChannel3Led229 = 1290,
+ CustomDeviceChannel3Led230 = 1291,
+ CustomDeviceChannel3Led231 = 1292,
+ CustomDeviceChannel3Led232 = 1293,
+ CustomDeviceChannel3Led233 = 1294,
+ CustomDeviceChannel3Led234 = 1295,
+ CustomDeviceChannel3Led235 = 1296,
+ CustomDeviceChannel3Led236 = 1297,
+ CustomDeviceChannel3Led237 = 1298,
+ CustomDeviceChannel3Led238 = 1299,
+ CustomDeviceChannel3Led239 = 1300,
+ CustomDeviceChannel3Led240 = 1301,
+ CustomDeviceChannel3Led241 = 1302,
+ CustomDeviceChannel3Led242 = 1303,
+ CustomDeviceChannel3Led243 = 1304,
+ CustomDeviceChannel3Led244 = 1305,
+ CustomDeviceChannel3Led245 = 1306,
+ CustomDeviceChannel3Led246 = 1307,
+ CustomDeviceChannel3Led247 = 1308,
+ CustomDeviceChannel3Led248 = 1309,
+ CustomDeviceChannel3Led249 = 1310,
+ CustomDeviceChannel3Led250 = 1311,
+ CustomDeviceChannel3Led251 = 1312,
+ CustomDeviceChannel3Led252 = 1313,
+ CustomDeviceChannel3Led253 = 1314,
+ CustomDeviceChannel3Led254 = 1315,
+ CustomDeviceChannel3Led255 = 1316,
+ CustomDeviceChannel3Led256 = 1317,
+ CustomDeviceChannel3Led257 = 1318,
+ CustomDeviceChannel3Led258 = 1319,
+ CustomDeviceChannel3Led259 = 1320,
+ CustomDeviceChannel3Led260 = 1321,
+ CustomDeviceChannel3Led261 = 1322,
+ CustomDeviceChannel3Led262 = 1323,
+ CustomDeviceChannel3Led263 = 1324,
+ CustomDeviceChannel3Led264 = 1325,
+ CustomDeviceChannel3Led265 = 1326,
+ CustomDeviceChannel3Led266 = 1327,
+ CustomDeviceChannel3Led267 = 1328,
+ CustomDeviceChannel3Led268 = 1329,
+ CustomDeviceChannel3Led269 = 1330,
+ CustomDeviceChannel3Led270 = 1331,
+ CustomDeviceChannel3Led271 = 1332,
+ CustomDeviceChannel3Led272 = 1333,
+ CustomDeviceChannel3Led273 = 1334,
+ CustomDeviceChannel3Led274 = 1335,
+ CustomDeviceChannel3Led275 = 1336,
+ CustomDeviceChannel3Led276 = 1337,
+ CustomDeviceChannel3Led277 = 1338,
+ CustomDeviceChannel3Led278 = 1339,
+ CustomDeviceChannel3Led279 = 1340,
+ CustomDeviceChannel3Led280 = 1341,
+ CustomDeviceChannel3Led281 = 1342,
+ CustomDeviceChannel3Led282 = 1343,
+ CustomDeviceChannel3Led283 = 1344,
+ CustomDeviceChannel3Led284 = 1345,
+ CustomDeviceChannel3Led285 = 1346,
+ CustomDeviceChannel3Led286 = 1347,
+ CustomDeviceChannel3Led287 = 1348,
+ CustomDeviceChannel3Led288 = 1349,
+ CustomDeviceChannel3Led289 = 1350,
+ CustomDeviceChannel3Led290 = 1351,
+ CustomDeviceChannel3Led291 = 1352,
+ CustomDeviceChannel3Led292 = 1353,
+ CustomDeviceChannel3Led293 = 1354,
+ CustomDeviceChannel3Led294 = 1355,
+ CustomDeviceChannel3Led295 = 1356,
+ CustomDeviceChannel3Led296 = 1357,
+ CustomDeviceChannel3Led297 = 1358,
+ CustomDeviceChannel3Led298 = 1359,
+ CustomDeviceChannel3Led299 = 1360,
+ CustomDeviceChannel3Led300 = 1361,
+
+ Mainboard1 = 1362,
+ Mainboard2 = 1363,
+ Mainboard3 = 1364,
+ Mainboard4 = 1365,
+ Mainboard5 = 1366,
+ Mainboard6 = 1367,
+ Mainboard7 = 1368,
+ Mainboard8 = 1369,
+ Mainboard9 = 1370,
+ Mainboard10 = 1371,
+ Mainboard11 = 1372,
+ Mainboard12 = 1373,
+ Mainboard13 = 1374,
+ Mainboard14 = 1375,
+ Mainboard15 = 1376,
+ Mainboard16 = 1377,
+ Mainboard17 = 1378,
+ Mainboard18 = 1379,
+ Mainboard19 = 1380,
+ Mainboard20 = 1381,
+ Mainboard21 = 1382,
+ Mainboard22 = 1383,
+ Mainboard23 = 1384,
+ Mainboard24 = 1385,
+ Mainboard25 = 1386,
+ Mainboard26 = 1387,
+ Mainboard27 = 1388,
+ Mainboard28 = 1389,
+ Mainboard29 = 1390,
+ Mainboard30 = 1391,
+ Mainboard31 = 1392,
+ Mainboard32 = 1393,
+ Mainboard33 = 1394,
+ Mainboard34 = 1395,
+ Mainboard35 = 1396,
+ Mainboard36 = 1397,
+ Mainboard37 = 1398,
+ Mainboard38 = 1399,
+ Mainboard39 = 1400,
+ Mainboard40 = 1401,
+ Mainboard41 = 1402,
+ Mainboard42 = 1403,
+ Mainboard43 = 1404,
+ Mainboard44 = 1405,
+ Mainboard45 = 1406,
+ Mainboard46 = 1407,
+ Mainboard47 = 1408,
+ Mainboard48 = 1409,
+ Mainboard49 = 1410,
+ Mainboard50 = 1411,
+ Mainboard51 = 1412,
+ Mainboard52 = 1413,
+ Mainboard53 = 1414,
+ Mainboard54 = 1415,
+ Mainboard55 = 1416,
+ Mainboard56 = 1417,
+ Mainboard57 = 1418,
+ Mainboard58 = 1419,
+ Mainboard59 = 1420,
+ Mainboard60 = 1421,
+ Mainboard61 = 1422,
+ Mainboard62 = 1423,
+ Mainboard63 = 1424,
+ Mainboard64 = 1425,
+ Mainboard65 = 1426,
+ Mainboard66 = 1427,
+ Mainboard67 = 1428,
+ Mainboard68 = 1429,
+ Mainboard69 = 1430,
+ Mainboard70 = 1431,
+ Mainboard71 = 1432,
+ Mainboard72 = 1433,
+ Mainboard73 = 1434,
+ Mainboard74 = 1435,
+ Mainboard75 = 1436,
+ Mainboard76 = 1437,
+ Mainboard77 = 1438,
+ Mainboard78 = 1439,
+ Mainboard79 = 1440,
+ Mainboard80 = 1441,
+ Mainboard81 = 1442,
+ Mainboard82 = 1443,
+ Mainboard83 = 1444,
+ Mainboard84 = 1445,
+ Mainboard85 = 1446,
+ Mainboard86 = 1447,
+ Mainboard87 = 1448,
+ Mainboard88 = 1449,
+ Mainboard89 = 1450,
+ Mainboard90 = 1451,
+ Mainboard91 = 1452,
+ Mainboard92 = 1453,
+ Mainboard93 = 1454,
+ Mainboard94 = 1455,
+ Mainboard95 = 1456,
+ Mainboard96 = 1457,
+ Mainboard97 = 1458,
+ Mainboard98 = 1459,
+ Mainboard99 = 1460,
+ Mainboard100 = 1461,
+
+ GPU1 = 1462,
+ GPU2 = 1463,
+ GPU3 = 1464,
+ GPU4 = 1465,
+ GPU5 = 1466,
+ GPU6 = 1467,
+ GPU7 = 1468,
+ GPU8 = 1469,
+ GPU9 = 1470,
+ GPU10 = 1471,
+ GPU11 = 1472,
+ GPU12 = 1473,
+ GPU13 = 1474,
+ GPU14 = 1475,
+ GPU15 = 1476,
+ GPU16 = 1477,
+ GPU17 = 1478,
+ GPU18 = 1479,
+ GPU19 = 1480,
+ GPU20 = 1481,
+ GPU21 = 1482,
+ GPU22 = 1483,
+ GPU23 = 1484,
+ GPU24 = 1485,
+ GPU25 = 1486,
+ GPU26 = 1487,
+ GPU27 = 1488,
+ GPU28 = 1489,
+ GPU29 = 1490,
+ GPU30 = 1491,
+ GPU31 = 1492,
+ GPU32 = 1493,
+ GPU33 = 1494,
+ GPU34 = 1495,
+ GPU35 = 1496,
+ GPU36 = 1497,
+ GPU37 = 1498,
+ GPU38 = 1499,
+ GPU39 = 1500,
+ GPU40 = 1501,
+ GPU41 = 1502,
+ GPU42 = 1503,
+ GPU43 = 1504,
+ GPU44 = 1505,
+ GPU45 = 1506,
+ GPU46 = 1507,
+ GPU47 = 1508,
+ GPU48 = 1509,
+ GPU49 = 1510,
+ GPU50 = 1511,
+
+ Lightbar20 = 1512,
+ Lightbar21 = 1513,
+ Lightbar22 = 1514,
+ Lightbar23 = 1515,
+ Lightbar24 = 1516,
+ Lightbar25 = 1517,
+ Lightbar26 = 1518,
+ Lightbar27 = 1519,
+ Lightbar28 = 1520,
+ Lightbar29 = 1521,
+ Lightbar30 = 1522,
+ Lightbar31 = 1523,
+ Lightbar32 = 1524,
+ Lightbar33 = 1525,
+ Lightbar34 = 1526,
+ Lightbar35 = 1527,
+ Lightbar36 = 1528,
+ Lightbar37 = 1529,
+ Lightbar38 = 1530,
+ Lightbar39 = 1531,
+ Lightbar40 = 1532,
+ Lightbar41 = 1533,
+ Lightbar42 = 1534,
+ Lightbar43 = 1535,
+ Lightbar44 = 1536,
+ Lightbar45 = 1537,
+ Lightbar46 = 1538,
+ Lightbar47 = 1539,
+ Lightbar48 = 1540,
+ Lightbar49 = 1541,
+ Lightbar50 = 1542,
+
+ Profile = 1543,
}
}
diff --git a/RGB.NET.Devices.Corsair/Generic/CorsairRGBDevice.cs b/RGB.NET.Devices.Corsair/Generic/CorsairRGBDevice.cs
index bb0c479..650a61e 100644
--- a/RGB.NET.Devices.Corsair/Generic/CorsairRGBDevice.cs
+++ b/RGB.NET.Devices.Corsair/Generic/CorsairRGBDevice.cs
@@ -122,6 +122,15 @@ namespace RGB.NET.Devices.Corsair
Marshal.FreeHGlobal(ptr);
}
+ ///
+ public override void Dispose()
+ {
+ try { DeviceUpdateQueue?.Dispose(); }
+ catch { /* at least we tried */ }
+
+ base.Dispose();
+ }
+
#endregion
}
}
diff --git a/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDevice.cs b/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDevice.cs
index 1ecbe9b..8152a2c 100644
--- a/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDevice.cs
+++ b/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDevice.cs
@@ -5,11 +5,11 @@ using RGB.NET.Core;
namespace RGB.NET.Devices.Corsair
{
- ///
+ ///
///
/// Represents a corsair headset.
///
- public class CorsairHeadsetRGBDevice : CorsairRGBDevice
+ public class CorsairHeadsetRGBDevice : CorsairRGBDevice, IHeadset
{
#region Constructors
diff --git a/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDevice.cs b/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDevice.cs
index ed25ad7..d7e28c9 100644
--- a/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDevice.cs
+++ b/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDevice.cs
@@ -10,11 +10,11 @@ using RGB.NET.Devices.Corsair.Native;
namespace RGB.NET.Devices.Corsair
{
- ///
+ ///
///
/// Represents a corsair headset stand.
///
- public class CorsairHeadsetStandRGBDevice : CorsairRGBDevice
+ public class CorsairHeadsetStandRGBDevice : CorsairRGBDevice, IHeadsetStand
{
#region Constructors
diff --git a/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDevice.cs b/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDevice.cs
index 4fdd829..c1bb52a 100644
--- a/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDevice.cs
+++ b/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDevice.cs
@@ -9,11 +9,11 @@ using RGB.NET.Devices.Corsair.Native;
namespace RGB.NET.Devices.Corsair
{
- ///
+ ///
///
/// Represents a corsair keyboard.
///
- public class CorsairKeyboardRGBDevice : CorsairRGBDevice
+ public class CorsairKeyboardRGBDevice : CorsairRGBDevice, IKeyboard
{
#region Constructors
diff --git a/RGB.NET.Devices.Corsair/Memory/CorsairMemoryRGBDevice.cs b/RGB.NET.Devices.Corsair/Memory/CorsairMemoryRGBDevice.cs
index ed2c2fb..836e055 100644
--- a/RGB.NET.Devices.Corsair/Memory/CorsairMemoryRGBDevice.cs
+++ b/RGB.NET.Devices.Corsair/Memory/CorsairMemoryRGBDevice.cs
@@ -9,11 +9,11 @@ using RGB.NET.Devices.Corsair.Native;
namespace RGB.NET.Devices.Corsair
{
- ///
+ ///
///
/// Represents a corsair memory.
///
- public class CorsairMemoryRGBDevice : CorsairRGBDevice
+ public class CorsairMemoryRGBDevice : CorsairRGBDevice, IDRAM
{
#region Constructors
diff --git a/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDevice.cs b/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDevice.cs
index 479b771..292d7d8 100644
--- a/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDevice.cs
+++ b/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDevice.cs
@@ -6,11 +6,11 @@ using RGB.NET.Core;
namespace RGB.NET.Devices.Corsair
{
- ///
+ ///
///
/// Represents a corsair mouse.
///
- public class CorsairMouseRGBDevice : CorsairRGBDevice
+ public class CorsairMouseRGBDevice : CorsairRGBDevice, IMouse
{
#region Constructors
diff --git a/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDevice.cs b/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDevice.cs
index e918b58..b245ca1 100644
--- a/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDevice.cs
+++ b/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDevice.cs
@@ -10,11 +10,11 @@ using RGB.NET.Devices.Corsair.Native;
namespace RGB.NET.Devices.Corsair
{
- ///
+ ///
///
/// Represents a corsair mousepad.
///
- public class CorsairMousepadRGBDevice : CorsairRGBDevice
+ public class CorsairMousepadRGBDevice : CorsairRGBDevice, IMousepad
{
#region Constructors
diff --git a/RGB.NET.Devices.Corsair/Native/_CUESDK.cs b/RGB.NET.Devices.Corsair/Native/_CUESDK.cs
index 0e319ff..9b217e4 100644
--- a/RGB.NET.Devices.Corsair/Native/_CUESDK.cs
+++ b/RGB.NET.Devices.Corsair/Native/_CUESDK.cs
@@ -56,7 +56,7 @@ namespace RGB.NET.Devices.Corsair.Native
_corsairGetLastErrorPointer = (CorsairGetLastErrorPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "CorsairGetLastError"), typeof(CorsairGetLastErrorPointer));
}
- private static void UnloadCUESDK()
+ internal static void UnloadCUESDK()
{
if (_dllHandle == IntPtr.Zero) return;
@@ -136,7 +136,7 @@ namespace RGB.NET.Devices.Corsair.Native
#endregion
// ReSharper disable EventExceptionNotDocumented
-
+
///
/// CUE-SDK: set specified LEDs to some colors.
/// This function set LEDs colors in the buffer which is written to the devices via CorsairSetLedsColorsFlushBuffer or CorsairSetLedsColorsFlushBufferAsync.
@@ -151,7 +151,7 @@ namespace RGB.NET.Devices.Corsair.Native
/// This function executes synchronously, if you are concerned about delays consider using CorsairSetLedsColorsFlushBufferAsync
///
internal static bool CorsairSetLedsColorsFlushBuffer() => _corsairSetLedsColorsFlushBufferPointer();
-
+
///
/// CUE-SDK: get current color for the list of requested LEDs.
/// The color should represent the actual state of the hardware LED, which could be a combination of SDK and/or CUE input.
@@ -175,7 +175,7 @@ namespace RGB.NET.Devices.Corsair.Native
/// CUE-SDK: returns information about device at provided index.
///
internal static IntPtr CorsairGetDeviceInfo(int deviceIndex) => _corsairGetDeviceInfoPointer(deviceIndex);
-
+
///
/// CUE-SDK: provides list of keyboard or mousepad LEDs with their physical positions.
///
diff --git a/RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj b/RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj
index 56519a3..e334b6b 100644
--- a/RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj
+++ b/RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj
@@ -14,8 +14,8 @@
RGB.NET.Devices.Corsair
Corsair-Device-Implementations of RGB.NET
Corsair-Device-Implementations of RGB.NET, a C# (.NET) library for accessing various RGB-peripherals
- Copyright © Wyrez 2017
- Copyright © Wyrez 2017
+ Copyright © Darth Affe 2020
+ Copyright © Darth Affe 2020
http://lib.arge.be/icon.png
https://github.com/DarthAffe/RGB.NET
https://raw.githubusercontent.com/DarthAffe/RGB.NET/master/LICENSE
@@ -63,6 +63,6 @@
-
+
\ No newline at end of file
diff --git a/RGB.NET.Devices.DMX/DMXDeviceProvider.cs b/RGB.NET.Devices.DMX/DMXDeviceProvider.cs
index 3e7d889..a151778 100644
--- a/RGB.NET.Devices.DMX/DMXDeviceProvider.cs
+++ b/RGB.NET.Devices.DMX/DMXDeviceProvider.cs
@@ -116,7 +116,10 @@ namespace RGB.NET.Devices.DMX
///
public void Dispose()
- { }
+ {
+ try { UpdateTrigger?.Dispose(); }
+ catch { /* at least we tried */ }
+ }
#endregion
}
diff --git a/RGB.NET.Devices.DMX/E131/E131Device.cs b/RGB.NET.Devices.DMX/E131/E131Device.cs
index 871466e..a4a69d2 100644
--- a/RGB.NET.Devices.DMX/E131/E131Device.cs
+++ b/RGB.NET.Devices.DMX/E131/E131Device.cs
@@ -8,7 +8,7 @@ namespace RGB.NET.Devices.DMX.E131
///
/// Represents a E1.31-DXM-device.
///
- public class E131Device : AbstractRGBDevice
+ public class E131Device : AbstractRGBDevice, IUnknownDevice
{
#region Properties & Fields
@@ -59,6 +59,15 @@ namespace RGB.NET.Devices.DMX.E131
///
protected override void UpdateLeds(IEnumerable ledsToUpdate) => _updateQueue.SetData(ledsToUpdate.Where(x => x.Color.A > 0));
+ ///
+ public override void Dispose()
+ {
+ try { _updateQueue?.Dispose(); }
+ catch { /* at least we tried */ }
+
+ base.Dispose();
+ }
+
#endregion
}
}
diff --git a/RGB.NET.Devices.DMX/RGB.NET.Devices.DMX.csproj b/RGB.NET.Devices.DMX/RGB.NET.Devices.DMX.csproj
index ce4cc51..96c1089 100644
--- a/RGB.NET.Devices.DMX/RGB.NET.Devices.DMX.csproj
+++ b/RGB.NET.Devices.DMX/RGB.NET.Devices.DMX.csproj
@@ -14,8 +14,8 @@
RGB.NET.Devices.DMX
DMX-Device-Implementations of RGB.NET
DMX-Device-Implementations of RGB.NET, a C# (.NET) library for accessing various RGB-peripherals
- Copyright © Wyrez 2017
- Copyright © Wyrez 2017
+ Copyright © Darth Affe 2020
+ Copyright © Darth Affe 2020
http://lib.arge.be/icon.png
https://github.com/DarthAffe/RGB.NET
https://raw.githubusercontent.com/DarthAffe/RGB.NET/master/LICENSE
@@ -63,6 +63,6 @@
-
+
\ No newline at end of file
diff --git a/RGB.NET.Devices.Debug/DebugRGBDevice.cs b/RGB.NET.Devices.Debug/DebugRGBDevice.cs
index 4c71688..174e7fd 100644
--- a/RGB.NET.Devices.Debug/DebugRGBDevice.cs
+++ b/RGB.NET.Devices.Debug/DebugRGBDevice.cs
@@ -5,17 +5,22 @@ using RGB.NET.Core.Layout;
namespace RGB.NET.Devices.Debug
{
- ///
+ ///
///
/// Represents a debug device.
///
- public class DebugRGBDevice : AbstractRGBDevice
+ public class DebugRGBDevice : AbstractRGBDevice, IUnknownDevice
{
#region Properties & Fields
///
public override DebugRGBDeviceInfo DeviceInfo { get; }
+ ///
+ /// Gets the path of the layout used to mock this
+ ///
+ public string LayoutPath { get; }
+
private Func> _syncBackFunc;
private Action> _updateLedsAction;
@@ -27,6 +32,7 @@ namespace RGB.NET.Devices.Debug
///
internal DebugRGBDevice(string layoutPath, Func> syncBackFunc = null, Action> updateLedsAction = null)
{
+ this.LayoutPath = layoutPath;
this._syncBackFunc = syncBackFunc;
this._updateLedsAction = updateLedsAction;
diff --git a/RGB.NET.Devices.Debug/RGB.NET.Devices.Debug.csproj b/RGB.NET.Devices.Debug/RGB.NET.Devices.Debug.csproj
index 1d68681..0ad819b 100644
--- a/RGB.NET.Devices.Debug/RGB.NET.Devices.Debug.csproj
+++ b/RGB.NET.Devices.Debug/RGB.NET.Devices.Debug.csproj
@@ -14,8 +14,8 @@
RGB.NET.Devices.Debug
Debug-Device-Implementations of RGB.NET
Debug-Device-Implementations of RGB.NET, a C# (.NET) library
- Copyright © Wyrez 2017
- Copyright © Wyrez 2017
+ Copyright © Darth Affe 2020
+ Copyright © Darth Affe 2020
http://lib.arge.be/icon.png
https://github.com/DarthAffe/RGB.NET
https://raw.githubusercontent.com/DarthAffe/RGB.NET/master/LICENSE
@@ -63,6 +63,6 @@
-
+
\ No newline at end of file
diff --git a/RGB.NET.Devices.Logitech/Generic/LogitechRGBDevice.cs b/RGB.NET.Devices.Logitech/Generic/LogitechRGBDevice.cs
index 02a8373..74104fa 100644
--- a/RGB.NET.Devices.Logitech/Generic/LogitechRGBDevice.cs
+++ b/RGB.NET.Devices.Logitech/Generic/LogitechRGBDevice.cs
@@ -70,6 +70,15 @@ namespace RGB.NET.Devices.Logitech
ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, @"Layouts\Logitech", $"{layoutPath}.xml"), layout, true);
}
+ ///
+ public override void Dispose()
+ {
+ try { UpdateQueue?.Dispose(); }
+ catch { /* at least we tried */ }
+
+ base.Dispose();
+ }
+
#endregion
}
}
diff --git a/RGB.NET.Devices.Logitech/HID/DeviceChecker.cs b/RGB.NET.Devices.Logitech/HID/DeviceChecker.cs
index 5ec7a69..4e8d551 100644
--- a/RGB.NET.Devices.Logitech/HID/DeviceChecker.cs
+++ b/RGB.NET.Devices.Logitech/HID/DeviceChecker.cs
@@ -18,9 +18,12 @@ namespace RGB.NET.Devices.Logitech.HID
{
("G910", RGBDeviceType.Keyboard, 0xC32B, 0, "DE", @"Keyboards\G910\UK"), //TODO DarthAffe 15.11.2017: Somehow detect the current layout
("G910v2", RGBDeviceType.Keyboard, 0xC335, 0, "DE", @"Keyboards\G910\UK"),
+ ("G915", RGBDeviceType.Keyboard, 0xC541, 0, "DE", @"Keyboards\G915\UK"),
("G810", RGBDeviceType.Keyboard, 0xC337, 0, "DE", @"Keyboards\G810\UK"),
+ ("G810", RGBDeviceType.Keyboard, 0xC331, 0, "DE", @"Keyboards\G810\UK"),
("G610", RGBDeviceType.Keyboard, 0xC333, 0, "DE", @"Keyboards\G610\UK"),
("G512", RGBDeviceType.Keyboard, 0xC33C, 0, "DE", @"Keyboards\G512\UK"),
+ ("G512 SE", RGBDeviceType.Keyboard, 0xC342, 0, "DE", @"Keyboards\G512SE\UK"),
("G410", RGBDeviceType.Keyboard, 0xC330, 0, "DE", @"Keyboards\G410\UK"),
("G213", RGBDeviceType.Keyboard, 0xC336, 0, "DE", @"Keyboards\G213\UK"),
("Pro", RGBDeviceType.Keyboard, 0xC339, 0, "DE", @"Keyboards\Pro\UK"),
@@ -56,6 +59,8 @@ namespace RGB.NET.Devices.Logitech.HID
("G303", RGBDeviceType.Mouse, 0xC080, 2, "default", @"Mice\G303"),
("G203", RGBDeviceType.Mouse, 0xC084, 1, "default", @"Mice\G203"),
("G Pro", RGBDeviceType.Mouse, 0xC085, 1, "default", @"Mice\GPro"),
+ ("G Pro Wireless", RGBDeviceType.Mouse, 0xC088, 1, "default", @"Mice\GPro"),
+ ("G Pro Hero", RGBDeviceType.Mouse, 0xC08C, 1, "default", @"Mice\GProHero"),
("G633", RGBDeviceType.Headset, 0x0A5C, 2, "default", @"Headsets\G633"),
("G933", RGBDeviceType.Headset, 0x0A5B, 2, "default", @"Headsets\G933"),
("G935", RGBDeviceType.Headset, 0x0A87, 2, "default", @"Headsets\G935"),
diff --git a/RGB.NET.Devices.Logitech/LogitechDeviceProvider.cs b/RGB.NET.Devices.Logitech/LogitechDeviceProvider.cs
index 991fc01..5169eb3 100644
--- a/RGB.NET.Devices.Logitech/LogitechDeviceProvider.cs
+++ b/RGB.NET.Devices.Logitech/LogitechDeviceProvider.cs
@@ -182,7 +182,17 @@ namespace RGB.NET.Devices.Logitech
public void ResetDevices() => _LogitechGSDK.LogiLedRestoreLighting();
///
- public void Dispose() => _LogitechGSDK.LogiLedRestoreLighting();
+ public void Dispose()
+ {
+ try { UpdateTrigger?.Dispose(); }
+ catch { /* at least we tried */ }
+
+ try { _LogitechGSDK.LogiLedRestoreLighting(); }
+ catch { /* at least we tried */ }
+
+ try { _LogitechGSDK.UnloadLogitechGSDK(); }
+ catch { /* at least we tried */ }
+ }
#endregion
}
diff --git a/RGB.NET.Devices.Logitech/Native/_LogitechGSDK.cs b/RGB.NET.Devices.Logitech/Native/_LogitechGSDK.cs
index 39d0968..8f1b826 100644
--- a/RGB.NET.Devices.Logitech/Native/_LogitechGSDK.cs
+++ b/RGB.NET.Devices.Logitech/Native/_LogitechGSDK.cs
@@ -55,7 +55,7 @@ namespace RGB.NET.Devices.Logitech.Native
_logiLedSetLightingForTargetZonePointer = (LogiLedSetLightingForTargetZonePointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "LogiLedSetLightingForTargetZone"), typeof(LogiLedSetLightingForTargetZonePointer));
}
- private static void UnloadLogitechGSDK()
+ internal static void UnloadLogitechGSDK()
{
if (_dllHandle == IntPtr.Zero) return;
diff --git a/RGB.NET.Devices.Logitech/PerDevice/LogitechPerDeviceRGBDevice.cs b/RGB.NET.Devices.Logitech/PerDevice/LogitechPerDeviceRGBDevice.cs
index 471b438..42ff262 100644
--- a/RGB.NET.Devices.Logitech/PerDevice/LogitechPerDeviceRGBDevice.cs
+++ b/RGB.NET.Devices.Logitech/PerDevice/LogitechPerDeviceRGBDevice.cs
@@ -4,11 +4,11 @@ using RGB.NET.Core;
namespace RGB.NET.Devices.Logitech
{
- ///
+ ///
///
/// Represents a logitech per-device-lightable device.
///
- public class LogitechPerDeviceRGBDevice : LogitechRGBDevice
+ public class LogitechPerDeviceRGBDevice : LogitechRGBDevice, IUnknownDevice //TODO DarthAffe 18.04.2020: It's know which kind of device this is, but they would need to be separated
{
#region Constructors
diff --git a/RGB.NET.Devices.Logitech/PerKey/LogitechPerKeyRGBDevice.cs b/RGB.NET.Devices.Logitech/PerKey/LogitechPerKeyRGBDevice.cs
index cdf10bf..e5e3f40 100644
--- a/RGB.NET.Devices.Logitech/PerKey/LogitechPerKeyRGBDevice.cs
+++ b/RGB.NET.Devices.Logitech/PerKey/LogitechPerKeyRGBDevice.cs
@@ -4,11 +4,11 @@ using RGB.NET.Core;
namespace RGB.NET.Devices.Logitech
{
- ///
+ ///
///
/// Represents a logitech per-key-lightable device.
///
- public class LogitechPerKeyRGBDevice : LogitechRGBDevice
+ public class LogitechPerKeyRGBDevice : LogitechRGBDevice, IUnknownDevice //TODO DarthAffe 18.04.2020: It's know which kind of device this is, but they would need to be separated
{
#region Constructors
diff --git a/RGB.NET.Devices.Logitech/RGB.NET.Devices.Logitech.csproj b/RGB.NET.Devices.Logitech/RGB.NET.Devices.Logitech.csproj
index b231942..220b205 100644
--- a/RGB.NET.Devices.Logitech/RGB.NET.Devices.Logitech.csproj
+++ b/RGB.NET.Devices.Logitech/RGB.NET.Devices.Logitech.csproj
@@ -14,8 +14,8 @@
RGB.NET.Devices.Logitech
Logitech-Device-Implementations of RGB.NET
Logitech-Device-Implementations of RGB.NET, a C# (.NET) library for accessing various RGB-peripherals
- Copyright © Wyrez 2017
- Copyright © Wyrez 2017
+ Copyright © Darth Affe 2020
+ Copyright © Darth Affe 2020
http://lib.arge.be/icon.png
https://github.com/DarthAffe/RGB.NET
https://raw.githubusercontent.com/DarthAffe/RGB.NET/master/LICENSE
@@ -60,10 +60,10 @@
-
+
-
+
\ No newline at end of file
diff --git a/RGB.NET.Devices.Logitech/Zone/LogitechZoneRGBDevice.cs b/RGB.NET.Devices.Logitech/Zone/LogitechZoneRGBDevice.cs
index c7263ae..419e796 100644
--- a/RGB.NET.Devices.Logitech/Zone/LogitechZoneRGBDevice.cs
+++ b/RGB.NET.Devices.Logitech/Zone/LogitechZoneRGBDevice.cs
@@ -4,11 +4,11 @@ using RGB.NET.Core;
namespace RGB.NET.Devices.Logitech
{
- ///
+ ///
///
/// Represents a logitech zone-lightable device.
///
- public class LogitechZoneRGBDevice : LogitechRGBDevice
+ public class LogitechZoneRGBDevice : LogitechRGBDevice, IUnknownDevice //TODO DarthAffe 18.04.2020: It's know which kind of device this is, but they would need to be separated
{
#region Constants
diff --git a/RGB.NET.Devices.Msi/Generic/MsiRGBDevice.cs b/RGB.NET.Devices.Msi/Generic/MsiRGBDevice.cs
index e6a5210..258bf84 100644
--- a/RGB.NET.Devices.Msi/Generic/MsiRGBDevice.cs
+++ b/RGB.NET.Devices.Msi/Generic/MsiRGBDevice.cs
@@ -68,6 +68,15 @@ namespace RGB.NET.Devices.Msi
protected override void UpdateLeds(IEnumerable ledsToUpdate)
=> DeviceUpdateQueue.SetData(ledsToUpdate.Where(x => (x.Color.A > 0) && (x.CustomData is int)));
+ ///
+ public override void Dispose()
+ {
+ try { DeviceUpdateQueue?.Dispose(); }
+ catch { /* at least we tried */ }
+
+ base.Dispose();
+ }
+
#endregion
}
}
diff --git a/RGB.NET.Devices.Msi/Generic/MsiRGBDeviceInfo.cs b/RGB.NET.Devices.Msi/Generic/MsiRGBDeviceInfo.cs
index d846266..269d34e 100644
--- a/RGB.NET.Devices.Msi/Generic/MsiRGBDeviceInfo.cs
+++ b/RGB.NET.Devices.Msi/Generic/MsiRGBDeviceInfo.cs
@@ -48,7 +48,7 @@ namespace RGB.NET.Devices.Msi
/// The internal type of the .
/// The manufacturer-name of the .
/// The model-name of the .
- internal MsiRGBDeviceInfo(RGBDeviceType deviceType, string msiDeviceType, string manufacturer = "Msi", string model = "Generic Msi-Device")
+ internal MsiRGBDeviceInfo(RGBDeviceType deviceType, string msiDeviceType, string manufacturer = "MSI", string model = "Generic Msi-Device")
{
this.DeviceType = deviceType;
this.MsiDeviceType = msiDeviceType;
diff --git a/RGB.NET.Devices.Msi/GraphicsCard/MsiGraphicsCardRGBDevice.cs b/RGB.NET.Devices.Msi/GraphicsCard/MsiGraphicsCardRGBDevice.cs
index ee0800a..74bd673 100644
--- a/RGB.NET.Devices.Msi/GraphicsCard/MsiGraphicsCardRGBDevice.cs
+++ b/RGB.NET.Devices.Msi/GraphicsCard/MsiGraphicsCardRGBDevice.cs
@@ -3,11 +3,11 @@ using RGB.NET.Devices.Msi.Native;
namespace RGB.NET.Devices.Msi
{
- ///
+ ///
///
/// Represents MSI VGA adapters.
///
- public class MsiGraphicsCardRGBDevice : MsiRGBDevice
+ public class MsiGraphicsCardRGBDevice : MsiRGBDevice, IGraphicsCard
{
#region Constructors
@@ -41,7 +41,7 @@ namespace RGB.NET.Devices.Msi
}
//TODO DarthAffe 07.10.2017: We don't know the model, how to save layouts and images?
- ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\MSI\GraphicsCard\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null);
+ ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, $@"Layouts\MSI\GraphicsCard\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null);
}
///
diff --git a/RGB.NET.Devices.Msi/Mainboard/MsiMainboardRGBDevice.cs b/RGB.NET.Devices.Msi/Mainboard/MsiMainboardRGBDevice.cs
index f80dab0..455e63a 100644
--- a/RGB.NET.Devices.Msi/Mainboard/MsiMainboardRGBDevice.cs
+++ b/RGB.NET.Devices.Msi/Mainboard/MsiMainboardRGBDevice.cs
@@ -3,11 +3,11 @@ using RGB.NET.Devices.Msi.Native;
namespace RGB.NET.Devices.Msi
{
- ///
+ ///
///
/// Represents a MSI mainboard.
///
- public class MsiMainboardRGBDevice : MsiRGBDevice
+ public class MsiMainboardRGBDevice : MsiRGBDevice, IMainboard
{
#region Constructors
@@ -39,7 +39,7 @@ namespace RGB.NET.Devices.Msi
}
//TODO DarthAffe 07.10.2017: We don't know the model, how to save layouts and images?
- ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\MSI\Mainboards\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null);
+ ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, $@"Layouts\MSI\Mainboards\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null);
}
///
diff --git a/RGB.NET.Devices.Msi/Mouse/MsiMouseRGBDevice.cs b/RGB.NET.Devices.Msi/Mouse/MsiMouseRGBDevice.cs
new file mode 100644
index 0000000..bbcbd57
--- /dev/null
+++ b/RGB.NET.Devices.Msi/Mouse/MsiMouseRGBDevice.cs
@@ -0,0 +1,54 @@
+using RGB.NET.Core;
+using RGB.NET.Devices.Msi.Native;
+
+namespace RGB.NET.Devices.Msi
+{
+ ///
+ ///
+ /// Represents a MSI mouse.
+ ///
+ public class MsiMouseRGBDevice : MsiRGBDevice
+ {
+ #region Constructors
+
+ ///
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The specific information provided by MSI for the mouse.
+ internal MsiMouseRGBDevice(MsiRGBDeviceInfo info)
+ : base(info)
+ { }
+
+ #endregion
+
+ #region Methods
+
+ ///
+ protected override void InitializeLayout(int ledCount)
+ {
+ for (int i = 0; i < ledCount; i++)
+ {
+ //Hex3l: Should it be configurable in order to provide style access?
+ //Hex3l: Sets led style to "Steady" in order to have a solid color output therefore a controllable led color
+ //Hex3l: This is a string defined by the output of _MsiSDK.GetLedStyle, "Steady" should be always present
+ const string LED_STYLE = "Steady";
+
+ _MsiSDK.SetLedStyle(DeviceInfo.MsiDeviceType, i, LED_STYLE);
+ InitializeLed(LedId.Mouse1 + i, new Rectangle(i * 10, 0, 10, 10));
+ }
+
+ //TODO DarthAffe 07.10.2017: We don't know the model, how to save layouts and images?
+ ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, $@"Layouts\MSI\Mouses\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null);
+ }
+
+ ///
+ protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mouse1;
+
+ ///
+ public override void SyncBack()
+ { }
+
+ #endregion
+ }
+}
diff --git a/RGB.NET.Devices.Msi/MsiDeviceProvider.cs b/RGB.NET.Devices.Msi/MsiDeviceProvider.cs
index 59a3980..ffc9506 100644
--- a/RGB.NET.Devices.Msi/MsiDeviceProvider.cs
+++ b/RGB.NET.Devices.Msi/MsiDeviceProvider.cs
@@ -118,7 +118,7 @@ namespace RGB.NET.Devices.Msi
if (deviceType.Equals("MSI_MB"))
{
MsiDeviceUpdateQueue updateQueue = new MsiDeviceUpdateQueue(UpdateTrigger, deviceType);
- IMsiRGBDevice motherboard = new MsiMainboardRGBDevice(new MsiRGBDeviceInfo(RGBDeviceType.Mainboard, deviceType, "Msi", "Motherboard"));
+ IMsiRGBDevice motherboard = new MsiMainboardRGBDevice(new MsiRGBDeviceInfo(RGBDeviceType.Mainboard, deviceType, "MSI", "Motherboard"));
motherboard.Initialize(updateQueue, ledCount);
devices.Add(motherboard);
}
@@ -128,10 +128,20 @@ namespace RGB.NET.Devices.Msi
//Hex3l: The led name is the name of the card (e.g. NVIDIA GeForce RTX 2080 Ti) we could provide it in device info.
MsiDeviceUpdateQueue updateQueue = new MsiDeviceUpdateQueue(UpdateTrigger, deviceType);
- IMsiRGBDevice graphicscard = new MsiGraphicsCardRGBDevice(new MsiRGBDeviceInfo(RGBDeviceType.GraphicsCard, deviceType, "Msi", "GraphicsCard"));
+ IMsiRGBDevice graphicscard = new MsiGraphicsCardRGBDevice(new MsiRGBDeviceInfo(RGBDeviceType.GraphicsCard, deviceType, "MSI", "GraphicsCard"));
graphicscard.Initialize(updateQueue, ledCount);
devices.Add(graphicscard);
}
+ else if (deviceType.Equals("MSI_MOUSE"))
+ {
+ //Hex3l: Every led under MSI_MOUSE should be a different mouse. Handling all the mouses together seems a good way to avoid overlapping of leds
+ //Hex3l: The led name is the name of the mouse (e.g. msi CLUTCH GM11) we could provide it in device info.
+
+ MsiDeviceUpdateQueue updateQueue = new MsiDeviceUpdateQueue(UpdateTrigger, deviceType);
+ IMsiRGBDevice mouses = new MsiMouseRGBDevice(new MsiRGBDeviceInfo(RGBDeviceType.Mouse, deviceType, "MSI", "Mouse"));
+ mouses.Initialize(updateQueue, ledCount);
+ devices.Add(mouses);
+ }
//TODO DarthAffe 22.02.2020: Add other devices
}
@@ -163,7 +173,13 @@ namespace RGB.NET.Devices.Msi
///
public void Dispose()
- { }
+ {
+ try { UpdateTrigger?.Dispose(); }
+ catch { /* at least we tried */ }
+
+ try { _MsiSDK.UnloadMsiSDK(); }
+ catch { /* at least we tried */ }
+ }
#endregion
}
diff --git a/RGB.NET.Devices.Msi/Native/_MsiSDK.cs b/RGB.NET.Devices.Msi/Native/_MsiSDK.cs
index a67aa94..930352f 100644
--- a/RGB.NET.Devices.Msi/Native/_MsiSDK.cs
+++ b/RGB.NET.Devices.Msi/Native/_MsiSDK.cs
@@ -60,7 +60,7 @@ namespace RGB.NET.Devices.Msi.Native
_getErrorMessagePointer = (GetErrorMessagePointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "MLAPI_GetErrorMessage"), typeof(GetErrorMessagePointer));
}
- private static void UnloadMsiSDK()
+ internal static void UnloadMsiSDK()
{
if (_dllHandle == IntPtr.Zero) return;
diff --git a/RGB.NET.Devices.Msi/RGB.NET.Devices.Msi.csproj b/RGB.NET.Devices.Msi/RGB.NET.Devices.Msi.csproj
index cb86295..ba24290 100644
--- a/RGB.NET.Devices.Msi/RGB.NET.Devices.Msi.csproj
+++ b/RGB.NET.Devices.Msi/RGB.NET.Devices.Msi.csproj
@@ -14,8 +14,8 @@
RGB.NET.Devices.Msi
Msi-Device-Implementations of RGB.NET
Msi-Device-Implementations of RGB.NET, a C# (.NET) library for accessing various RGB-peripherals
- Copyright © Wyrez 2017
- Copyright © Wyrez 2017
+ Copyright © Darth Affe 2020
+ Copyright © Darth Affe 2020
http://lib.arge.be/icon.png
https://github.com/DarthAffe/RGB.NET
https://raw.githubusercontent.com/DarthAffe/RGB.NET/master/LICENSE
@@ -63,6 +63,6 @@
-
+
\ No newline at end of file
diff --git a/RGB.NET.Devices.Novation/Attributes/LedIdMappingAttribute.cs b/RGB.NET.Devices.Novation/Attributes/LedIdMappingAttribute.cs
new file mode 100644
index 0000000..3cda1aa
--- /dev/null
+++ b/RGB.NET.Devices.Novation/Attributes/LedIdMappingAttribute.cs
@@ -0,0 +1,35 @@
+using System;
+
+namespace RGB.NET.Devices.Novation.Attributes
+{
+ ///
+ ///
+ /// Specifies the led id mapping of a field.
+ ///
+ [AttributeUsage(AttributeTargets.Field)]
+ internal class LedIdMappingAttribute : Attribute
+ {
+ #region Properties & Fields
+
+ ///
+ /// Gets the led id mapping.
+ ///
+ internal LedIdMappings LedIdMapping { get; }
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The led id mapping.
+ internal LedIdMappingAttribute(LedIdMappings ledIdMapping)
+ {
+ this.LedIdMapping = ledIdMapping;
+ }
+
+ #endregion
+ }
+}
diff --git a/RGB.NET.Devices.Novation/Enum/NovationDevices.cs b/RGB.NET.Devices.Novation/Enum/NovationDevices.cs
index ca16a62..f1afa2c 100644
--- a/RGB.NET.Devices.Novation/Enum/NovationDevices.cs
+++ b/RGB.NET.Devices.Novation/Enum/NovationDevices.cs
@@ -13,6 +13,17 @@ namespace RGB.NET.Devices.Novation
{
[DeviceId("Launchpad S")]
[ColorCapability(NovationColorCapabilities.LimitedRG)]
- LaunchpadS
+ [LedIdMapping(LedIdMappings.Legacy)]
+ LaunchpadS,
+
+ [DeviceId("Launchpad Mini")]
+ [ColorCapability(NovationColorCapabilities.LimitedRG)]
+ [LedIdMapping(LedIdMappings.Legacy)]
+ LaunchpadMini,
+
+ [DeviceId("Launchpad MK2")]
+ [ColorCapability(NovationColorCapabilities.RGB)]
+ [LedIdMapping(LedIdMappings.Current)]
+ LaunchpadMK2
}
}
diff --git a/RGB.NET.Devices.Novation/Enum/NovationLedId.cs b/RGB.NET.Devices.Novation/Enum/NovationLedId.cs
deleted file mode 100644
index 22f44c3..0000000
--- a/RGB.NET.Devices.Novation/Enum/NovationLedId.cs
+++ /dev/null
@@ -1,107 +0,0 @@
-// ReSharper disable InconsistentNaming
-// ReSharper disable UnusedMember.Global
-
-#pragma warning disable 1591 // Missing XML comment for publicly visible type or member
-
-namespace RGB.NET.Devices.Novation
-{
- ///
- /// Contains list of all LEDs available for all Novation devices.
- /// They are represented as Hex 0x[00][11] where [00] is the status flag, [1] the id of the led.
- ///
- //TODO DarthAffe 15.08.2017: Check if this is really correct for all devices
- public enum NovationLedId
- {
- Invalid = -1,
-
- Grid1 = 0x9000,
- Grid2 = 0x9001,
- Grid3 = 0x9002,
- Grid4 = 0x9003,
- Grid5 = 0x9004,
- Grid6 = 0x9005,
- Grid7 = 0x9006,
- Grid8 = 0x9007,
-
- Grid9 = 0x9010,
- Grid10 = 0x9011,
- Grid11 = 0x9012,
- Grid12 = 0x9013,
- Grid13 = 0x9014,
- Grid14 = 0x9015,
- Grid15 = 0x9016,
- Grid16 = 0x9017,
-
- Grid17 = 0x9020,
- Grid18 = 0x9021,
- Grid19 = 0x9022,
- Grid20 = 0x9023,
- Grid21 = 0x9024,
- Grid22 = 0x9025,
- Grid23 = 0x9026,
- Grid24 = 0x9027,
-
- Grid25 = 0x9030,
- Grid26 = 0x9031,
- Grid27 = 0x9032,
- Grid28 = 0x9033,
- Grid29 = 0x9034,
- Grid30 = 0x9035,
- Grid31 = 0x9036,
- Grid32 = 0x9037,
-
- Grid33 = 0x9040,
- Grid34 = 0x9041,
- Grid35 = 0x9042,
- Grid36 = 0x9043,
- Grid37 = 0x9044,
- Grid38 = 0x9045,
- Grid39 = 0x9046,
- Grid40 = 0x9047,
-
- Grid41 = 0x9050,
- Grid42 = 0x9051,
- Grid43 = 0x9052,
- Grid44 = 0x9053,
- Grid45 = 0x9054,
- Grid46 = 0x9055,
- Grid47 = 0x9056,
- Grid48 = 0x9057,
-
- Grid49 = 0x9060,
- Grid50 = 0x9061,
- Grid51 = 0x9062,
- Grid52 = 0x9063,
- Grid53 = 0x9064,
- Grid54 = 0x9065,
- Grid55 = 0x9066,
- Grid56 = 0x9067,
-
- Grid57 = 0x9070,
- Grid58 = 0x9071,
- Grid59 = 0x9072,
- Grid60 = 0x9073,
- Grid61 = 0x9074,
- Grid62 = 0x9075,
- Grid63 = 0x9076,
- Grid64 = 0x9077,
-
- Up = 0xB068,
- Down = 0xB069,
- Left = 0xB06A,
- Right = 0xB06B,
- Session = 0xB06C,
- User1 = 0xB06D,
- User2 = 0xB06E,
- Mix = 0xB06F,
-
- Scene1 = 0x9009,
- Scene2 = 0x9019,
- Scene3 = 0x9029,
- Scene4 = 0x9039,
- Scene5 = 0x9049,
- Scene6 = 0x9059,
- Scene7 = 0x9069,
- Scene8 = 0x9079
- }
-}
diff --git a/RGB.NET.Devices.Novation/Generic/LimitedColorUpdateQueue.cs b/RGB.NET.Devices.Novation/Generic/LimitedColorUpdateQueue.cs
index a3570c9..588e359 100644
--- a/RGB.NET.Devices.Novation/Generic/LimitedColorUpdateQueue.cs
+++ b/RGB.NET.Devices.Novation/Generic/LimitedColorUpdateQueue.cs
@@ -28,8 +28,8 @@ namespace RGB.NET.Devices.Novation
///
protected override ShortMessage CreateMessage(KeyValuePair data)
{
- NovationLedId ledId = (NovationLedId)data.Key;
- return new ShortMessage(Convert.ToByte(ledId.GetStatus()), Convert.ToByte(ledId.GetId()), Convert.ToByte(ConvertColor(data.Value)));
+ (byte mode, byte id) = ((byte, byte))data.Key;
+ return new ShortMessage(mode, id, Convert.ToByte(ConvertColor(data.Value)));
}
///
diff --git a/RGB.NET.Devices.Novation/Generic/MidiUpdateQueue.cs b/RGB.NET.Devices.Novation/Generic/MidiUpdateQueue.cs
index 4dfafc9..6e34359 100644
--- a/RGB.NET.Devices.Novation/Generic/MidiUpdateQueue.cs
+++ b/RGB.NET.Devices.Novation/Generic/MidiUpdateQueue.cs
@@ -47,7 +47,12 @@ namespace RGB.NET.Devices.Novation
/// Sends the specified message to the device this queue is performing updates for.
///
/// The message to send.
- protected virtual void SendMessage(ShortMessage message) => _outputDevice.SendShort(message.Message);
+ protected virtual void SendMessage(ShortMessage message)
+ {
+ if (message != null)
+ _outputDevice.SendShort(message.Message);
+ }
+
///
/// Creates a update-message out of a given data set.
@@ -57,7 +62,12 @@ namespace RGB.NET.Devices.Novation
protected abstract ShortMessage CreateMessage(KeyValuePair data);
///
- public void Dispose() => _outputDevice.Dispose();
+ public override void Dispose()
+ {
+ base.Dispose();
+
+ _outputDevice.Dispose();
+ }
#endregion
}
diff --git a/RGB.NET.Devices.Novation/Generic/NovationRGBDevice.cs b/RGB.NET.Devices.Novation/Generic/NovationRGBDevice.cs
index c1904eb..d1f7679 100644
--- a/RGB.NET.Devices.Novation/Generic/NovationRGBDevice.cs
+++ b/RGB.NET.Devices.Novation/Generic/NovationRGBDevice.cs
@@ -57,8 +57,12 @@ namespace RGB.NET.Devices.Novation
Size = ledRectangle.Size + new Size(ledRectangle.Location.X, ledRectangle.Location.Y);
}
- if (DeviceInfo.ColorCapabilities == NovationColorCapabilities.LimitedRG)
- UpdateQueue = new LimitedColorUpdateQueue(updateTrigger, DeviceInfo.DeviceId);
+ UpdateQueue = DeviceInfo.ColorCapabilities switch
+ {
+ NovationColorCapabilities.LimitedRG => new LimitedColorUpdateQueue(updateTrigger, DeviceInfo.DeviceId),
+ NovationColorCapabilities.RGB => new RGBColorUpdateQueue(updateTrigger, DeviceInfo.DeviceId),
+ _ => throw new ArgumentOutOfRangeException()
+ };
}
///
@@ -79,7 +83,10 @@ namespace RGB.NET.Devices.Novation
public override void Dispose()
{
Reset();
- UpdateQueue.Dispose();
+
+ try { UpdateQueue?.Dispose(); }
+ catch { /* at least we tried */ }
+
base.Dispose();
}
diff --git a/RGB.NET.Devices.Novation/Generic/RGBColorUpdateQueue.cs b/RGB.NET.Devices.Novation/Generic/RGBColorUpdateQueue.cs
new file mode 100644
index 0000000..5dd9d54
--- /dev/null
+++ b/RGB.NET.Devices.Novation/Generic/RGBColorUpdateQueue.cs
@@ -0,0 +1,195 @@
+using System;
+using System.Collections.Generic;
+using RGB.NET.Core;
+using Sanford.Multimedia.Midi;
+
+namespace RGB.NET.Devices.Novation
+{
+ ///
+ /// Represents the update-queue performing updates for a RGB-color novation device.
+ ///
+ public class RGBColorUpdateQueue : MidiUpdateQueue
+ {
+ #region Properties & Fields
+
+ private static readonly (Color, int)[] COLOR_PALETTE =
+ {
+ (new Color(0, 0, 0), 0),
+ (new Color(28, 28, 28), 1),
+ (new Color(124, 124, 124), 2),
+ (new Color(252, 252, 252), 3),
+ (new Color(255, 77, 71), 4),
+ (new Color(255, 10, 0), 5),
+ (new Color(90, 1, 0), 6),
+ (new Color(25, 0, 0), 7),
+ (new Color(255, 189, 98), 8),
+ (new Color(255, 86, 0), 9),
+ (new Color(90, 29, 0), 10),
+ (new Color(36, 24, 0), 11),
+ (new Color(253, 253, 33), 12),
+ (new Color(253, 253, 0), 13),
+ (new Color(88, 88, 0), 14),
+ (new Color(24, 24, 0), 15),
+ (new Color(128, 253, 42), 16),
+ (new Color(64, 253, 0), 17),
+ (new Color(22, 88, 0), 18),
+ (new Color(19, 40, 0), 19),
+ (new Color(52, 253, 43), 20),
+ (new Color(0, 253, 0), 21),
+ (new Color(0, 88, 0), 22),
+ (new Color(0, 24, 0), 23),
+ (new Color(51, 253, 70), 24),
+ (new Color(50, 253, 126), 28),
+ (new Color(0, 253, 58), 29),
+ (new Color(0, 88, 20), 30),
+ (new Color(0, 28, 15), 31),
+ (new Color(47, 252, 176), 32),
+ (new Color(0, 252, 145), 33),
+ (new Color(0, 88, 49), 34),
+ (new Color(0, 24, 15), 35),
+ (new Color(57, 191, 255), 36),
+ (new Color(0, 167, 255), 37),
+ (new Color(0, 64, 81), 38),
+ (new Color(0, 16, 24), 39),
+ (new Color(65, 134, 255), 40),
+ (new Color(0, 80, 255), 41),
+ (new Color(0, 26, 90), 42),
+ (new Color(0, 7, 25), 43),
+ (new Color(70, 71, 255), 44),
+ (new Color(0, 0, 255), 45),
+ (new Color(0, 0, 91), 46),
+ (new Color(0, 0, 25), 47),
+ (new Color(131, 71, 255), 48),
+ (new Color(80, 0, 255), 49),
+ (new Color(22, 0, 103), 50),
+ (new Color(11, 0, 50), 51),
+ (new Color(255, 73, 255), 52),
+ (new Color(255, 0, 255), 53),
+ (new Color(90, 0, 90), 54),
+ (new Color(25, 0, 25), 55),
+ (new Color(255, 77, 132), 56),
+ (new Color(255, 7, 82), 57),
+ (new Color(90, 1, 27), 58),
+ (new Color(33, 0, 16), 59),
+ (new Color(255, 25, 0), 60),
+ (new Color(155, 53, 0), 61),
+ (new Color(122, 81, 0), 62),
+ (new Color(62, 100, 0), 63),
+ (new Color(0, 56, 0), 64),
+ (new Color(0, 84, 50), 65),
+ (new Color(0, 83, 126), 66),
+ (new Color(0, 68, 77), 68),
+ (new Color(27, 0, 210), 69),
+ (new Color(32, 32, 32), 71),
+ (new Color(186, 253, 0), 73),
+ (new Color(170, 237, 0), 74),
+ (new Color(86, 253, 0), 75),
+ (new Color(0, 136, 0), 76),
+ (new Color(0, 252, 122), 77),
+ (new Color(0, 27, 255), 79),
+ (new Color(53, 0, 255), 80),
+ (new Color(119, 0, 255), 81),
+ (new Color(180, 23, 126), 82),
+ (new Color(65, 32, 0), 83),
+ (new Color(255, 74, 0), 84),
+ (new Color(131, 225, 0), 85),
+ (new Color(101, 253, 0), 86),
+ (new Color(69, 253, 97), 89),
+ (new Color(0, 252, 202), 90),
+ (new Color(80, 134, 255), 91),
+ (new Color(39, 77, 201), 92),
+ (new Color(130, 122, 237), 93),
+ (new Color(211, 12, 255), 94),
+ (new Color(255, 6, 90), 95),
+ (new Color(255, 125, 0), 96),
+ (new Color(185, 177, 0), 97),
+ (new Color(138, 253, 0), 98),
+ (new Color(130, 93, 0), 99),
+ (new Color(57, 40, 0), 100),
+ (new Color(13, 76, 5), 101),
+ (new Color(0, 80, 55), 102),
+ (new Color(19, 19, 41), 103),
+ (new Color(16, 31, 90), 104),
+ (new Color(106, 60, 23), 105),
+ (new Color(172, 4, 0), 106),
+ (new Color(225, 81, 53), 107),
+ (new Color(220, 105, 0), 108),
+ (new Color(255, 255, 0), 109),
+ (new Color(153, 225, 0), 110),
+ (new Color(95, 181, 0), 111),
+ (new Color(27, 27, 49), 112),
+ (new Color(220, 253, 84), 113),
+ (new Color(118, 252, 184), 114),
+ (new Color(150, 151, 255), 115),
+ (new Color(139, 97, 255), 116),
+ (new Color(64, 64, 64), 117),
+ (new Color(116, 116, 116), 118),
+ (new Color(222, 252, 252), 119),
+ (new Color(164, 4, 0), 120),
+ (new Color(53, 0, 0), 121),
+ (new Color(0, 209, 0), 122),
+ (new Color(0, 64, 0), 123),
+ (new Color(61, 48, 0), 125),
+ (new Color(180, 93, 0), 126),
+ (new Color(74, 20, 0), 127),
+ };
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The update trigger used by this queue.
+ /// The device-id of the device this queue is performing updates for.
+ public RGBColorUpdateQueue(IDeviceUpdateTrigger updateTrigger, int deviceId)
+ : base(updateTrigger, deviceId)
+ { }
+
+ #endregion
+
+ #region Methods
+
+ ///
+ protected override ShortMessage CreateMessage(KeyValuePair data)
+ {
+ (byte mode, byte id) = ((byte, byte))data.Key;
+ if (mode == 0x00) return null;
+
+ return new ShortMessage(mode, id, Convert.ToByte(ConvertColor(data.Value)));
+ }
+
+ ///
+ /// Convert a to its novation-representation depending on the of the .
+ /// Source: http://www.launchpadfun.com/downloads_de/velocity-colors/
+ ///
+ /// The to convert.
+ /// The novation-representation of the .
+ protected virtual int ConvertColor(Color color)
+ {
+ int bestVelocity = 0;
+ double bestMatchDistance = double.MaxValue;
+ foreach ((Color c, int velocity) in COLOR_PALETTE)
+ {
+ double distance = c.DistanceTo(color);
+ if (distance < bestMatchDistance)
+ {
+ bestVelocity = velocity;
+ bestMatchDistance = distance;
+ }
+ }
+
+ return bestVelocity;
+ }
+
+ ///
+ public override void Reset()
+ {
+ base.Reset();
+ SendMessage(new ShortMessage(Convert.ToByte(0xB0), Convert.ToByte(0), Convert.ToByte(0)));
+ }
+
+ #endregion
+ }
+}
diff --git a/RGB.NET.Devices.Novation/Helper/DictionaryExtension.cs b/RGB.NET.Devices.Novation/Helper/DictionaryExtension.cs
deleted file mode 100644
index 607ad97..0000000
--- a/RGB.NET.Devices.Novation/Helper/DictionaryExtension.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-
-namespace RGB.NET.Devices.Novation
-{
- internal static class DictionaryExtension
- {
- public static Dictionary SwapKeyValue(this Dictionary dictionary) => dictionary.ToDictionary(x => x.Value, x => x.Key);
- }
-}
diff --git a/RGB.NET.Devices.Novation/Helper/EnumExtension.cs b/RGB.NET.Devices.Novation/Helper/EnumExtension.cs
index 9be8305..a3f432a 100644
--- a/RGB.NET.Devices.Novation/Helper/EnumExtension.cs
+++ b/RGB.NET.Devices.Novation/Helper/EnumExtension.cs
@@ -23,6 +23,13 @@ namespace RGB.NET.Devices.Novation
/// The value of the of the source.
internal static NovationColorCapabilities GetColorCapability(this Enum source) => source.GetAttribute()?.Capability ?? NovationColorCapabilities.None;
+ ///
+ /// Gets the value of the .
+ ///
+ /// The enum value to get the description from.
+ /// The value of the of the source.
+ internal static LedIdMappings GetLedIdMapping(this Enum source) => source.GetAttribute()?.LedIdMapping ?? LedIdMappings.Current;
+
///
/// Gets the attribute of type T.
///
diff --git a/RGB.NET.Devices.Novation/Helper/NovationLedIdExtension.cs b/RGB.NET.Devices.Novation/Helper/NovationLedIdExtension.cs
deleted file mode 100644
index 7d8556c..0000000
--- a/RGB.NET.Devices.Novation/Helper/NovationLedIdExtension.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-namespace RGB.NET.Devices.Novation
-{
- ///
- /// Offers some extensions and helper-methods for NovationLedId related things.
- ///
- public static class NovationLedIdExtension
- {
- #region Methods
-
- ///
- /// Gets the status-flag associated with the id.
- ///
- /// The whose status-flag should be determinated.
- /// The status-flag of the .
- public static int GetStatus(this NovationLedId ledId) => ((int)ledId & 0xFF00) >> 8;
-
- ///
- /// Gets the id associated with the id.
- ///
- /// The whose idshould be determinated.
- /// The id of the .
- public static int GetId(this NovationLedId ledId) => (int)ledId & 0x00FF;
-
- ///
- /// Tests if the given is a grid-button.
- ///
- /// the to test.
- /// true if is a grid-button; otherwise, false .
- public static bool IsGrid(this NovationLedId ledId) => (ledId.GetStatus() == 0x90) && ((ledId.GetId() / 0x10) < 0x08) && ((ledId.GetId() % 0x10) < 0x08);
-
- ///
- /// Tests if the given is a scene-button.
- ///
- /// the to test.
- /// true if is a scene-button; otherwise, false .
- public static bool IsScene(this NovationLedId ledId) => (ledId.GetStatus() == 0x90) && ((ledId.GetId() / 0x10) < 0x08) && ((ledId.GetId() % 0x10) == 0x09);
-
- ///
- /// Tests if the given is custom-button.
- ///
- /// the to test.
- /// true if is a custom-button; otherwise, false .
- public static bool IsCustom(this NovationLedId ledId) => (ledId.GetStatus() == 0xB0) && ((ledId.GetId() / 0x10) == 0x06) && ((ledId.GetId() % 0x10) > 0x07);
-
- #endregion
- }
-}
diff --git a/RGB.NET.Devices.Novation/Launchpad/LaunchpadIdMapping.cs b/RGB.NET.Devices.Novation/Launchpad/LaunchpadIdMapping.cs
index 8d90205..39aa29f 100644
--- a/RGB.NET.Devices.Novation/Launchpad/LaunchpadIdMapping.cs
+++ b/RGB.NET.Devices.Novation/Launchpad/LaunchpadIdMapping.cs
@@ -5,92 +5,180 @@ namespace RGB.NET.Devices.Novation
{
internal static class LaunchpadIdMapping
{
- internal static readonly Dictionary DEFAULT = new Dictionary
+ internal static readonly Dictionary LEGACY = new Dictionary
{
- { LedId.Invalid, NovationLedId.Invalid },
+ { LedId.Invalid, (0x00, 0xFF, 8, 0) },
- { LedId.LedMatrix1, NovationLedId.Grid1 },
- { LedId.LedMatrix2, NovationLedId.Grid2 },
- { LedId.LedMatrix3, NovationLedId.Grid3 },
- { LedId.LedMatrix4, NovationLedId.Grid4 },
- { LedId.LedMatrix5, NovationLedId.Grid5 },
- { LedId.LedMatrix6, NovationLedId.Grid6 },
- { LedId.LedMatrix7, NovationLedId.Grid7 },
- { LedId.LedMatrix8, NovationLedId.Grid8 },
- { LedId.LedMatrix9, NovationLedId.Grid9 },
- { LedId.LedMatrix10, NovationLedId.Grid10 },
- { LedId.LedMatrix11, NovationLedId.Grid11 },
- { LedId.LedMatrix12, NovationLedId.Grid12 },
- { LedId.LedMatrix13, NovationLedId.Grid13 },
- { LedId.LedMatrix14, NovationLedId.Grid14 },
- { LedId.LedMatrix15, NovationLedId.Grid15 },
- { LedId.LedMatrix16, NovationLedId.Grid16 },
- { LedId.LedMatrix17, NovationLedId.Grid17 },
- { LedId.LedMatrix18, NovationLedId.Grid18 },
- { LedId.LedMatrix19, NovationLedId.Grid19 },
- { LedId.LedMatrix20, NovationLedId.Grid20 },
- { LedId.LedMatrix21, NovationLedId.Grid21 },
- { LedId.LedMatrix22, NovationLedId.Grid22 },
- { LedId.LedMatrix23, NovationLedId.Grid23 },
- { LedId.LedMatrix24, NovationLedId.Grid24 },
- { LedId.LedMatrix25, NovationLedId.Grid25 },
- { LedId.LedMatrix26, NovationLedId.Grid26 },
- { LedId.LedMatrix27, NovationLedId.Grid27 },
- { LedId.LedMatrix28, NovationLedId.Grid28 },
- { LedId.LedMatrix29, NovationLedId.Grid29 },
- { LedId.LedMatrix30, NovationLedId.Grid30 },
- { LedId.LedMatrix31, NovationLedId.Grid31 },
- { LedId.LedMatrix32, NovationLedId.Grid32 },
- { LedId.LedMatrix33, NovationLedId.Grid33 },
- { LedId.LedMatrix34, NovationLedId.Grid34 },
- { LedId.LedMatrix35, NovationLedId.Grid35 },
- { LedId.LedMatrix36, NovationLedId.Grid36 },
- { LedId.LedMatrix37, NovationLedId.Grid37 },
- { LedId.LedMatrix38, NovationLedId.Grid38 },
- { LedId.LedMatrix39, NovationLedId.Grid39 },
- { LedId.LedMatrix40, NovationLedId.Grid40 },
- { LedId.LedMatrix41, NovationLedId.Grid41 },
- { LedId.LedMatrix42, NovationLedId.Grid42 },
- { LedId.LedMatrix43, NovationLedId.Grid43 },
- { LedId.LedMatrix44, NovationLedId.Grid44 },
- { LedId.LedMatrix45, NovationLedId.Grid45 },
- { LedId.LedMatrix46, NovationLedId.Grid46 },
- { LedId.LedMatrix47, NovationLedId.Grid47 },
- { LedId.LedMatrix48, NovationLedId.Grid48 },
- { LedId.LedMatrix49, NovationLedId.Grid49 },
- { LedId.LedMatrix50, NovationLedId.Grid50 },
- { LedId.LedMatrix51, NovationLedId.Grid51 },
- { LedId.LedMatrix52, NovationLedId.Grid52 },
- { LedId.LedMatrix53, NovationLedId.Grid53 },
- { LedId.LedMatrix54, NovationLedId.Grid54 },
- { LedId.LedMatrix55, NovationLedId.Grid55 },
- { LedId.LedMatrix56, NovationLedId.Grid56 },
- { LedId.LedMatrix57, NovationLedId.Grid57 },
- { LedId.LedMatrix58, NovationLedId.Grid58 },
- { LedId.LedMatrix59, NovationLedId.Grid59 },
- { LedId.LedMatrix60, NovationLedId.Grid60 },
- { LedId.LedMatrix61, NovationLedId.Grid61 },
- { LedId.LedMatrix62, NovationLedId.Grid62 },
- { LedId.LedMatrix63, NovationLedId.Grid63 },
- { LedId.LedMatrix64, NovationLedId.Grid64 },
+ { LedId.LedMatrix1, (0x90, 0x00, 0, 1) },
+ { LedId.LedMatrix2, (0x90, 0x01, 1, 1) },
+ { LedId.LedMatrix3, (0x90, 0x02, 2, 1) },
+ { LedId.LedMatrix4, (0x90, 0x03, 3, 1) },
+ { LedId.LedMatrix5, (0x90, 0x04, 4, 1) },
+ { LedId.LedMatrix6, (0x90, 0x05, 5, 1) },
+ { LedId.LedMatrix7, (0x90, 0x06, 6, 1) },
+ { LedId.LedMatrix8, (0x90, 0x07, 7, 1) },
+ { LedId.LedMatrix9, (0x90, 0x10, 0, 2) },
+ { LedId.LedMatrix10, (0x90, 0x11, 1, 2) },
+ { LedId.LedMatrix11, (0x90, 0x12, 2, 2) },
+ { LedId.LedMatrix12, (0x90, 0x13, 3, 2) },
+ { LedId.LedMatrix13, (0x90, 0x14, 4, 2) },
+ { LedId.LedMatrix14, (0x90, 0x15, 5, 2) },
+ { LedId.LedMatrix15, (0x90, 0x16, 6, 2) },
+ { LedId.LedMatrix16, (0x90, 0x17, 7, 2) },
+ { LedId.LedMatrix17, (0x90, 0x20, 0, 3) },
+ { LedId.LedMatrix18, (0x90, 0x21, 1, 3) },
+ { LedId.LedMatrix19, (0x90, 0x22, 2, 3) },
+ { LedId.LedMatrix20, (0x90, 0x23, 3, 3) },
+ { LedId.LedMatrix21, (0x90, 0x24, 4, 3) },
+ { LedId.LedMatrix22, (0x90, 0x25, 5, 3) },
+ { LedId.LedMatrix23, (0x90, 0x26, 6, 3) },
+ { LedId.LedMatrix24, (0x90, 0x27, 7, 3) },
+ { LedId.LedMatrix25, (0x90, 0x30, 0, 4) },
+ { LedId.LedMatrix26, (0x90, 0x31, 1, 4) },
+ { LedId.LedMatrix27, (0x90, 0x32, 2, 4) },
+ { LedId.LedMatrix28, (0x90, 0x33, 3, 4) },
+ { LedId.LedMatrix29, (0x90, 0x34, 4, 4) },
+ { LedId.LedMatrix30, (0x90, 0x35, 5, 4) },
+ { LedId.LedMatrix31, (0x90, 0x36, 6, 4) },
+ { LedId.LedMatrix32, (0x90, 0x37, 7, 4) },
+ { LedId.LedMatrix33, (0x90, 0x40, 0, 5) },
+ { LedId.LedMatrix34, (0x90, 0x41, 1, 5) },
+ { LedId.LedMatrix35, (0x90, 0x42, 2, 5) },
+ { LedId.LedMatrix36, (0x90, 0x43, 3, 5) },
+ { LedId.LedMatrix37, (0x90, 0x44, 4, 5) },
+ { LedId.LedMatrix38, (0x90, 0x45, 5, 5) },
+ { LedId.LedMatrix39, (0x90, 0x46, 6, 5) },
+ { LedId.LedMatrix40, (0x90, 0x47, 7, 5) },
+ { LedId.LedMatrix41, (0x90, 0x50, 0, 6) },
+ { LedId.LedMatrix42, (0x90, 0x51, 1, 6) },
+ { LedId.LedMatrix43, (0x90, 0x52, 2, 6) },
+ { LedId.LedMatrix44, (0x90, 0x53, 3, 6) },
+ { LedId.LedMatrix45, (0x90, 0x54, 4, 6) },
+ { LedId.LedMatrix46, (0x90, 0x55, 5, 6) },
+ { LedId.LedMatrix47, (0x90, 0x56, 6, 6) },
+ { LedId.LedMatrix48, (0x90, 0x57, 7, 6) },
+ { LedId.LedMatrix49, (0x90, 0x60, 0, 7) },
+ { LedId.LedMatrix50, (0x90, 0x61, 1, 7) },
+ { LedId.LedMatrix51, (0x90, 0x62, 2, 7) },
+ { LedId.LedMatrix52, (0x90, 0x63, 3, 7) },
+ { LedId.LedMatrix53, (0x90, 0x64, 4, 7) },
+ { LedId.LedMatrix54, (0x90, 0x65, 5, 7) },
+ { LedId.LedMatrix55, (0x90, 0x66, 6, 7) },
+ { LedId.LedMatrix56, (0x90, 0x67, 7, 7) },
+ { LedId.LedMatrix57, (0x90, 0x70, 0, 8) },
+ { LedId.LedMatrix58, (0x90, 0x71, 1, 8) },
+ { LedId.LedMatrix59, (0x90, 0x72, 2, 8) },
+ { LedId.LedMatrix60, (0x90, 0x73, 3, 8) },
+ { LedId.LedMatrix61, (0x90, 0x74, 4, 8) },
+ { LedId.LedMatrix62, (0x90, 0x75, 5, 8) },
+ { LedId.LedMatrix63, (0x90, 0x76, 6, 8) },
+ { LedId.LedMatrix64, (0x90, 0x77, 7, 8) },
- { LedId.Custom1, NovationLedId.Up },
- { LedId.Custom2, NovationLedId.Down },
- { LedId.Custom3, NovationLedId.Left },
- { LedId.Custom4, NovationLedId.Right },
- { LedId.Custom5, NovationLedId.Session },
- { LedId.Custom6, NovationLedId.User1 },
- { LedId.Custom7, NovationLedId.User2 },
- { LedId.Custom8, NovationLedId.Mix },
+ { LedId.Custom1, (0xB0, 0x68, 0, 0) }, // Up
+ { LedId.Custom2, (0xB0, 0x69, 1, 0) }, // Down
+ { LedId.Custom3, (0xB0, 0x6A, 2, 0) }, // Left
+ { LedId.Custom4, (0xB0, 0x6B, 3, 0) }, // Right
+ { LedId.Custom5, (0xB0, 0x6C, 4, 0) }, // Session
+ { LedId.Custom6, (0xB0, 0x6D, 5, 0) }, // User 1
+ { LedId.Custom7, (0xB0, 0x6E, 6, 0) }, // User 2
+ { LedId.Custom8, (0xB0, 0x6F, 7, 0) }, // Mix
- { LedId.Custom9, NovationLedId.Scene1 },
- { LedId.Custom10, NovationLedId.Scene2 },
- { LedId.Custom11, NovationLedId.Scene3 },
- { LedId.Custom12, NovationLedId.Scene4 },
- { LedId.Custom13, NovationLedId.Scene5 },
- { LedId.Custom14, NovationLedId.Scene6 },
- { LedId.Custom15, NovationLedId.Scene7 },
- { LedId.Custom16, NovationLedId.Scene8 },
+ { LedId.Custom9, (0x90, 0x08, 8, 1) }, //Scene1
+ { LedId.Custom10, (0x90, 0x18, 8, 2) }, //Scene2
+ { LedId.Custom11, (0x90, 0x28, 8, 3) }, //Scene3
+ { LedId.Custom12, (0x90, 0x38, 8, 4) }, //Scene4
+ { LedId.Custom13, (0x90, 0x48, 8, 5) }, //Scene5
+ { LedId.Custom14, (0x90, 0x58, 8, 6) }, //Scene6
+ { LedId.Custom15, (0x90, 0x68, 8, 7) }, //Scene7
+ { LedId.Custom16, (0x90, 0x78, 8, 8) }, //Scene8
+ };
+
+ internal static readonly Dictionary CURRENT = new Dictionary
+ {
+ { LedId.Invalid, (0x00, 0xFF, 8, 0) },
+
+ { LedId.LedMatrix1, (0x90, 81, 0, 1) },
+ { LedId.LedMatrix2, (0x90, 82, 1, 1) },
+ { LedId.LedMatrix3, (0x90, 83, 2, 1) },
+ { LedId.LedMatrix4, (0x90, 84, 3, 1) },
+ { LedId.LedMatrix5, (0x90, 85, 4, 1) },
+ { LedId.LedMatrix6, (0x90, 86, 5, 1) },
+ { LedId.LedMatrix7, (0x90, 87, 6, 1) },
+ { LedId.LedMatrix8, (0x90, 88, 7, 1) },
+ { LedId.LedMatrix9, (0x90, 71, 0, 2) },
+ { LedId.LedMatrix10, (0x90, 72, 1, 2) },
+ { LedId.LedMatrix11, (0x90, 73, 2, 2) },
+ { LedId.LedMatrix12, (0x90, 74, 3, 2) },
+ { LedId.LedMatrix13, (0x90, 75, 4, 2) },
+ { LedId.LedMatrix14, (0x90, 76, 5, 2) },
+ { LedId.LedMatrix15, (0x90, 77, 6, 2) },
+ { LedId.LedMatrix16, (0x90, 78, 7, 2) },
+ { LedId.LedMatrix17, (0x90, 61, 0, 3) },
+ { LedId.LedMatrix18, (0x90, 62, 1, 3) },
+ { LedId.LedMatrix19, (0x90, 63, 2, 3) },
+ { LedId.LedMatrix20, (0x90, 64, 3, 3) },
+ { LedId.LedMatrix21, (0x90, 65, 4, 3) },
+ { LedId.LedMatrix22, (0x90, 66, 5, 3) },
+ { LedId.LedMatrix23, (0x90, 67, 6, 3) },
+ { LedId.LedMatrix24, (0x90, 68, 7, 3) },
+ { LedId.LedMatrix25, (0x90, 51, 0, 4) },
+ { LedId.LedMatrix26, (0x90, 52, 1, 4) },
+ { LedId.LedMatrix27, (0x90, 53, 2, 4) },
+ { LedId.LedMatrix28, (0x90, 54, 3, 4) },
+ { LedId.LedMatrix29, (0x90, 55, 4, 4) },
+ { LedId.LedMatrix30, (0x90, 56, 5, 4) },
+ { LedId.LedMatrix31, (0x90, 57, 6, 4) },
+ { LedId.LedMatrix32, (0x90, 58, 7, 4) },
+ { LedId.LedMatrix33, (0x90, 41, 0, 5) },
+ { LedId.LedMatrix34, (0x90, 42, 1, 5) },
+ { LedId.LedMatrix35, (0x90, 43, 2, 5) },
+ { LedId.LedMatrix36, (0x90, 44, 3, 5) },
+ { LedId.LedMatrix37, (0x90, 45, 4, 5) },
+ { LedId.LedMatrix38, (0x90, 46, 5, 5) },
+ { LedId.LedMatrix39, (0x90, 47, 6, 5) },
+ { LedId.LedMatrix40, (0x90, 48, 7, 5) },
+ { LedId.LedMatrix41, (0x90, 31, 0, 6) },
+ { LedId.LedMatrix42, (0x90, 32, 1, 6) },
+ { LedId.LedMatrix43, (0x90, 33, 2, 6) },
+ { LedId.LedMatrix44, (0x90, 34, 3, 6) },
+ { LedId.LedMatrix45, (0x90, 35, 4, 6) },
+ { LedId.LedMatrix46, (0x90, 36, 5, 6) },
+ { LedId.LedMatrix47, (0x90, 37, 6, 6) },
+ { LedId.LedMatrix48, (0x90, 38, 7, 6) },
+ { LedId.LedMatrix49, (0x90, 21, 0, 7) },
+ { LedId.LedMatrix50, (0x90, 22, 1, 7) },
+ { LedId.LedMatrix51, (0x90, 23, 2, 7) },
+ { LedId.LedMatrix52, (0x90, 24, 3, 7) },
+ { LedId.LedMatrix53, (0x90, 25, 4, 7) },
+ { LedId.LedMatrix54, (0x90, 26, 5, 7) },
+ { LedId.LedMatrix55, (0x90, 27, 6, 7) },
+ { LedId.LedMatrix56, (0x90, 28, 7, 7) },
+ { LedId.LedMatrix57, (0x90, 11, 0, 8) },
+ { LedId.LedMatrix58, (0x90, 12, 1, 8) },
+ { LedId.LedMatrix59, (0x90, 13, 2, 8) },
+ { LedId.LedMatrix60, (0x90, 14, 3, 8) },
+ { LedId.LedMatrix61, (0x90, 15, 4, 8) },
+ { LedId.LedMatrix62, (0x90, 16, 5, 8) },
+ { LedId.LedMatrix63, (0x90, 17, 6, 8) },
+ { LedId.LedMatrix64, (0x90, 18, 7, 8) },
+
+ { LedId.Custom1, (0xB0, 104, 0, 0) }, // Up
+ { LedId.Custom2, (0xB0, 105, 1, 0) }, // Down
+ { LedId.Custom3, (0xB0, 106, 2, 0) }, // Left
+ { LedId.Custom4, (0xB0, 107, 3, 0) }, // Right
+ { LedId.Custom5, (0xB0, 108, 4, 0) }, // Session
+ { LedId.Custom6, (0xB0, 109, 5, 0) }, // User 1
+ { LedId.Custom7, (0xB0, 110, 6, 0) }, // User 2
+ { LedId.Custom8, (0xB0, 111, 7, 0) }, // Mix
+
+ { LedId.Custom9, (0x90, 89, 8, 1) }, //Scene1
+ { LedId.Custom10, (0x90, 79, 8, 2) }, //Scene2
+ { LedId.Custom11, (0x90, 69, 8, 3) }, //Scene3
+ { LedId.Custom12, (0x90, 59, 8, 4) }, //Scene4
+ { LedId.Custom13, (0x90, 49, 8, 5) }, //Scene5
+ { LedId.Custom14, (0x90, 39, 8, 6) }, //Scene6
+ { LedId.Custom15, (0x90, 29, 8, 7) }, //Scene7
+ { LedId.Custom16, (0x90, 19, 8, 8) }, //Scene8
};
}
}
diff --git a/RGB.NET.Devices.Novation/Launchpad/LedIdMappings.cs b/RGB.NET.Devices.Novation/Launchpad/LedIdMappings.cs
new file mode 100644
index 0000000..e264f1a
--- /dev/null
+++ b/RGB.NET.Devices.Novation/Launchpad/LedIdMappings.cs
@@ -0,0 +1,8 @@
+namespace RGB.NET.Devices.Novation
+{
+ internal enum LedIdMappings
+ {
+ Current,
+ Legacy
+ }
+}
diff --git a/RGB.NET.Devices.Novation/Launchpad/NovationLaunchpadRGBDevice.cs b/RGB.NET.Devices.Novation/Launchpad/NovationLaunchpadRGBDevice.cs
index 6f58e93..e00f114 100644
--- a/RGB.NET.Devices.Novation/Launchpad/NovationLaunchpadRGBDevice.cs
+++ b/RGB.NET.Devices.Novation/Launchpad/NovationLaunchpadRGBDevice.cs
@@ -4,11 +4,11 @@ using RGB.NET.Core;
namespace RGB.NET.Devices.Novation
{
- ///
+ ///
///
/// Represents a Novation launchpad.
///
- public class NovationLaunchpadRGBDevice : NovationRGBDevice
+ public class NovationLaunchpadRGBDevice : NovationRGBDevice, ILedMatrix
{
#region Constructors
@@ -28,22 +28,13 @@ namespace RGB.NET.Devices.Novation
///
protected override void InitializeLayout()
{
- Dictionary mapping = LaunchpadIdMapping.DEFAULT.SwapKeyValue();
+ Dictionary mapping = GetDeviceMapping();
- //TODO DarthAffe 15.08.2017: Check if all launchpads are using the same basic layout
const int BUTTON_SIZE = 20;
- foreach (NovationLedId ledId in Enum.GetValues(typeof(NovationLedId)))
+ foreach (LedId ledId in mapping.Keys)
{
- Rectangle rectangle;
- if (ledId.IsCustom())
- rectangle = new Rectangle(BUTTON_SIZE * (ledId.GetId() - 0x68), 0, BUTTON_SIZE, BUTTON_SIZE);
- else if (ledId.IsScene())
- rectangle = new Rectangle(8 * BUTTON_SIZE, BUTTON_SIZE * (((int)ledId.GetId() / 0x10) + 1), BUTTON_SIZE, BUTTON_SIZE);
- else if (ledId.IsGrid())
- rectangle = new Rectangle(BUTTON_SIZE * ((int)ledId.GetId() % 0x10), BUTTON_SIZE * (((int)ledId.GetId() / 0x10) + 1), BUTTON_SIZE, BUTTON_SIZE);
- else continue;
-
- InitializeLed(mapping[ledId], rectangle);
+ (_, _, int x, int y) = mapping[ledId];
+ InitializeLed(ledId, new Point(BUTTON_SIZE * x, BUTTON_SIZE * y), new Size(BUTTON_SIZE));
}
string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper();
@@ -51,7 +42,15 @@ namespace RGB.NET.Devices.Novation
}
///
- protected override object CreateLedCustomData(LedId ledId) => LaunchpadIdMapping.DEFAULT.TryGetValue(ledId, out NovationLedId novationLedId) ? novationLedId : NovationLedId.Invalid;
+ protected override object CreateLedCustomData(LedId ledId) => GetDeviceMapping().TryGetValue(ledId, out (byte mode, byte id, int _, int __) data) ? (data.mode, data.id) : ((byte)0x00, (byte)0x00);
+
+ protected virtual Dictionary GetDeviceMapping()
+ => DeviceInfo.LedIdMapping switch
+ {
+ LedIdMappings.Current => LaunchpadIdMapping.CURRENT,
+ LedIdMappings.Legacy => LaunchpadIdMapping.LEGACY,
+ _ => throw new ArgumentOutOfRangeException()
+ };
#endregion
}
diff --git a/RGB.NET.Devices.Novation/Launchpad/NovationLaunchpadRGBDeviceInfo.cs b/RGB.NET.Devices.Novation/Launchpad/NovationLaunchpadRGBDeviceInfo.cs
index b854c26..ce86e05 100644
--- a/RGB.NET.Devices.Novation/Launchpad/NovationLaunchpadRGBDeviceInfo.cs
+++ b/RGB.NET.Devices.Novation/Launchpad/NovationLaunchpadRGBDeviceInfo.cs
@@ -8,6 +8,12 @@ namespace RGB.NET.Devices.Novation
///
public class NovationLaunchpadRGBDeviceInfo : NovationRGBDeviceInfo
{
+ #region Properties & Fields
+
+ internal LedIdMappings LedIdMapping { get; }
+
+ #endregion
+
#region Constructors
///
@@ -17,9 +23,12 @@ namespace RGB.NET.Devices.Novation
/// The represented device model.
///
/// The of the .
- internal NovationLaunchpadRGBDeviceInfo(string model, int deviceId, NovationColorCapabilities colorCapabilities)
+ internal NovationLaunchpadRGBDeviceInfo(string model, int deviceId, NovationColorCapabilities colorCapabilities,
+ LedIdMappings ledIdMapping)
: base(RGBDeviceType.LedMatrix, model, deviceId, colorCapabilities)
- { }
+ {
+ this.LedIdMapping = ledIdMapping;
+ }
#endregion
}
diff --git a/RGB.NET.Devices.Novation/NovationDeviceProvider.cs b/RGB.NET.Devices.Novation/NovationDeviceProvider.cs
index 5ad614f..4e031fe 100644
--- a/RGB.NET.Devices.Novation/NovationDeviceProvider.cs
+++ b/RGB.NET.Devices.Novation/NovationDeviceProvider.cs
@@ -85,11 +85,14 @@ namespace RGB.NET.Devices.Novation
NovationDevices? deviceId = (NovationDevices?)Enum.GetValues(typeof(NovationDevices))
.Cast()
- .FirstOrDefault(x => string.Equals(x.GetDeviceId(), outCaps.name, StringComparison.OrdinalIgnoreCase));
+ .FirstOrDefault(x => x.GetDeviceId().ToUpperInvariant().Contains(outCaps.name.ToUpperInvariant()));
if (deviceId == null) continue;
- INovationRGBDevice device = new NovationLaunchpadRGBDevice(new NovationLaunchpadRGBDeviceInfo(outCaps.name, index, deviceId.GetColorCapability()));
+ NovationColorCapabilities colorCapability = deviceId.GetColorCapability();
+ if (colorCapability == NovationColorCapabilities.None) continue;
+
+ INovationRGBDevice device = new NovationLaunchpadRGBDevice(new NovationLaunchpadRGBDeviceInfo(outCaps.name, index, colorCapability, deviceId.GetLedIdMapping()));
device.Initialize(UpdateTrigger);
devices.Add(device);
}
@@ -122,7 +125,10 @@ namespace RGB.NET.Devices.Novation
///
public void Dispose()
- { }
+ {
+ try { UpdateTrigger?.Dispose(); }
+ catch { /* at least we tried */ }
+ }
#endregion
}
diff --git a/RGB.NET.Devices.Novation/RGB.NET.Devices.Novation.csproj b/RGB.NET.Devices.Novation/RGB.NET.Devices.Novation.csproj
index 476f0ad..abd09fa 100644
--- a/RGB.NET.Devices.Novation/RGB.NET.Devices.Novation.csproj
+++ b/RGB.NET.Devices.Novation/RGB.NET.Devices.Novation.csproj
@@ -14,8 +14,8 @@
RGB.NET.Devices.Novation
Novation-Device-Implementations of RGB.NET
Novation-Device-Implementations of RGB.NET, a C# (.NET) library for accessing various RGB-peripherals
- Copyright © Wyrez 2017
- Copyright © Wyrez 2017
+ Copyright © Darth Affe 2020
+ Copyright © Darth Affe 2020
http://lib.arge.be/icon.png
https://github.com/DarthAffe/RGB.NET
https://raw.githubusercontent.com/DarthAffe/RGB.NET/master/LICENSE
@@ -64,6 +64,6 @@
-
+
\ No newline at end of file
diff --git a/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkRGBDevice.cs b/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkRGBDevice.cs
index 79745d4..853b222 100644
--- a/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkRGBDevice.cs
+++ b/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkRGBDevice.cs
@@ -6,11 +6,11 @@ using RGB.NET.Devices.Razer.Native;
namespace RGB.NET.Devices.Razer
{
- ///
+ ///
///
/// Represents a razer chroma link.
///
- public class RazerChromaLinkRGBDevice : RazerRGBDevice
+ public class RazerChromaLinkRGBDevice : RazerRGBDevice, ILedStripe
{
#region Constructors
diff --git a/RGB.NET.Devices.Razer/Generic/Devices.cs b/RGB.NET.Devices.Razer/Generic/Devices.cs
index 76b5923..a1eeeff 100644
--- a/RGB.NET.Devices.Razer/Generic/Devices.cs
+++ b/RGB.NET.Devices.Razer/Generic/Devices.cs
@@ -17,7 +17,9 @@ namespace RGB.NET.Devices.Razer
(new Guid("C83BDFE8-E7FC-40E0-99DB-872E23F19891"), "Razer Blade Stealth"),
(new Guid("F2BEDFAF-A0FE-4651-9D41-B6CE603A3DDD"), "Razer Blade"),
(new Guid("A73AC338-F0E5-4BF7-91AE-DD1F7E1737A5"), "Razer Blade Pro"),
- (new Guid("608E743F-B402-44BD-A7A6-7AA9F574ECF4"), "Razer Blackwidow Chroma v2")
+ (new Guid("608E743F-B402-44BD-A7A6-7AA9F574ECF4"), "Razer Blackwidow Chroma v2"),
+ (new Guid("F85E7473-8F03-45B6-A16E-CE26CB8D2441"), "Razer Huntsman"),
+ (new Guid("16BB5ABD-C1CD-4CB3-BDF7-62438748BD98"), "Razer Blackwidow Elite")
};
public static readonly List<(Guid guid, string model)> MICE = new List<(Guid guid, string model)>
@@ -37,7 +39,8 @@ namespace RGB.NET.Devices.Razer
{
(new Guid("DF3164D7-5408-4A0E-8A7F-A7412F26BEBF"), "Razer ManO'War"),
(new Guid("CD1E09A5-D5E6-4A6C-A93B-E6D9BF1D2092"), "Razer Kraken 7.1 Chroma"),
- (new Guid("7FB8A36E-9E74-4BB3-8C86-CAC7F7891EBD"), "Razer Kraken 7.1 Chroma Refresh")
+ (new Guid("7FB8A36E-9E74-4BB3-8C86-CAC7F7891EBD"), "Razer Kraken 7.1 Chroma Refresh"),
+ (new Guid("FB357780-4617-43A7-960F-D1190ED54806"), "Razer Kraken Kitty")
};
public static readonly List<(Guid guid, string model)> MOUSEMATS = new List<(Guid guid, string model)>
diff --git a/RGB.NET.Devices.Razer/Generic/RazerRGBDevice.cs b/RGB.NET.Devices.Razer/Generic/RazerRGBDevice.cs
index 525dd58..e537caf 100644
--- a/RGB.NET.Devices.Razer/Generic/RazerRGBDevice.cs
+++ b/RGB.NET.Devices.Razer/Generic/RazerRGBDevice.cs
@@ -81,6 +81,15 @@ namespace RGB.NET.Devices.Razer
///
public void Reset() => UpdateQueue.Reset();
+ ///
+ public override void Dispose()
+ {
+ try { UpdateQueue?.Dispose(); }
+ catch { /* at least we tried */ }
+
+ base.Dispose();
+ }
+
#endregion
}
}
diff --git a/RGB.NET.Devices.Razer/Headset/RazerHeadsetRGBDevice.cs b/RGB.NET.Devices.Razer/Headset/RazerHeadsetRGBDevice.cs
index fb332dc..25fbfd4 100644
--- a/RGB.NET.Devices.Razer/Headset/RazerHeadsetRGBDevice.cs
+++ b/RGB.NET.Devices.Razer/Headset/RazerHeadsetRGBDevice.cs
@@ -6,11 +6,11 @@ using RGB.NET.Devices.Razer.Native;
namespace RGB.NET.Devices.Razer
{
- ///
+ ///
///
/// Represents a razer headset.
///
- public class RazerHeadsetRGBDevice : RazerRGBDevice
+ public class RazerHeadsetRGBDevice : RazerRGBDevice, IHeadset
{
#region Constructors
diff --git a/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardRGBDevice.cs b/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardRGBDevice.cs
index 763fd47..8c6aab6 100644
--- a/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardRGBDevice.cs
+++ b/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardRGBDevice.cs
@@ -6,11 +6,11 @@ using RGB.NET.Devices.Razer.Native;
namespace RGB.NET.Devices.Razer
{
- ///
+ ///
///
/// Represents a razer keyboard.
///
- public class RazerKeyboardRGBDevice : RazerRGBDevice
+ public class RazerKeyboardRGBDevice : RazerRGBDevice, IKeyboard
{
#region Constructors
diff --git a/RGB.NET.Devices.Razer/Keypad/RazerKeypadRGBDevice.cs b/RGB.NET.Devices.Razer/Keypad/RazerKeypadRGBDevice.cs
index 01f1820..be86e2d 100644
--- a/RGB.NET.Devices.Razer/Keypad/RazerKeypadRGBDevice.cs
+++ b/RGB.NET.Devices.Razer/Keypad/RazerKeypadRGBDevice.cs
@@ -6,11 +6,11 @@ using RGB.NET.Devices.Razer.Native;
namespace RGB.NET.Devices.Razer
{
- ///
+ ///
///
/// Represents a razer keypad.
///
- public class RazerKeypadRGBDevice : RazerRGBDevice
+ public class RazerKeypadRGBDevice : RazerRGBDevice, IKeypad
{
#region Constructors
diff --git a/RGB.NET.Devices.Razer/Mouse/RazerMouseRGBDevice.cs b/RGB.NET.Devices.Razer/Mouse/RazerMouseRGBDevice.cs
index 4516f15..6562467 100644
--- a/RGB.NET.Devices.Razer/Mouse/RazerMouseRGBDevice.cs
+++ b/RGB.NET.Devices.Razer/Mouse/RazerMouseRGBDevice.cs
@@ -6,11 +6,11 @@ using RGB.NET.Devices.Razer.Native;
namespace RGB.NET.Devices.Razer
{
- ///
+ ///
///
/// Represents a razer mouse.
///
- public class RazerMouseRGBDevice : RazerRGBDevice
+ public class RazerMouseRGBDevice : RazerRGBDevice, IMouse
{
#region Constructors
diff --git a/RGB.NET.Devices.Razer/Mousepad/RazerMousepadRGBDevice.cs b/RGB.NET.Devices.Razer/Mousepad/RazerMousepadRGBDevice.cs
index 869c67b..d9c4d81 100644
--- a/RGB.NET.Devices.Razer/Mousepad/RazerMousepadRGBDevice.cs
+++ b/RGB.NET.Devices.Razer/Mousepad/RazerMousepadRGBDevice.cs
@@ -6,11 +6,11 @@ using RGB.NET.Devices.Razer.Native;
namespace RGB.NET.Devices.Razer
{
- ///
+ ///
///
/// Represents a razer mousepad.
///
- public class RazerMousepadRGBDevice : RazerRGBDevice
+ public class RazerMousepadRGBDevice : RazerRGBDevice, IMousepad
{
#region Constructors
diff --git a/RGB.NET.Devices.Razer/Native/_RazerSDK.cs b/RGB.NET.Devices.Razer/Native/_RazerSDK.cs
index 17742b3..4802196 100644
--- a/RGB.NET.Devices.Razer/Native/_RazerSDK.cs
+++ b/RGB.NET.Devices.Razer/Native/_RazerSDK.cs
@@ -52,7 +52,7 @@ namespace RGB.NET.Devices.Razer.Native
_deleteEffectPointer = (DeleteEffectPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "DeleteEffect"), typeof(DeleteEffectPointer));
}
- private static void UnloadRazerSDK()
+ internal static void UnloadRazerSDK()
{
if (_dllHandle == IntPtr.Zero) return;
diff --git a/RGB.NET.Devices.Razer/RGB.NET.Devices.Razer.csproj b/RGB.NET.Devices.Razer/RGB.NET.Devices.Razer.csproj
index b1ec9e6..7ed66a5 100644
--- a/RGB.NET.Devices.Razer/RGB.NET.Devices.Razer.csproj
+++ b/RGB.NET.Devices.Razer/RGB.NET.Devices.Razer.csproj
@@ -14,8 +14,8 @@
RGB.NET.Devices.Razer
Razer-Device-Implementations of RGB.NET
Razer-Device-Implementations of RGB.NET, a C# (.NET) library for accessing various RGB-peripherals
- Copyright © Wyrez 2017
- Copyright © Wyrez 2017
+ Copyright © Darth Affe 2020
+ Copyright © Darth Affe 2020
http://lib.arge.be/icon.png
https://github.com/DarthAffe/RGB.NET
https://raw.githubusercontent.com/DarthAffe/RGB.NET/master/LICENSE
@@ -63,6 +63,6 @@
-
+
\ No newline at end of file
diff --git a/RGB.NET.Devices.Razer/RazerDeviceProvider.cs b/RGB.NET.Devices.Razer/RazerDeviceProvider.cs
index 5c9f88b..c49cfcb 100644
--- a/RGB.NET.Devices.Razer/RazerDeviceProvider.cs
+++ b/RGB.NET.Devices.Razer/RazerDeviceProvider.cs
@@ -222,7 +222,17 @@ namespace RGB.NET.Devices.Razer
}
///
- public void Dispose() => TryUnInit();
+ public void Dispose()
+ {
+ try { UpdateTrigger?.Dispose(); }
+ catch { /* at least we tried */ }
+
+ TryUnInit();
+
+ // DarthAffe 03.03.2020: Fails with an access-violation - verify if an unload is already triggered by uninit
+ //try { _RazerSDK.UnloadRazerSDK(); }
+ //catch { /* at least we tried */ }
+ }
#endregion
}
diff --git a/RGB.NET.Devices.Roccat/Native/_ROCCATSDK.cs b/RGB.NET.Devices.Roccat/Native/_ROCCATSDK.cs
index aa59118..21e1644 100644
--- a/RGB.NET.Devices.Roccat/Native/_ROCCATSDK.cs
+++ b/RGB.NET.Devices.Roccat/Native/_ROCCATSDK.cs
@@ -27,11 +27,11 @@ namespace RGB.NET.Devices.Roccat.Native
///
internal static void Reload()
{
- UnloadCUESDK();
- LoadCUESDK();
+ UnloadRoccatSDK();
+ LoadRoccatSDK();
}
- private static void LoadCUESDK()
+ private static void LoadRoccatSDK()
{
if (_dllHandle != IntPtr.Zero) return;
@@ -57,7 +57,7 @@ namespace RGB.NET.Devices.Roccat.Native
_setAllLedSfxPointer = (SetAllLedSfxPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "Set_all_LEDSFX"), typeof(SetAllLedSfxPointer));
}
- private static void UnloadCUESDK()
+ internal static void UnloadRoccatSDK()
{
if (_dllHandle == IntPtr.Zero) return;
diff --git a/RGB.NET.Devices.Roccat/RGB.NET.Devices.Roccat.csproj b/RGB.NET.Devices.Roccat/RGB.NET.Devices.Roccat.csproj
index 51a7d42..f83e1c4 100644
--- a/RGB.NET.Devices.Roccat/RGB.NET.Devices.Roccat.csproj
+++ b/RGB.NET.Devices.Roccat/RGB.NET.Devices.Roccat.csproj
@@ -14,8 +14,8 @@
RGB.NET.Devices.Roccat
Roccat-Device-Implementations of RGB.NET
Roccat-Device-Implementations of RGB.NET, a C# (.NET) library for accessing various RGB-peripherals
- Copyright © Wyrez 2017
- Copyright © Wyrez 2017
+ Copyright © Darth Affe 2020
+ Copyright © Darth Affe 2020
http://lib.arge.be/icon.png
https://github.com/DarthAffe/RGB.NET
https://raw.githubusercontent.com/DarthAffe/RGB.NET/master/LICENSE
@@ -63,6 +63,6 @@
-
+
\ No newline at end of file
diff --git a/RGB.NET.Devices.Roccat/RoccatDeviceProvider.cs b/RGB.NET.Devices.Roccat/RoccatDeviceProvider.cs
index 391a0da..4ad9a9e 100644
--- a/RGB.NET.Devices.Roccat/RoccatDeviceProvider.cs
+++ b/RGB.NET.Devices.Roccat/RoccatDeviceProvider.cs
@@ -114,6 +114,9 @@ namespace RGB.NET.Devices.Roccat
try { _RoccatSDK.UnloadSDK(_sdkHandle); }
catch { /* We tried our best */}
}
+
+ try { _RoccatSDK.UnloadRoccatSDK(); }
+ catch { /* at least we tried */ }
}
#endregion
diff --git a/RGB.NET.Devices.SoIP/Client/SoIPClientRGBDevice.cs b/RGB.NET.Devices.SoIP/Client/SoIPClientRGBDevice.cs
index c3bec0f..38ef9a8 100644
--- a/RGB.NET.Devices.SoIP/Client/SoIPClientRGBDevice.cs
+++ b/RGB.NET.Devices.SoIP/Client/SoIPClientRGBDevice.cs
@@ -7,7 +7,7 @@ using SimpleTCP;
namespace RGB.NET.Devices.SoIP.Client
{
- public class SoIPClientRGBDevice : AbstractRGBDevice, ISoIPRGBDevice
+ public class SoIPClientRGBDevice : AbstractRGBDevice, ISoIPRGBDevice, IUnknownDevice
{
#region Properties & Fields
diff --git a/RGB.NET.Devices.SoIP/FodyWeavers.xml b/RGB.NET.Devices.SoIP/FodyWeavers.xml
index ba40f91..7e25d14 100644
--- a/RGB.NET.Devices.SoIP/FodyWeavers.xml
+++ b/RGB.NET.Devices.SoIP/FodyWeavers.xml
@@ -1,4 +1,4 @@
-
-
-
+
+
+
\ No newline at end of file
diff --git a/RGB.NET.Devices.SoIP/FodyWeavers.xsd b/RGB.NET.Devices.SoIP/FodyWeavers.xsd
new file mode 100644
index 0000000..44a5374
--- /dev/null
+++ b/RGB.NET.Devices.SoIP/FodyWeavers.xsd
@@ -0,0 +1,111 @@
+
+
+
+
+
+
+
+
+
+
+
+ A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks
+
+
+
+
+ A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.
+
+
+
+
+ A list of unmanaged 32 bit assembly names to include, delimited with line breaks.
+
+
+
+
+ A list of unmanaged 64 bit assembly names to include, delimited with line breaks.
+
+
+
+
+ The order of preloaded assemblies, delimited with line breaks.
+
+
+
+
+
+ This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file.
+
+
+
+
+ Controls if .pdbs for reference assemblies are also embedded.
+
+
+
+
+ Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.
+
+
+
+
+ As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.
+
+
+
+
+ Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code.
+
+
+
+
+ Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior.
+
+
+
+
+ A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with |
+
+
+
+
+ A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.
+
+
+
+
+ A list of unmanaged 32 bit assembly names to include, delimited with |.
+
+
+
+
+ A list of unmanaged 64 bit assembly names to include, delimited with |.
+
+
+
+
+ The order of preloaded assemblies, delimited with |.
+
+
+
+
+
+
+
+ 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.
+
+
+
+
+ A comma-separated list of error codes that can be safely ignored in assembly verification.
+
+
+
+
+ 'false' to turn off automatic generation of the XML Schema file.
+
+
+
+
+
\ No newline at end of file
diff --git a/RGB.NET.Devices.SoIP/RGB.NET.Devices.SoIP.csproj b/RGB.NET.Devices.SoIP/RGB.NET.Devices.SoIP.csproj
index 6fd43e8..0816d25 100644
--- a/RGB.NET.Devices.SoIP/RGB.NET.Devices.SoIP.csproj
+++ b/RGB.NET.Devices.SoIP/RGB.NET.Devices.SoIP.csproj
@@ -14,8 +14,8 @@
RGB.NET.Devices.SoIP
SoIP-Device-Implementations of RGB.NET
SoIP-Device-Implementations of RGB.NET, a C# (.NET) library
- Copyright © Wyrez 2017
- Copyright © Wyrez 2017
+ Copyright © Darth Affe 2020
+ Copyright © Darth Affe 2020
http://lib.arge.be/icon.png
https://github.com/DarthAffe/RGB.NET
https://raw.githubusercontent.com/DarthAffe/RGB.NET/master/LICENSE
@@ -59,8 +59,8 @@
-
-
+
+
all
runtime; build; native; contentfiles; analyzers
@@ -72,6 +72,6 @@
-
+
\ No newline at end of file
diff --git a/RGB.NET.Devices.SoIP/Server/SoIPServerRGBDevice.cs b/RGB.NET.Devices.SoIP/Server/SoIPServerRGBDevice.cs
index 5a5285e..5908a1b 100644
--- a/RGB.NET.Devices.SoIP/Server/SoIPServerRGBDevice.cs
+++ b/RGB.NET.Devices.SoIP/Server/SoIPServerRGBDevice.cs
@@ -7,7 +7,7 @@ using SimpleTCP;
namespace RGB.NET.Devices.SoIP.Server
{
- public class SoIPServerRGBDevice : AbstractRGBDevice, ISoIPRGBDevice
+ public class SoIPServerRGBDevice : AbstractRGBDevice, ISoIPRGBDevice, IUnknownDevice
{
#region Properties & Fields
@@ -66,6 +66,9 @@ namespace RGB.NET.Devices.SoIP.Server
///
public override void Dispose()
{
+ try { _updateQueue?.Dispose(); }
+ catch { /* at least we tried */ }
+
base.Dispose();
_tcpServer.Stop();
diff --git a/RGB.NET.Devices.SoIP/SoIPDeviceProvider.cs b/RGB.NET.Devices.SoIP/SoIPDeviceProvider.cs
index 9152b9a..9755cc2 100644
--- a/RGB.NET.Devices.SoIP/SoIPDeviceProvider.cs
+++ b/RGB.NET.Devices.SoIP/SoIPDeviceProvider.cs
@@ -56,7 +56,7 @@ namespace RGB.NET.Devices.SoIP
{
if (_instance != null) throw new InvalidOperationException($"There can be only one instance of type {nameof(SoIPDeviceProvider)}");
_instance = this;
-
+
UpdateTrigger = new DeviceUpdateTrigger();
}
@@ -130,8 +130,8 @@ namespace RGB.NET.Devices.SoIP
///
public void Dispose()
{
- foreach (IRGBDevice device in Devices)
- device.Dispose();
+ try { UpdateTrigger?.Dispose(); }
+ catch { /* at least we tried */ }
}
#endregion
diff --git a/RGB.NET.Devices.SteelSeries/API/SteelSeriesSDK.cs b/RGB.NET.Devices.SteelSeries/API/SteelSeriesSDK.cs
index be7f5ac..bf82309 100644
--- a/RGB.NET.Devices.SteelSeries/API/SteelSeriesSDK.cs
+++ b/RGB.NET.Devices.SteelSeries/API/SteelSeriesSDK.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
+using System.Linq;
using System.Net.Http;
using System.Runtime.InteropServices;
using System.Text;
@@ -16,16 +17,34 @@ namespace RGB.NET.Devices.SteelSeries.API
private const string GAME_NAME = "RGBNET";
private const string GAME_DISPLAYNAME = "RGB.NET";
private const string EVENT_NAME = "UPDATELEDS";
- private const string HANDLER = @"(handler """ + EVENT_NAME + @"""
+ private static readonly string HANDLER = $@"(define (getZone x)
+ (case x
+ {string.Join(Environment.NewLine, Enum.GetValues(typeof(SteelSeriesLedId))
+ .Cast()
+ .Select(x => x.GetAPIName())
+ .Select(ledId => $" ((\"{ledId}\") {ledId}:)"))}
+ ))
+
+(handler ""{EVENT_NAME}""
(lambda (data)
(let* ((device (value: data))
- (zoneData (frame: data))
- (zones (frame-keys zoneData)))
- (do ((zoneDo zones (cdr zoneDo)))
- ((nil? zoneDo))
- (let* ((zone (car zoneDo))
- (color (get-slot zoneData zone)))
- (on-device device show-on-zone: color zone))))))";
+ (zones (zones: data))
+ (colors (colors: data)))
+ (on-device device show-on-zones: colors (map (lambda (x) (getZone x)) zones)))))
+
+(add-event-per-key-zone-use ""{EVENT_NAME}"" ""all"")
+(add-event-zone-use-with-specifier ""{EVENT_NAME}"" ""all"" ""rgb-1-zone"")
+(add-event-zone-use-with-specifier ""{EVENT_NAME}"" ""all"" ""rgb-2-zone"")
+(add-event-zone-use-with-specifier ""{EVENT_NAME}"" ""all"" ""rgb-3-zone"")
+(add-event-zone-use-with-specifier ""{EVENT_NAME}"" ""all"" ""rgb-4-zone"")
+(add-event-zone-use-with-specifier ""{EVENT_NAME}"" ""all"" ""rgb-5-zone"")
+(add-event-zone-use-with-specifier ""{EVENT_NAME}"" ""all"" ""rgb-6-zone"")
+(add-event-zone-use-with-specifier ""{EVENT_NAME}"" ""all"" ""rgb-7-zone"")
+(add-event-zone-use-with-specifier ""{EVENT_NAME}"" ""all"" ""rgb-8-zone"")
+(add-event-zone-use-with-specifier ""{EVENT_NAME}"" ""all"" ""rgb-12-zone"")
+(add-event-zone-use-with-specifier ""{EVENT_NAME}"" ""all"" ""rgb-17-zone"")
+(add-event-zone-use-with-specifier ""{EVENT_NAME}"" ""all"" ""rgb-24-zone"")
+(add-event-zone-use-with-specifier ""{EVENT_NAME}"" ""all"" ""rgb-103-zone"")";
private const string CORE_PROPS_WINDOWS = "%PROGRAMDATA%/SteelSeries/SteelSeries Engine 3/coreProps.json";
private const string CORE_PROPS_OSX = "/Library/Application Support/SteelSeries Engine 3/coreProps.json";
@@ -74,7 +93,8 @@ namespace RGB.NET.Devices.SteelSeries.API
{
_event.Data.Clear();
_event.Data.Add("value", device);
- _event.Data.Add("frame", data);
+ _event.Data.Add("colors", data.Values.ToList());
+ _event.Data.Add("zones", data.Keys.ToList());
TriggerEvent(_event);
}
@@ -85,7 +105,9 @@ namespace RGB.NET.Devices.SteelSeries.API
internal static void Dispose()
{
- ResetLeds();
+ if (IsInitialized)
+ ResetLeds();
+
_client.Dispose();
}
diff --git a/RGB.NET.Devices.SteelSeries/Enum/SteelSeriesDeviceType.cs b/RGB.NET.Devices.SteelSeries/Enum/SteelSeriesDeviceType.cs
index 65ee724..3e68226 100644
--- a/RGB.NET.Devices.SteelSeries/Enum/SteelSeriesDeviceType.cs
+++ b/RGB.NET.Devices.SteelSeries/Enum/SteelSeriesDeviceType.cs
@@ -1,5 +1,6 @@
namespace RGB.NET.Devices.SteelSeries
{
+ // DarthAffe 09.07.2020: Review the LISP-Handler in SteelSeriesSDK after adding new device-types! They need to be initialized.
public enum SteelSeriesDeviceType
{
[APIName("rgb-per-key-zones")]
diff --git a/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesDeviceUpdateQueue.cs b/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesDeviceUpdateQueue.cs
index fe3d576..c2befb6 100644
--- a/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesDeviceUpdateQueue.cs
+++ b/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesDeviceUpdateQueue.cs
@@ -15,7 +15,6 @@ namespace RGB.NET.Devices.SteelSeries
#region Properties & Fields
private string _deviceType;
- private Dictionary _lastDataSet;
#endregion
@@ -39,20 +38,14 @@ namespace RGB.NET.Devices.SteelSeries
protected override void OnUpdate(object sender, CustomUpdateData customData)
{
if ((customData != null) && (customData["refresh"] as bool? ?? false))
- {
- if ((_lastDataSet != null) && (_lastDataSet.Count != 0))
- Update(_lastDataSet);
- }
+ SteelSeriesSDK.SendHeartbeat();
else
base.OnUpdate(sender, customData);
}
///
protected override void Update(Dictionary dataSet)
- {
- _lastDataSet = dataSet;
- SteelSeriesSDK.UpdateLeds(_deviceType, dataSet.ToDictionary(x => ((SteelSeriesLedId)x.Key).GetAPIName(), x => x.Value.ToIntArray()));
- }
+ => SteelSeriesSDK.UpdateLeds(_deviceType, dataSet.ToDictionary(x => ((SteelSeriesLedId)x.Key).GetAPIName(), x => x.Value.ToIntArray()));
#endregion
}
diff --git a/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesRGBDevice.cs b/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesRGBDevice.cs
index f13d918..ec59fd3 100644
--- a/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesRGBDevice.cs
+++ b/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesRGBDevice.cs
@@ -9,7 +9,7 @@ namespace RGB.NET.Devices.SteelSeries
///
/// Represents a SteelSeries-device. (keyboard, mouse, headset, mousepad).
///
- public class SteelSeriesRGBDevice : AbstractRGBDevice, ISteelSeriesRGBDevice
+ public class SteelSeriesRGBDevice : AbstractRGBDevice, ISteelSeriesRGBDevice, IUnknownDevice//TODO DarthAffe 18.04.2020: It's know which kind of device this is, but they would need to be separated
{
#region Properties & Fields
@@ -83,6 +83,15 @@ namespace RGB.NET.Devices.SteelSeries
ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, @"Layouts\SteelSeries", $"{layoutPath}.xml"), layout, true);
}
+ ///
+ public override void Dispose()
+ {
+ try { UpdateQueue?.Dispose(); }
+ catch { /* at least we tried */ }
+
+ base.Dispose();
+ }
+
#endregion
}
}
diff --git a/RGB.NET.Devices.SteelSeries/HID/DeviceChecker.cs b/RGB.NET.Devices.SteelSeries/HID/DeviceChecker.cs
index 0c4b26f..8dda21a 100644
--- a/RGB.NET.Devices.SteelSeries/HID/DeviceChecker.cs
+++ b/RGB.NET.Devices.SteelSeries/HID/DeviceChecker.cs
@@ -121,10 +121,110 @@ namespace RGB.NET.Devices.SteelSeries.HID
{ LedId.Keyboard_NumPeriodAndDelete, SteelSeriesLedId.KeypadPeriod }
};
+ private static readonly LedMapping KEYBOARD_TKL_MAPPING_UK = new LedMapping
+ {
+ { LedId.Logo, SteelSeriesLedId.Logo },
+ { LedId.Keyboard_Escape, SteelSeriesLedId.Escape },
+ { LedId.Keyboard_F1, SteelSeriesLedId.F1 },
+ { LedId.Keyboard_F2, SteelSeriesLedId.F2 },
+ { LedId.Keyboard_F3, SteelSeriesLedId.F3 },
+ { LedId.Keyboard_F4, SteelSeriesLedId.F4 },
+ { LedId.Keyboard_F5, SteelSeriesLedId.F5 },
+ { LedId.Keyboard_F6, SteelSeriesLedId.F6 },
+ { LedId.Keyboard_F7, SteelSeriesLedId.F7 },
+ { LedId.Keyboard_F8, SteelSeriesLedId.F8 },
+ { LedId.Keyboard_F9, SteelSeriesLedId.F9 },
+ { LedId.Keyboard_F10, SteelSeriesLedId.F10 },
+ { LedId.Keyboard_F11, SteelSeriesLedId.F11 },
+ { LedId.Keyboard_GraveAccentAndTilde, SteelSeriesLedId.Backqoute },
+ { LedId.Keyboard_1, SteelSeriesLedId.Keyboard1 },
+ { LedId.Keyboard_2, SteelSeriesLedId.Keyboard2 },
+ { LedId.Keyboard_3, SteelSeriesLedId.Keyboard3 },
+ { LedId.Keyboard_4, SteelSeriesLedId.Keyboard4 },
+ { LedId.Keyboard_5, SteelSeriesLedId.Keyboard5 },
+ { LedId.Keyboard_6, SteelSeriesLedId.Keyboard6 },
+ { LedId.Keyboard_7, SteelSeriesLedId.Keyboard7 },
+ { LedId.Keyboard_8, SteelSeriesLedId.Keyboard8 },
+ { LedId.Keyboard_9, SteelSeriesLedId.Keyboard9 },
+ { LedId.Keyboard_0, SteelSeriesLedId.Keyboard0 },
+ { LedId.Keyboard_MinusAndUnderscore, SteelSeriesLedId.Dash },
+ { LedId.Keyboard_Tab, SteelSeriesLedId.Tab },
+ { LedId.Keyboard_Q, SteelSeriesLedId.Q },
+ { LedId.Keyboard_W, SteelSeriesLedId.W },
+ { LedId.Keyboard_E, SteelSeriesLedId.E },
+ { LedId.Keyboard_R, SteelSeriesLedId.R },
+ { LedId.Keyboard_T, SteelSeriesLedId.T },
+ { LedId.Keyboard_Y, SteelSeriesLedId.Y },
+ { LedId.Keyboard_U, SteelSeriesLedId.U },
+ { LedId.Keyboard_I, SteelSeriesLedId.I },
+ { LedId.Keyboard_O, SteelSeriesLedId.O },
+ { LedId.Keyboard_P, SteelSeriesLedId.P },
+ { LedId.Keyboard_BracketLeft, SteelSeriesLedId.LBracket },
+ { LedId.Keyboard_CapsLock, SteelSeriesLedId.Caps },
+ { LedId.Keyboard_A, SteelSeriesLedId.A },
+ { LedId.Keyboard_S, SteelSeriesLedId.S },
+ { LedId.Keyboard_D, SteelSeriesLedId.D },
+ { LedId.Keyboard_F, SteelSeriesLedId.F },
+ { LedId.Keyboard_G, SteelSeriesLedId.G },
+ { LedId.Keyboard_H, SteelSeriesLedId.H },
+ { LedId.Keyboard_J, SteelSeriesLedId.J },
+ { LedId.Keyboard_K, SteelSeriesLedId.K },
+ { LedId.Keyboard_L, SteelSeriesLedId.L },
+ { LedId.Keyboard_SemicolonAndColon, SteelSeriesLedId.Semicolon },
+ { LedId.Keyboard_ApostropheAndDoubleQuote, SteelSeriesLedId.Quote },
+ { LedId.Keyboard_LeftShift, SteelSeriesLedId.LShift },
+ { LedId.Keyboard_NonUsTilde, SteelSeriesLedId.Pound },
+ { LedId.Keyboard_Z, SteelSeriesLedId.Z },
+ { LedId.Keyboard_X, SteelSeriesLedId.X },
+ { LedId.Keyboard_C, SteelSeriesLedId.C },
+ { LedId.Keyboard_V, SteelSeriesLedId.V },
+ { LedId.Keyboard_B, SteelSeriesLedId.B },
+ { LedId.Keyboard_N, SteelSeriesLedId.N },
+ { LedId.Keyboard_M, SteelSeriesLedId.M },
+ { LedId.Keyboard_CommaAndLessThan, SteelSeriesLedId.Comma },
+ { LedId.Keyboard_PeriodAndBiggerThan, SteelSeriesLedId.Period },
+ { LedId.Keyboard_SlashAndQuestionMark, SteelSeriesLedId.Slash },
+ { LedId.Keyboard_LeftCtrl, SteelSeriesLedId.LCtrl },
+ { LedId.Keyboard_LeftGui, SteelSeriesLedId.LWin },
+ { LedId.Keyboard_LeftAlt, SteelSeriesLedId.LAlt },
+ { LedId.Keyboard_Space, SteelSeriesLedId.Spacebar },
+ { LedId.Keyboard_RightAlt, SteelSeriesLedId.RAlt },
+ { LedId.Keyboard_RightGui, SteelSeriesLedId.RWin },
+ { LedId.Keyboard_Application, SteelSeriesLedId.SSKey },
+ { LedId.Keyboard_F12, SteelSeriesLedId.F12 },
+ { LedId.Keyboard_PrintScreen, SteelSeriesLedId.PrintScreen },
+ { LedId.Keyboard_ScrollLock, SteelSeriesLedId.ScrollLock },
+ { LedId.Keyboard_PauseBreak, SteelSeriesLedId.Pause },
+ { LedId.Keyboard_Insert, SteelSeriesLedId.Insert },
+ { LedId.Keyboard_Home, SteelSeriesLedId.Home },
+ { LedId.Keyboard_PageUp, SteelSeriesLedId.PageUp },
+ { LedId.Keyboard_BracketRight, SteelSeriesLedId.RBracket },
+ { LedId.Keyboard_Backslash, SteelSeriesLedId.Backslash },
+ { LedId.Keyboard_Enter, SteelSeriesLedId.Return },
+ { LedId.Keyboard_EqualsAndPlus, SteelSeriesLedId.Equal },
+ { LedId.Keyboard_Backspace, SteelSeriesLedId.Backspace },
+ { LedId.Keyboard_Delete, SteelSeriesLedId.Delete },
+ { LedId.Keyboard_End, SteelSeriesLedId.End },
+ { LedId.Keyboard_PageDown, SteelSeriesLedId.PageDown },
+ { LedId.Keyboard_RightShift, SteelSeriesLedId.RShift },
+ { LedId.Keyboard_RightCtrl, SteelSeriesLedId.RCtrl },
+ { LedId.Keyboard_ArrowUp, SteelSeriesLedId.UpArrow },
+ { LedId.Keyboard_ArrowLeft, SteelSeriesLedId.LeftArrow },
+ { LedId.Keyboard_ArrowDown, SteelSeriesLedId.DownArrow },
+ { LedId.Keyboard_ArrowRight, SteelSeriesLedId.RightArrow }
+ };
+
private static readonly LedMapping MOUSE_TWO_ZONE = new LedMapping
{
{LedId.Mouse1, SteelSeriesLedId.ZoneOne},
{LedId.Mouse2, SteelSeriesLedId.ZoneTwo}
+ };
+
+ private static readonly LedMapping MOUSE_THREE_ZONE = new LedMapping
+ {
+ {LedId.Mouse1, SteelSeriesLedId.ZoneOne},
+ {LedId.Mouse2, SteelSeriesLedId.ZoneTwo},
+ {LedId.Mouse3, SteelSeriesLedId.ZoneThree}
};
private static readonly LedMapping MOUSE_EIGHT_ZONE = new LedMapping
@@ -139,16 +239,33 @@ namespace RGB.NET.Devices.SteelSeries.HID
{ LedId.Mouse8, SteelSeriesLedId.ZoneEight}
};
+ private static readonly LedMapping HEADSET_TWO_ZONE = new LedMapping
+ {
+ {LedId.Headset1, SteelSeriesLedId.ZoneOne},
+ {LedId.Headset2, SteelSeriesLedId.ZoneTwo}
+ };
+
private const int VENDOR_ID = 0x1038;
//TODO DarthAffe 16.02.2019: Add devices
private static readonly DeviceDataList DEVICES = new DeviceDataList
{
- ("Rival 600", RGBDeviceType.Mouse, 0x0616, SteelSeriesDeviceType.EightZone, "default", @"Mice\Rival600", MOUSE_EIGHT_ZONE),
+ ("Rival 600", RGBDeviceType.Mouse, 0x1724, SteelSeriesDeviceType.EightZone, "default", @"Mice\Rival600", MOUSE_EIGHT_ZONE),
("Rival 500", RGBDeviceType.Mouse, 0x170E, SteelSeriesDeviceType.TwoZone, "default", @"Mice\Rival500", MOUSE_TWO_ZONE),
("Rival 310", RGBDeviceType.Mouse, 0x1720, SteelSeriesDeviceType.TwoZone, "default", @"Mice\Rival310", MOUSE_TWO_ZONE),
+ ("Rival 3 (Old Firmware)", RGBDeviceType.Mouse, 0x1824, SteelSeriesDeviceType.ThreeZone, "default", @"Mice\Rival3", MOUSE_THREE_ZONE),
+ ("Rival 3", RGBDeviceType.Mouse, 0x184C, SteelSeriesDeviceType.ThreeZone, "default", @"Mice\Rival3", MOUSE_THREE_ZONE),
- ("Apex M750", RGBDeviceType.Keyboard, 0x1724, SteelSeriesDeviceType.PerKey, "UK", @"Keyboards\M750\UK", KEYBOARD_MAPPING_UK),
+ ("Apex 5", RGBDeviceType.Keyboard, 0x161C, SteelSeriesDeviceType.PerKey, "UK", @"Keyboards\5\UK", KEYBOARD_MAPPING_UK),
+ ("Apex 7", RGBDeviceType.Keyboard, 0x1612, SteelSeriesDeviceType.PerKey, "UK", @"Keyboards\7\UK", KEYBOARD_MAPPING_UK),
+ ("Apex 7 TKL", RGBDeviceType.Keyboard, 0x1618, SteelSeriesDeviceType.PerKey, "UK", @"Keyboards\7TKL\UK", KEYBOARD_TKL_MAPPING_UK),
+ ("Apex M750", RGBDeviceType.Keyboard, 0x0616, SteelSeriesDeviceType.PerKey, "UK", @"Keyboards\M750\UK", KEYBOARD_MAPPING_UK),
+
+ ("Arctis 5", RGBDeviceType.Headset, 0x12AA, SteelSeriesDeviceType.TwoZone, "default", @"Headsets\Artis5", HEADSET_TWO_ZONE),
+ ("Arctis 5 Game", RGBDeviceType.Headset, 0x1250, SteelSeriesDeviceType.TwoZone, "default", @"Headsets\Artis5", HEADSET_TWO_ZONE),
+ ("Arctis 5 Game - Dota 2 edition", RGBDeviceType.Headset, 0x1251, SteelSeriesDeviceType.TwoZone, "default", @"Headsets\Artis5", HEADSET_TWO_ZONE),
+ ("Arctis 5 Pro Game", RGBDeviceType.Headset, 0x1252, SteelSeriesDeviceType.TwoZone, "default", @"Headsets\Artis5", HEADSET_TWO_ZONE),
+ ("Arctis 5 Game - PUBG edition", RGBDeviceType.Headset, 0x12A8, SteelSeriesDeviceType.TwoZone, "default", @"Headsets\Artis5", HEADSET_TWO_ZONE),
};
#endregion
diff --git a/RGB.NET.Devices.SteelSeries/RGB.NET.Devices.SteelSeries.csproj b/RGB.NET.Devices.SteelSeries/RGB.NET.Devices.SteelSeries.csproj
index bfe4e06..bf4b1e5 100644
--- a/RGB.NET.Devices.SteelSeries/RGB.NET.Devices.SteelSeries.csproj
+++ b/RGB.NET.Devices.SteelSeries/RGB.NET.Devices.SteelSeries.csproj
@@ -14,8 +14,8 @@
RGB.NET.Devices.SteelSeries
SteelSeries-Device-Implementations of RGB.NET
SteelSeries-Device-Implementations of RGB.NET, a C# (.NET) library for accessing various RGB-peripherals
- Copyright © Wyrez 2017
- Copyright © Wyrez 2017
+ Copyright © Darth Affe 2020
+ Copyright © Darth Affe 2020
http://lib.arge.be/icon.png
https://github.com/DarthAffe/RGB.NET
https://raw.githubusercontent.com/DarthAffe/RGB.NET/master/LICENSE
@@ -56,7 +56,7 @@
-
-
+
+
\ No newline at end of file
diff --git a/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs b/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs
index 9f59d7d..21402dd 100644
--- a/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs
+++ b/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs
@@ -117,11 +117,11 @@ namespace RGB.NET.Devices.SteelSeries
///
public void Dispose()
{
- try
- {
- SteelSeriesSDK.Dispose();
- }
- catch {/* shit happens */}
+ try { UpdateTrigger?.Dispose(); }
+ catch { /* at least we tried */ }
+
+ try { SteelSeriesSDK.Dispose(); }
+ catch { /* shit happens */ }
}
#endregion
diff --git a/RGB.NET.Devices.WS281X/Arduino/ArduinoWS2812USBDevice.cs b/RGB.NET.Devices.WS281X/Arduino/ArduinoWS2812USBDevice.cs
index 5fa3c85..c940db4 100644
--- a/RGB.NET.Devices.WS281X/Arduino/ArduinoWS2812USBDevice.cs
+++ b/RGB.NET.Devices.WS281X/Arduino/ArduinoWS2812USBDevice.cs
@@ -12,7 +12,7 @@ namespace RGB.NET.Devices.WS281X.Arduino
///
/// Represents an arduino WS2812 device.
///
- public class ArduinoWS2812USBDevice : AbstractRGBDevice
+ public class ArduinoWS2812USBDevice : AbstractRGBDevice, ILedStripe
{
#region Properties & Fields
@@ -73,6 +73,15 @@ namespace RGB.NET.Devices.WS281X.Arduino
///
protected override void UpdateLeds(IEnumerable ledsToUpdate) => UpdateQueue.SetData(ledsToUpdate.Where(x => x.Color.A > 0));
+ ///
+ public override void Dispose()
+ {
+ try { UpdateQueue?.Dispose(); }
+ catch { /* at least we tried */ }
+
+ base.Dispose();
+ }
+
#endregion
}
}
diff --git a/RGB.NET.Devices.WS281X/Arduino/ArduinoWS2812USBUpdateQueue.cs b/RGB.NET.Devices.WS281X/Arduino/ArduinoWS2812USBUpdateQueue.cs
index e9fea46..6b2c1cb 100644
--- a/RGB.NET.Devices.WS281X/Arduino/ArduinoWS2812USBUpdateQueue.cs
+++ b/RGB.NET.Devices.WS281X/Arduino/ArduinoWS2812USBUpdateQueue.cs
@@ -9,7 +9,7 @@ namespace RGB.NET.Devices.WS281X.Arduino
///
/// Represents the update-queue performing updates for arduino WS2812 devices.
///
- public class ArduinoWS2812USBUpdateQueue : SerialPortUpdateQueue
+ public class ArduinoWS2812USBUpdateQueue : SerialConnectionUpdateQueue
{
#region Constants
@@ -33,8 +33,8 @@ namespace RGB.NET.Devices.WS281X.Arduino
/// The update trigger used by this queue.
/// The name of the serial-port to connect to.
/// The baud-rate used by the serial-connection.
- public ArduinoWS2812USBUpdateQueue(IDeviceUpdateTrigger updateTrigger, string portName, int baudRate = 115200)
- : base(updateTrigger, portName, baudRate)
+ public ArduinoWS2812USBUpdateQueue(IDeviceUpdateTrigger updateTrigger, ISerialConnection serialConnection)
+ : base(updateTrigger, serialConnection)
{ }
#endregion
@@ -45,7 +45,7 @@ namespace RGB.NET.Devices.WS281X.Arduino
protected override void OnStartup(object sender, CustomUpdateData customData)
{
base.OnStartup(sender, customData);
-
+
SendCommand(ASK_PROMPT_COMMAND); // Get initial prompt
}
@@ -75,26 +75,26 @@ namespace RGB.NET.Devices.WS281X.Arduino
}
///
- protected override void SendCommand(byte[] command) => SerialPort.Write(command, 0, command.Length);
+ protected override void SendCommand(byte[] command) => SerialConnection.Write(command, 0, command.Length);
internal IEnumerable<(int channel, int ledCount)> GetChannels()
{
- if (!SerialPort.IsOpen)
- SerialPort.Open();
+ if (!SerialConnection.IsOpen)
+ SerialConnection.Open();
- SerialPort.DiscardInBuffer();
+ SerialConnection.DiscardInBuffer();
SendCommand(ASK_PROMPT_COMMAND);
- SerialPort.ReadTo(Prompt);
+ SerialConnection.ReadTo(Prompt);
SendCommand(COUNT_COMMAND);
- int channelCount = SerialPort.ReadByte();
+ int channelCount = SerialConnection.ReadByte();
for (int i = 1; i <= channelCount; i++)
{
- SerialPort.ReadTo(Prompt);
+ SerialConnection.ReadTo(Prompt);
byte[] channelLedCountCommand = { (byte)((i << 4) | COUNT_COMMAND[0]) };
SendCommand(channelLedCountCommand);
- int ledCount = SerialPort.ReadByte();
+ int ledCount = SerialConnection.ReadByte();
if (ledCount > 0)
yield return (i, ledCount);
}
diff --git a/RGB.NET.Devices.WS281X/Arduino/ArduinoWS281XDeviceDefinition.cs b/RGB.NET.Devices.WS281X/Arduino/ArduinoWS281XDeviceDefinition.cs
index dc28760..ff1b88f 100644
--- a/RGB.NET.Devices.WS281X/Arduino/ArduinoWS281XDeviceDefinition.cs
+++ b/RGB.NET.Devices.WS281X/Arduino/ArduinoWS281XDeviceDefinition.cs
@@ -16,15 +16,20 @@ namespace RGB.NET.Devices.WS281X.Arduino
{
#region Properties & Fields
+ ///
+ /// Gets the serial-connection used for the device.
+ ///
+ public ISerialConnection SerialConnection { get; }
+
///
/// Gets the name of the serial-port to connect to.
///
- public string Port { get; }
+ public string Port => SerialConnection?.Port;
///
/// Gets the baud-rate used by the serial-connection.
///
- public int BaudRate { get; set; } = 115200;
+ public int BaudRate => SerialConnection?.BaudRate ?? 0;
///
/// Gets or sets the name used by this device.
@@ -39,10 +44,20 @@ namespace RGB.NET.Devices.WS281X.Arduino
///
/// Initializes a new instance of the class.
///
- /// The name of the serial-port to connect to.
- public ArduinoWS281XDeviceDefinition(string port)
+ /// The serial connection used for the device.
+ public ArduinoWS281XDeviceDefinition(ISerialConnection serialConnection)
{
- this.Port = port;
+ this.SerialConnection = serialConnection;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The name of the serial-port to connect to.
+ /// The baud-rate of the serial-connection.
+ public ArduinoWS281XDeviceDefinition(string port, int baudRate = 115200)
+ {
+ SerialConnection = new SerialPortConnection(port, baudRate);
}
#endregion
@@ -50,11 +65,9 @@ namespace RGB.NET.Devices.WS281X.Arduino
#region Methods
///
- public IEnumerable CreateDevices()
+ public IEnumerable CreateDevices(IDeviceUpdateTrigger updateTrigger)
{
- DeviceUpdateTrigger updateTrigger = new DeviceUpdateTrigger();
-
- ArduinoWS2812USBUpdateQueue queue = new ArduinoWS2812USBUpdateQueue(updateTrigger, Port, BaudRate);
+ ArduinoWS2812USBUpdateQueue queue = new ArduinoWS2812USBUpdateQueue(updateTrigger, SerialConnection);
IEnumerable<(int channel, int ledCount)> channels = queue.GetChannels();
int counter = 0;
foreach ((int channel, int ledCount) in channels)
@@ -64,8 +77,6 @@ namespace RGB.NET.Devices.WS281X.Arduino
device.Initialize(ledCount);
yield return device;
}
-
- updateTrigger.Start();
}
#endregion
diff --git a/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS2812USBDevice.cs b/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS2812USBDevice.cs
index 0e4f7a9..b9e5cf6 100644
--- a/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS2812USBDevice.cs
+++ b/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS2812USBDevice.cs
@@ -12,7 +12,7 @@ namespace RGB.NET.Devices.WS281X.Bitwizard
///
/// Represents an bitwizard WS2812 USB device.
///
- public class BitwizardWS2812USBDevice : AbstractRGBDevice
+ public class BitwizardWS2812USBDevice : AbstractRGBDevice, ILedStripe
{
#region Properties & Fields
@@ -63,6 +63,15 @@ namespace RGB.NET.Devices.WS281X.Bitwizard
///
protected override void UpdateLeds(IEnumerable ledsToUpdate) => UpdateQueue.SetData(ledsToUpdate.Where(x => x.Color.A > 0));
+ ///
+ public override void Dispose()
+ {
+ try { UpdateQueue?.Dispose(); }
+ catch { /* at least we tried */ }
+
+ base.Dispose();
+ }
+
#endregion
}
}
diff --git a/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS2812USBUpdateQueue.cs b/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS2812USBUpdateQueue.cs
index 5b70008..dd6acc0 100644
--- a/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS2812USBUpdateQueue.cs
+++ b/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS2812USBUpdateQueue.cs
@@ -8,7 +8,7 @@ namespace RGB.NET.Devices.WS281X.Bitwizard
///
/// Represents the update-queue performing updates for a bitwizard WS2812 device.
///
- public class BitwizardWS2812USBUpdateQueue : SerialPortUpdateQueue
+ public class BitwizardWS2812USBUpdateQueue : SerialConnectionUpdateQueue
{
#region Constructors
@@ -19,8 +19,8 @@ namespace RGB.NET.Devices.WS281X.Bitwizard
/// The update trigger used by this queue.
/// The name of the serial-port to connect to.
/// The baud-rate used by the serial-connection.
- public BitwizardWS2812USBUpdateQueue(IDeviceUpdateTrigger updateTrigger, string portName, int baudRate = 115200)
- : base(updateTrigger, portName, baudRate)
+ public BitwizardWS2812USBUpdateQueue(IDeviceUpdateTrigger updateTrigger, ISerialConnection serialConnection)
+ : base(updateTrigger, serialConnection)
{ }
#endregion
diff --git a/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS281XDeviceDefinition.cs b/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS281XDeviceDefinition.cs
index d8bc4f3..b7f61b3 100644
--- a/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS281XDeviceDefinition.cs
+++ b/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS281XDeviceDefinition.cs
@@ -16,15 +16,20 @@ namespace RGB.NET.Devices.WS281X.Bitwizard
{
#region Properties & Fields
+ ///
+ /// Gets the serial-connection used for the device.
+ ///
+ public ISerialConnection SerialConnection { get; }
+
///
/// Gets the name of the serial-port to connect to.
///
- public string Port { get; }
+ public string Port => SerialConnection?.Port;
///
/// Gets the baud-rate used by the serial-connection.
///
- public int BaudRate { get; set; } = 115200;
+ public int BaudRate => SerialConnection?.BaudRate ?? 0;
///
/// Gets or sets the name used by this device.
@@ -43,10 +48,20 @@ namespace RGB.NET.Devices.WS281X.Bitwizard
///
/// Initializes a new instance of the class.
///
- /// The name of the serial-port to connect to.
- public BitwizardWS281XDeviceDefinition(string port)
+ /// The serial connection used for the device.
+ public BitwizardWS281XDeviceDefinition(ISerialConnection serialConnection)
{
- this.Port = port;
+ this.SerialConnection = serialConnection;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The name of the serial-port to connect to.
+ /// The baud-rate of the serial-connection.
+ public BitwizardWS281XDeviceDefinition(string port, int baudRate = 115200)
+ {
+ SerialConnection = new SerialPortConnection(port, baudRate);
}
#endregion
@@ -54,17 +69,13 @@ namespace RGB.NET.Devices.WS281X.Bitwizard
#region Methods
///
- public IEnumerable CreateDevices()
+ public IEnumerable CreateDevices(IDeviceUpdateTrigger updateTrigger)
{
- DeviceUpdateTrigger updateTrigger = new DeviceUpdateTrigger();
-
- BitwizardWS2812USBUpdateQueue queue = new BitwizardWS2812USBUpdateQueue(updateTrigger, Port, BaudRate);
+ BitwizardWS2812USBUpdateQueue queue = new BitwizardWS2812USBUpdateQueue(updateTrigger, SerialConnection);
string name = Name ?? $"Bitwizard WS2812 USB ({Port})";
BitwizardWS2812USBDevice device = new BitwizardWS2812USBDevice(new BitwizardWS2812USBDeviceInfo(name), queue);
device.Initialize(StripLength);
yield return device;
-
- updateTrigger.Start();
}
#endregion
diff --git a/RGB.NET.Devices.WS281X/Generic/ISerialConnection.cs b/RGB.NET.Devices.WS281X/Generic/ISerialConnection.cs
new file mode 100644
index 0000000..5851e7a
--- /dev/null
+++ b/RGB.NET.Devices.WS281X/Generic/ISerialConnection.cs
@@ -0,0 +1,62 @@
+using System;
+
+namespace RGB.NET.Devices.WS281X
+{
+ ///
+ /// Represents a generic serial connection.
+ ///
+ public interface ISerialConnection : IDisposable
+ {
+ ///
+ /// Gets the COM-port used by the serial connection.
+ ///
+ string Port { get; }
+
+ ///
+ /// Gets the baud-rate used by the serial connection.
+ ///
+ int BaudRate { get; }
+
+ ///
+ /// Gets the connection-status of the serial connection.
+ /// true if connected; otherwise false .
+ ///
+ bool IsOpen { get; }
+
+ ///
+ /// Opens the serial connection.
+ ///
+ void Open();
+
+ ///
+ /// Discards the in-buffer of the serial connection.
+ ///
+ void DiscardInBuffer();
+
+ ///
+ /// Reads a single byte from the serial connection
+ ///
+ /// The byte read.
+ byte ReadByte();
+
+ ///
+ /// Blocks till the provided char is received from the serial connection.
+ ///
+ /// The target-character to read to.
+ void ReadTo(char target);
+
+ ///
+ /// Writes the provided data to the serial connection.
+ ///
+ /// The buffer containing the data to write.
+ /// The offset of the data in the buffer.
+ /// The amount of data to write.
+ void Write(byte[] buffer, int offset, int length);
+
+ ///
+ /// Write the provided text to the serial connection followed by a line break.
+ ///
+ /// The text to write.
+ void WriteLine(string line);
+ }
+}
diff --git a/RGB.NET.Devices.WS281X/Generic/IWS281XDeviceDefinition.cs b/RGB.NET.Devices.WS281X/Generic/IWS281XDeviceDefinition.cs
index 8ff5fa9..a6f375e 100644
--- a/RGB.NET.Devices.WS281X/Generic/IWS281XDeviceDefinition.cs
+++ b/RGB.NET.Devices.WS281X/Generic/IWS281XDeviceDefinition.cs
@@ -13,6 +13,6 @@ namespace RGB.NET.Devices.WS281X
/// Gets the devices defined by this definition.
///
/// The initialized devices defined by this definition.
- IEnumerable CreateDevices();
+ IEnumerable CreateDevices(IDeviceUpdateTrigger updateTrigger);
}
}
diff --git a/RGB.NET.Devices.WS281X/Generic/SerialPortConnection.cs b/RGB.NET.Devices.WS281X/Generic/SerialPortConnection.cs
new file mode 100644
index 0000000..fded9dc
--- /dev/null
+++ b/RGB.NET.Devices.WS281X/Generic/SerialPortConnection.cs
@@ -0,0 +1,63 @@
+using System.IO.Ports;
+
+namespace RGB.NET.Devices.WS281X
+{
+ ///
+ ///
+ /// Represents a serial-connection using the default microsoft serial-port implementation.
+ ///
+ public class SerialPortConnection : ISerialConnection
+ {
+ #region Properties & Fields
+
+ ///
+ /// The used for the connection.
+ ///
+ public SerialPort SerialPort { get; }
+
+ ///
+ public string Port => SerialPort.PortName;
+
+ ///
+ public int BaudRate => SerialPort.BaudRate;
+
+ ///
+ public bool IsOpen => SerialPort.IsOpen;
+
+ #endregion
+
+ #region Constructors
+
+ public SerialPortConnection(string port, int baudRate)
+ {
+ SerialPort = new SerialPort(port, baudRate);
+ }
+
+ #endregion
+
+ #region Methods
+
+ ///
+ public void Open() => SerialPort.Open();
+
+ ///
+ public void DiscardInBuffer() => SerialPort.DiscardInBuffer();
+
+ ///
+ public byte ReadByte() => (byte)SerialPort.ReadByte();
+
+ ///
+ public void ReadTo(char target) => SerialPort.ReadTo(target.ToString());
+
+ ///
+ public void Write(byte[] buffer, int offset, int length) => SerialPort.Write(buffer, offset, length);
+
+ ///
+ public void WriteLine(string line) => SerialPort.WriteLine(line);
+
+ ///
+ public void Dispose() => SerialPort.Dispose();
+
+ #endregion
+ }
+}
diff --git a/RGB.NET.Devices.WS281X/Generic/SerialPortUpdateQueue.cs b/RGB.NET.Devices.WS281X/Generic/SerialPortUpdateQueue.cs
index 21504cf..0f343da 100644
--- a/RGB.NET.Devices.WS281X/Generic/SerialPortUpdateQueue.cs
+++ b/RGB.NET.Devices.WS281X/Generic/SerialPortUpdateQueue.cs
@@ -9,7 +9,7 @@ namespace RGB.NET.Devices.WS281X
/// Represents a update queue for serial devices.
///
/// The type of data sent through the serial connection.
- public abstract class SerialPortUpdateQueue : UpdateQueue
+ public abstract class SerialConnectionUpdateQueue : UpdateQueue
{
#region Properties & Fields
@@ -17,12 +17,12 @@ namespace RGB.NET.Devices.WS281X
/// Gets or sets the prompt to wait for between sending commands.
///
// ReSharper disable once AutoPropertyCanBeMadeGetOnly.Global
- protected string Prompt { get; set; } = ">";
+ protected char Prompt { get; set; } = '>';
///
/// Gets the serial port used by this queue.
///
- protected SerialPort SerialPort { get; }
+ protected ISerialConnection SerialConnection { get; }
#endregion
@@ -30,15 +30,15 @@ namespace RGB.NET.Devices.WS281X
///
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The update trigger used by this queue.
/// The name of the serial-port to connect to.
/// The baud-rate used by the serial-connection.
- internal SerialPortUpdateQueue(IDeviceUpdateTrigger updateTrigger, string portName, int baudRate = 115200)
+ internal SerialConnectionUpdateQueue(IDeviceUpdateTrigger updateTrigger, ISerialConnection serialConnection)
: base(updateTrigger)
{
- SerialPort = new SerialPort(portName, baudRate);
+ SerialConnection = serialConnection;
}
#endregion
@@ -50,10 +50,10 @@ namespace RGB.NET.Devices.WS281X
{
base.OnStartup(sender, customData);
- if (!SerialPort.IsOpen)
- SerialPort.Open();
+ if (!SerialConnection.IsOpen)
+ SerialConnection.Open();
- SerialPort.DiscardInBuffer();
+ SerialConnection.DiscardInBuffer();
}
///
@@ -61,7 +61,7 @@ namespace RGB.NET.Devices.WS281X
{
foreach (TData command in GetCommands(dataSet))
{
- SerialPort.ReadTo(Prompt);
+ SerialConnection.ReadTo(Prompt);
SendCommand(command);
}
}
@@ -78,7 +78,7 @@ namespace RGB.NET.Devices.WS281X
/// This most likely needs to be overwritten if the data-type isn't string.
///
/// The command to be sent.
- protected virtual void SendCommand(TData command) => SerialPort.WriteLine((command as string) ?? string.Empty);
+ protected virtual void SendCommand(TData command) => SerialConnection.WriteLine((command as string) ?? string.Empty);
#endregion
}
diff --git a/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUUpdateMode.cs b/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUUpdateMode.cs
new file mode 100644
index 0000000..f20bd8e
--- /dev/null
+++ b/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUUpdateMode.cs
@@ -0,0 +1,21 @@
+namespace RGB.NET.Devices.WS281X.NodeMCU
+{
+ ///
+ /// Contaisn a list of possible update-modes for NodeMCU-devices.
+ ///
+ // ReSharper disable once InconsistentNaming
+ public enum NodeMCUUpdateMode
+ {
+ ///
+ /// Updates through the HTTP-REST-API.
+ /// Slow, but reliable.
+ ///
+ Http,
+
+ ///
+ /// Updates through a UDP-connection.
+ /// Fast, but might skip updates if the network connection is bad.
+ ///
+ Udp
+ }
+}
diff --git a/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBDevice.cs b/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBDevice.cs
new file mode 100644
index 0000000..4b03b81
--- /dev/null
+++ b/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBDevice.cs
@@ -0,0 +1,87 @@
+// ReSharper disable MemberCanBePrivate.Global
+// ReSharper disable UnusedMember.Global
+
+using System.Collections.Generic;
+using System.Linq;
+using RGB.NET.Core;
+
+namespace RGB.NET.Devices.WS281X.NodeMCU
+{
+ // ReSharper disable once InconsistentNaming
+ ///
+ ///
+ /// Represents an NodeMCU WS2812 device.
+ ///
+ public class NodeMCUWS2812USBDevice : AbstractRGBDevice, ILedStripe
+ {
+ #region Properties & Fields
+
+ ///
+ /// Gets the update queue performing updates for this device.
+ ///
+ public NodeMCUWS2812USBUpdateQueue UpdateQueue { get; }
+
+ ///
+ public override NodeMCUWS2812USBDeviceInfo DeviceInfo { get; }
+
+ ///
+ /// Gets the channel (as defined in the NodeMCU-sketch) this device is attached to.
+ ///
+ public int Channel { get; }
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The update trigger used by this queue.
+ /// The update queue performing updates for this device.
+ /// The channel (as defined in the NodeMCU-sketch) this device is attached to.
+ public NodeMCUWS2812USBDevice(NodeMCUWS2812USBDeviceInfo deviceInfo, NodeMCUWS2812USBUpdateQueue updateQueue, int channel)
+ {
+ this.DeviceInfo = deviceInfo;
+ this.UpdateQueue = updateQueue;
+ this.Channel = channel;
+ }
+
+ #endregion
+
+ #region Methods
+
+ internal void Initialize(int ledCount)
+ {
+ for (int i = 0; i < ledCount; i++)
+ InitializeLed(LedId.LedStripe1 + i, new Point(i * 10, 0), new Size(10, 10));
+
+ //TODO DarthAffe 23.12.2018: Allow to load a layout.
+
+ if (Size == Size.Invalid)
+ {
+ Rectangle ledRectangle = new Rectangle(this.Select(x => x.LedRectangle));
+ Size = ledRectangle.Size + new Size(ledRectangle.Location.X, ledRectangle.Location.Y);
+ }
+ }
+
+ ///
+ protected override object CreateLedCustomData(LedId ledId) => (Channel, (int)ledId - (int)LedId.LedStripe1);
+
+ ///
+ protected override IEnumerable GetLedsToUpdate(bool flushLeds) => (flushLeds || LedMapping.Values.Any(x => x.IsDirty)) ? LedMapping.Values : null;
+
+ ///
+ protected override void UpdateLeds(IEnumerable ledsToUpdate) => UpdateQueue.SetData(ledsToUpdate.Where(x => x.Color.A > 0));
+
+ ///
+ public override void Dispose()
+ {
+ try { UpdateQueue?.Dispose(); }
+ catch { /* at least we tried */ }
+
+ base.Dispose();
+ }
+
+ #endregion
+ }
+}
diff --git a/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBDeviceInfo.cs b/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBDeviceInfo.cs
new file mode 100644
index 0000000..916f516
--- /dev/null
+++ b/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBDeviceInfo.cs
@@ -0,0 +1,51 @@
+using System;
+using RGB.NET.Core;
+
+namespace RGB.NET.Devices.WS281X.NodeMCU
+{
+ // ReSharper disable once InconsistentNaming
+ ///
+ ///
+ /// Represents a generic information for a .
+ ///
+ public class NodeMCUWS2812USBDeviceInfo : IRGBDeviceInfo
+ {
+ #region Properties & Fields
+
+ ///
+ public string DeviceName { get; }
+
+ ///
+ public RGBDeviceType DeviceType => RGBDeviceType.LedStripe;
+
+ ///
+ public string Manufacturer => "NodeMCU";
+
+ ///
+ public string Model => "WS2812 WLAN";
+
+ ///
+ public RGBDeviceLighting Lighting => RGBDeviceLighting.Key;
+
+ ///
+ public bool SupportsSyncBack => false;
+
+ ///
+ public Uri Image { get; set; }
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The name of this device.
+ public NodeMCUWS2812USBDeviceInfo(string name)
+ {
+ this.DeviceName = name;
+ }
+
+ #endregion
+ }
+}
diff --git a/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBUpdateQueue.cs b/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBUpdateQueue.cs
new file mode 100644
index 0000000..f5feffe
--- /dev/null
+++ b/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBUpdateQueue.cs
@@ -0,0 +1,184 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Http;
+using System.Net.Sockets;
+using System.Text;
+using System.Text.RegularExpressions;
+using RGB.NET.Core;
+
+namespace RGB.NET.Devices.WS281X.NodeMCU
+{
+ // ReSharper disable once InconsistentNaming
+ ///
+ ///
+ /// Represents the update-queue performing updates for NodeMCU WS2812 devices.
+ ///
+ public class NodeMCUWS2812USBUpdateQueue : UpdateQueue
+ {
+ #region Properties & Fields
+
+ private readonly string _hostname;
+
+ private HttpClient _httpClient = new HttpClient();
+ private UdpClient _udpClient;
+
+ private readonly Dictionary _dataBuffer = new Dictionary();
+ private readonly Dictionary _sequenceNumbers = new Dictionary();
+
+ private readonly Action _sendDataAction;
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ /// Initializes a new instance of the class.
+ /// If this constructor is used UDP updates are disabled.
+ ///
+ /// The update trigger used by this queue.
+ /// The hostname to connect to.
+ public NodeMCUWS2812USBUpdateQueue(IDeviceUpdateTrigger updateTrigger, string hostname)
+ : base(updateTrigger)
+ {
+ this._hostname = hostname;
+
+ _sendDataAction = SendHttp;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ /// If this constructor is used UDP updates are enabled.
+ ///
+ /// The update trigger used by this queue.
+ /// The hostname to connect to.
+ /// The port used by the UDP-connection.
+ public NodeMCUWS2812USBUpdateQueue(IDeviceUpdateTrigger updateTrigger, string hostname, int udpPort)
+ : base(updateTrigger)
+ {
+ this._hostname = hostname;
+
+ _udpClient = new UdpClient();
+ EnableUdp(udpPort);
+
+ _sendDataAction = SendUdp;
+ }
+
+ #endregion
+
+ #region Methods
+
+ ///
+ protected override void OnStartup(object sender, CustomUpdateData customData)
+ {
+ base.OnStartup(sender, customData);
+
+ ResetDevice();
+ }
+
+ ///
+ protected override void Update(Dictionary dataSet)
+ {
+ foreach (IGrouping channelData in dataSet.Select(x => (((int channel, int key))x.Key, x.Value))
+ .GroupBy(x => x.Item1.channel))
+ {
+ byte[] buffer = GetBuffer(channelData);
+ _sendDataAction(buffer);
+ }
+ }
+
+ private void SendHttp(byte[] buffer)
+ {
+ string data = Convert.ToBase64String(buffer);
+ lock (_httpClient) _httpClient?.PostAsync(GetUrl("update"), new StringContent(data, Encoding.ASCII)).Wait();
+ }
+
+ private void SendUdp(byte[] buffer)
+ {
+ _udpClient?.Send(buffer, buffer.Length);
+ }
+
+ private byte[] GetBuffer(IGrouping data)
+ {
+ int channel = data.Key;
+ byte[] buffer = _dataBuffer[channel];
+
+ buffer[0] = GetSequenceNumber(channel);
+ buffer[1] = (byte)channel;
+ int i = 2;
+ foreach ((byte _, byte r, byte g, byte b) in data.OrderBy(x => x.Item1.key)
+ .Select(x => x.Value.GetRGBBytes()))
+ {
+ buffer[i++] = r;
+ buffer[i++] = g;
+ buffer[i++] = b;
+ }
+
+ return buffer;
+ }
+
+ internal IEnumerable<(int channel, int ledCount)> GetChannels()
+ {
+ string configString;
+ lock (_httpClient) configString = _httpClient.GetStringAsync(GetUrl("config")).Result;
+
+ configString = configString.Replace(" ", "")
+ .Replace("\r", "")
+ .Replace("\n", "");
+
+ //HACK DarthAffe 13.07.2020: Adding a JSON-Parser dependency just for this is not really worth it right now ...
+ MatchCollection channelMatches = Regex.Matches(configString, "\\{\"channel\":(?\\d+),\"leds\":(?\\d+)\\}");
+ foreach (Match channelMatch in channelMatches)
+ {
+ int channel = int.Parse(channelMatch.Groups["channel"].Value);
+ int leds = int.Parse(channelMatch.Groups["leds"].Value);
+ if (leds > 0)
+ {
+ _dataBuffer[channel] = new byte[(leds * 3) + 2];
+ _sequenceNumbers[channel] = 0;
+ yield return (channel, leds);
+ }
+ }
+ }
+
+ internal void ResetDevice()
+ {
+ lock (_httpClient) _httpClient.GetStringAsync(GetUrl("reset")).Wait();
+ }
+
+ private void EnableUdp(int port)
+ {
+ _httpClient.PostAsync(GetUrl("enableUDP"), new StringContent(port.ToString(), Encoding.UTF8, "application/json")).Result.Content.ReadAsStringAsync().Wait();
+ _udpClient.Connect(_hostname, port);
+ }
+
+ private byte GetSequenceNumber(int channel)
+ {
+ byte sequenceNumber = (byte)Math.Max(1, (_sequenceNumbers[channel] + 1) % byte.MaxValue);
+ _sequenceNumbers[channel] = sequenceNumber;
+ return sequenceNumber;
+ }
+
+ ///
+ public override void Dispose()
+ {
+ lock (_httpClient)
+ {
+ base.Dispose();
+
+#if NETSTANDARD
+ _udpClient?.Dispose();
+#endif
+ _udpClient = null;
+
+ ResetDevice();
+ _httpClient.Dispose();
+ _httpClient = null;
+ }
+ }
+
+ private string GetUrl(string path) => $"http://{_hostname}/{path}";
+
+ #endregion
+ }
+}
diff --git a/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS281XDeviceDefinition.cs b/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS281XDeviceDefinition.cs
new file mode 100644
index 0000000..f573eab
--- /dev/null
+++ b/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS281XDeviceDefinition.cs
@@ -0,0 +1,83 @@
+// ReSharper disable MemberCanBePrivate.Global
+// ReSharper disable UnusedMember.Global
+// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
+
+using System;
+using System.Collections.Generic;
+using RGB.NET.Core;
+
+namespace RGB.NET.Devices.WS281X.NodeMCU
+{
+ // ReSharper disable once InconsistentNaming
+ ///
+ ///
+ /// Represents a definition of an NodeMCU WS2812 devices.
+ ///
+ public class NodeMCUWS281XDeviceDefinition : IWS281XDeviceDefinition
+ {
+ #region Properties & Fields
+
+ ///
+ /// Gets the hostname to connect to.
+ ///
+ public string Hostname { get; }
+
+ ///
+ /// Gets or sets the port of the UDP connection.
+ ///
+ public int Port { get; set; } = 1872;
+
+ ///
+ /// Gets or sets the update-mode of the device.
+ ///
+ public NodeMCUUpdateMode UpdateMode { get; set; }
+
+ ///
+ /// Gets or sets the name used by this device.
+ /// This allows to use {0} as a placeholder for a incrementing number if multiple devices are created.
+ ///
+ public string Name { get; set; }
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The hostname to connect to.
+ /// The update mode of the device.
+ public NodeMCUWS281XDeviceDefinition(string hostname, NodeMCUUpdateMode updateMode = NodeMCUUpdateMode.Udp)
+ {
+ this.Hostname = hostname;
+ this.UpdateMode = updateMode;
+ }
+
+ #endregion
+
+ #region Methods
+
+ ///
+ public IEnumerable CreateDevices(IDeviceUpdateTrigger updateTrigger)
+ {
+ NodeMCUWS2812USBUpdateQueue queue = UpdateMode switch
+ {
+ NodeMCUUpdateMode.Http => new NodeMCUWS2812USBUpdateQueue(updateTrigger, Hostname),
+ NodeMCUUpdateMode.Udp => new NodeMCUWS2812USBUpdateQueue(updateTrigger, Hostname, Port),
+ _ => throw new ArgumentOutOfRangeException()
+ };
+
+ IEnumerable<(int channel, int ledCount)> channels = queue.GetChannels();
+ int counter = 0;
+ foreach ((int channel, int ledCount) in channels)
+ {
+ string name = string.Format(Name ?? $"NodeMCU WS2812 WIFI ({Hostname}) [{{0}}]", ++counter);
+ NodeMCUWS2812USBDevice device = new NodeMCUWS2812USBDevice(new NodeMCUWS2812USBDeviceInfo(name), queue, channel);
+ device.Initialize(ledCount);
+ yield return device;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj b/RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj
index a2d0f40..c8a987d 100644
--- a/RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj
+++ b/RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj
@@ -14,8 +14,8 @@
RGB.NET.Devices.WS281X
WS281X-Device-Implementations of RGB.NET
WS281X-Device-Implementations of RGB.NET, a C# (.NET) library for accessing various RGB-peripherals
- Copyright © Wyrez 2018
- Copyright © Wyrez 2018
+ Copyright © Darth Affe 2020
+ Copyright © Darth Affe 2020
http://lib.arge.be/icon.png
https://github.com/DarthAffe/RGB.NET
https://raw.githubusercontent.com/DarthAffe/RGB.NET/master/LICENSE
@@ -63,10 +63,11 @@
-
+
+
-
+
\ No newline at end of file
diff --git a/RGB.NET.Devices.WS281X/Sketches/RGB.NET_NodeMCU.ino b/RGB.NET.Devices.WS281X/Sketches/RGB.NET_NodeMCU.ino
new file mode 100644
index 0000000..02feab3
--- /dev/null
+++ b/RGB.NET.Devices.WS281X/Sketches/RGB.NET_NodeMCU.ino
@@ -0,0 +1,295 @@
+#define FASTLED_ESP8266_RAW_PIN_ORDER
+
+#include "FastLED.h"
+#include
+#include
+#include
+#include "base64.hpp"
+
+//#### CONFIGURATION ####
+
+// WLAN settings
+const char* ssid = ""; // WLAN-network-name
+const char* password = ""; // WLAN-password
+
+#define CHANNELS 4 // change this only if you add or remove channels in the implementation-part. To disable channels set them to 0 leds.
+
+// should not exceed 168 leds, since that results in the maximum paket size that is safe to transmit. Everything above could potentially be dropped.
+// no more than 255 leds per channel (hard limit)
+#define LEDS_CHANNEL_1 3
+#define LEDS_CHANNEL_2 0
+#define LEDS_CHANNEL_3 0
+#define LEDS_CHANNEL_4 0
+
+#define PIN_CHANNEL_1 15 // D8
+#define PIN_CHANNEL_2 13 // D7
+#define PIN_CHANNEL_3 12 // D6
+#define PIN_CHANNEL_4 14 // D5
+
+#define WEBSERVER_PORT 80
+
+//#######################
+
+CRGB leds_channel_1[LEDS_CHANNEL_1];
+CRGB leds_channel_2[LEDS_CHANNEL_2];
+CRGB leds_channel_3[LEDS_CHANNEL_3];
+CRGB leds_channel_4[LEDS_CHANNEL_4];
+
+ESP8266WebServer server(WEBSERVER_PORT);
+WiFiUDP Udp;
+
+bool isUDPEnabled;
+int udpPort;
+byte incomingPacket[767]; // 255 (max leds) * 3 + 2 (header)
+byte lastSequenceNumbers[CHANNELS];
+
+bool checkSequenceNumber(int channel, byte currentSequenceNumber)
+{
+ bool isValid = (currentSequenceNumber > lastSequenceNumbers[channel]) || ((lastSequenceNumbers[channel] > 200) && (currentSequenceNumber < 50));
+ if(isValid)
+ {
+ lastSequenceNumbers[channel] = currentSequenceNumber;
+ }
+ return isValid;
+}
+
+void processUDP()
+{
+ int packetSize = Udp.parsePacket();
+ if (packetSize)
+ {
+ // receive incoming UDP packets
+ byte sequenceNumber = Udp.read();
+ byte channel = Udp.read();
+ if(checkSequenceNumber(channel, sequenceNumber))
+ {
+ switch(channel)
+ {
+ case 1: // set leds of channel 1
+ Udp.read((uint8_t*)leds_channel_1, (LEDS_CHANNEL_1 * 3));
+ FastLED.show();
+ break;
+
+ // ### channel 2 ###
+ case 2: // set leds of channel 2
+ Udp.read((uint8_t*)leds_channel_2, (LEDS_CHANNEL_2 * 3));
+ FastLED.show();
+ break;
+
+ // ### channel 3 ###
+ case 3: // set leds of channel 3
+ Udp.read((uint8_t*)leds_channel_3, (LEDS_CHANNEL_3 * 3));
+ FastLED.show();
+ break;
+
+ // ### channel 4 ###
+ case 4: // set leds of channel 4
+ Udp.read((uint8_t*)leds_channel_4, (LEDS_CHANNEL_4 * 3));
+ FastLED.show();
+ break;
+
+ // ### default ###
+ default:
+ break;
+ }
+ }
+ }
+}
+
+void handleRoot()
+{
+ String infoSite = (String)"\
+ \
+ RGB.NET \
+ \
+ \
+ RGB.NET \
+ This device is currently running the NodeMCU WS281X RGB.NET-Sketch. \
+ \
+ Check https://github.com/DarthAffe/RGB.NET for more info and the latest version of this sketch. \
+ \
+ Configuration: \
+ UDP: \ " + (isUDPEnabled ? ((String)"enabled (" + udpPort + ")") : "disabled") + " \
+ \
+ Channel 1 \
+ Leds: " + LEDS_CHANNEL_1 + " \
+ Pin: " + PIN_CHANNEL_1 + " \
+ \
+ Channel 2 \
+ Leds: " + LEDS_CHANNEL_2 + " \
+ Pin: " + PIN_CHANNEL_2 + " \
+ \
+ Channel 4 \
+ Leds: " + LEDS_CHANNEL_3 + " \
+ Pin: " + PIN_CHANNEL_3 + " \
+ \
+ Channel 4 \
+ Leds: " + LEDS_CHANNEL_4 + " \
+ Pin: " + PIN_CHANNEL_4 + " \
+ \
+ \
+";
+
+ server.send(200, "text/html", infoSite);
+}
+
+void handleConfig()
+{
+ String config = (String)"{\
+ \"channels\": [\
+ {\
+ \"channel\": 1,\
+ \"leds\": " + LEDS_CHANNEL_1 + "\
+ },\
+ {\
+ \"channel\": 2,\
+ \"leds\": " + LEDS_CHANNEL_2 + "\
+ },\
+ {\
+ \"channel\": 3,\
+ \"leds\": " + LEDS_CHANNEL_3 + "\
+ },\
+ {\
+ \"channel\": 4,\
+ \"leds\": " + LEDS_CHANNEL_4 + "\
+ }\
+ ]\
+}";
+
+ server.send(200, "application/json", config);
+}
+
+void handleEnableUDP()
+{
+ if(isUDPEnabled)
+ {
+ Udp.stop();
+ }
+
+ udpPort = server.arg(0).toInt();
+
+ Udp.begin(udpPort);
+ isUDPEnabled = true;
+
+ server.send(200, "text/html", "");
+}
+
+void handleDisableUDP()
+{
+ if(isUDPEnabled)
+ {
+ Udp.stop();
+ isUDPEnabled = false;
+ }
+
+ server.send(200, "text/html", "");
+}
+
+void handleReset()
+{
+ for(int i = 0; i < CHANNELS; i++)
+ {
+ lastSequenceNumbers[i] = 0;
+ }
+
+ for(int i = 0; i < LEDS_CHANNEL_1; i++)
+ {
+ leds_channel_1[i] = CRGB::Black;
+ }
+
+ for(int i = 0; i < LEDS_CHANNEL_2; i++)
+ {
+ leds_channel_2[i] = CRGB::Black;
+ }
+
+ for(int i = 0; i < LEDS_CHANNEL_3; i++)
+ {
+ leds_channel_3[i] = CRGB::Black;
+ }
+
+ for(int i = 0; i < LEDS_CHANNEL_4; i++)
+ {
+ leds_channel_4[i] = CRGB::Black;
+ }
+
+ FastLED.show();
+
+ server.send(200, "text/html", "");
+}
+
+void handleUpdate()
+{
+ unsigned int dataLength = decode_base64((unsigned char*)server.arg(0).c_str(), incomingPacket);
+
+ byte channel = (byte)incomingPacket[1];
+ switch(channel)
+ {
+ case 1: // set leds of channel 1
+ memcpy((uint8_t*)leds_channel_1, &incomingPacket[2], (LEDS_CHANNEL_1 * 3));
+ FastLED.show();
+ break;
+
+ // ### channel 2 ###
+ case 2: // set leds of channel 2
+ memcpy((uint8_t*)leds_channel_2, &incomingPacket[2], (LEDS_CHANNEL_2 * 3));
+ FastLED.show();
+ break;
+
+ // ### channel 3 ###
+ case 3: // set leds of channel 3
+ memcpy((uint8_t*)leds_channel_3, &incomingPacket[2], (LEDS_CHANNEL_3 * 3));
+ FastLED.show();
+ break;
+
+ // ### channel 4 ###
+ case 4: // set leds of channel 4
+ memcpy((uint8_t*)leds_channel_4, &incomingPacket[2], (LEDS_CHANNEL_4 * 3));
+ FastLED.show();
+ break;
+
+ // ### default ###
+ default:
+ break;
+ }
+
+ server.send(200, "text/html", "");
+}
+
+void setup()
+{
+ if(LEDS_CHANNEL_1 > 0) { FastLED.addLeds(leds_channel_1, LEDS_CHANNEL_1); }
+ if(LEDS_CHANNEL_2 > 0) { FastLED.addLeds(leds_channel_2, LEDS_CHANNEL_2); }
+ if(LEDS_CHANNEL_3 > 0) { FastLED.addLeds(leds_channel_3, LEDS_CHANNEL_3); }
+ if(LEDS_CHANNEL_4 > 0) { FastLED.addLeds(leds_channel_4, LEDS_CHANNEL_4); }
+
+ WiFi.begin(ssid, password);
+ while (WiFi.status() != WL_CONNECTED)
+ {
+ delay(500);
+ }
+
+ delay(100);
+
+ server.on("/", handleRoot);
+ server.on("/config", handleConfig);
+ server.on("/enableUDP", handleEnableUDP);
+ server.on("/disableUDP", handleDisableUDP);
+ server.on("/reset", handleReset);
+ server.on("/update", handleUpdate);
+ server.onNotFound(handleRoot);
+
+ server.begin();
+
+ handleReset();
+}
+
+void loop()
+{
+ server.handleClient();
+
+ if(isUDPEnabled)
+ {
+ processUDP();
+ }
+}
+
diff --git a/RGB.NET.Devices.WS281X/WS281XDeviceProvider.cs b/RGB.NET.Devices.WS281X/WS281XDeviceProvider.cs
index 127e54b..3875cf4 100644
--- a/RGB.NET.Devices.WS281X/WS281XDeviceProvider.cs
+++ b/RGB.NET.Devices.WS281X/WS281XDeviceProvider.cs
@@ -2,7 +2,9 @@
using System;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
using RGB.NET.Core;
+using RGB.NET.Devices.WS281X.NodeMCU;
namespace RGB.NET.Devices.WS281X
{
@@ -37,6 +39,11 @@ namespace RGB.NET.Devices.WS281X
// ReSharper disable once ReturnTypeCanBeEnumerable.Global
public List DeviceDefinitions { get; } = new List();
+ ///
+ /// The used to trigger the updates for corsair devices.
+ ///
+ public DeviceUpdateTrigger UpdateTrigger { get; }
+
#endregion
#region Constructors
@@ -49,6 +56,8 @@ namespace RGB.NET.Devices.WS281X
{
if (_instance != null) throw new InvalidOperationException($"There can be only one instance of type {nameof(WS281XDeviceProvider)}");
_instance = this;
+
+ UpdateTrigger = new DeviceUpdateTrigger();
}
#endregion
@@ -69,17 +78,20 @@ namespace RGB.NET.Devices.WS281X
try
{
+ UpdateTrigger?.Stop();
+
List devices = new List();
foreach (IWS281XDeviceDefinition deviceDefinition in DeviceDefinitions)
{
try
{
- devices.AddRange(deviceDefinition.CreateDevices());
+ devices.AddRange(deviceDefinition.CreateDevices(UpdateTrigger));
}
catch { if (throwExceptions) throw; }
}
- Devices = devices;
+ UpdateTrigger?.Start();
+ Devices = new ReadOnlyCollection(devices);
IsInitialized = true;
}
catch
@@ -94,15 +106,19 @@ namespace RGB.NET.Devices.WS281X
///
public void ResetDevices()
- { }
+ {
+ foreach (IRGBDevice device in Devices)
+ if (device is NodeMCUWS2812USBDevice nodemcuDevice)
+ nodemcuDevice.UpdateQueue.ResetDevice();
+ }
///
public void Dispose()
{
- if (IsInitialized)
- foreach (IRGBDevice device in Devices)
- if (device is IDisposable disposable)
- disposable.Dispose();
+ try { UpdateTrigger?.Dispose(); }
+ catch { /* at least we tried */}
+
+ DeviceDefinitions.Clear();
}
#endregion
diff --git a/RGB.NET.Devices.Wooting/Generic/WootingRGBDevice.cs b/RGB.NET.Devices.Wooting/Generic/WootingRGBDevice.cs
index 7647a3d..b766da8 100644
--- a/RGB.NET.Devices.Wooting/Generic/WootingRGBDevice.cs
+++ b/RGB.NET.Devices.Wooting/Generic/WootingRGBDevice.cs
@@ -63,6 +63,15 @@ namespace RGB.NET.Devices.Wooting.Generic
///
protected abstract void InitializeLayout();
+ ///
+ public override void Dispose()
+ {
+ try { UpdateQueue?.Dispose(); }
+ catch { /* at least we tried */ }
+
+ base.Dispose();
+ }
+
#endregion
}
}
diff --git a/RGB.NET.Devices.Wooting/Generic/WootingUpdateQueue.cs b/RGB.NET.Devices.Wooting/Generic/WootingUpdateQueue.cs
index 8342768..8f89610 100644
--- a/RGB.NET.Devices.Wooting/Generic/WootingUpdateQueue.cs
+++ b/RGB.NET.Devices.Wooting/Generic/WootingUpdateQueue.cs
@@ -36,7 +36,7 @@ namespace RGB.NET.Devices.Wooting.Generic
_WootingSDK.ArrayUpdateKeyboard();
}
-
+
#endregion
}
}
diff --git a/RGB.NET.Devices.Wooting/Keyboard/WootingKeyboardLedMappings.cs b/RGB.NET.Devices.Wooting/Keyboard/WootingKeyboardLedMappings.cs
index 2f032f6..dc9fa15 100644
--- a/RGB.NET.Devices.Wooting/Keyboard/WootingKeyboardLedMappings.cs
+++ b/RGB.NET.Devices.Wooting/Keyboard/WootingKeyboardLedMappings.cs
@@ -32,7 +32,7 @@ namespace RGB.NET.Devices.Wooting.Keyboard
{ LedId.Keyboard_F12, (0,13) },
{ LedId.Keyboard_PrintScreen, (0,14) },
{ LedId.Keyboard_PauseBreak, (0,15) },
- { LedId.Keyboard_Custom1, (0,20) },
+ { LedId.Keyboard_Custom1, (0,16) },
{ LedId.Keyboard_GraveAccentAndTilde, (1,0) },
{ LedId.Keyboard_1, (1,1) },
@@ -128,7 +128,7 @@ namespace RGB.NET.Devices.Wooting.Keyboard
{ LedId.Keyboard_F12, (0,13) },
{ LedId.Keyboard_PrintScreen, (0,14) },
{ LedId.Keyboard_PauseBreak, (0,15) },
- { LedId.Keyboard_Custom1, (0,20) },
+ { LedId.Keyboard_Custom1, (0,16) },
{ LedId.Keyboard_GraveAccentAndTilde, (1,0) },
{ LedId.Keyboard_1, (1,1) },
diff --git a/RGB.NET.Devices.Wooting/Keyboard/WootingKeyboardRGBDevice.cs b/RGB.NET.Devices.Wooting/Keyboard/WootingKeyboardRGBDevice.cs
index 0b3334a..3ccc35a 100644
--- a/RGB.NET.Devices.Wooting/Keyboard/WootingKeyboardRGBDevice.cs
+++ b/RGB.NET.Devices.Wooting/Keyboard/WootingKeyboardRGBDevice.cs
@@ -5,11 +5,11 @@ using RGB.NET.Devices.Wooting.Generic;
namespace RGB.NET.Devices.Wooting.Keyboard
{
- ///
+ ///
///
/// Represents a Wooting keyboard.
///
- public class WootingKeyboardRGBDevice : WootingRGBDevice
+ public class WootingKeyboardRGBDevice : WootingRGBDevice, IKeyboard
{
#region Constructors
diff --git a/RGB.NET.Devices.Wooting/Native/_WootingDeviceInfo.cs b/RGB.NET.Devices.Wooting/Native/_WootingDeviceInfo.cs
index 5855a7b..d22a518 100644
--- a/RGB.NET.Devices.Wooting/Native/_WootingDeviceInfo.cs
+++ b/RGB.NET.Devices.Wooting/Native/_WootingDeviceInfo.cs
@@ -4,18 +4,18 @@ using RGB.NET.Devices.Wooting.Enum;
namespace RGB.NET.Devices.Wooting.Native
{
[StructLayout(LayoutKind.Sequential)]
- public struct _WootingDeviceInfo
+ internal struct _WootingDeviceInfo
{
- public bool Connected { get; private set; }
+ internal bool Connected { get; private set; }
- public string Model { get; private set; }
+ internal string Model { get; private set; }
- public byte MaxRows { get; private set; }
+ internal byte MaxRows { get; private set; }
- public byte MaxColumns { get; private set; }
+ internal byte MaxColumns { get; private set; }
- public byte KeycodeLimit { get; private set; }
+ internal byte KeycodeLimit { get; private set; }
- public WootingDeviceType DeviceType { get; private set; }
+ internal WootingDeviceType DeviceType { get; private set; }
}
}
diff --git a/RGB.NET.Devices.Wooting/Native/_WootingSDK.cs b/RGB.NET.Devices.Wooting/Native/_WootingSDK.cs
index a9017f3..1bb7dd9 100644
--- a/RGB.NET.Devices.Wooting/Native/_WootingSDK.cs
+++ b/RGB.NET.Devices.Wooting/Native/_WootingSDK.cs
@@ -6,13 +6,12 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
-using System.Text;
using RGB.NET.Core;
namespace RGB.NET.Devices.Wooting.Native
{
// ReSharper disable once InconsistentNaming
- public class _WootingSDK
+ internal static class _WootingSDK
{
#region Library management
@@ -47,12 +46,13 @@ namespace RGB.NET.Devices.Wooting.Native
_getDeviceInfoPointer = (GetDeviceInfoPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "wooting_rgb_device_info"), typeof(GetDeviceInfoPointer));
_keyboardConnectedPointer = (KeyboardConnectedPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "wooting_rgb_kbd_connected"), typeof(KeyboardConnectedPointer));
- _resetPointer = (ResetPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "wooting_rgb_reset"), typeof(ResetPointer));
+ _resetPointer = (ResetPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "wooting_rgb_reset_rgb"), typeof(ResetPointer));
+ _closePointer = (ClosePointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "wooting_rgb_close"), typeof(ClosePointer));
_arrayUpdateKeyboardPointer = (ArrayUpdateKeyboardPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "wooting_rgb_array_update_keyboard"), typeof(ArrayUpdateKeyboardPointer));
_arraySetSinglePointer = (ArraySetSinglePointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "wooting_rgb_array_set_single"), typeof(ArraySetSinglePointer));
}
- private static void UnloadWootingSDK()
+ internal static void UnloadWootingSDK()
{
if (_dllHandle == IntPtr.Zero) return;
@@ -82,6 +82,7 @@ namespace RGB.NET.Devices.Wooting.Native
private static GetDeviceInfoPointer _getDeviceInfoPointer;
private static KeyboardConnectedPointer _keyboardConnectedPointer;
private static ResetPointer _resetPointer;
+ private static ClosePointer _closePointer;
private static ArrayUpdateKeyboardPointer _arrayUpdateKeyboardPointer;
private static ArraySetSinglePointer _arraySetSinglePointer;
@@ -91,13 +92,16 @@ namespace RGB.NET.Devices.Wooting.Native
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate IntPtr GetDeviceInfoPointer();
-
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate bool KeyboardConnectedPointer();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate bool ResetPointer();
-
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ private delegate bool ClosePointer();
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate bool ArrayUpdateKeyboardPointer();
@@ -109,6 +113,7 @@ namespace RGB.NET.Devices.Wooting.Native
internal static IntPtr GetDeviceInfo() => _getDeviceInfoPointer();
internal static bool KeyboardConnected() => _keyboardConnectedPointer();
internal static bool Reset() => _resetPointer();
+ internal static bool Close() => _closePointer();
internal static bool ArrayUpdateKeyboard() => _arrayUpdateKeyboardPointer();
internal static bool ArraySetSingle(byte row, byte column, byte red, byte green, byte blue) => _arraySetSinglePointer(row, column, red, green, blue);
diff --git a/RGB.NET.Devices.Wooting/RGB.NET.Devices.Wooting.csproj b/RGB.NET.Devices.Wooting/RGB.NET.Devices.Wooting.csproj
index 128556f..4efa935 100644
--- a/RGB.NET.Devices.Wooting/RGB.NET.Devices.Wooting.csproj
+++ b/RGB.NET.Devices.Wooting/RGB.NET.Devices.Wooting.csproj
@@ -14,14 +14,14 @@
RGB.NET.Devices.Wooting
Wooting-Device-Implementations of RGB.NET
Wooting-Device-Implementations of RGB.NET, a C# (.NET) library for accessing various RGB-peripherals
- Copyright © Wyrez 2017
- Copyright © Wyrez 2017
+ Copyright © Darth Affe 2020
+ Copyright © Darth Affe 2020
http://lib.arge.be/icon.png
https://github.com/DarthAffe/RGB.NET
https://raw.githubusercontent.com/DarthAffe/RGB.NET/master/LICENSE
Github
https://github.com/DarthAffe/RGB.NET
- False
+ True
@@ -63,6 +63,6 @@
-
+
\ No newline at end of file
diff --git a/RGB.NET.Devices.Wooting/WootingDeviceProvider.cs b/RGB.NET.Devices.Wooting/WootingDeviceProvider.cs
index 5a1113c..9b83452 100644
--- a/RGB.NET.Devices.Wooting/WootingDeviceProvider.cs
+++ b/RGB.NET.Devices.Wooting/WootingDeviceProvider.cs
@@ -28,13 +28,13 @@ namespace RGB.NET.Devices.Wooting
/// Gets a modifiable list of paths used to find the native SDK-dlls for x86 applications.
/// The first match will be used.
///
- public static List PossibleX86NativePaths { get; } = new List {"x86/wooting-rgb-sdk.dll"};
+ public static List PossibleX86NativePaths { get; } = new List { "x86/wooting-rgb-sdk.dll" };
///
/// Gets a modifiable list of paths used to find the native SDK-dlls for x64 applications.
/// The first match will be used.
///
- public static List PossibleX64NativePaths { get; } = new List {"x64/wooting-rgb-sdk64.dll"};
+ public static List PossibleX64NativePaths { get; } = new List { "x64/wooting-rgb-sdk64.dll" };
///
///
@@ -143,10 +143,14 @@ namespace RGB.NET.Devices.Wooting
///
public void Dispose()
{
- try { _WootingSDK.Reset(); }
- catch
- { /* Unlucky.. */
- }
+ try { UpdateTrigger?.Dispose(); }
+ catch { /* at least we tried */ }
+
+ try { _WootingSDK.Close(); }
+ catch { /* Unlucky.. */ }
+
+ try { _WootingSDK.UnloadWootingSDK(); }
+ catch { /* at least we tried */ }
}
#endregion
diff --git a/RGB.NET.Groups/Groups/ListLedGroup.cs b/RGB.NET.Groups/Groups/ListLedGroup.cs
index a5fed36..eb833d8 100644
--- a/RGB.NET.Groups/Groups/ListLedGroup.cs
+++ b/RGB.NET.Groups/Groups/ListLedGroup.cs
@@ -92,9 +92,10 @@ namespace RGB.NET.Groups
{
if (leds == null) return;
- foreach (Led led in leds)
- if ((led != null) && !ContainsLed(led))
- GroupLeds.Add(led);
+ lock (GroupLeds)
+ foreach (Led led in leds)
+ if ((led != null) && !ContainsLed(led))
+ GroupLeds.Add(led);
}
///
@@ -111,9 +112,10 @@ namespace RGB.NET.Groups
{
if (leds == null) return;
- foreach (Led led in leds)
- if (led != null)
- GroupLeds.Remove(led);
+ lock (GroupLeds)
+ foreach (Led led in leds)
+ if (led != null)
+ GroupLeds.Remove(led);
}
///
@@ -121,7 +123,11 @@ namespace RGB.NET.Groups
///
/// The LED which should be checked.
/// true if the LED is contained by this ledgroup; otherwise, false .
- public bool ContainsLed(Led led) => (led != null) && GroupLeds.Contains(led);
+ public bool ContainsLed(Led led)
+ {
+ lock (GroupLeds)
+ return (led != null) && GroupLeds.Contains(led);
+ }
///
/// Merges the from the given ledgroup in this ledgroup.
@@ -129,9 +135,10 @@ namespace RGB.NET.Groups
/// The ledgroup to merge.
public void MergeLeds(ILedGroup groupToMerge)
{
- foreach (Led led in groupToMerge.GetLeds())
- if (!GroupLeds.Contains(led))
- GroupLeds.Add(led);
+ lock (GroupLeds)
+ foreach (Led led in groupToMerge.GetLeds())
+ if (!GroupLeds.Contains(led))
+ GroupLeds.Add(led);
}
///
@@ -139,7 +146,11 @@ namespace RGB.NET.Groups
/// Gets a list containing the from this group.
///
/// The list containing the .
- public override IEnumerable GetLeds() => GroupLeds;
+ public override IList GetLeds()
+ {
+ lock (GroupLeds)
+ return new List(GroupLeds);
+ }
#endregion
}
diff --git a/RGB.NET.Groups/Groups/RectangleLedGroup.cs b/RGB.NET.Groups/Groups/RectangleLedGroup.cs
index 1b23c26..90bb88c 100644
--- a/RGB.NET.Groups/Groups/RectangleLedGroup.cs
+++ b/RGB.NET.Groups/Groups/RectangleLedGroup.cs
@@ -105,7 +105,7 @@ namespace RGB.NET.Groups
/// Gets a list containing all of this .
///
/// The list containing all of this .
- public override IEnumerable GetLeds() => _ledCache ??= RGBSurface.Instance.Leds.Where(led => led.AbsoluteLedRectangle.CalculateIntersectPercentage(Rectangle) >= MinOverlayPercentage).ToList();
+ public override IList GetLeds() => _ledCache ??= RGBSurface.Instance.Leds.Where(led => led.AbsoluteLedRectangle.CalculateIntersectPercentage(Rectangle) >= MinOverlayPercentage).ToList();
private void InvalidateCache() => _ledCache = null;
diff --git a/RGB.NET.Groups/RGB.NET.Groups.csproj b/RGB.NET.Groups/RGB.NET.Groups.csproj
index de52c4a..59c8c35 100644
--- a/RGB.NET.Groups/RGB.NET.Groups.csproj
+++ b/RGB.NET.Groups/RGB.NET.Groups.csproj
@@ -14,8 +14,8 @@
RGB.NET.Groups
Group-Presets of RGB.NET
Group-Presets of RGB.NET, a C# (.NET) library for accessing various RGB-peripherals
- Copyright © Wyrez 2017
- Copyright © Wyrez 2017
+ Copyright © Darth Affe 2020
+ Copyright © Darth Affe 2020
http://lib.arge.be/icon.png
https://github.com/DarthAffe/RGB.NET
https://raw.githubusercontent.com/DarthAffe/RGB.NET/master/LICENSE
@@ -63,6 +63,6 @@
-
+
\ No newline at end of file
diff --git a/Tests/RGB.NET.Core.Tests/RGB.NET.Core.Tests.csproj b/Tests/RGB.NET.Core.Tests/RGB.NET.Core.Tests.csproj
index 49bf8e9..1a1ca5b 100644
--- a/Tests/RGB.NET.Core.Tests/RGB.NET.Core.Tests.csproj
+++ b/Tests/RGB.NET.Core.Tests/RGB.NET.Core.Tests.csproj
@@ -7,9 +7,9 @@
-
-
-
+
+
+