From 5cb5962c1ea6bd616d61dfb380e333194e546803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ayta=C3=A7=20Kayadelen?= Date: Wed, 14 Jun 2023 22:41:07 +0200 Subject: [PATCH 01/38] remove System.Management dependency --- RGB.NET.Devices.Asus/AsusDeviceProvider.cs | 2 +- RGB.NET.Devices.Asus/Helper/WMIHelper.cs | 82 ------------------- .../Keyboard/AsusKeyboardRGBDeviceInfo.cs | 11 +-- .../RGB.NET.Devices.Asus.csproj | 4 - 4 files changed, 3 insertions(+), 96 deletions(-) delete mode 100644 RGB.NET.Devices.Asus/Helper/WMIHelper.cs diff --git a/RGB.NET.Devices.Asus/AsusDeviceProvider.cs b/RGB.NET.Devices.Asus/AsusDeviceProvider.cs index e3b093c..1f0784e 100644 --- a/RGB.NET.Devices.Asus/AsusDeviceProvider.cs +++ b/RGB.NET.Devices.Asus/AsusDeviceProvider.cs @@ -63,7 +63,7 @@ public sealed class AsusDeviceProvider : AbstractRGBDeviceProvider yield return (AsusDeviceType)device.Type switch { - AsusDeviceType.MB_RGB => new AsusMainboardRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Mainboard, device, WMIHelper.GetMainboardInfo()?.model ?? device.Name), GetUpdateTrigger()), + AsusDeviceType.MB_RGB => new AsusMainboardRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Mainboard, device, device.Name), GetUpdateTrigger()), AsusDeviceType.MB_ADDRESABLE => new AsusUnspecifiedRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.LedStripe, device), LedId.LedStripe1, GetUpdateTrigger()), AsusDeviceType.VGA_RGB => new AsusGraphicsCardRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.GraphicsCard, device), GetUpdateTrigger()), AsusDeviceType.HEADSET_RGB => new AsusHeadsetRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Headset, device), GetUpdateTrigger()), diff --git a/RGB.NET.Devices.Asus/Helper/WMIHelper.cs b/RGB.NET.Devices.Asus/Helper/WMIHelper.cs deleted file mode 100644 index 482f3a3..0000000 --- a/RGB.NET.Devices.Asus/Helper/WMIHelper.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; -using System.Management; - -namespace RGB.NET.Devices.Asus; - -// ReSharper disable once InconsistentNaming -internal static class WMIHelper -{ - #region Properties & Fields - - // ReSharper disable InconsistentNaming - private static readonly ManagementObjectSearcher? _systemModelSearcher; - private static readonly ManagementObjectSearcher? _mainboardSearcher; - private static readonly ManagementObjectSearcher? _graphicsCardSearcher; - // ReSharper restore InconsistentNaming - - private static string? _systemModelInfo; - private static (string manufacturer, string model)? _mainboardInfo; - private static string? _graphicsCardInfo; - - #endregion - - #region Constructors - - static WMIHelper() - { - if (OperatingSystem.IsWindows()) - { - _systemModelSearcher = new ManagementObjectSearcher(@"root\CIMV2", "SELECT Model FROM Win32_ComputerSystem"); - _mainboardSearcher = new ManagementObjectSearcher(@"root\CIMV2", "SELECT Manufacturer,Product FROM Win32_BaseBoard"); - _graphicsCardSearcher = new ManagementObjectSearcher(@"root\CIMV2", "SELECT Name FROM Win32_VideoController"); - } - } - - #endregion - - #region Methods - - internal static string? GetSystemModelInfo() - { - if (!OperatingSystem.IsWindows()) return null; - - if ((_systemModelInfo == null) && (_systemModelSearcher != null)) - foreach (ManagementBaseObject managementBaseObject in _systemModelSearcher.Get()) - { - _systemModelInfo = managementBaseObject["Model"].ToString(); - break; - } - - return _systemModelInfo; - } - - internal static (string manufacturer, string model)? GetMainboardInfo() - { - if (!OperatingSystem.IsWindows()) return null; - - if (!_mainboardInfo.HasValue && (_mainboardSearcher != null)) - foreach (ManagementBaseObject managementBaseObject in _mainboardSearcher.Get()) - { - _mainboardInfo = (managementBaseObject["Manufacturer"].ToString() ?? string.Empty, managementBaseObject["Product"].ToString() ?? string.Empty); - break; - } - - return _mainboardInfo; - } - - internal static string? GetGraphicsCardsInfo() - { - if (!OperatingSystem.IsWindows()) return null; - - if ((_graphicsCardInfo == null) && (_graphicsCardSearcher != null)) - foreach (ManagementBaseObject managementBaseObject in _graphicsCardSearcher.Get()) - { - _graphicsCardInfo = managementBaseObject["Name"].ToString(); - break; - } - - return _graphicsCardInfo; - } - - #endregion -} \ No newline at end of file diff --git a/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs b/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs index b40ec59..b99688a 100644 --- a/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using AuraServiceLib; +using AuraServiceLib; using RGB.NET.Core; namespace RGB.NET.Devices.Asus; @@ -11,12 +10,6 @@ public sealed class AsusKeyboardRGBDeviceInfo : AsusRGBDeviceInfo, IKeyboardDevi { #region Properties & Fields - /// - /// The ASUS SDK returns useless names for notebook keyboards, possibly for others as well. - /// Keep a list of those and rely on to get the real model - /// - private static readonly List GENERIC_DEVICE_NAMES = new() { "NotebookKeyboard" }; - /// public KeyboardLayoutType Layout => KeyboardLayoutType.Unknown; @@ -37,7 +30,7 @@ public sealed class AsusKeyboardRGBDeviceInfo : AsusRGBDeviceInfo, IKeyboardDevi #region Methods - private static string? GetKeyboardModel(string deviceName) => GENERIC_DEVICE_NAMES.Contains(deviceName) ? WMIHelper.GetSystemModelInfo() : deviceName; + private static string? GetKeyboardModel(string deviceName) => deviceName; #endregion } \ No newline at end of file diff --git a/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj b/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj index dc67689..6d14d24 100644 --- a/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj +++ b/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj @@ -56,10 +56,6 @@ - - - - From 1bd5b54892344399fa216ea17eb0897e7d4c8397 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ayta=C3=A7=20Kayadelen?= Date: Wed, 6 Dec 2023 22:19:43 +0100 Subject: [PATCH 02/38] pull --- RGB.NET.Devices.Asus/AsusDeviceProvider.cs | 2 +- .../Keyboard/AsusKeyboardRGBDeviceInfo.cs | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/RGB.NET.Devices.Asus/AsusDeviceProvider.cs b/RGB.NET.Devices.Asus/AsusDeviceProvider.cs index f939cb5..5515bc1 100644 --- a/RGB.NET.Devices.Asus/AsusDeviceProvider.cs +++ b/RGB.NET.Devices.Asus/AsusDeviceProvider.cs @@ -76,7 +76,7 @@ public sealed class AsusDeviceProvider : AbstractRGBDeviceProvider yield return (AsusDeviceType)device.Type switch { - AsusDeviceType.MB_RGB => new AsusMainboardRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Mainboard, device, device.Name), GetUpdateTrigger()), + AsusDeviceType.MB_RGB => new AsusMainboardRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Mainboard, device, "Asus Motherboard"), GetUpdateTrigger()), AsusDeviceType.MB_ADDRESABLE => new AsusUnspecifiedRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.LedStripe, device), LedId.LedStripe1, GetUpdateTrigger()), AsusDeviceType.VGA_RGB => new AsusGraphicsCardRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.GraphicsCard, device), GetUpdateTrigger()), AsusDeviceType.HEADSET_RGB => new AsusHeadsetRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Headset, device), GetUpdateTrigger()), diff --git a/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs b/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs index b99688a..f86a766 100644 --- a/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs @@ -1,4 +1,5 @@ -using AuraServiceLib; +using System.Collections.Generic; +using AuraServiceLib; using RGB.NET.Core; namespace RGB.NET.Devices.Asus; @@ -10,6 +11,11 @@ public sealed class AsusKeyboardRGBDeviceInfo : AsusRGBDeviceInfo, IKeyboardDevi { #region Properties & Fields + /// + /// The ASUS SDK returns useless names for notebook keyboards, possibly for others as well. + /// + private static readonly List GENERIC_DEVICE_NAMES = new() { "NotebookKeyboard" }; + /// public KeyboardLayoutType Layout => KeyboardLayoutType.Unknown; @@ -30,7 +36,7 @@ public sealed class AsusKeyboardRGBDeviceInfo : AsusRGBDeviceInfo, IKeyboardDevi #region Methods - private static string? GetKeyboardModel(string deviceName) => deviceName; + private static string? GetKeyboardModel(string deviceName) => GENERIC_DEVICE_NAMES.Contains(deviceName) ? "Asus Motherboard" : deviceName; #endregion } \ No newline at end of file From 83d1b2472b3b544a7dda0c7e662f00662b332d82 Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Mon, 27 May 2024 22:31:58 +0200 Subject: [PATCH 03/38] Added detection for a razer and a stellseries device --- RGB.NET.Devices.Razer/RazerDeviceProvider.cs | 1 + RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/RGB.NET.Devices.Razer/RazerDeviceProvider.cs b/RGB.NET.Devices.Razer/RazerDeviceProvider.cs index 047705d..3657300 100644 --- a/RGB.NET.Devices.Razer/RazerDeviceProvider.cs +++ b/RGB.NET.Devices.Razer/RazerDeviceProvider.cs @@ -149,6 +149,7 @@ public sealed class RazerDeviceProvider : AbstractRGBDeviceProvider { 0x02A0, RGBDeviceType.Keyboard, "Blade 18", LedMappings.Blade, RazerEndpointType.Keyboard }, { 0x02A1, RGBDeviceType.Keyboard, "Ornata V3", LedMappings.Keyboard, RazerEndpointType.Keyboard }, { 0x02A5, RGBDeviceType.Keyboard, "BlackWidow V4 75%", LedMappings.Keyboard, RazerEndpointType.Keyboard }, + { 0x02A7, RGBDeviceType.Keyboard, "Huntsman V3 Pro TKL", LedMappings.Keyboard, RazerEndpointType.Keyboard }, { 0x0A24, RGBDeviceType.Keyboard, "BlackWidow V3 TKL", LedMappings.Keyboard, RazerEndpointType.Keyboard }, // Mice diff --git a/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs b/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs index 4f5a399..8bc3244 100644 --- a/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs +++ b/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs @@ -76,9 +76,10 @@ public sealed class SteelSeriesDeviceProvider : AbstractRGBDeviceProvider { 0x1600, RGBDeviceType.Keyboard, "Apex M800", LedMappings.KeyboardMappingUk, SteelSeriesDeviceType.PerKey }, { 0x1610, RGBDeviceType.Keyboard, "Apex Pro", LedMappings.KeyboardMappingUk, SteelSeriesDeviceType.PerKey }, { 0x1614, RGBDeviceType.Keyboard, "Apex Pro TKL", LedMappings.KeyboardTklMappingUk, SteelSeriesDeviceType.PerKey }, + { 0x1630, RGBDeviceType.Keyboard, "Apex Pro TKL", LedMappings.KeyboardTklMappingUk, SteelSeriesDeviceType.PerKey }, // DarthAffe 27.05.2024: This could be a generic wireless connector { 0x2036, RGBDeviceType.Keyboard, "MSI Notebook", LedMappings.KeyboardNotebookMappingUk, SteelSeriesDeviceType.PerKey }, { 0x113A, RGBDeviceType.Keyboard, "MSI GE78HX", LedMappings.KeyboardMSIGE78Mapping, SteelSeriesDeviceType.PerKey }, - { 0x1122, RGBDeviceType.Keyboard, "MSI Notebook", LedMappings.KeyboardNotebookMappingUk, SteelSeriesDeviceType.PerKey }, + { 0x1122, RGBDeviceType.Keyboard, "MSI Notebook", LedMappings.KeyboardNotebookMappingUk, SteelSeriesDeviceType.PerKey }, //Headsets { 0x12AA, RGBDeviceType.Headset, "Arctis 5", LedMappings.HeadsetTwoZone, SteelSeriesDeviceType.TwoZone }, From ed7ff7621034d437e6f97b01967ccaea432a51c9 Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Mon, 10 Jun 2024 19:46:06 +0200 Subject: [PATCH 04/38] Added detection for SteelSeries Apex 3 --- RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs b/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs index 8bc3244..60b797c 100644 --- a/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs +++ b/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs @@ -69,6 +69,7 @@ public sealed class SteelSeriesDeviceProvider : AbstractRGBDeviceProvider { 0x1852, RGBDeviceType.Mouse, "Aerox 5 Wireless", LedMappings.MouseThreeZone, SteelSeriesDeviceType.ThreeZone }, //Keyboards + { 0x161A, RGBDeviceType.Keyboard, "Apex 3", LedMappings.KeyboardMappingUk, SteelSeriesDeviceType.TenZone }, { 0x161C, RGBDeviceType.Keyboard, "Apex 5", LedMappings.KeyboardMappingUk, SteelSeriesDeviceType.PerKey }, { 0x1612, RGBDeviceType.Keyboard, "Apex 7", LedMappings.KeyboardMappingUk, SteelSeriesDeviceType.PerKey }, { 0x1618, RGBDeviceType.Keyboard, "Apex 7 TKL", LedMappings.KeyboardTklMappingUk, SteelSeriesDeviceType.PerKey }, From 5a13fcef7f37b30c5ef4fa63ca713954483cd351 Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Sat, 22 Jun 2024 19:30:47 +0200 Subject: [PATCH 05/38] Added media-keys and underglow-leds to razer-mapping; Correctly named BlackWidow v4 Pro --- RGB.NET.Devices.Razer/Generic/LedMappings.cs | 32 ++++++++++++++++++-- RGB.NET.Devices.Razer/RazerDeviceProvider.cs | 2 +- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/RGB.NET.Devices.Razer/Generic/LedMappings.cs b/RGB.NET.Devices.Razer/Generic/LedMappings.cs index d1a3dab..3b24f78 100644 --- a/RGB.NET.Devices.Razer/Generic/LedMappings.cs +++ b/RGB.NET.Devices.Razer/Generic/LedMappings.cs @@ -13,10 +13,17 @@ public static class LedMappings /// public static LedMapping Keyboard { get; } = new() { - //Row 0 is empty + #region Row 0 + + [LedId.LedStripe1] = (_Defines.KEYBOARD_MAX_COLUMN * 0) + 0, + [LedId.LedStripe16] = (_Defines.KEYBOARD_MAX_COLUMN * 0) + 23, + + #endregion #region Row 1 + [LedId.LedStripe2] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 0, + [LedId.Custom1] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 1, [LedId.Keyboard_Escape] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 2, [LedId.Keyboard_F1] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 4, [LedId.Keyboard_F2] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 5, @@ -33,12 +40,17 @@ public static class LedMappings [LedId.Keyboard_PrintScreen] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 16, [LedId.Keyboard_ScrollLock] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 17, [LedId.Keyboard_PauseBreak] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 18, - [LedId.Logo] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 21, + [LedId.Keyboard_MediaPreviousTrack] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 19, + [LedId.Keyboard_MediaPlay] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 20, + [LedId.Keyboard_MediaNextTrack] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 21, + [LedId.Keyboard_MediaMute] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 22, + [LedId.LedStripe15] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 23, #endregion #region Row 2 + [LedId.LedStripe3] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 0, [LedId.Keyboard_Programmable1] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 1, [LedId.Keyboard_GraveAccentAndTilde] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 2, [LedId.Keyboard_1] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 3, @@ -61,11 +73,13 @@ public static class LedMappings [LedId.Keyboard_NumSlash] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 20, [LedId.Keyboard_NumAsterisk] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 21, [LedId.Keyboard_NumMinus] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 22, + [LedId.LedStripe14] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 23, #endregion #region Row 3 + [LedId.LedStripe4] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 0, [LedId.Keyboard_Programmable2] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 1, [LedId.Keyboard_Tab] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 2, [LedId.Keyboard_Q] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 3, @@ -88,11 +102,13 @@ public static class LedMappings [LedId.Keyboard_Num8] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 20, [LedId.Keyboard_Num9] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 21, [LedId.Keyboard_NumPlus] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 22, + [LedId.LedStripe13] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 23, #endregion #region Row 4 + [LedId.LedStripe5] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 0, [LedId.Keyboard_Programmable3] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 1, [LedId.Keyboard_CapsLock] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 2, [LedId.Keyboard_A] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 3, @@ -111,11 +127,13 @@ public static class LedMappings [LedId.Keyboard_Num4] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 19, [LedId.Keyboard_Num5] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 20, [LedId.Keyboard_Num6] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 21, + [LedId.LedStripe12] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 23, #endregion #region Row 5 + [LedId.LedStripe6] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 0, [LedId.Keyboard_Programmable4] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 1, [LedId.Keyboard_LeftShift] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 2, [LedId.Keyboard_NonUsBackslash] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 3, @@ -135,11 +153,13 @@ public static class LedMappings [LedId.Keyboard_Num2] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 20, [LedId.Keyboard_Num3] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 21, [LedId.Keyboard_NumEnter] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 22, + [LedId.LedStripe11] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 23, #endregion #region Row 6 + [LedId.LedStripe7] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 0, [LedId.Keyboard_Programmable5] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 1, [LedId.Keyboard_LeftCtrl] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 2, [LedId.Keyboard_LeftGui] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 3, @@ -152,12 +172,18 @@ public static class LedMappings [LedId.Keyboard_ArrowLeft] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 16, [LedId.Keyboard_ArrowDown] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 17, [LedId.Keyboard_ArrowRight] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 18, + [LedId.LedStripe9] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 19, [LedId.Keyboard_Num0] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 20, [LedId.Keyboard_NumPeriodAndDelete] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 21, + [LedId.LedStripe10] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 23, #endregion - //Row 7 is also empty + #region Row 6 + + [LedId.LedStripe8] = (_Defines.KEYBOARD_MAX_COLUMN * 7) + 0, + + #endregion }; diff --git a/RGB.NET.Devices.Razer/RazerDeviceProvider.cs b/RGB.NET.Devices.Razer/RazerDeviceProvider.cs index 047705d..db32944 100644 --- a/RGB.NET.Devices.Razer/RazerDeviceProvider.cs +++ b/RGB.NET.Devices.Razer/RazerDeviceProvider.cs @@ -139,7 +139,7 @@ public sealed class RazerDeviceProvider : AbstractRGBDeviceProvider { 0x028B, RGBDeviceType.Keyboard, "Blade 17 (2022)", LedMappings.Keyboard, RazerEndpointType.Keyboard }, { 0x028C, RGBDeviceType.Keyboard, "Blade 14 (2022)", LedMappings.Keyboard, RazerEndpointType.Keyboard }, { 0x029F, RGBDeviceType.Keyboard, "Blade 16 (2023)", LedMappings.Blade, RazerEndpointType.Keyboard }, - { 0x028D, RGBDeviceType.Keyboard, "BlackWidow V4", LedMappings.Keyboard, RazerEndpointType.Keyboard }, + { 0x028D, RGBDeviceType.Keyboard, "BlackWidow V4 Pro", LedMappings.Keyboard, RazerEndpointType.Keyboard }, { 0x0290, RGBDeviceType.Keyboard, "DeathStalker V2 Pro", LedMappings.Keyboard, RazerEndpointType.Keyboard }, // Wireless { 0x0292, RGBDeviceType.Keyboard, "DeathStalker V2 Pro", LedMappings.Keyboard, RazerEndpointType.Keyboard }, // Wired { 0x0294, RGBDeviceType.Keyboard, "Ornata V3 X", LedMappings.Keyboard, RazerEndpointType.Keyboard }, From f21acbd7673c4fc71e0ce49c387d054922b5badc Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Sat, 22 Jun 2024 19:48:52 +0200 Subject: [PATCH 06/38] Fixed potential performance issue with for-loops when Spans are passed by reference --- RGB.NET.Core/Rendering/Textures/PixelTexture.cs | 4 ++-- .../Rendering/Textures/Sampler/AverageColorSampler.cs | 2 +- RGB.NET.Core/Rendering/Textures/Sampler/ISampler.cs | 2 +- RGB.NET.Core/Rendering/Textures/Sampler/SamplerInfo.cs | 2 +- RGB.NET.Core/Update/Devices/UpdateQueue.cs | 2 +- RGB.NET.Devices.Asus/Generic/AsusUpdateQueue.cs | 2 +- .../Generic/CoolerMasterUpdateQueue.cs | 2 +- RGB.NET.Devices.Corsair/Generic/CorsairDeviceUpdateQueue.cs | 2 +- .../Generic/CorsairDeviceUpdateQueue.cs | 2 +- RGB.NET.Devices.DMX/E131/E131UpdateQueue.cs | 2 +- RGB.NET.Devices.Debug/DebugDeviceUpdateQueue.cs | 2 +- .../PerDevice/LogitechPerDeviceUpdateQueue.cs | 2 +- .../PerKey/LogitechPerKeyUpdateQueue.cs | 2 +- RGB.NET.Devices.Logitech/Zone/LogitechZoneUpdateQueue.cs | 2 +- RGB.NET.Devices.Msi/Generic/MsiDeviceUpdateQueue.cs | 2 +- RGB.NET.Devices.Novation/Generic/MidiUpdateQueue.cs | 2 +- RGB.NET.Devices.OpenRGB/Generic/OpenRGBUpdateQueue.cs | 2 +- RGB.NET.Devices.PicoPi/PicoPi/PicoPiBulkUpdateQueue.cs | 2 +- RGB.NET.Devices.PicoPi/PicoPi/PicoPiHIDUpdateQueue.cs | 2 +- RGB.NET.Devices.PicoPi/PicoPi/PicoPiSDK.cs | 6 +++--- .../ChromaLink/RazerChromaLinkUpdateQueue.cs | 2 +- RGB.NET.Devices.Razer/Generic/RazerUpdateQueue.cs | 4 ++-- RGB.NET.Devices.Razer/Headset/RazerHeadsetUpdateQueue.cs | 2 +- RGB.NET.Devices.Razer/Keyboard/RazerKeyboardUpdateQueue.cs | 2 +- RGB.NET.Devices.Razer/Keypad/RazerKeypadUpdateQueue.cs | 2 +- RGB.NET.Devices.Razer/Mouse/RazerMouseUpdateQueue.cs | 2 +- RGB.NET.Devices.Razer/Mousepad/RazerMousepadUpdateQueue.cs | 2 +- .../Generic/SteelSeriesDeviceUpdateQueue.cs | 2 +- RGB.NET.Devices.WLED/Generic/WLedDeviceUpdateQueue.cs | 2 +- RGB.NET.Devices.WS281X/Generic/SerialPortUpdateQueue.cs | 2 +- .../NodeMCU/NodeMCUWS2812USBUpdateQueue.cs | 2 +- RGB.NET.Devices.Wooting/Generic/WootingUpdateQueue.cs | 2 +- RGB.NET.Presets/Textures/BytePixelTexture.cs | 2 +- RGB.NET.Presets/Textures/FloatPixelTexture.cs | 2 +- RGB.NET.Presets/Textures/Sampler/AverageByteSampler.cs | 2 +- RGB.NET.Presets/Textures/Sampler/AverageFloatSampler.cs | 2 +- 36 files changed, 40 insertions(+), 40 deletions(-) diff --git a/RGB.NET.Core/Rendering/Textures/PixelTexture.cs b/RGB.NET.Core/Rendering/Textures/PixelTexture.cs index 170d2d5..5ad4459 100644 --- a/RGB.NET.Core/Rendering/Textures/PixelTexture.cs +++ b/RGB.NET.Core/Rendering/Textures/PixelTexture.cs @@ -126,7 +126,7 @@ public abstract class PixelTexture : ITexture /// /// The pixel-data to convert. /// The color represented by the specified pixel-data. - protected abstract Color GetColor(in ReadOnlySpan pixel); + protected abstract Color GetColor(ReadOnlySpan pixel); /// /// Gets the pixel-data at the specified location. @@ -189,7 +189,7 @@ public sealed class PixelTexture : PixelTexture /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - protected override Color GetColor(in ReadOnlySpan pixel) => pixel[0]; + protected override Color GetColor(ReadOnlySpan pixel) => pixel[0]; #endregion } \ No newline at end of file diff --git a/RGB.NET.Core/Rendering/Textures/Sampler/AverageColorSampler.cs b/RGB.NET.Core/Rendering/Textures/Sampler/AverageColorSampler.cs index 9ba2cb0..f7e3258 100644 --- a/RGB.NET.Core/Rendering/Textures/Sampler/AverageColorSampler.cs +++ b/RGB.NET.Core/Rendering/Textures/Sampler/AverageColorSampler.cs @@ -22,7 +22,7 @@ public sealed class AverageColorSampler : ISampler #region Methods /// - public unsafe void Sample(in SamplerInfo info, in Span pixelData) + public unsafe void Sample(in SamplerInfo info, Span pixelData) { int count = info.Width * info.Height; if (count == 0) return; diff --git a/RGB.NET.Core/Rendering/Textures/Sampler/ISampler.cs b/RGB.NET.Core/Rendering/Textures/Sampler/ISampler.cs index 9a2c4f1..04fcfa0 100644 --- a/RGB.NET.Core/Rendering/Textures/Sampler/ISampler.cs +++ b/RGB.NET.Core/Rendering/Textures/Sampler/ISampler.cs @@ -13,5 +13,5 @@ public interface ISampler /// /// The information containing the data to sample. /// The buffer used to write the resulting pixel to. - void Sample(in SamplerInfo info, in Span pixelData); + void Sample(in SamplerInfo info, Span pixelData); } \ No newline at end of file diff --git a/RGB.NET.Core/Rendering/Textures/Sampler/SamplerInfo.cs b/RGB.NET.Core/Rendering/Textures/Sampler/SamplerInfo.cs index bf59c93..19ae76c 100644 --- a/RGB.NET.Core/Rendering/Textures/Sampler/SamplerInfo.cs +++ b/RGB.NET.Core/Rendering/Textures/Sampler/SamplerInfo.cs @@ -44,7 +44,7 @@ public readonly ref struct SamplerInfo /// The width of the region the data comes from. /// The height of region the data comes from. /// The data to sample. - public SamplerInfo(int x, int y, int width, int height, int stride, int dataPerPixel, in ReadOnlySpan data) + public SamplerInfo(int x, int y, int width, int height, int stride, int dataPerPixel, ReadOnlySpan data) { this._x = x; this._y = y; diff --git a/RGB.NET.Core/Update/Devices/UpdateQueue.cs b/RGB.NET.Core/Update/Devices/UpdateQueue.cs index 22ef7f9..7db3517 100644 --- a/RGB.NET.Core/Update/Devices/UpdateQueue.cs +++ b/RGB.NET.Core/Update/Devices/UpdateQueue.cs @@ -80,7 +80,7 @@ public abstract class UpdateQueue : AbstractReferenceCountin /// Performs the update this queue is responsible for. /// /// The set of data that needs to be updated. - protected abstract bool Update(in ReadOnlySpan<(TIdentifier key, TData color)> dataSet); + protected abstract bool Update(ReadOnlySpan<(TIdentifier key, TData color)> dataSet); /// /// Sets or merges the provided data set in the current dataset and notifies the trigger that there is new data available. diff --git a/RGB.NET.Devices.Asus/Generic/AsusUpdateQueue.cs b/RGB.NET.Devices.Asus/Generic/AsusUpdateQueue.cs index 2f40ec6..e6077a6 100644 --- a/RGB.NET.Devices.Asus/Generic/AsusUpdateQueue.cs +++ b/RGB.NET.Devices.Asus/Generic/AsusUpdateQueue.cs @@ -43,7 +43,7 @@ public sealed class AsusUpdateQueue : UpdateQueue #region Methods /// - protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet) { try { diff --git a/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterUpdateQueue.cs b/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterUpdateQueue.cs index 99e1428..f7506ce 100644 --- a/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterUpdateQueue.cs +++ b/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterUpdateQueue.cs @@ -37,7 +37,7 @@ public sealed class CoolerMasterUpdateQueue : UpdateQueue #region Methods /// - protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet) { try { diff --git a/RGB.NET.Devices.Corsair/Generic/CorsairDeviceUpdateQueue.cs b/RGB.NET.Devices.Corsair/Generic/CorsairDeviceUpdateQueue.cs index be3a3bf..bd707a2 100644 --- a/RGB.NET.Devices.Corsair/Generic/CorsairDeviceUpdateQueue.cs +++ b/RGB.NET.Devices.Corsair/Generic/CorsairDeviceUpdateQueue.cs @@ -40,7 +40,7 @@ public sealed class CorsairDeviceUpdateQueue : UpdateQueue #region Methods /// - protected override unsafe bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override unsafe bool Update(ReadOnlySpan<(object key, Color color)> dataSet) { try { diff --git a/RGB.NET.Devices.Corsair_Legacy/Generic/CorsairDeviceUpdateQueue.cs b/RGB.NET.Devices.Corsair_Legacy/Generic/CorsairDeviceUpdateQueue.cs index a766911..5237353 100644 --- a/RGB.NET.Devices.Corsair_Legacy/Generic/CorsairDeviceUpdateQueue.cs +++ b/RGB.NET.Devices.Corsair_Legacy/Generic/CorsairDeviceUpdateQueue.cs @@ -35,7 +35,7 @@ public class CorsairDeviceUpdateQueue : UpdateQueue #region Methods /// - protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet) { try { diff --git a/RGB.NET.Devices.DMX/E131/E131UpdateQueue.cs b/RGB.NET.Devices.DMX/E131/E131UpdateQueue.cs index 2e513ec..4fb1f43 100644 --- a/RGB.NET.Devices.DMX/E131/E131UpdateQueue.cs +++ b/RGB.NET.Devices.DMX/E131/E131UpdateQueue.cs @@ -59,7 +59,7 @@ public sealed class E131UpdateQueue : UpdateQueue } /// - protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet) { try { diff --git a/RGB.NET.Devices.Debug/DebugDeviceUpdateQueue.cs b/RGB.NET.Devices.Debug/DebugDeviceUpdateQueue.cs index df86acc..e228ea5 100644 --- a/RGB.NET.Devices.Debug/DebugDeviceUpdateQueue.cs +++ b/RGB.NET.Devices.Debug/DebugDeviceUpdateQueue.cs @@ -7,7 +7,7 @@ internal sealed class DebugDeviceUpdateQueue() : UpdateQueue(new DeviceUpdateTri { #region Methods - protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) => true; + protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet) => true; #endregion } \ No newline at end of file diff --git a/RGB.NET.Devices.Logitech/PerDevice/LogitechPerDeviceUpdateQueue.cs b/RGB.NET.Devices.Logitech/PerDevice/LogitechPerDeviceUpdateQueue.cs index b780a28..655c9a7 100644 --- a/RGB.NET.Devices.Logitech/PerDevice/LogitechPerDeviceUpdateQueue.cs +++ b/RGB.NET.Devices.Logitech/PerDevice/LogitechPerDeviceUpdateQueue.cs @@ -25,7 +25,7 @@ public sealed class LogitechPerDeviceUpdateQueue : UpdateQueue #region Methods /// - protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet) { try { diff --git a/RGB.NET.Devices.Logitech/PerKey/LogitechPerKeyUpdateQueue.cs b/RGB.NET.Devices.Logitech/PerKey/LogitechPerKeyUpdateQueue.cs index 7f1917f..7159b66 100644 --- a/RGB.NET.Devices.Logitech/PerKey/LogitechPerKeyUpdateQueue.cs +++ b/RGB.NET.Devices.Logitech/PerKey/LogitechPerKeyUpdateQueue.cs @@ -24,7 +24,7 @@ public sealed class LogitechPerKeyUpdateQueue : UpdateQueue #region Methods /// - protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet) { try { diff --git a/RGB.NET.Devices.Logitech/Zone/LogitechZoneUpdateQueue.cs b/RGB.NET.Devices.Logitech/Zone/LogitechZoneUpdateQueue.cs index c9a83a5..baf2253 100644 --- a/RGB.NET.Devices.Logitech/Zone/LogitechZoneUpdateQueue.cs +++ b/RGB.NET.Devices.Logitech/Zone/LogitechZoneUpdateQueue.cs @@ -33,7 +33,7 @@ public sealed class LogitechZoneUpdateQueue : UpdateQueue #region Methods /// - protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet) { try { diff --git a/RGB.NET.Devices.Msi/Generic/MsiDeviceUpdateQueue.cs b/RGB.NET.Devices.Msi/Generic/MsiDeviceUpdateQueue.cs index 0367029..0a64856 100644 --- a/RGB.NET.Devices.Msi/Generic/MsiDeviceUpdateQueue.cs +++ b/RGB.NET.Devices.Msi/Generic/MsiDeviceUpdateQueue.cs @@ -34,7 +34,7 @@ public sealed class MsiDeviceUpdateQueue : UpdateQueue #region Methods /// - protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet) { try { diff --git a/RGB.NET.Devices.Novation/Generic/MidiUpdateQueue.cs b/RGB.NET.Devices.Novation/Generic/MidiUpdateQueue.cs index 945c4ff..4cc8929 100644 --- a/RGB.NET.Devices.Novation/Generic/MidiUpdateQueue.cs +++ b/RGB.NET.Devices.Novation/Generic/MidiUpdateQueue.cs @@ -35,7 +35,7 @@ public abstract class MidiUpdateQueue : UpdateQueue #region Methods /// - protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet) { try { diff --git a/RGB.NET.Devices.OpenRGB/Generic/OpenRGBUpdateQueue.cs b/RGB.NET.Devices.OpenRGB/Generic/OpenRGBUpdateQueue.cs index 0537d11..43ddc0b 100644 --- a/RGB.NET.Devices.OpenRGB/Generic/OpenRGBUpdateQueue.cs +++ b/RGB.NET.Devices.OpenRGB/Generic/OpenRGBUpdateQueue.cs @@ -48,7 +48,7 @@ public sealed class OpenRGBUpdateQueue : UpdateQueue #region Methods /// - protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet) { try { diff --git a/RGB.NET.Devices.PicoPi/PicoPi/PicoPiBulkUpdateQueue.cs b/RGB.NET.Devices.PicoPi/PicoPi/PicoPiBulkUpdateQueue.cs index edd290b..3b211ae 100644 --- a/RGB.NET.Devices.PicoPi/PicoPi/PicoPiBulkUpdateQueue.cs +++ b/RGB.NET.Devices.PicoPi/PicoPi/PicoPiBulkUpdateQueue.cs @@ -44,7 +44,7 @@ public sealed class PicoPiBulkUpdateQueue : UpdateQueue #region Methods /// - protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet) { try { diff --git a/RGB.NET.Devices.PicoPi/PicoPi/PicoPiHIDUpdateQueue.cs b/RGB.NET.Devices.PicoPi/PicoPi/PicoPiHIDUpdateQueue.cs index 652ba80..cae4080 100644 --- a/RGB.NET.Devices.PicoPi/PicoPi/PicoPiHIDUpdateQueue.cs +++ b/RGB.NET.Devices.PicoPi/PicoPi/PicoPiHIDUpdateQueue.cs @@ -41,7 +41,7 @@ public sealed class PicoPiHIDUpdateQueue : UpdateQueue #region Methods /// - protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet) { try { diff --git a/RGB.NET.Devices.PicoPi/PicoPi/PicoPiSDK.cs b/RGB.NET.Devices.PicoPi/PicoPi/PicoPiSDK.cs index 2dcd6de..1e5c3ce 100644 --- a/RGB.NET.Devices.PicoPi/PicoPi/PicoPiSDK.cs +++ b/RGB.NET.Devices.PicoPi/PicoPi/PicoPiSDK.cs @@ -212,7 +212,7 @@ public sealed class PicoPiSDK : IDisposable /// /// The data to send. /// The channel to update. - public void SendHidUpdate(in Span buffer, int channel) + public void SendHidUpdate(Span buffer, int channel) { int chunks = buffer.Length / HID_OFFSET_MULTIPLIER; if ((chunks * HID_OFFSET_MULTIPLIER) < buffer.Length) chunks++; @@ -232,7 +232,7 @@ public sealed class PicoPiSDK : IDisposable /// The channel to update. /// The chunk id of the packet. (Required if packets are fragmented.) /// A value indicating if the device should update directly after receiving this packet. (If packets are fragmented this should only be true for the last chunk.) - public void SendHidUpdate(in Span data, int channel, int chunk, bool update) + public void SendHidUpdate(Span data, int channel, int chunk, bool update) { if (data.Length == 0) return; @@ -253,7 +253,7 @@ public sealed class PicoPiSDK : IDisposable /// /// The data packet to send. /// The channel to update. - public void SendBulkUpdate(in Span data, int channel) + public void SendBulkUpdate(Span data, int channel) { if ((data.Length == 0) || !IsBulkSupported) return; diff --git a/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkUpdateQueue.cs b/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkUpdateQueue.cs index 17b7add..1b12a93 100644 --- a/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkUpdateQueue.cs +++ b/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkUpdateQueue.cs @@ -25,7 +25,7 @@ public sealed class RazerChromaLinkUpdateQueue : RazerUpdateQueue #region Methods /// - protected override nint CreateEffectParams(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override nint CreateEffectParams(ReadOnlySpan<(object key, Color color)> dataSet) { _Color[] colors = new _Color[_Defines.CHROMALINK_MAX_LEDS]; diff --git a/RGB.NET.Devices.Razer/Generic/RazerUpdateQueue.cs b/RGB.NET.Devices.Razer/Generic/RazerUpdateQueue.cs index 615e48b..f8fa417 100644 --- a/RGB.NET.Devices.Razer/Generic/RazerUpdateQueue.cs +++ b/RGB.NET.Devices.Razer/Generic/RazerUpdateQueue.cs @@ -30,7 +30,7 @@ public abstract class RazerUpdateQueue : UpdateQueue #region Methods /// - protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet) { try { @@ -77,7 +77,7 @@ public abstract class RazerUpdateQueue : UpdateQueue /// /// The data to be updated. /// An pointing to the effect parameter struct. - protected abstract nint CreateEffectParams(in ReadOnlySpan<(object key, Color color)> dataSet); + protected abstract nint CreateEffectParams(ReadOnlySpan<(object key, Color color)> dataSet); #endregion } \ No newline at end of file diff --git a/RGB.NET.Devices.Razer/Headset/RazerHeadsetUpdateQueue.cs b/RGB.NET.Devices.Razer/Headset/RazerHeadsetUpdateQueue.cs index 8ddbce3..e29f435 100644 --- a/RGB.NET.Devices.Razer/Headset/RazerHeadsetUpdateQueue.cs +++ b/RGB.NET.Devices.Razer/Headset/RazerHeadsetUpdateQueue.cs @@ -25,7 +25,7 @@ public sealed class RazerHeadsetUpdateQueue : RazerUpdateQueue #region Methods /// - protected override nint CreateEffectParams(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override nint CreateEffectParams(ReadOnlySpan<(object key, Color color)> dataSet) { _Color[] colors = new _Color[_Defines.HEADSET_MAX_LEDS]; diff --git a/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardUpdateQueue.cs b/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardUpdateQueue.cs index 68e0f5f..4a709aa 100644 --- a/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardUpdateQueue.cs +++ b/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardUpdateQueue.cs @@ -25,7 +25,7 @@ public sealed class RazerKeyboardUpdateQueue : RazerUpdateQueue #region Methods /// - protected override nint CreateEffectParams(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override nint CreateEffectParams(ReadOnlySpan<(object key, Color color)> dataSet) { _Color[] colors = new _Color[_Defines.KEYBOARD_MAX_LEDS]; diff --git a/RGB.NET.Devices.Razer/Keypad/RazerKeypadUpdateQueue.cs b/RGB.NET.Devices.Razer/Keypad/RazerKeypadUpdateQueue.cs index 7e2470e..e33487a 100644 --- a/RGB.NET.Devices.Razer/Keypad/RazerKeypadUpdateQueue.cs +++ b/RGB.NET.Devices.Razer/Keypad/RazerKeypadUpdateQueue.cs @@ -25,7 +25,7 @@ public sealed class RazerKeypadUpdateQueue : RazerUpdateQueue #region Methods /// - protected override nint CreateEffectParams(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override nint CreateEffectParams(ReadOnlySpan<(object key, Color color)> dataSet) { _Color[] colors = new _Color[_Defines.KEYPAD_MAX_LEDS]; diff --git a/RGB.NET.Devices.Razer/Mouse/RazerMouseUpdateQueue.cs b/RGB.NET.Devices.Razer/Mouse/RazerMouseUpdateQueue.cs index cbdde12..8e056c6 100644 --- a/RGB.NET.Devices.Razer/Mouse/RazerMouseUpdateQueue.cs +++ b/RGB.NET.Devices.Razer/Mouse/RazerMouseUpdateQueue.cs @@ -25,7 +25,7 @@ public sealed class RazerMouseUpdateQueue : RazerUpdateQueue #region Methods /// - protected override nint CreateEffectParams(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override nint CreateEffectParams(ReadOnlySpan<(object key, Color color)> dataSet) { _Color[] colors = new _Color[_Defines.MOUSE_MAX_LEDS]; diff --git a/RGB.NET.Devices.Razer/Mousepad/RazerMousepadUpdateQueue.cs b/RGB.NET.Devices.Razer/Mousepad/RazerMousepadUpdateQueue.cs index 8f510e4..3b69487 100644 --- a/RGB.NET.Devices.Razer/Mousepad/RazerMousepadUpdateQueue.cs +++ b/RGB.NET.Devices.Razer/Mousepad/RazerMousepadUpdateQueue.cs @@ -25,7 +25,7 @@ public sealed class RazerMousepadUpdateQueue : RazerUpdateQueue #region Methods /// - protected override nint CreateEffectParams(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override nint CreateEffectParams(ReadOnlySpan<(object key, Color color)> dataSet) { _Color[] colors = new _Color[_Defines.MOUSEPAD_MAX_LEDS]; diff --git a/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesDeviceUpdateQueue.cs b/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesDeviceUpdateQueue.cs index c85f394..815e223 100644 --- a/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesDeviceUpdateQueue.cs +++ b/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesDeviceUpdateQueue.cs @@ -51,7 +51,7 @@ internal sealed class SteelSeriesDeviceUpdateQueue : UpdateQueue } /// - protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet) { try { diff --git a/RGB.NET.Devices.WLED/Generic/WLedDeviceUpdateQueue.cs b/RGB.NET.Devices.WLED/Generic/WLedDeviceUpdateQueue.cs index d16834b..7ebeef7 100644 --- a/RGB.NET.Devices.WLED/Generic/WLedDeviceUpdateQueue.cs +++ b/RGB.NET.Devices.WLED/Generic/WLedDeviceUpdateQueue.cs @@ -63,7 +63,7 @@ internal sealed class WledDeviceUpdateQueue : UpdateQueue } /// - protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet) { try { diff --git a/RGB.NET.Devices.WS281X/Generic/SerialPortUpdateQueue.cs b/RGB.NET.Devices.WS281X/Generic/SerialPortUpdateQueue.cs index f1aa16c..699218d 100644 --- a/RGB.NET.Devices.WS281X/Generic/SerialPortUpdateQueue.cs +++ b/RGB.NET.Devices.WS281X/Generic/SerialPortUpdateQueue.cs @@ -56,7 +56,7 @@ public abstract class SerialConnectionUpdateQueue : UpdateQueue } /// - protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet) { try { diff --git a/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBUpdateQueue.cs b/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBUpdateQueue.cs index 38a51f1..442c5b3 100644 --- a/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBUpdateQueue.cs +++ b/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBUpdateQueue.cs @@ -77,7 +77,7 @@ public sealed class NodeMCUWS2812USBUpdateQueue : UpdateQueue } /// - protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet) { try { diff --git a/RGB.NET.Devices.Wooting/Generic/WootingUpdateQueue.cs b/RGB.NET.Devices.Wooting/Generic/WootingUpdateQueue.cs index 8a3012e..be942cf 100644 --- a/RGB.NET.Devices.Wooting/Generic/WootingUpdateQueue.cs +++ b/RGB.NET.Devices.Wooting/Generic/WootingUpdateQueue.cs @@ -33,7 +33,7 @@ public sealed class WootingUpdateQueue : UpdateQueue #region Methods /// - protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet) { try { diff --git a/RGB.NET.Presets/Textures/BytePixelTexture.cs b/RGB.NET.Presets/Textures/BytePixelTexture.cs index 103b2ae..176b54f 100644 --- a/RGB.NET.Presets/Textures/BytePixelTexture.cs +++ b/RGB.NET.Presets/Textures/BytePixelTexture.cs @@ -61,7 +61,7 @@ public sealed class BytePixelTexture : PixelTexture /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - protected override Color GetColor(in ReadOnlySpan pixel) + protected override Color GetColor(ReadOnlySpan pixel) { return ColorFormat switch { diff --git a/RGB.NET.Presets/Textures/FloatPixelTexture.cs b/RGB.NET.Presets/Textures/FloatPixelTexture.cs index f60b177..4657ec3 100644 --- a/RGB.NET.Presets/Textures/FloatPixelTexture.cs +++ b/RGB.NET.Presets/Textures/FloatPixelTexture.cs @@ -61,7 +61,7 @@ public sealed class FloatPixelTexture : PixelTexture /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - protected override Color GetColor(in ReadOnlySpan pixel) + protected override Color GetColor(ReadOnlySpan pixel) { return ColorFormat switch { diff --git a/RGB.NET.Presets/Textures/Sampler/AverageByteSampler.cs b/RGB.NET.Presets/Textures/Sampler/AverageByteSampler.cs index bf5d7c6..f9002c9 100644 --- a/RGB.NET.Presets/Textures/Sampler/AverageByteSampler.cs +++ b/RGB.NET.Presets/Textures/Sampler/AverageByteSampler.cs @@ -18,7 +18,7 @@ public sealed class AverageByteSampler : ISampler #region Methods /// - public unsafe void Sample(in SamplerInfo info, in Span pixelData) + public unsafe void Sample(in SamplerInfo info, Span pixelData) { int count = info.Width * info.Height; if (count == 0) return; diff --git a/RGB.NET.Presets/Textures/Sampler/AverageFloatSampler.cs b/RGB.NET.Presets/Textures/Sampler/AverageFloatSampler.cs index cea8f45..9cdc37b 100644 --- a/RGB.NET.Presets/Textures/Sampler/AverageFloatSampler.cs +++ b/RGB.NET.Presets/Textures/Sampler/AverageFloatSampler.cs @@ -12,7 +12,7 @@ public sealed class AverageFloatSampler : ISampler #region Methods /// - public unsafe void Sample(in SamplerInfo info, in Span pixelData) + public unsafe void Sample(in SamplerInfo info, Span pixelData) { int count = info.Width * info.Height; if (count == 0) return; From 6f0711564c44e4b667637cf9e0ef51b3246c36e8 Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Sat, 22 Jun 2024 19:49:38 +0200 Subject: [PATCH 07/38] Removed unnecessary in GetByteValueFromPercentage --- RGB.NET.Core/Extensions/MathExtensions.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/RGB.NET.Core/Extensions/MathExtensions.cs b/RGB.NET.Core/Extensions/MathExtensions.cs index c3176b1..665df6a 100644 --- a/RGB.NET.Core/Extensions/MathExtensions.cs +++ b/RGB.NET.Core/Extensions/MathExtensions.cs @@ -91,9 +91,8 @@ public static class FloatExtensions [MethodImpl(MethodImplOptions.AggressiveInlining)] public static byte GetByteValueFromPercentage(this float percentage) { - if (float.IsNaN(percentage)) return 0; + if (float.IsNaN(percentage) || (percentage <= 0)) return 0; - percentage = percentage.Clamp(0, 1.0f); return (byte)(percentage >= 1.0f ? 255 : percentage * 256.0f); } From 9f0c3be7bb43b2937ad6dd4cf6d68586f706e237 Mon Sep 17 00:00:00 2001 From: Danielle Date: Sun, 7 Jul 2024 19:08:17 +1000 Subject: [PATCH 08/38] Added Razer Leviathan V2 X Speakers --- RGB.NET.Devices.Razer/RazerDeviceProvider.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/RGB.NET.Devices.Razer/RazerDeviceProvider.cs b/RGB.NET.Devices.Razer/RazerDeviceProvider.cs index 6290d46..ae65b09 100644 --- a/RGB.NET.Devices.Razer/RazerDeviceProvider.cs +++ b/RGB.NET.Devices.Razer/RazerDeviceProvider.cs @@ -268,6 +268,7 @@ public sealed class RazerDeviceProvider : AbstractRGBDeviceProvider { 0x00A4, RGBDeviceType.LedStripe, "Mouse Dock Pro", LedMappings.Mousepad, RazerEndpointType.Mousepad }, // DarthAffe 22.09.2023: Most likely also a mousepad? { 0x0517, RGBDeviceType.Speaker, "Nommo Chroma", LedMappings.ChromaLink, RazerEndpointType.ChromaLink }, { 0x0518, RGBDeviceType.Speaker, "Nommo Pro", LedMappings.ChromaLink, RazerEndpointType.ChromaLink }, + { 0x054a, RGBDeviceType.Speaker, "Leviathan V2 X", LedMappings.ChromaLink, RazerEndpointType.ChromaLink }, { 0x0F07, RGBDeviceType.Unknown, "Chroma Mug Holder", LedMappings.ChromaLink, RazerEndpointType.ChromaLink }, { 0x0F09, RGBDeviceType.LedController, "Chroma Hardware Development Kit (HDK)", LedMappings.ChromaLink, RazerEndpointType.ChromaLink }, { 0x0F13, RGBDeviceType.Unknown, "Lian Li O11", LedMappings.ChromaLink, RazerEndpointType.ChromaLink }, From 976ee6d007da1b85a3822e818c8e939fc11bdba9 Mon Sep 17 00:00:00 2001 From: Danielle Date: Sun, 7 Jul 2024 19:15:55 +1000 Subject: [PATCH 09/38] Added BlackWidow V4 Mini HyperSpeed --- RGB.NET.Devices.Razer/RazerDeviceProvider.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/RGB.NET.Devices.Razer/RazerDeviceProvider.cs b/RGB.NET.Devices.Razer/RazerDeviceProvider.cs index ae65b09..048db27 100644 --- a/RGB.NET.Devices.Razer/RazerDeviceProvider.cs +++ b/RGB.NET.Devices.Razer/RazerDeviceProvider.cs @@ -151,6 +151,7 @@ public sealed class RazerDeviceProvider : AbstractRGBDeviceProvider { 0x02A5, RGBDeviceType.Keyboard, "BlackWidow V4 75%", LedMappings.Keyboard, RazerEndpointType.Keyboard }, { 0x02A7, RGBDeviceType.Keyboard, "Huntsman V3 Pro TKL", LedMappings.Keyboard, RazerEndpointType.Keyboard }, { 0x0A24, RGBDeviceType.Keyboard, "BlackWidow V3 TKL", LedMappings.Keyboard, RazerEndpointType.Keyboard }, + { 0x02BA, RGBDeviceType.Keyboard, "BlackWidow V4 Mini HyperSpeed", LedMappings.Keyboard, RazerEndpointType.Keyboard }, // Mice { 0x0013, RGBDeviceType.Mouse, "Orochi 2011", LedMappings.Mouse, RazerEndpointType.Mouse }, From 9de1233c93a4d756ed498504a21bfe2e87931bfe Mon Sep 17 00:00:00 2001 From: DarthAffe Date: Sun, 7 Jul 2024 12:03:39 +0000 Subject: [PATCH 10/38] Update RGB.NET.Devices.Razer/RazerDeviceProvider.cs --- RGB.NET.Devices.Razer/RazerDeviceProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RGB.NET.Devices.Razer/RazerDeviceProvider.cs b/RGB.NET.Devices.Razer/RazerDeviceProvider.cs index 048db27..1ab31c8 100644 --- a/RGB.NET.Devices.Razer/RazerDeviceProvider.cs +++ b/RGB.NET.Devices.Razer/RazerDeviceProvider.cs @@ -269,7 +269,7 @@ public sealed class RazerDeviceProvider : AbstractRGBDeviceProvider { 0x00A4, RGBDeviceType.LedStripe, "Mouse Dock Pro", LedMappings.Mousepad, RazerEndpointType.Mousepad }, // DarthAffe 22.09.2023: Most likely also a mousepad? { 0x0517, RGBDeviceType.Speaker, "Nommo Chroma", LedMappings.ChromaLink, RazerEndpointType.ChromaLink }, { 0x0518, RGBDeviceType.Speaker, "Nommo Pro", LedMappings.ChromaLink, RazerEndpointType.ChromaLink }, - { 0x054a, RGBDeviceType.Speaker, "Leviathan V2 X", LedMappings.ChromaLink, RazerEndpointType.ChromaLink }, + { 0x054A, RGBDeviceType.Speaker, "Leviathan V2 X", LedMappings.ChromaLink, RazerEndpointType.ChromaLink }, { 0x0F07, RGBDeviceType.Unknown, "Chroma Mug Holder", LedMappings.ChromaLink, RazerEndpointType.ChromaLink }, { 0x0F09, RGBDeviceType.LedController, "Chroma Hardware Development Kit (HDK)", LedMappings.ChromaLink, RazerEndpointType.ChromaLink }, { 0x0F13, RGBDeviceType.Unknown, "Lian Li O11", LedMappings.ChromaLink, RazerEndpointType.ChromaLink }, From d207fdf495cdb5e952bb93a699d54e3e4fb71ad6 Mon Sep 17 00:00:00 2001 From: Diogo Trindade Date: Sat, 20 Jul 2024 23:06:50 +0100 Subject: [PATCH 11/38] Add Wooting 80HE support --- .../Enum/WootingDeviceType.cs | 5 + .../Generic/WootingLedMappings.cs | 102 +++++++++++++++++- 2 files changed, 106 insertions(+), 1 deletion(-) diff --git a/RGB.NET.Devices.Wooting/Enum/WootingDeviceType.cs b/RGB.NET.Devices.Wooting/Enum/WootingDeviceType.cs index 63ff83a..af2d4a3 100644 --- a/RGB.NET.Devices.Wooting/Enum/WootingDeviceType.cs +++ b/RGB.NET.Devices.Wooting/Enum/WootingDeviceType.cs @@ -26,4 +26,9 @@ public enum WootingDeviceType /// Three key keypad. E.g. Wooting Uwu /// Keypad3Keys = 4, + + /// + /// 80 percent keyboard. E.g. Wooting 80HE + /// + KeyboardEightyPercent = 5, } \ No newline at end of file diff --git a/RGB.NET.Devices.Wooting/Generic/WootingLedMappings.cs b/RGB.NET.Devices.Wooting/Generic/WootingLedMappings.cs index 081e993..3ad37e1 100644 --- a/RGB.NET.Devices.Wooting/Generic/WootingLedMappings.cs +++ b/RGB.NET.Devices.Wooting/Generic/WootingLedMappings.cs @@ -110,6 +110,105 @@ internal static class WootingLedMappings { LedId.Keyboard_ArrowDown, (5, 15) }, { LedId.Keyboard_ArrowRight, (5, 16) } }; + + private static readonly Dictionary EightyPercent = new() + { + { LedId.Keyboard_Escape, (0, 0) }, + { LedId.Keyboard_F1, (0, 1) }, + { LedId.Keyboard_F2, (0, 2) }, + { LedId.Keyboard_F3, (0, 3) }, + { LedId.Keyboard_F4, (0, 4) }, + { LedId.Keyboard_F5, (0, 5) }, + { LedId.Keyboard_F6, (0, 6) }, + { LedId.Keyboard_F7, (0, 7) }, + { LedId.Keyboard_F8, (0, 8) }, + { LedId.Keyboard_F9, (0, 10) }, + { LedId.Keyboard_F10, (0, 11) }, + { LedId.Keyboard_F11, (0, 12) }, + { LedId.Keyboard_F12, (0, 13) }, + { LedId.Keyboard_Custom1, (0, 14) }, + { LedId.Keyboard_PrintScreen, (0, 15) }, + { LedId.Keyboard_PauseBreak, (0, 16) }, + + { LedId.Keyboard_GraveAccentAndTilde, (1, 0) }, + { LedId.Keyboard_1, (1, 1) }, + { LedId.Keyboard_2, (1, 2) }, + { LedId.Keyboard_3, (1, 3) }, + { LedId.Keyboard_4, (1, 4) }, + { LedId.Keyboard_5, (1, 5) }, + { LedId.Keyboard_6, (1, 6) }, + { LedId.Keyboard_7, (1, 7) }, + { LedId.Keyboard_8, (1, 8) }, + { LedId.Keyboard_9, (1, 9) }, + { LedId.Keyboard_0, (1, 10) }, + { LedId.Keyboard_MinusAndUnderscore, (1, 11) }, + { LedId.Keyboard_EqualsAndPlus, (1, 12) }, + { LedId.Keyboard_International1, (1, 13) },//JIS key + { LedId.Keyboard_Backspace, (1, 14) }, + { LedId.Keyboard_Insert, (1, 15) }, + { LedId.Keyboard_Home, (1, 16) }, + + { LedId.Keyboard_Tab, (2, 0) }, + { LedId.Keyboard_Q, (2, 1) }, + { LedId.Keyboard_W, (2, 2) }, + { LedId.Keyboard_E, (2, 3) }, + { LedId.Keyboard_R, (2, 4) }, + { LedId.Keyboard_T, (2, 5) }, + { LedId.Keyboard_Y, (2, 6) }, + { LedId.Keyboard_U, (2, 7) }, + { LedId.Keyboard_I, (2, 8) }, + { LedId.Keyboard_O, (2, 9) }, + { LedId.Keyboard_P, (2, 10) }, + { LedId.Keyboard_BracketLeft, (2, 11) }, + { LedId.Keyboard_BracketRight, (2, 12) }, + { LedId.Keyboard_Backslash, (2, 14) }, + { LedId.Keyboard_Delete, (2, 15) }, + { LedId.Keyboard_End, (2, 16) }, + + { LedId.Keyboard_CapsLock, (3, 0) }, + { LedId.Keyboard_A, (3, 1) }, + { LedId.Keyboard_S, (3, 2) }, + { LedId.Keyboard_D, (3, 3) }, + { LedId.Keyboard_F, (3, 4) }, + { LedId.Keyboard_G, (3, 5) }, + { LedId.Keyboard_H, (3, 6) }, + { LedId.Keyboard_J, (3, 7) }, + { LedId.Keyboard_K, (3, 8) }, + { LedId.Keyboard_L, (3, 9) }, + { LedId.Keyboard_SemicolonAndColon, (3, 10) }, + { LedId.Keyboard_ApostropheAndDoubleQuote, (3, 11) }, + { LedId.Keyboard_NonUsTilde, (3, 12) }, + { LedId.Keyboard_Enter, (3, 14) }, + + { LedId.Keyboard_LeftShift, (4, 0) }, + { LedId.Keyboard_NonUsBackslash, (4, 1) }, + { LedId.Keyboard_Z, (4, 2) }, + { LedId.Keyboard_X, (4, 3) }, + { LedId.Keyboard_C, (4, 4) }, + { LedId.Keyboard_V, (4, 5) }, + { LedId.Keyboard_B, (4, 6) }, + { LedId.Keyboard_N, (4, 7) }, + { LedId.Keyboard_M, (4, 8) }, + { LedId.Keyboard_CommaAndLessThan, (4, 9) }, + { LedId.Keyboard_PeriodAndBiggerThan, (4, 10) }, + { LedId.Keyboard_SlashAndQuestionMark, (4, 11) }, + { LedId.Keyboard_International2, (4, 13) },//JIS key + { LedId.Keyboard_RightShift, (4, 14) }, + { LedId.Keyboard_ArrowUp, (4, 15) }, + + { LedId.Keyboard_LeftCtrl, (5, 0) }, + { LedId.Keyboard_LeftGui, (5, 1) }, + { LedId.Keyboard_LeftAlt, (5, 2) }, + { LedId.Keyboard_International3, (4, 3) },//JIS key + { LedId.Keyboard_Space, (5, 6) }, + { LedId.Keyboard_International4, (4, 9) },//JIS key + { LedId.Keyboard_RightAlt, (5, 10) }, + { LedId.Keyboard_RightGui, (5, 11) }, + { LedId.Keyboard_Function, (5, 12) }, + { LedId.Keyboard_ArrowLeft, (5, 14) }, + { LedId.Keyboard_ArrowDown, (5, 15) }, + { LedId.Keyboard_ArrowRight, (5, 16) } + }; private static readonly Dictionary Fullsize = new() { @@ -343,7 +442,8 @@ internal static class WootingLedMappings [WootingDeviceType.Keyboard] = Fullsize, [WootingDeviceType.KeyboardTKL] = TKL, [WootingDeviceType.KeyboardSixtyPercent] = SixtyPercent, - [WootingDeviceType.Keypad3Keys] = ThreeKeyKeypad + [WootingDeviceType.Keypad3Keys] = ThreeKeyKeypad, + [WootingDeviceType.KeyboardEightyPercent] = EightyPercent }; #endregion From c39849949a1b1d49bf26b7b7d40bddb00a97f6ff Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Sun, 21 Jul 2024 23:10:56 +0200 Subject: [PATCH 12/38] (MAJOR) Removed all in paramters as their performance impact is too hard to predict --- .../Color/Behaviors/DefaultColorBehavior.cs | 10 ++-- .../Color/Behaviors/IColorBehavior.cs | 10 ++-- RGB.NET.Core/Color/Color.cs | 10 ++-- RGB.NET.Core/Color/HSVColor.cs | 18 +++---- RGB.NET.Core/Color/HclColor.cs | 18 +++---- RGB.NET.Core/Color/LabColor.cs | 18 +++---- RGB.NET.Core/Color/RGBColor.cs | 50 +++++++++---------- RGB.NET.Core/Color/XYZColor.cs | 18 +++---- RGB.NET.Core/Decorators/IBrushDecorator.cs | 2 +- RGB.NET.Core/Devices/AbstractRGBDevice.cs | 2 +- RGB.NET.Core/Devices/IRGBDevice.cs | 2 +- RGB.NET.Core/Extensions/ColorExtensions.cs | 2 +- RGB.NET.Core/Extensions/MathExtensions.cs | 4 +- RGB.NET.Core/Extensions/PointExtensions.cs | 4 +- .../Extensions/RectangleExtensions.cs | 28 +++++------ RGB.NET.Core/Positioning/Point.cs | 16 +++--- RGB.NET.Core/Positioning/Rectangle.cs | 8 +-- RGB.NET.Core/Positioning/Rotation.cs | 14 +++--- RGB.NET.Core/Positioning/Size.cs | 20 ++++---- .../Rendering/Brushes/AbstractBrush.cs | 4 +- .../Rendering/Brushes/SolidColorBrush.cs | 2 +- .../Rendering/Brushes/TextureBrush.cs | 2 +- .../Rendering/Textures/EmptyTexture.cs | 4 +- RGB.NET.Core/Rendering/Textures/ITexture.cs | 4 +- .../Rendering/Textures/PixelTexture.cs | 4 +- .../Textures/Sampler/AverageColorSampler.cs | 2 +- .../Rendering/Textures/Sampler/ISampler.cs | 2 +- .../Generic/LimitedColorUpdateQueue.cs | 4 +- .../Generic/MidiUpdateQueue.cs | 2 +- .../Generic/RGBColorUpdateQueue.cs | 4 +- RGB.NET.Presets/Decorators/FlashDecorator.cs | 2 +- RGB.NET.Presets/Helper/GradientHelper.cs | 6 +-- .../Textures/AbstractGradientTexture.cs | 6 +-- .../Textures/ConicalGradientTexture.cs | 2 +- .../Textures/LinearGradientTexture.cs | 2 +- .../Textures/RadialGradientTexture.cs | 2 +- .../Textures/Sampler/AverageByteSampler.cs | 2 +- .../Textures/Sampler/AverageFloatSampler.cs | 2 +- 38 files changed, 157 insertions(+), 155 deletions(-) diff --git a/RGB.NET.Core/Color/Behaviors/DefaultColorBehavior.cs b/RGB.NET.Core/Color/Behaviors/DefaultColorBehavior.cs index c1859c2..36f41c8 100644 --- a/RGB.NET.Core/Color/Behaviors/DefaultColorBehavior.cs +++ b/RGB.NET.Core/Color/Behaviors/DefaultColorBehavior.cs @@ -14,7 +14,7 @@ public sealed class DefaultColorBehavior : IColorBehavior /// Converts the individual byte values of this to a human-readable string. /// /// A string that contains the individual byte values of this . For example "[A: 255, R: 255, G: 0, B: 0]". - public string ToString(in Color color) => $"[A: {color.GetA()}, R: {color.GetR()}, G: {color.GetG()}, B: {color.GetB()}]"; + public string ToString(Color color) => $"[A: {color.GetA()}, R: {color.GetR()}, G: {color.GetG()}, B: {color.GetB()}]"; /// /// Tests whether the specified object is a and is equivalent to this . @@ -22,7 +22,7 @@ public sealed class DefaultColorBehavior : IColorBehavior /// The color to test. /// The object to test. /// true if is a equivalent to this ; otherwise, false. - public bool Equals(in Color color, object? obj) => obj is Color color2 && Equals(color, color2); + public bool Equals(Color color, object? obj) => obj is Color color2 && Equals(color, color2); /// /// Tests whether the specified object is a and is equivalent to this . @@ -30,7 +30,7 @@ public sealed class DefaultColorBehavior : IColorBehavior /// The first color to test. /// The second color to test. /// true if equivalent to this ; otherwise, false. - public bool Equals(in Color color, in Color color2) => color.A.EqualsInTolerance(color2.A) + public bool Equals(Color color, Color color2) => color.A.EqualsInTolerance(color2.A) && color.R.EqualsInTolerance(color2.R) && color.G.EqualsInTolerance(color2.G) && color.B.EqualsInTolerance(color2.B); @@ -39,14 +39,14 @@ public sealed class DefaultColorBehavior : IColorBehavior /// Returns a hash code for this . /// /// An integer value that specifies the hash code for this . - public int GetHashCode(in Color color) => HashCode.Combine(color.A, color.R, color.G, color.B); + public int GetHashCode(Color color) => HashCode.Combine(color.A, color.R, color.G, color.B); /// /// Blends a over this color. /// /// The to to blend over. /// The to blend. - public Color Blend(in Color baseColor, in Color blendColor) + public Color Blend(Color baseColor, Color blendColor) { if (blendColor.A.EqualsInTolerance(0)) return baseColor; diff --git a/RGB.NET.Core/Color/Behaviors/IColorBehavior.cs b/RGB.NET.Core/Color/Behaviors/IColorBehavior.cs index f365f37..432bb4f 100644 --- a/RGB.NET.Core/Color/Behaviors/IColorBehavior.cs +++ b/RGB.NET.Core/Color/Behaviors/IColorBehavior.cs @@ -10,7 +10,7 @@ public interface IColorBehavior /// /// The color to convert. /// The string representation of the specified color. - string ToString(in Color color); + string ToString(Color color); /// /// Tests whether the specified object is a and is equivalent to this . @@ -18,7 +18,7 @@ public interface IColorBehavior /// The color to test. /// The object to test. /// true if is a equivalent to this ; otherwise, false. - bool Equals(in Color color, object? obj); + bool Equals(Color color, object? obj); /// /// Tests whether the specified object is a and is equivalent to this . @@ -26,18 +26,18 @@ public interface IColorBehavior /// The first color to test. /// The second color to test. /// true if equivalent to this ; otherwise, false. - bool Equals(in Color color, in Color color2); + bool Equals(Color color, Color color2); /// /// Returns a hash code for this . /// /// An integer value that specifies the hash code for this . - int GetHashCode(in Color color); + int GetHashCode(Color color); /// /// Blends a over this color. /// /// The to to blend over. /// The to blend. - Color Blend(in Color baseColor, in Color blendColor); + Color Blend(Color baseColor, Color blendColor); } \ No newline at end of file diff --git a/RGB.NET.Core/Color/Color.cs b/RGB.NET.Core/Color/Color.cs index c786502..3ef16fb 100644 --- a/RGB.NET.Core/Color/Color.cs +++ b/RGB.NET.Core/Color/Color.cs @@ -175,7 +175,7 @@ public readonly struct Color : IEquatable /// Initializes a new instance of the struct by cloning a existing . /// /// The the values are copied from. - public Color(in Color color) + public Color(Color color) : this(color.A, color.R, color.G, color.B) { } @@ -214,7 +214,7 @@ public readonly struct Color : IEquatable /// Blends a over this color, as defined by the current . /// /// The to blend. - public Color Blend(in Color color) => Behavior.Blend(this, color); + public Color Blend(Color color) => Behavior.Blend(this, color); #endregion @@ -226,7 +226,7 @@ public readonly struct Color : IEquatable /// The base color. /// The color to blend. /// The blended color. - public static Color operator +(in Color color1, in Color color2) => color1.Blend(color2); + public static Color operator +(Color color1, Color color2) => color1.Blend(color2); /// /// Returns a value that indicates whether two specified are equal. @@ -234,7 +234,7 @@ public readonly struct Color : IEquatable /// The first to compare. /// The second to compare. /// true if and are equal; otherwise, false. - public static bool operator ==(in Color color1, in Color color2) => color1.Equals(color2); + public static bool operator ==(Color color1, Color color2) => color1.Equals(color2); /// /// Returns a value that indicates whether two specified are equal. @@ -242,7 +242,7 @@ public readonly struct Color : IEquatable /// The first to compare. /// The second to compare. /// true if and are not equal; otherwise, false. - public static bool operator !=(in Color color1, in Color color2) => !(color1 == color2); + public static bool operator !=(Color color1, Color color2) => !(color1 == color2); /// /// Converts a of ARGB-components to a . diff --git a/RGB.NET.Core/Color/HSVColor.cs b/RGB.NET.Core/Color/HSVColor.cs index 35af63f..c4177db 100644 --- a/RGB.NET.Core/Color/HSVColor.cs +++ b/RGB.NET.Core/Color/HSVColor.cs @@ -16,21 +16,21 @@ public static class HSVColor /// /// The color to get the value from. /// The hue component value of the color. - public static float GetHue(this in Color color) => color.GetHSV().hue; + public static float GetHue(this Color color) => color.GetHSV().hue; /// /// Gets the saturation component value (HSV-color space) of this in the range [0..1]. /// /// The color to get the value from. /// The saturation component value of the color. - public static float GetSaturation(this in Color color) => color.GetHSV().saturation; + public static float GetSaturation(this Color color) => color.GetHSV().saturation; /// /// Gets the value component value (HSV-color space) of this in the range [0..1]. /// /// The color to get the value from. /// The value component value of the color. - public static float GetValue(this in Color color) => color.GetHSV().value; + public static float GetValue(this Color color) => color.GetHSV().value; /// /// Gets the hue, saturation and value component values (HSV-color space) of this . @@ -40,7 +40,7 @@ public static class HSVColor /// /// The color to get the value from. /// A tuple containing the hue, saturation and value component value of the color. - public static (float hue, float saturation, float value) GetHSV(this in Color color) + public static (float hue, float saturation, float value) GetHSV(this Color color) => CaclulateHSVFromRGB(color.R, color.G, color.B); #endregion @@ -55,7 +55,7 @@ public static class HSVColor /// The saturation value to add. /// The value value to add. /// The new color after the modification. - public static Color AddHSV(this in Color color, float hue = 0, float saturation = 0, float value = 0) + public static Color AddHSV(this Color color, float hue = 0, float saturation = 0, float value = 0) { (float cHue, float cSaturation, float cValue) = color.GetHSV(); return Create(color.A, cHue + hue, cSaturation + saturation, cValue + value); @@ -69,7 +69,7 @@ public static class HSVColor /// The saturation value to subtract. /// The value value to subtract. /// The new color after the modification. - public static Color SubtractHSV(this in Color color, float hue = 0, float saturation = 0, float value = 0) + public static Color SubtractHSV(this Color color, float hue = 0, float saturation = 0, float value = 0) { (float cHue, float cSaturation, float cValue) = color.GetHSV(); return Create(color.A, cHue - hue, cSaturation - saturation, cValue - value); @@ -83,7 +83,7 @@ public static class HSVColor /// The saturation value to multiply. /// The value value to multiply. /// The new color after the modification. - public static Color MultiplyHSV(this in Color color, float hue = 1, float saturation = 1, float value = 1) + public static Color MultiplyHSV(this Color color, float hue = 1, float saturation = 1, float value = 1) { (float cHue, float cSaturation, float cValue) = color.GetHSV(); return Create(color.A, cHue * hue, cSaturation * saturation, cValue * value); @@ -97,7 +97,7 @@ public static class HSVColor /// The saturation value to divide. /// The value value to divide. /// The new color after the modification. - public static Color DivideHSV(this in Color color, float hue = 1, float saturation = 1, float value = 1) + public static Color DivideHSV(this Color color, float hue = 1, float saturation = 1, float value = 1) { (float cHue, float cSaturation, float cValue) = color.GetHSV(); return Create(color.A, cHue / hue, cSaturation / saturation, cValue / value); @@ -111,7 +111,7 @@ public static class HSVColor /// The saturation value to set. /// The value value to set. /// The new color after the modification. - public static Color SetHSV(this in Color color, float? hue = null, float? saturation = null, float? value = null) + public static Color SetHSV(this Color color, float? hue = null, float? saturation = null, float? value = null) { (float cHue, float cSaturation, float cValue) = color.GetHSV(); return Create(color.A, hue ?? cHue, saturation ?? cSaturation, value ?? cValue); diff --git a/RGB.NET.Core/Color/HclColor.cs b/RGB.NET.Core/Color/HclColor.cs index 4133c58..7a6e5be 100644 --- a/RGB.NET.Core/Color/HclColor.cs +++ b/RGB.NET.Core/Color/HclColor.cs @@ -16,21 +16,21 @@ public static class HclColor /// /// The color to get the value from. /// The H component value of the color. - public static float GetHclH(this in Color color) => color.GetHcl().h; + public static float GetHclH(this Color color) => color.GetHcl().h; /// /// Gets the c component value (Hcl-color space) of this in the range [0..1]. /// /// The color to get the value from. /// The c component value of the color. - public static float GetHclC(this in Color color) => color.GetHcl().c; + public static float GetHclC(this Color color) => color.GetHcl().c; /// /// Gets the l component value (Hcl-color space) of this in the range [0..1]. /// /// The color to get the value from. /// The l component value of the color. - public static float GetHclL(this in Color color) => color.GetHcl().l; + public static float GetHclL(this Color color) => color.GetHcl().l; /// /// Gets the H, c and l component values (Hcl-color space) of this . @@ -40,7 +40,7 @@ public static class HclColor /// /// The color to get the value from. /// A tuple containing the H, c and l component value of the color. - public static (float h, float c, float l) GetHcl(this in Color color) + public static (float h, float c, float l) GetHcl(this Color color) => CalculateHclFromRGB(color.R, color.G, color.B); #endregion @@ -55,7 +55,7 @@ public static class HclColor /// The c value to add. /// The l value to add. /// The new color after the modification. - public static Color AddHcl(this in Color color, float h = 0, float c = 0, float l = 0) + public static Color AddHcl(this Color color, float h = 0, float c = 0, float l = 0) { (float cH, float cC, float cL) = color.GetHcl(); return Create(color.A, cH + h, cC + c, cL + l); @@ -69,7 +69,7 @@ public static class HclColor /// The c value to subtract. /// The l value to subtract. /// The new color after the modification. - public static Color SubtractHcl(this in Color color, float h = 0, float c = 0, float l = 0) + public static Color SubtractHcl(this Color color, float h = 0, float c = 0, float l = 0) { (float cH, float cC, float cL) = color.GetHcl(); return Create(color.A, cH - h, cC - c, cL - l); @@ -83,7 +83,7 @@ public static class HclColor /// The c value to multiply. /// The l value to multiply. /// The new color after the modification. - public static Color MultiplyHcl(this in Color color, float h = 1, float c = 1, float l = 1) + public static Color MultiplyHcl(this Color color, float h = 1, float c = 1, float l = 1) { (float cH, float cC, float cL) = color.GetHcl(); return Create(color.A, cH * h, cC * c, cL * l); @@ -97,7 +97,7 @@ public static class HclColor /// The c value to divide. /// The l value to divide. /// The new color after the modification. - public static Color DivideHcl(this in Color color, float h = 1, float c = 1, float l = 1) + public static Color DivideHcl(this Color color, float h = 1, float c = 1, float l = 1) { (float cH, float cC, float cL) = color.GetHcl(); return Create(color.A, cH / h, cC / c, cL / l); @@ -111,7 +111,7 @@ public static class HclColor /// The c value to set. /// The l value to set. /// The new color after the modification. - public static Color SetHcl(this in Color color, float? h = null, float? c = null, float? l = null) + public static Color SetHcl(this Color color, float? h = null, float? c = null, float? l = null) { (float cH, float cC, float cL) = color.GetHcl(); return Create(color.A, h ?? cH, c ?? cC, l ?? cL); diff --git a/RGB.NET.Core/Color/LabColor.cs b/RGB.NET.Core/Color/LabColor.cs index 7be0650..438f069 100644 --- a/RGB.NET.Core/Color/LabColor.cs +++ b/RGB.NET.Core/Color/LabColor.cs @@ -16,21 +16,21 @@ public static class LabColor /// /// The color to get the value from. /// The L component value of the color. - public static float GetLabL(this in Color color) => color.GetLab().l; + public static float GetLabL(this Color color) => color.GetLab().l; /// /// Gets the a component value (Lab-color space) of this in the range [0..1]. /// /// The color to get the value from. /// The a component value of the color. - public static float GetLabA(this in Color color) => color.GetLab().a; + public static float GetLabA(this Color color) => color.GetLab().a; /// /// Gets the b component value (Lab-color space) of this in the range [0..1]. /// /// The color to get the value from. /// The b component value of the color. - public static float GetLabB(this in Color color) => color.GetLab().b; + public static float GetLabB(this Color color) => color.GetLab().b; /// /// Gets the L, a and b component values (Lab-color space) of this . @@ -40,7 +40,7 @@ public static class LabColor /// /// The color to get the value from. /// A tuple containing the L, a and b component value of the color. - public static (float l, float a, float b) GetLab(this in Color color) + public static (float l, float a, float b) GetLab(this Color color) => CalculateLabFromRGB(color.R, color.G, color.B); #endregion @@ -55,7 +55,7 @@ public static class LabColor /// The a value to add. /// The b value to add. /// The new color after the modification. - public static Color AddLab(this in Color color, float l = 0, float a = 0, float b = 0) + public static Color AddLab(this Color color, float l = 0, float a = 0, float b = 0) { (float cL, float cA, float cB) = color.GetLab(); return Create(color.A, cL + l, cA + a, cB + b); @@ -69,7 +69,7 @@ public static class LabColor /// The a value to subtract. /// The b value to subtract. /// The new color after the modification. - public static Color SubtractLab(this in Color color, float l = 0, float a = 0, float b = 0) + public static Color SubtractLab(this Color color, float l = 0, float a = 0, float b = 0) { (float cL, float cA, float cB) = color.GetLab(); return Create(color.A, cL - l, cA - a, cB - b); @@ -83,7 +83,7 @@ public static class LabColor /// The a value to multiply. /// The b value to multiply. /// The new color after the modification. - public static Color MultiplyLab(this in Color color, float l = 1, float a = 1, float b = 1) + public static Color MultiplyLab(this Color color, float l = 1, float a = 1, float b = 1) { (float cL, float cA, float cB) = color.GetLab(); return Create(color.A, cL * l, cA * a, cB * b); @@ -97,7 +97,7 @@ public static class LabColor /// The a value to divide. /// The b value to divide. /// The new color after the modification. - public static Color DivideLab(this in Color color, float l = 1, float a = 1, float b = 1) + public static Color DivideLab(this Color color, float l = 1, float a = 1, float b = 1) { (float cL, float cA, float cB) = color.GetLab(); return Create(color.A, cL / l, cA / a, cB / b); @@ -111,7 +111,7 @@ public static class LabColor /// The a value to set. /// The b value to set. /// The new color after the modification. - public static Color SetLab(this in Color color, float? l = null, float? a = null, float? b = null) + public static Color SetLab(this Color color, float? l = null, float? a = null, float? b = null) { (float cL, float cA, float cB) = color.GetLab(); return Create(color.A, l ?? cL, a ?? cA, b ?? cB); diff --git a/RGB.NET.Core/Color/RGBColor.cs b/RGB.NET.Core/Color/RGBColor.cs index 9ffa528..4b61189 100644 --- a/RGB.NET.Core/Color/RGBColor.cs +++ b/RGB.NET.Core/Color/RGBColor.cs @@ -16,35 +16,35 @@ public static class RGBColor /// /// The color to get the value from. /// The A component value of the color. - public static byte GetA(this in Color color) => color.A.GetByteValueFromPercentage(); + public static byte GetA(this Color color) => color.A.GetByteValueFromPercentage(); /// /// Gets the R component value of this as byte in the range [0..255]. /// /// The color to get the value from. /// The R component value of the color. - public static byte GetR(this in Color color) => color.R.GetByteValueFromPercentage(); + public static byte GetR(this Color color) => color.R.GetByteValueFromPercentage(); /// /// Gets the G component value of this as byte in the range [0..255]. /// /// The color to get the value from. /// The G component value of the color. - public static byte GetG(this in Color color) => color.G.GetByteValueFromPercentage(); + public static byte GetG(this Color color) => color.G.GetByteValueFromPercentage(); /// /// Gets the B component value of this as byte in the range [0..255]. /// /// The color to get the value from. /// The B component value of the color. - public static byte GetB(this in Color color) => color.B.GetByteValueFromPercentage(); + public static byte GetB(this Color color) => color.B.GetByteValueFromPercentage(); /// /// Gets the A, R, G and B component value of this as byte in the range [0..255]. /// /// The color to get the value from. /// A tuple containing the A, R, G and B component value of the color. - public static (byte a, byte r, byte g, byte b) GetRGBBytes(this in Color color) + public static (byte a, byte r, byte g, byte b) GetRGBBytes(this Color color) => (color.GetA(), color.GetR(), color.GetG(), color.GetB()); /// @@ -52,7 +52,7 @@ public static class RGBColor /// /// The color to get the value from. /// A tuple containing the A, R, G and B component value of the color. - public static (float a, float r, float g, float b) GetRGB(this in Color color) + public static (float a, float r, float g, float b) GetRGB(this Color color) => (color.A, color.R, color.G, color.B); #endregion @@ -69,7 +69,7 @@ public static class RGBColor /// The green value to add. /// The blue value to add. /// The new color after the modification. - public static Color AddRGB(this in Color color, int r = 0, int g = 0, int b = 0) + public static Color AddRGB(this Color color, int r = 0, int g = 0, int b = 0) => new(color.A, color.GetR() + r, color.GetG() + g, color.GetB() + b); /// @@ -80,7 +80,7 @@ public static class RGBColor /// The green value to add. /// The blue value to add. /// The new color after the modification. - public static Color AddRGB(this in Color color, float r = 0, float g = 0, float b = 0) + public static Color AddRGB(this Color color, float r = 0, float g = 0, float b = 0) => new(color.A, color.R + r, color.G + g, color.B + b); /// @@ -89,7 +89,7 @@ public static class RGBColor /// The color to modify. /// The alpha value to add. /// The new color after the modification. - public static Color AddA(this in Color color, int a) + public static Color AddA(this Color color, int a) => new(color.GetA() + a, color.R, color.G, color.B); /// @@ -98,7 +98,7 @@ public static class RGBColor /// The color to modify. /// The alpha value to add. /// The new color after the modification. - public static Color AddA(this in Color color, float a) + public static Color AddA(this Color color, float a) => new(color.A + a, color.R, color.G, color.B); #endregion @@ -113,7 +113,7 @@ public static class RGBColor /// The green value to subtract. /// The blue value to subtract. /// The new color after the modification. - public static Color SubtractRGB(this in Color color, int r = 0, int g = 0, int b = 0) + public static Color SubtractRGB(this Color color, int r = 0, int g = 0, int b = 0) => new(color.A, color.GetR() - r, color.GetG() - g, color.GetB() - b); /// @@ -124,7 +124,7 @@ public static class RGBColor /// The green value to subtract. /// The blue value to subtract. /// The new color after the modification. - public static Color SubtractRGB(this in Color color, float r = 0, float g = 0, float b = 0) + public static Color SubtractRGB(this Color color, float r = 0, float g = 0, float b = 0) => new(color.A, color.R - r, color.G - g, color.B - b); /// @@ -133,7 +133,7 @@ public static class RGBColor /// The color to modify. /// The alpha value to subtract. /// The new color after the modification. - public static Color SubtractA(this in Color color, int a) + public static Color SubtractA(this Color color, int a) => new(color.GetA() - a, color.R, color.G, color.B); /// @@ -142,7 +142,7 @@ public static class RGBColor /// The color to modify. /// The alpha value to subtract. /// The new color after the modification. - public static Color SubtractA(this in Color color, float aPercent) + public static Color SubtractA(this Color color, float aPercent) => new(color.A - aPercent, color.R, color.G, color.B); #endregion @@ -157,7 +157,7 @@ public static class RGBColor /// The green value to multiply. /// The blue value to multiply. /// The new color after the modification. - public static Color MultiplyRGB(this in Color color, float r = 1, float g = 1, float b = 1) + public static Color MultiplyRGB(this Color color, float r = 1, float g = 1, float b = 1) => new(color.A, color.R * r, color.G * g, color.B * b); /// @@ -166,7 +166,7 @@ public static class RGBColor /// The color to modify. /// The alpha value to multiply. /// The new color after the modification. - public static Color MultiplyA(this in Color color, float a) + public static Color MultiplyA(this Color color, float a) => new(color.A * a, color.R, color.G, color.B); #endregion @@ -181,7 +181,7 @@ public static class RGBColor /// The green value to divide. /// The blue value to divide. /// The new color after the modification. - public static Color DivideRGB(this in Color color, float r = 1, float g = 1, float b = 1) + public static Color DivideRGB(this Color color, float r = 1, float g = 1, float b = 1) => new(color.A, color.R / r, color.G / g, color.B / b); /// @@ -190,7 +190,7 @@ public static class RGBColor /// The color to modify. /// The alpha value to divide. /// The new color after the modification. - public static Color DivideA(this in Color color, float a) + public static Color DivideA(this Color color, float a) => new(color.A / a, color.R, color.G, color.B); #endregion @@ -205,7 +205,7 @@ public static class RGBColor /// The green value to set. /// The blue value to set. /// The new color after the modification. - public static Color SetRGB(this in Color color, byte? r = null, byte? g = null, byte? b = null) + public static Color SetRGB(this Color color, byte? r = null, byte? g = null, byte? b = null) => new(color.A, r ?? color.GetR(), g ?? color.GetG(), b ?? color.GetB()); /// @@ -216,7 +216,7 @@ public static class RGBColor /// The green value to set. /// The blue value to set. /// The new color after the modification. - public static Color SetRGB(this in Color color, int? r = null, int? g = null, int? b = null) + public static Color SetRGB(this Color color, int? r = null, int? g = null, int? b = null) => new(color.A, r ?? color.GetR(), g ?? color.GetG(), b ?? color.GetB()); /// @@ -227,7 +227,7 @@ public static class RGBColor /// The green value to set. /// The blue value to set. /// The new color after the modification. - public static Color SetRGB(this in Color color, float? r = null, float? g = null, float? b = null) + public static Color SetRGB(this Color color, float? r = null, float? g = null, float? b = null) => new(color.A, r ?? color.R, g ?? color.G, b ?? color.B); /// @@ -236,7 +236,7 @@ public static class RGBColor /// The color to modify. /// The alpha value to set. /// The new color after the modification. - public static Color SetA(this in Color color, int a) => new(a, color.R, color.G, color.B); + public static Color SetA(this Color color, int a) => new(a, color.R, color.G, color.B); /// /// Sets the specified alpha value of this color. @@ -244,7 +244,7 @@ public static class RGBColor /// The color to modify. /// The alpha value to set. /// The new color after the modification. - public static Color SetA(this in Color color, float a) => new(a, color.R, color.G, color.B); + public static Color SetA(this Color color, float a) => new(a, color.R, color.G, color.B); #endregion @@ -256,13 +256,13 @@ public static class RGBColor /// Gets the current color as a RGB-HEX-string. /// /// The RGB-HEX-string. - public static string AsRGBHexString(this in Color color, bool leadingHash = true) => (leadingHash ? "#" : "") + ConversionHelper.ToHex(color.GetR(), color.GetG(), color.GetB()); + public static string AsRGBHexString(this Color color, bool leadingHash = true) => (leadingHash ? "#" : "") + ConversionHelper.ToHex(color.GetR(), color.GetG(), color.GetB()); /// /// Gets the current color as a ARGB-HEX-string. /// /// The ARGB-HEX-string. - public static string AsARGBHexString(this in Color color, bool leadingHash = true) => (leadingHash ? "#" : "") + ConversionHelper.ToHex(color.GetA(), color.GetR(), color.GetG(), color.GetB()); + public static string AsARGBHexString(this Color color, bool leadingHash = true) => (leadingHash ? "#" : "") + ConversionHelper.ToHex(color.GetA(), color.GetR(), color.GetG(), color.GetB()); #endregion diff --git a/RGB.NET.Core/Color/XYZColor.cs b/RGB.NET.Core/Color/XYZColor.cs index 168d4f7..a20f5ac 100644 --- a/RGB.NET.Core/Color/XYZColor.cs +++ b/RGB.NET.Core/Color/XYZColor.cs @@ -16,21 +16,21 @@ public static class XYZColor /// /// The color to get the value from. /// The X component value of the color. - public static float GetX(this in Color color) => color.GetXYZ().x; + public static float GetX(this Color color) => color.GetXYZ().x; /// /// Gets the Y component value (XYZ-color space) of this in the range [0..100]. /// /// The color to get the value from. /// The Y component value of the color. - public static float GetY(this in Color color) => color.GetXYZ().y; + public static float GetY(this Color color) => color.GetXYZ().y; /// /// Gets the Z component value (XYZ-color space) of this in the range [0..108.883]. /// /// The color to get the value from. /// The Z component value of the color. - public static float GetZ(this in Color color) => color.GetXYZ().z; + public static float GetZ(this Color color) => color.GetXYZ().z; /// /// Gets the X, Y and Z component values (XYZ-color space) of this . @@ -40,7 +40,7 @@ public static class XYZColor /// /// The color to get the value from. /// A tuple containing the X, Y and Z component value of the color. - public static (float x, float y, float z) GetXYZ(this in Color color) + public static (float x, float y, float z) GetXYZ(this Color color) => CaclulateXYZFromRGB(color.R, color.G, color.B); #endregion @@ -55,7 +55,7 @@ public static class XYZColor /// The Y value to add. /// The Z value to add. /// The new color after the modification. - public static Color AddXYZ(this in Color color, float x = 0, float y = 0, float z = 0) + public static Color AddXYZ(this Color color, float x = 0, float y = 0, float z = 0) { (float cX, float cY, float cZ) = color.GetXYZ(); return Create(color.A, cX + x, cY + y, cZ + z); @@ -69,7 +69,7 @@ public static class XYZColor /// The Y value to subtract. /// The Z value to subtract. /// The new color after the modification. - public static Color SubtractXYZ(this in Color color, float x = 0, float y = 0, float z = 0) + public static Color SubtractXYZ(this Color color, float x = 0, float y = 0, float z = 0) { (float cX, float cY, float cZ) = color.GetXYZ(); return Create(color.A, cX - x, cY - y, cZ - z); @@ -83,7 +83,7 @@ public static class XYZColor /// The Y value to multiply. /// The Z value to multiply. /// The new color after the modification. - public static Color MultiplyXYZ(this in Color color, float x = 1, float y = 1, float z = 1) + public static Color MultiplyXYZ(this Color color, float x = 1, float y = 1, float z = 1) { (float cX, float cY, float cZ) = color.GetXYZ(); return Create(color.A, cX * x, cY * y, cZ * z); @@ -97,7 +97,7 @@ public static class XYZColor /// The Y value to divide. /// The Z value to divide. /// The new color after the modification. - public static Color DivideXYZ(this in Color color, float x = 1, float y = 1, float z = 1) + public static Color DivideXYZ(this Color color, float x = 1, float y = 1, float z = 1) { (float cX, float cY, float cZ) = color.GetXYZ(); return Create(color.A, cX / x, cY / y, cZ / z); @@ -111,7 +111,7 @@ public static class XYZColor /// The Y value to set. /// The Z value to set. /// The new color after the modification. - public static Color SetXYZ(this in Color color, float? x = null, float? y = null, float? z = null) + public static Color SetXYZ(this Color color, float? x = null, float? y = null, float? z = null) { (float cX, float cY, float cZ) = color.GetXYZ(); return Create(color.A, x ?? cX, y ?? cY, z ?? cZ); diff --git a/RGB.NET.Core/Decorators/IBrushDecorator.cs b/RGB.NET.Core/Decorators/IBrushDecorator.cs index ec1c432..89594b7 100644 --- a/RGB.NET.Core/Decorators/IBrushDecorator.cs +++ b/RGB.NET.Core/Decorators/IBrushDecorator.cs @@ -12,5 +12,5 @@ public interface IBrushDecorator : IDecorator /// The rectangle in which the should be drawn. /// The target (key/point) from which the should be taken. /// The to be modified. - void ManipulateColor(in Rectangle rectangle, in RenderTarget renderTarget, ref Color color); + void ManipulateColor(Rectangle rectangle, RenderTarget renderTarget, ref Color color); } \ No newline at end of file diff --git a/RGB.NET.Core/Devices/AbstractRGBDevice.cs b/RGB.NET.Core/Devices/AbstractRGBDevice.cs index 9e3572b..f4db90e 100644 --- a/RGB.NET.Core/Devices/AbstractRGBDevice.cs +++ b/RGB.NET.Core/Devices/AbstractRGBDevice.cs @@ -179,7 +179,7 @@ public abstract class AbstractRGBDevice : Placeable, IRGBDevice - public virtual Led? AddLed(LedId ledId, in Point location, in Size size, object? customData = null) + public virtual Led? AddLed(LedId ledId, Point location, Size size, object? customData = null) { if ((ledId == LedId.Invalid) || LedMapping.ContainsKey(ledId)) return null; diff --git a/RGB.NET.Core/Devices/IRGBDevice.cs b/RGB.NET.Core/Devices/IRGBDevice.cs index 6e79fb3..ce9dbd2 100644 --- a/RGB.NET.Core/Devices/IRGBDevice.cs +++ b/RGB.NET.Core/Devices/IRGBDevice.cs @@ -72,7 +72,7 @@ public interface IRGBDevice : IEnumerable, IPlaceable, IBindable, IDisposab /// The size of the led. /// Custom data saved on the led. /// The newly added led or null if a led with this id is already added. - Led? AddLed(LedId ledId, in Point location, in Size size, object? customData = null); + Led? AddLed(LedId ledId, Point location, Size size, object? customData = null); /// /// Removes the led with the specified id from the device. diff --git a/RGB.NET.Core/Extensions/ColorExtensions.cs b/RGB.NET.Core/Extensions/ColorExtensions.cs index c2afc23..de3756a 100644 --- a/RGB.NET.Core/Extensions/ColorExtensions.cs +++ b/RGB.NET.Core/Extensions/ColorExtensions.cs @@ -16,7 +16,7 @@ public static class ColorExtensions /// The start color of the distance calculation. /// The end color fot the distance calculation. /// The redmean distance between the two specified colors. - public static double DistanceTo(this in Color color1, in Color color2) + 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(); diff --git a/RGB.NET.Core/Extensions/MathExtensions.cs b/RGB.NET.Core/Extensions/MathExtensions.cs index 665df6a..93107b6 100644 --- a/RGB.NET.Core/Extensions/MathExtensions.cs +++ b/RGB.NET.Core/Extensions/MathExtensions.cs @@ -91,9 +91,11 @@ public static class FloatExtensions [MethodImpl(MethodImplOptions.AggressiveInlining)] public static byte GetByteValueFromPercentage(this float percentage) { + // ReSharper disable once ConvertIfStatementToSwitchStatement - This results in a bit more instructions if (float.IsNaN(percentage) || (percentage <= 0)) return 0; + if (percentage >= 1.0f) return byte.MaxValue; - return (byte)(percentage >= 1.0f ? 255 : percentage * 256.0f); + return (byte)(percentage * 256.0f); } /// diff --git a/RGB.NET.Core/Extensions/PointExtensions.cs b/RGB.NET.Core/Extensions/PointExtensions.cs index 1acab3a..747098c 100644 --- a/RGB.NET.Core/Extensions/PointExtensions.cs +++ b/RGB.NET.Core/Extensions/PointExtensions.cs @@ -16,7 +16,7 @@ public static class PointExtensions /// The x-ammount to move. /// The y-ammount to move. /// The new location of the point. - public static Point Translate(this in Point point, float x = 0, float y = 0) => new(point.X + x, point.Y + y); + public static Point Translate(this Point point, float x = 0, float y = 0) => new(point.X + x, point.Y + y); /// /// Rotates the specified by the specified amuont around the specified origin. @@ -25,7 +25,7 @@ public static class PointExtensions /// The rotation. /// The origin to rotate around. [0,0] if not set. /// The new location of the point. - public static Point Rotate(this in Point point, in Rotation rotation, in Point origin = new()) + public static Point Rotate(this Point point, Rotation rotation, Point origin = new()) { float sin = MathF.Sin(rotation.Radians); float cos = MathF.Cos(rotation.Radians); diff --git a/RGB.NET.Core/Extensions/RectangleExtensions.cs b/RGB.NET.Core/Extensions/RectangleExtensions.cs index c97256f..741742b 100644 --- a/RGB.NET.Core/Extensions/RectangleExtensions.cs +++ b/RGB.NET.Core/Extensions/RectangleExtensions.cs @@ -15,7 +15,7 @@ public static class RectangleExtensions /// The rectangle to modify. /// The new location of the rectangle. /// The modified . - public static Rectangle SetLocation(this in Rectangle rect, in Point location) => new(location, rect.Size); + public static Rectangle SetLocation(this Rectangle rect, Point location) => new(location, rect.Size); /// /// Sets the of the of the specified rectangle. @@ -23,7 +23,7 @@ public static class RectangleExtensions /// The rectangle to modify. /// The new x-location of the rectangle. /// The modified . - public static Rectangle SetX(this in Rectangle rect, float x) => new(new Point(x, rect.Location.Y), rect.Size); + public static Rectangle SetX(this Rectangle rect, float x) => new(new Point(x, rect.Location.Y), rect.Size); /// /// Sets the of the of the specified rectangle. @@ -31,7 +31,7 @@ public static class RectangleExtensions /// The rectangle to modify. /// The new y-location of the rectangle. /// The modified . - public static Rectangle SetY(this in Rectangle rect, float y) => new(new Point(rect.Location.X, y), rect.Size); + public static Rectangle SetY(this Rectangle rect, float y) => new(new Point(rect.Location.X, y), rect.Size); /// /// Sets the of the specified rectangle. @@ -39,7 +39,7 @@ public static class RectangleExtensions /// The rectangle to modify. /// The new size of the rectangle. /// The modified . - public static Rectangle SetSize(this in Rectangle rect, in Size size) => new(rect.Location, size); + public static Rectangle SetSize(this Rectangle rect, Size size) => new(rect.Location, size); /// /// Sets the of the of the specified rectangle. @@ -47,7 +47,7 @@ public static class RectangleExtensions /// The rectangle to modify. /// The new width of the rectangle. /// The modified . - public static Rectangle SetWidth(this in Rectangle rect, float width) => new(rect.Location, new Size(width, rect.Size.Height)); + public static Rectangle SetWidth(this Rectangle rect, float width) => new(rect.Location, new Size(width, rect.Size.Height)); /// /// Sets the of the of the specified rectangle. @@ -55,7 +55,7 @@ public static class RectangleExtensions /// The rectangle to modify. /// The new height of the rectangle. /// The modified . - public static Rectangle SetHeight(this in Rectangle rect, float height) => new(rect.Location, new Size(rect.Size.Width, height)); + public static Rectangle SetHeight(this Rectangle rect, float height) => new(rect.Location, new Size(rect.Size.Width, height)); /// /// Calculates the percentage of intersection of a rectangle. @@ -63,7 +63,7 @@ public static class RectangleExtensions /// The rectangle to calculate the intersection for. /// The intersecting rectangle. /// The percentage of intersection. - public static float CalculateIntersectPercentage(this in Rectangle rect, in Rectangle intersectingRect) + public static float CalculateIntersectPercentage(this Rectangle rect, Rectangle intersectingRect) { if (rect.IsEmpty || intersectingRect.IsEmpty) return 0; @@ -77,7 +77,7 @@ public static class RectangleExtensions /// The rectangle to calculate the intersection for. /// The intersecting . /// A new representing the intersection this and the one provided as parameter. - public static Rectangle CalculateIntersection(this in Rectangle rect, in Rectangle intersectingRectangle) + public static Rectangle CalculateIntersection(this Rectangle rect, Rectangle intersectingRectangle) { float x1 = Math.Max(rect.Location.X, intersectingRectangle.Location.X); float x2 = Math.Min(rect.Location.X + rect.Size.Width, intersectingRectangle.Location.X + intersectingRectangle.Size.Width); @@ -97,7 +97,7 @@ public static class RectangleExtensions /// The containing rectangle. /// The to test. /// true if the rectangle contains the specified point; otherwise false. - public static bool Contains(this in Rectangle rect, in Point point) => rect.Contains(point.X, point.Y); + public static bool Contains(this Rectangle rect, Point point) => rect.Contains(point.X, point.Y); /// /// Determines if the specified location is contained within this . @@ -106,7 +106,7 @@ public static class RectangleExtensions /// The X-location to test. /// The Y-location to test. /// true if the rectangle contains the specified coordinates; otherwise false. - public static bool Contains(this in Rectangle rect, float x, float y) => (rect.Location.X <= x) && (x < (rect.Location.X + rect.Size.Width)) + public static bool Contains(this Rectangle rect, float x, float y) => (rect.Location.X <= x) && (x < (rect.Location.X + rect.Size.Width)) && (rect.Location.Y <= y) && (y < (rect.Location.Y + rect.Size.Height)); /// @@ -115,7 +115,7 @@ public static class RectangleExtensions /// The containing rectangle. /// The to test. /// true if the rectangle contains the specified rect; otherwise false. - public static bool Contains(this in Rectangle rect, in Rectangle rect2) => (rect.Location.X <= rect2.Location.X) && ((rect2.Location.X + rect2.Size.Width) <= (rect.Location.X + rect.Size.Width)) + public static bool Contains(this Rectangle rect, Rectangle rect2) => (rect.Location.X <= rect2.Location.X) && ((rect2.Location.X + rect2.Size.Width) <= (rect.Location.X + rect.Size.Width)) && (rect.Location.Y <= rect2.Location.Y) && ((rect2.Location.Y + rect2.Size.Height) <= (rect.Location.Y + rect.Size.Height)); /// @@ -124,7 +124,7 @@ public static class RectangleExtensions /// The to move. /// The amount to move. /// The moved rectangle. - public static Rectangle Translate(this in Rectangle rect, in Point point) => rect.Translate(point.X, point.Y); + public static Rectangle Translate(this Rectangle rect, Point point) => rect.Translate(point.X, point.Y); /// /// Moves the specified by the specified amount. @@ -133,7 +133,7 @@ public static class RectangleExtensions /// The x-ammount to move. /// The y-ammount to move. /// The moved rectangle. - public static Rectangle Translate(this in Rectangle rect, float x = 0, float y = 0) => new(rect.Location.Translate(x, y), rect.Size); + public static Rectangle Translate(this Rectangle rect, float x = 0, float y = 0) => new(rect.Location.Translate(x, y), rect.Size); /// /// Rotates the specified by the specified amuont around the specified origin. @@ -149,7 +149,7 @@ public static class RectangleExtensions /// The rotation. /// The origin to rotate around. [0,0] if not set. /// A array of containing the new locations of the corners of the original rectangle. - public static Point[] Rotate(this in Rectangle rect, in Rotation rotation, in Point origin = new()) + public static Point[] Rotate(this Rectangle rect, Rotation rotation, Point origin = new()) { Point[] points = [ diff --git a/RGB.NET.Core/Positioning/Point.cs b/RGB.NET.Core/Positioning/Point.cs index e92c65f..b8f15e7 100644 --- a/RGB.NET.Core/Positioning/Point.cs +++ b/RGB.NET.Core/Positioning/Point.cs @@ -90,7 +90,7 @@ public readonly struct Point : IEquatable /// The first to compare. /// The second to compare. /// true if and are equal; otherwise, false. - public static bool operator ==(in Point point1, in Point point2) => point1.Equals(point2); + public static bool operator ==(Point point1, Point point2) => point1.Equals(point2); /// /// Returns a value that indicates whether two specified are equal. @@ -98,7 +98,7 @@ public readonly struct Point : IEquatable /// The first to compare. /// The second to compare. /// true if and are not equal; otherwise, false. - public static bool operator !=(in Point point1, in Point point2) => !(point1 == point2); + public static bool operator !=(Point point1, Point point2) => !(point1 == point2); /// /// Returns a new representing the addition of the two provided . @@ -106,7 +106,7 @@ public readonly struct Point : IEquatable /// The first . /// The second . /// A new representing the addition of the two provided . - public static Point operator +(in Point point1, in Point point2) => new(point1.X + point2.X, point1.Y + point2.Y); + public static Point operator +(Point point1, Point point2) => new(point1.X + point2.X, point1.Y + point2.Y); /// /// Returns a new created from the provided and . @@ -114,7 +114,7 @@ public readonly struct Point : IEquatable /// The of the rectangle. /// The of the rectangle. /// The rectangle created from the provided and . - public static Rectangle operator +(in Point point, in Size size) => new(point, size); + public static Rectangle operator +(Point point, Size size) => new(point, size); /// /// Returns a new representing the subtraction of the two provided . @@ -122,7 +122,7 @@ public readonly struct Point : IEquatable /// The first . /// The second . /// A new representing the subtraction of the two provided . - public static Point operator -(in Point point1, in Point point2) => new(point1.X - point2.X, point1.Y - point2.Y); + public static Point operator -(Point point1, Point point2) => new(point1.X - point2.X, point1.Y - point2.Y); /// /// Returns a new representing the multiplication of the two provided . @@ -130,7 +130,7 @@ public readonly struct Point : IEquatable /// The first . /// The second . /// A new representing the multiplication of the two provided . - public static Point operator *(in Point point1, in Point point2) => new(point1.X * point2.X, point1.Y * point2.Y); + public static Point operator *(Point point1, Point point2) => new(point1.X * point2.X, point1.Y * point2.Y); /// /// Returns a new representing the division of the two provided . @@ -138,7 +138,7 @@ public readonly struct Point : IEquatable /// The first . /// The second . /// A new representing the division of the two provided . - public static Point operator /(in Point point1, in Point point2) + public static Point operator /(Point point1, Point point2) { if (point2.X.EqualsInTolerance(0) || point2.Y.EqualsInTolerance(0)) return Invalid; return new Point(point1.X / point2.X, point1.Y / point2.Y); @@ -150,7 +150,7 @@ public readonly struct Point : IEquatable /// The . /// The . /// A new representing the multiplication of the and the provided . - public static Point operator *(in Point point, in Scale scale) => new(point.X * scale.Horizontal, point.Y * scale.Vertical); + public static Point operator *(Point point, Scale scale) => new(point.X * scale.Horizontal, point.Y * scale.Vertical); #endregion } \ No newline at end of file diff --git a/RGB.NET.Core/Positioning/Rectangle.cs b/RGB.NET.Core/Positioning/Rectangle.cs index 095a210..a1cf4de 100644 --- a/RGB.NET.Core/Positioning/Rectangle.cs +++ b/RGB.NET.Core/Positioning/Rectangle.cs @@ -179,7 +179,7 @@ public readonly struct Rectangle : IEquatable #region Methods - private static (Point location, Size size) InitializeFromPoints(in Point point1, in Point point2) + private static (Point location, Size size) InitializeFromPoints(Point point1, Point point2) { float posX = Math.Min(point1.X, point2.X); float posY = Math.Min(point1.Y, point2.Y); @@ -225,7 +225,7 @@ public readonly struct Rectangle : IEquatable /// The first to compare. /// The second to compare. /// true if and are equal; otherwise, false. - public static bool operator ==(in Rectangle rectangle1, in Rectangle rectangle2) => rectangle1.Equals(rectangle2); + public static bool operator ==(Rectangle rectangle1, Rectangle rectangle2) => rectangle1.Equals(rectangle2); /// /// Returns a value that indicates whether two specified are equal. @@ -233,7 +233,7 @@ public readonly struct Rectangle : IEquatable /// The first to compare. /// The second to compare. /// true if and are not equal; otherwise, false. - public static bool operator !=(in Rectangle rectangle1, in Rectangle rectangle2) => !(rectangle1 == rectangle2); + public static bool operator !=(Rectangle rectangle1, Rectangle rectangle2) => !(rectangle1 == rectangle2); // DarthAffe 20.02.2021: Used for normalization /// @@ -242,7 +242,7 @@ public readonly struct Rectangle : IEquatable /// The rectangle to nromalize. /// The reference used for normalization. /// A normalized rectangle. - public static Rectangle operator /(in Rectangle rectangle1, in Rectangle rectangle2) + public static Rectangle operator /(Rectangle rectangle1, Rectangle rectangle2) { float x = rectangle1.Location.X / (rectangle2.Size.Width - rectangle2.Location.X); float y = rectangle1.Location.Y / (rectangle2.Size.Height - rectangle2.Location.Y); diff --git a/RGB.NET.Core/Positioning/Rotation.cs b/RGB.NET.Core/Positioning/Rotation.cs index e204b75..4b6732b 100644 --- a/RGB.NET.Core/Positioning/Rotation.cs +++ b/RGB.NET.Core/Positioning/Rotation.cs @@ -103,7 +103,7 @@ public readonly struct Rotation : IEquatable /// The first to compare. /// The second to compare. /// true if and are equal; otherwise, false. - public static bool operator ==(in Rotation rotation1, in Rotation rotation2) => rotation1.Equals(rotation2); + public static bool operator ==(Rotation rotation1, Rotation rotation2) => rotation1.Equals(rotation2); /// /// Returns a value that indicates whether two specified are equal. @@ -111,7 +111,7 @@ public readonly struct Rotation : IEquatable /// The first to compare. /// The second to compare. /// true if and are not equal; otherwise, false. - public static bool operator !=(in Rotation rotation1, in Rotation rotation2) => !(rotation1 == rotation2); + public static bool operator !=(Rotation rotation1, Rotation rotation2) => !(rotation1 == rotation2); /// /// Returns a new representing the addition of the and the provided value. @@ -119,7 +119,7 @@ public readonly struct Rotation : IEquatable /// The . /// The value to add. /// A new representing the addition of the and the provided value. - public static Rotation operator +(in Rotation rotation, float value) => new(rotation.Degrees + value); + public static Rotation operator +(Rotation rotation, float value) => new(rotation.Degrees + value); /// /// Returns a new representing the subtraction of the and the provided value. @@ -127,7 +127,7 @@ public readonly struct Rotation : IEquatable /// The . /// The value to substract. /// A new representing the subtraction of the and the provided value. - public static Rotation operator -(in Rotation rotation, float value) => new(rotation.Degrees - value); + public static Rotation operator -(Rotation rotation, float value) => new(rotation.Degrees - value); /// /// Returns a new representing the multiplication of the and the provided value. @@ -135,7 +135,7 @@ public readonly struct Rotation : IEquatable /// The . /// The value to multiply with. /// A new representing the multiplication of the and the provided value. - public static Rotation operator *(in Rotation rotation, float value) => new(rotation.Degrees * value); + public static Rotation operator *(Rotation rotation, float value) => new(rotation.Degrees * value); /// /// Returns a new representing the division of the and the provided value. @@ -143,7 +143,7 @@ public readonly struct Rotation : IEquatable /// The . /// The value to device with. /// A new representing the division of the and the provided value. - public static Rotation operator /(in Rotation rotation, float value) => value.EqualsInTolerance(0) ? new Rotation(0) : new Rotation(rotation.Degrees / value); + public static Rotation operator /(Rotation rotation, float value) => value.EqualsInTolerance(0) ? new Rotation(0) : new Rotation(rotation.Degrees / value); /// /// Converts a float to a . @@ -155,7 +155,7 @@ public readonly struct Rotation : IEquatable /// Converts to a float representing the rotation in degrees. /// /// The rotatio to convert. - public static implicit operator float(in Rotation rotation) => rotation.Degrees; + public static implicit operator float(Rotation rotation) => rotation.Degrees; #endregion } \ No newline at end of file diff --git a/RGB.NET.Core/Positioning/Size.cs b/RGB.NET.Core/Positioning/Size.cs index 1a9a6d6..2270449 100644 --- a/RGB.NET.Core/Positioning/Size.cs +++ b/RGB.NET.Core/Positioning/Size.cs @@ -110,7 +110,7 @@ public readonly struct Size : IEquatable /// The first to compare. /// The second to compare. /// true if and are equal; otherwise, false. - public static bool operator ==(in Size size1, in Size size2) => size1.Equals(size2); + public static bool operator ==(Size size1, Size size2) => size1.Equals(size2); /// /// Returns a value that indicates whether two specified are equal. @@ -118,7 +118,7 @@ public readonly struct Size : IEquatable /// The first to compare. /// The second to compare. /// true if and are not equal; otherwise, false. - public static bool operator !=(in Size size1, in Size size2) => !(size1 == size2); + public static bool operator !=(Size size1, Size size2) => !(size1 == size2); /// /// Returns a new representing the addition of the two provided . @@ -126,7 +126,7 @@ public readonly struct Size : IEquatable /// The first . /// The second . /// A new representing the addition of the two provided . - public static Size operator +(in Size size1, in Size size2) => new(size1.Width + size2.Width, size1.Height + size2.Height); + public static Size operator +(Size size1, Size size2) => new(size1.Width + size2.Width, size1.Height + size2.Height); /// /// Returns a new created from the provided and . @@ -134,7 +134,7 @@ public readonly struct Size : IEquatable /// The of the rectangle. /// The of the rectangle. /// The rectangle created from the provided and . - public static Rectangle operator +(in Size size, in Point point) => new(point, size); + public static Rectangle operator +(Size size, Point point) => new(point, size); /// /// Returns a new representing the subtraction of the two provided . @@ -142,7 +142,7 @@ public readonly struct Size : IEquatable /// The first . /// The second . /// A new representing the subtraction of the two provided . - public static Size operator -(in Size size1, in Size size2) => new(size1.Width - size2.Width, size1.Height - size2.Height); + public static Size operator -(Size size1, Size size2) => new(size1.Width - size2.Width, size1.Height - size2.Height); /// /// Returns a new representing the multiplication of the two provided . @@ -150,7 +150,7 @@ public readonly struct Size : IEquatable /// The first . /// The second . /// A new representing the multiplication of the two provided . - public static Size operator *(in Size size1, in Size size2) => new(size1.Width * size2.Width, size1.Height * size2.Height); + public static Size operator *(Size size1, Size size2) => new(size1.Width * size2.Width, size1.Height * size2.Height); /// /// Returns a new representing the multiplication of the and the provided factor. @@ -158,7 +158,7 @@ public readonly struct Size : IEquatable /// The . /// The factor by which the should be multiplied. /// A new representing the multiplication of the and the provided factor. - public static Size operator *(in Size size, float factor) => new(size.Width * factor, size.Height * factor); + public static Size operator *(Size size, float factor) => new(size.Width * factor, size.Height * factor); /// /// Returns a new representing the division of the two provided . @@ -166,7 +166,7 @@ public readonly struct Size : IEquatable /// The first . /// The second . /// A new representing the division of the two provided . - public static Size operator /(in Size size1, in Size size2) + public static Size operator /(Size size1, Size size2) => size2.Width.EqualsInTolerance(0) || size2.Height.EqualsInTolerance(0) ? Invalid : new Size(size1.Width / size2.Width, size1.Height / size2.Height); @@ -176,7 +176,7 @@ public readonly struct Size : IEquatable /// The . /// The factor by which the should be divided. /// A new representing the division of the and the provided factor. - public static Size operator /(in Size size, float factor) => factor.EqualsInTolerance(0) ? Invalid : new Size(size.Width / factor, size.Height / factor); + public static Size operator /(Size size, float factor) => factor.EqualsInTolerance(0) ? Invalid : new Size(size.Width / factor, size.Height / factor); /// /// Returns a new representing the multiplication of the and the specified . @@ -184,7 +184,7 @@ public readonly struct Size : IEquatable /// The to scale. /// The scaling factor. /// A new representing the multiplication of the and the specified . - public static Size operator *(in Size size, in Scale scale) => new(size.Width * scale.Horizontal, size.Height * scale.Vertical); + public static Size operator *(Size size, Scale scale) => new(size.Width * scale.Horizontal, size.Height * scale.Vertical); #endregion } \ No newline at end of file diff --git a/RGB.NET.Core/Rendering/Brushes/AbstractBrush.cs b/RGB.NET.Core/Rendering/Brushes/AbstractBrush.cs index bc39b5d..dc69fb2 100644 --- a/RGB.NET.Core/Rendering/Brushes/AbstractBrush.cs +++ b/RGB.NET.Core/Rendering/Brushes/AbstractBrush.cs @@ -69,7 +69,7 @@ public abstract class AbstractBrush : AbstractDecoratable, IBru /// The rectangle in which the brush should be drawn. /// The target (key/point) from which the color should be taken. /// The to be modified. - protected virtual void ApplyDecorators(in Rectangle rectangle, in RenderTarget renderTarget, ref Color color) + protected virtual void ApplyDecorators(Rectangle rectangle, RenderTarget renderTarget, ref Color color) { if (Decorators.Count == 0) return; @@ -89,7 +89,7 @@ public abstract class AbstractBrush : AbstractDecoratable, IBru /// The rectangle in which the brush should be drawn. /// The target (key/point) from which the color should be taken. /// The color at the specified point. - protected abstract Color GetColorAtPoint(in Rectangle rectangle, in RenderTarget renderTarget); + protected abstract Color GetColorAtPoint(Rectangle rectangle, RenderTarget renderTarget); /// /// Finalizes the color by appliing the overall brightness and opacity.
diff --git a/RGB.NET.Core/Rendering/Brushes/SolidColorBrush.cs b/RGB.NET.Core/Rendering/Brushes/SolidColorBrush.cs index 02f8e2d..33464b6 100644 --- a/RGB.NET.Core/Rendering/Brushes/SolidColorBrush.cs +++ b/RGB.NET.Core/Rendering/Brushes/SolidColorBrush.cs @@ -41,7 +41,7 @@ public sealed class SolidColorBrush : AbstractBrush #region Methods /// - protected override Color GetColorAtPoint(in Rectangle rectangle, in RenderTarget renderTarget) => Color; + protected override Color GetColorAtPoint(Rectangle rectangle, RenderTarget renderTarget) => Color; #endregion diff --git a/RGB.NET.Core/Rendering/Brushes/TextureBrush.cs b/RGB.NET.Core/Rendering/Brushes/TextureBrush.cs index 41280cd..3881545 100644 --- a/RGB.NET.Core/Rendering/Brushes/TextureBrush.cs +++ b/RGB.NET.Core/Rendering/Brushes/TextureBrush.cs @@ -36,7 +36,7 @@ public sealed class TextureBrush : AbstractBrush #region Methods /// - protected override Color GetColorAtPoint(in Rectangle rectangle, in RenderTarget renderTarget) + protected override Color GetColorAtPoint(Rectangle rectangle, RenderTarget renderTarget) { Rectangle normalizedRect = renderTarget.Rectangle / rectangle; return Texture[normalizedRect]; diff --git a/RGB.NET.Core/Rendering/Textures/EmptyTexture.cs b/RGB.NET.Core/Rendering/Textures/EmptyTexture.cs index 7aca9b7..28152f4 100644 --- a/RGB.NET.Core/Rendering/Textures/EmptyTexture.cs +++ b/RGB.NET.Core/Rendering/Textures/EmptyTexture.cs @@ -5,8 +5,8 @@ internal sealed class EmptyTexture : ITexture #region Properties & Fields public Size Size { get; } = new(0, 0); - public Color this[in Point point] => Color.Transparent; - public Color this[in Rectangle rectangle] => Color.Transparent; + public Color this[Point point] => Color.Transparent; + public Color this[Rectangle rectangle] => Color.Transparent; #endregion } \ No newline at end of file diff --git a/RGB.NET.Core/Rendering/Textures/ITexture.cs b/RGB.NET.Core/Rendering/Textures/ITexture.cs index 8fdd2ae..93773bb 100644 --- a/RGB.NET.Core/Rendering/Textures/ITexture.cs +++ b/RGB.NET.Core/Rendering/Textures/ITexture.cs @@ -20,12 +20,12 @@ public interface ITexture ///
/// The location to get the color from. /// The color at the specified location. - Color this[in Point point] { get; } + Color this[Point point] { get; } /// /// Gets the sampled color inside the specified rectangle. /// /// The rectangle to get the color from. /// The sampled color. - Color this[in Rectangle rectangle] { get; } + Color this[Rectangle rectangle] { get; } } \ No newline at end of file diff --git a/RGB.NET.Core/Rendering/Textures/PixelTexture.cs b/RGB.NET.Core/Rendering/Textures/PixelTexture.cs index 5ad4459..4047840 100644 --- a/RGB.NET.Core/Rendering/Textures/PixelTexture.cs +++ b/RGB.NET.Core/Rendering/Textures/PixelTexture.cs @@ -39,7 +39,7 @@ public abstract class PixelTexture : ITexture public Size Size { get; } /// - public virtual Color this[in Point point] + public virtual Color this[Point point] { get { @@ -52,7 +52,7 @@ public abstract class PixelTexture : ITexture } /// - public virtual Color this[in Rectangle rectangle] + public virtual Color this[Rectangle rectangle] { get { diff --git a/RGB.NET.Core/Rendering/Textures/Sampler/AverageColorSampler.cs b/RGB.NET.Core/Rendering/Textures/Sampler/AverageColorSampler.cs index f7e3258..24f4dfb 100644 --- a/RGB.NET.Core/Rendering/Textures/Sampler/AverageColorSampler.cs +++ b/RGB.NET.Core/Rendering/Textures/Sampler/AverageColorSampler.cs @@ -22,7 +22,7 @@ public sealed class AverageColorSampler : ISampler #region Methods /// - public unsafe void Sample(in SamplerInfo info, Span pixelData) + public unsafe void Sample(SamplerInfo info, Span pixelData) { int count = info.Width * info.Height; if (count == 0) return; diff --git a/RGB.NET.Core/Rendering/Textures/Sampler/ISampler.cs b/RGB.NET.Core/Rendering/Textures/Sampler/ISampler.cs index 04fcfa0..7461afd 100644 --- a/RGB.NET.Core/Rendering/Textures/Sampler/ISampler.cs +++ b/RGB.NET.Core/Rendering/Textures/Sampler/ISampler.cs @@ -13,5 +13,5 @@ public interface ISampler ///
/// The information containing the data to sample. /// The buffer used to write the resulting pixel to. - void Sample(in SamplerInfo info, Span pixelData); + void Sample(SamplerInfo info, Span pixelData); } \ No newline at end of file diff --git a/RGB.NET.Devices.Novation/Generic/LimitedColorUpdateQueue.cs b/RGB.NET.Devices.Novation/Generic/LimitedColorUpdateQueue.cs index 987b691..1eb0548 100644 --- a/RGB.NET.Devices.Novation/Generic/LimitedColorUpdateQueue.cs +++ b/RGB.NET.Devices.Novation/Generic/LimitedColorUpdateQueue.cs @@ -25,7 +25,7 @@ public sealed class LimitedColorUpdateQueue : MidiUpdateQueue #region Methods /// - protected override ShortMessage CreateMessage(object key, in Color color) + protected override ShortMessage CreateMessage(object key, Color color) { (byte mode, byte id) = ((byte, byte))key; return new ShortMessage(mode, id, Convert.ToByte(ConvertColor(color))); @@ -37,7 +37,7 @@ public sealed class LimitedColorUpdateQueue : MidiUpdateQueue ///
/// The to convert. /// The novation-representation of the . - private static int ConvertColor(in Color color) + private static int ConvertColor(Color color) { (double hue, double _, double value) = color.GetHSV(); diff --git a/RGB.NET.Devices.Novation/Generic/MidiUpdateQueue.cs b/RGB.NET.Devices.Novation/Generic/MidiUpdateQueue.cs index 4cc8929..8b45176 100644 --- a/RGB.NET.Devices.Novation/Generic/MidiUpdateQueue.cs +++ b/RGB.NET.Devices.Novation/Generic/MidiUpdateQueue.cs @@ -68,7 +68,7 @@ public abstract class MidiUpdateQueue : UpdateQueue /// The key used to identify the LED to update. /// The color to send. /// The message created out of the data set. - protected abstract ShortMessage? CreateMessage(object key, in Color color); + protected abstract ShortMessage? CreateMessage(object key, Color color); /// public override void Dispose() diff --git a/RGB.NET.Devices.Novation/Generic/RGBColorUpdateQueue.cs b/RGB.NET.Devices.Novation/Generic/RGBColorUpdateQueue.cs index aa3f53d..0584d45 100644 --- a/RGB.NET.Devices.Novation/Generic/RGBColorUpdateQueue.cs +++ b/RGB.NET.Devices.Novation/Generic/RGBColorUpdateQueue.cs @@ -151,7 +151,7 @@ public sealed class RGBColorUpdateQueue : MidiUpdateQueue #region Methods /// - protected override ShortMessage? CreateMessage(object key, in Color color) + protected override ShortMessage? CreateMessage(object key, Color color) { (byte mode, byte id) = ((byte, byte))key; if (mode == 0x00) return null; @@ -165,7 +165,7 @@ public sealed class RGBColorUpdateQueue : MidiUpdateQueue ///
/// The to convert. /// The novation-representation of the . - private static int ConvertColor(in Color color) + private static int ConvertColor(Color color) { int bestVelocity = 0; double bestMatchDistance = double.MaxValue; diff --git a/RGB.NET.Presets/Decorators/FlashDecorator.cs b/RGB.NET.Presets/Decorators/FlashDecorator.cs index e30a5f2..ab70266 100644 --- a/RGB.NET.Presets/Decorators/FlashDecorator.cs +++ b/RGB.NET.Presets/Decorators/FlashDecorator.cs @@ -90,7 +90,7 @@ public sealed class FlashDecorator : AbstractUpdateAwareDecorator, IBrushDecorat #region Methods /// - public void ManipulateColor(in Rectangle rectangle, in RenderTarget renderTarget, ref Color color) => color = color.SetA(_currentValue); + public void ManipulateColor(Rectangle rectangle, RenderTarget renderTarget, ref Color color) => color = color.SetA(_currentValue); /// protected override void Update(double deltaTime) diff --git a/RGB.NET.Presets/Helper/GradientHelper.cs b/RGB.NET.Presets/Helper/GradientHelper.cs index 2f6d68d..8645979 100644 --- a/RGB.NET.Presets/Helper/GradientHelper.cs +++ b/RGB.NET.Presets/Helper/GradientHelper.cs @@ -20,7 +20,7 @@ public static class GradientHelper /// The end of the gradient. /// The on the gradient to which the offset is calculated. /// The offset of the on the gradient. - public static float CalculateLinearGradientOffset(in Point startPoint, in Point endPoint, in Point point) + public static float CalculateLinearGradientOffset(Point startPoint, Point endPoint, Point point) { Point intersectingPoint; if (startPoint.Y.EqualsInTolerance(endPoint.Y)) // Horizontal case @@ -57,7 +57,7 @@ public static class GradientHelper /// The origin of the vector. /// The direction of the vector. /// The signed magnitude of a on a vector. - public static float CalculateDistance(in Point point, in Point origin, in Point direction) + public static float CalculateDistance(Point point, Point origin, Point direction) { float distance = CalculateDistance(point, origin); @@ -74,7 +74,7 @@ public static class GradientHelper /// The first . /// The second . /// The distance between the two . - public static float CalculateDistance(in Point point1, in Point point2) + public static float CalculateDistance(Point point1, Point point2) { float x = point1.X - point2.X; float y = point1.Y - point2.Y; diff --git a/RGB.NET.Presets/Textures/AbstractGradientTexture.cs b/RGB.NET.Presets/Textures/AbstractGradientTexture.cs index 3f2f73c..e4b6b88 100644 --- a/RGB.NET.Presets/Textures/AbstractGradientTexture.cs +++ b/RGB.NET.Presets/Textures/AbstractGradientTexture.cs @@ -21,10 +21,10 @@ public abstract class AbstractGradientTexture : AbstractBindable, ITexture public Size Size { get; } /// - public Color this[in Point point] => GetColor(point); + public Color this[Point point] => GetColor(point); /// - public Color this[in Rectangle rectangle] => GetColor(rectangle.Center); + public Color this[Rectangle rectangle] => GetColor(rectangle.Center); #endregion @@ -50,7 +50,7 @@ public abstract class AbstractGradientTexture : AbstractBindable, ITexture ///
/// The location to get the color from. /// The color at the specified location. - protected abstract Color GetColor(in Point point); + protected abstract Color GetColor(Point point); #endregion } \ No newline at end of file diff --git a/RGB.NET.Presets/Textures/ConicalGradientTexture.cs b/RGB.NET.Presets/Textures/ConicalGradientTexture.cs index c60d9e4..b9110e4 100644 --- a/RGB.NET.Presets/Textures/ConicalGradientTexture.cs +++ b/RGB.NET.Presets/Textures/ConicalGradientTexture.cs @@ -88,7 +88,7 @@ public sealed class ConicalGradientTexture : AbstractGradientTexture #region Methods /// - protected override Color GetColor(in Point point) + protected override Color GetColor(Point point) { float angle = MathF.Atan2(point.Y - Center.Y, point.X - Center.X) - Origin; if (angle < 0) angle += PI2; diff --git a/RGB.NET.Presets/Textures/LinearGradientTexture.cs b/RGB.NET.Presets/Textures/LinearGradientTexture.cs index c5bc2f7..70db2ac 100644 --- a/RGB.NET.Presets/Textures/LinearGradientTexture.cs +++ b/RGB.NET.Presets/Textures/LinearGradientTexture.cs @@ -71,7 +71,7 @@ public sealed class LinearGradientTexture : AbstractGradientTexture #region Methods /// - protected override Color GetColor(in Point point) + protected override Color GetColor(Point point) { float offset = GradientHelper.CalculateLinearGradientOffset(StartPoint, EndPoint, point); return Gradient.GetColor(offset); diff --git a/RGB.NET.Presets/Textures/RadialGradientTexture.cs b/RGB.NET.Presets/Textures/RadialGradientTexture.cs index 3f96ded..3f299fc 100644 --- a/RGB.NET.Presets/Textures/RadialGradientTexture.cs +++ b/RGB.NET.Presets/Textures/RadialGradientTexture.cs @@ -69,7 +69,7 @@ public sealed class RadialGradientTexture : AbstractGradientTexture } /// - protected override Color GetColor(in Point point) + protected override Color GetColor(Point point) { float distance = GradientHelper.CalculateDistance(point, Center); float offset = distance / _referenceDistance; diff --git a/RGB.NET.Presets/Textures/Sampler/AverageByteSampler.cs b/RGB.NET.Presets/Textures/Sampler/AverageByteSampler.cs index f9002c9..a45fe64 100644 --- a/RGB.NET.Presets/Textures/Sampler/AverageByteSampler.cs +++ b/RGB.NET.Presets/Textures/Sampler/AverageByteSampler.cs @@ -18,7 +18,7 @@ public sealed class AverageByteSampler : ISampler #region Methods /// - public unsafe void Sample(in SamplerInfo info, Span pixelData) + public unsafe void Sample(SamplerInfo info, Span pixelData) { int count = info.Width * info.Height; if (count == 0) return; diff --git a/RGB.NET.Presets/Textures/Sampler/AverageFloatSampler.cs b/RGB.NET.Presets/Textures/Sampler/AverageFloatSampler.cs index 9cdc37b..dd1d0a4 100644 --- a/RGB.NET.Presets/Textures/Sampler/AverageFloatSampler.cs +++ b/RGB.NET.Presets/Textures/Sampler/AverageFloatSampler.cs @@ -12,7 +12,7 @@ public sealed class AverageFloatSampler : ISampler #region Methods /// - public unsafe void Sample(in SamplerInfo info, Span pixelData) + public unsafe void Sample(SamplerInfo info, Span pixelData) { int count = info.Width * info.Height; if (count == 0) return; From 3e53b51bac0000ddde24579863615fad6ec2ffa2 Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Sun, 21 Jul 2024 23:44:59 +0200 Subject: [PATCH 13/38] Removed support for old .NETs --- RGB.NET.Core/RGB.NET.Core.csproj | 2 +- RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj | 2 +- .../RGB.NET.Devices.CoolerMaster.csproj | 2 +- RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj | 2 +- .../RGB.NET.Devices.Corsair_Legacy.csproj | 2 +- RGB.NET.Devices.DMX/RGB.NET.Devices.DMX.csproj | 2 +- RGB.NET.Devices.Debug/RGB.NET.Devices.Debug.csproj | 2 +- RGB.NET.Devices.Logitech/RGB.NET.Devices.Logitech.csproj | 2 +- RGB.NET.Devices.Msi/RGB.NET.Devices.Msi.csproj | 2 +- RGB.NET.Devices.Novation/RGB.NET.Devices.Novation.csproj | 2 +- RGB.NET.Devices.OpenRGB/RGB.NET.Devices.OpenRGB.csproj | 2 +- RGB.NET.Devices.PicoPi/RGB.NET.Devices.PicoPi.csproj | 2 +- RGB.NET.Devices.Razer/RGB.NET.Devices.Razer.csproj | 2 +- RGB.NET.Devices.SteelSeries/RGB.NET.Devices.SteelSeries.csproj | 2 +- RGB.NET.Devices.WLED/RGB.NET.Devices.WLED.csproj | 2 +- RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj | 2 +- RGB.NET.Devices.Wooting/RGB.NET.Devices.Wooting.csproj | 2 +- RGB.NET.HID/RGB.NET.HID.csproj | 2 +- RGB.NET.Layout/RGB.NET.Layout.csproj | 2 +- RGB.NET.Presets/RGB.NET.Presets.csproj | 2 +- 20 files changed, 20 insertions(+), 20 deletions(-) diff --git a/RGB.NET.Core/RGB.NET.Core.csproj b/RGB.NET.Core/RGB.NET.Core.csproj index 1022bf0..415101b 100644 --- a/RGB.NET.Core/RGB.NET.Core.csproj +++ b/RGB.NET.Core/RGB.NET.Core.csproj @@ -1,6 +1,6 @@  - net8.0;net7.0;net6.0 + net8.0 latest enable diff --git a/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj b/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj index ecf4ea7..c108b7c 100644 --- a/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj +++ b/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj @@ -1,6 +1,6 @@  - net8.0;net7.0;net6.0 + net8.0 latest enable diff --git a/RGB.NET.Devices.CoolerMaster/RGB.NET.Devices.CoolerMaster.csproj b/RGB.NET.Devices.CoolerMaster/RGB.NET.Devices.CoolerMaster.csproj index 73017c6..2e0c5ff 100644 --- a/RGB.NET.Devices.CoolerMaster/RGB.NET.Devices.CoolerMaster.csproj +++ b/RGB.NET.Devices.CoolerMaster/RGB.NET.Devices.CoolerMaster.csproj @@ -1,6 +1,6 @@  - net8.0;net7.0;net6.0 + net8.0 latest enable diff --git a/RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj b/RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj index ee6cfca..5426319 100644 --- a/RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj +++ b/RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj @@ -1,6 +1,6 @@  - net8.0;net7.0;net6.0 + net8.0 latest enable diff --git a/RGB.NET.Devices.Corsair_Legacy/RGB.NET.Devices.Corsair_Legacy.csproj b/RGB.NET.Devices.Corsair_Legacy/RGB.NET.Devices.Corsair_Legacy.csproj index c80995d..148ac07 100644 --- a/RGB.NET.Devices.Corsair_Legacy/RGB.NET.Devices.Corsair_Legacy.csproj +++ b/RGB.NET.Devices.Corsair_Legacy/RGB.NET.Devices.Corsair_Legacy.csproj @@ -1,6 +1,6 @@  - net8.0;net7.0;net6.0 + net8.0 latest enable diff --git a/RGB.NET.Devices.DMX/RGB.NET.Devices.DMX.csproj b/RGB.NET.Devices.DMX/RGB.NET.Devices.DMX.csproj index df8e547..28b54c1 100644 --- a/RGB.NET.Devices.DMX/RGB.NET.Devices.DMX.csproj +++ b/RGB.NET.Devices.DMX/RGB.NET.Devices.DMX.csproj @@ -1,6 +1,6 @@  - net8.0;net7.0;net6.0 + net8.0 latest enable diff --git a/RGB.NET.Devices.Debug/RGB.NET.Devices.Debug.csproj b/RGB.NET.Devices.Debug/RGB.NET.Devices.Debug.csproj index 1f17728..3bee8a9 100644 --- a/RGB.NET.Devices.Debug/RGB.NET.Devices.Debug.csproj +++ b/RGB.NET.Devices.Debug/RGB.NET.Devices.Debug.csproj @@ -1,6 +1,6 @@  - net8.0;net7.0;net6.0 + net8.0 latest enable diff --git a/RGB.NET.Devices.Logitech/RGB.NET.Devices.Logitech.csproj b/RGB.NET.Devices.Logitech/RGB.NET.Devices.Logitech.csproj index 6ae10dd..2bd68a2 100644 --- a/RGB.NET.Devices.Logitech/RGB.NET.Devices.Logitech.csproj +++ b/RGB.NET.Devices.Logitech/RGB.NET.Devices.Logitech.csproj @@ -1,6 +1,6 @@  - net8.0;net7.0;net6.0 + net8.0 latest enable diff --git a/RGB.NET.Devices.Msi/RGB.NET.Devices.Msi.csproj b/RGB.NET.Devices.Msi/RGB.NET.Devices.Msi.csproj index 12f416f..6c3067d 100644 --- a/RGB.NET.Devices.Msi/RGB.NET.Devices.Msi.csproj +++ b/RGB.NET.Devices.Msi/RGB.NET.Devices.Msi.csproj @@ -1,6 +1,6 @@  - net8.0;net7.0;net6.0 + net8.0 latest enable diff --git a/RGB.NET.Devices.Novation/RGB.NET.Devices.Novation.csproj b/RGB.NET.Devices.Novation/RGB.NET.Devices.Novation.csproj index c249fc2..85255e4 100644 --- a/RGB.NET.Devices.Novation/RGB.NET.Devices.Novation.csproj +++ b/RGB.NET.Devices.Novation/RGB.NET.Devices.Novation.csproj @@ -1,6 +1,6 @@  - net8.0;net7.0;net6.0 + net8.0 latest enable diff --git a/RGB.NET.Devices.OpenRGB/RGB.NET.Devices.OpenRGB.csproj b/RGB.NET.Devices.OpenRGB/RGB.NET.Devices.OpenRGB.csproj index 6b32521..9662dea 100644 --- a/RGB.NET.Devices.OpenRGB/RGB.NET.Devices.OpenRGB.csproj +++ b/RGB.NET.Devices.OpenRGB/RGB.NET.Devices.OpenRGB.csproj @@ -1,6 +1,6 @@ - net8.0;net7.0;net6.0 + net8.0 latest enable diff --git a/RGB.NET.Devices.PicoPi/RGB.NET.Devices.PicoPi.csproj b/RGB.NET.Devices.PicoPi/RGB.NET.Devices.PicoPi.csproj index a2b134f..9f21613 100644 --- a/RGB.NET.Devices.PicoPi/RGB.NET.Devices.PicoPi.csproj +++ b/RGB.NET.Devices.PicoPi/RGB.NET.Devices.PicoPi.csproj @@ -1,6 +1,6 @@  - net8.0;net7.0;net6.0 + net8.0 latest enable diff --git a/RGB.NET.Devices.Razer/RGB.NET.Devices.Razer.csproj b/RGB.NET.Devices.Razer/RGB.NET.Devices.Razer.csproj index 3632399..199f17e 100644 --- a/RGB.NET.Devices.Razer/RGB.NET.Devices.Razer.csproj +++ b/RGB.NET.Devices.Razer/RGB.NET.Devices.Razer.csproj @@ -1,6 +1,6 @@  - net8.0;net7.0;net6.0 + net8.0 latest enable diff --git a/RGB.NET.Devices.SteelSeries/RGB.NET.Devices.SteelSeries.csproj b/RGB.NET.Devices.SteelSeries/RGB.NET.Devices.SteelSeries.csproj index 76525ce..6ee494a 100644 --- a/RGB.NET.Devices.SteelSeries/RGB.NET.Devices.SteelSeries.csproj +++ b/RGB.NET.Devices.SteelSeries/RGB.NET.Devices.SteelSeries.csproj @@ -1,6 +1,6 @@  - net8.0;net7.0;net6.0 + net8.0 latest enable diff --git a/RGB.NET.Devices.WLED/RGB.NET.Devices.WLED.csproj b/RGB.NET.Devices.WLED/RGB.NET.Devices.WLED.csproj index 84ceafa..fc71677 100644 --- a/RGB.NET.Devices.WLED/RGB.NET.Devices.WLED.csproj +++ b/RGB.NET.Devices.WLED/RGB.NET.Devices.WLED.csproj @@ -1,6 +1,6 @@  - net8.0;net7.0;net6.0 + net8.0 latest enable diff --git a/RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj b/RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj index 39f4d52..17930a7 100644 --- a/RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj +++ b/RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj @@ -1,6 +1,6 @@  - net8.0;net7.0;net6.0 + net8.0 latest enable diff --git a/RGB.NET.Devices.Wooting/RGB.NET.Devices.Wooting.csproj b/RGB.NET.Devices.Wooting/RGB.NET.Devices.Wooting.csproj index 37d84ab..47808ff 100644 --- a/RGB.NET.Devices.Wooting/RGB.NET.Devices.Wooting.csproj +++ b/RGB.NET.Devices.Wooting/RGB.NET.Devices.Wooting.csproj @@ -1,6 +1,6 @@  - net8.0;net7.0;net6.0 + net8.0 latest enable diff --git a/RGB.NET.HID/RGB.NET.HID.csproj b/RGB.NET.HID/RGB.NET.HID.csproj index 58b5b0f..5edef08 100644 --- a/RGB.NET.HID/RGB.NET.HID.csproj +++ b/RGB.NET.HID/RGB.NET.HID.csproj @@ -1,6 +1,6 @@ - net8.0;net7.0;net6.0 + net8.0 latest enable diff --git a/RGB.NET.Layout/RGB.NET.Layout.csproj b/RGB.NET.Layout/RGB.NET.Layout.csproj index 473f421..4b76a64 100644 --- a/RGB.NET.Layout/RGB.NET.Layout.csproj +++ b/RGB.NET.Layout/RGB.NET.Layout.csproj @@ -1,6 +1,6 @@ - net8.0;net7.0;net6.0 + net8.0 latest enable diff --git a/RGB.NET.Presets/RGB.NET.Presets.csproj b/RGB.NET.Presets/RGB.NET.Presets.csproj index c7b6129..f598320 100644 --- a/RGB.NET.Presets/RGB.NET.Presets.csproj +++ b/RGB.NET.Presets/RGB.NET.Presets.csproj @@ -1,6 +1,6 @@  - net8.0;net7.0;net6.0 + net8.0 latest enable From 4c3875e561348fede925818b79eac48a237dd84d Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Sun, 21 Jul 2024 23:45:23 +0200 Subject: [PATCH 14/38] Fixed a doc comment --- RGB.NET.Core/Devices/AbstractRGBDevice.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RGB.NET.Core/Devices/AbstractRGBDevice.cs b/RGB.NET.Core/Devices/AbstractRGBDevice.cs index f4db90e..07663f3 100644 --- a/RGB.NET.Core/Devices/AbstractRGBDevice.cs +++ b/RGB.NET.Core/Devices/AbstractRGBDevice.cs @@ -119,7 +119,7 @@ public abstract class AbstractRGBDevice : Placeable, IRGBDevice. /// if no ist specified the is used. /// - /// The enumerable of leds to convert. + /// The of led to convert. /// The enumerable of custom data and color tuples for the specified leds. [MethodImpl(MethodImplOptions.AggressiveInlining)] protected (object key, Color color) GetUpdateData(Led led) From b1cf26b1e6a327f0b4a276cd54008d49b14632fa Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Sun, 21 Jul 2024 23:46:13 +0200 Subject: [PATCH 15/38] Added support for HPPH-images in presets --- RGB.NET.Presets/Extensions/HPPHExtensions.cs | 27 +++++++ RGB.NET.Presets/RGB.NET.Presets.csproj | 4 ++ RGB.NET.Presets/Textures/ImageTexture.cs | 76 ++++++++++++++++++++ RGB.NET.sln.DotSettings | 1 + 4 files changed, 108 insertions(+) create mode 100644 RGB.NET.Presets/Extensions/HPPHExtensions.cs create mode 100644 RGB.NET.Presets/Textures/ImageTexture.cs diff --git a/RGB.NET.Presets/Extensions/HPPHExtensions.cs b/RGB.NET.Presets/Extensions/HPPHExtensions.cs new file mode 100644 index 0000000..363b9bc --- /dev/null +++ b/RGB.NET.Presets/Extensions/HPPHExtensions.cs @@ -0,0 +1,27 @@ +using HPPH; +using RGB.NET.Core; + +namespace RGB.NET.Presets.Extensions; + +/// +/// Offers some extensions related to HPPH. +/// +public static class HPPHExtensions +{ + /// + /// Converts the given HPPH to a RGB.NET . + /// + /// The color to convert. + /// The converted color. + public static Color ToColor(this IColor color) => new(color.A, color.R, color.G, color.B); + + /// + /// Converts the given HPPH to a RGB.NET . + /// + /// The color to convert. + /// The color-type of the HPPH color. + /// The converted color. + public static Color ToColor(this T color) + where T : struct, IColor + => new(color.A, color.R, color.G, color.B); +} \ No newline at end of file diff --git a/RGB.NET.Presets/RGB.NET.Presets.csproj b/RGB.NET.Presets/RGB.NET.Presets.csproj index f598320..d495956 100644 --- a/RGB.NET.Presets/RGB.NET.Presets.csproj +++ b/RGB.NET.Presets/RGB.NET.Presets.csproj @@ -57,6 +57,10 @@ + + + + diff --git a/RGB.NET.Presets/Textures/ImageTexture.cs b/RGB.NET.Presets/Textures/ImageTexture.cs new file mode 100644 index 0000000..fc05b74 --- /dev/null +++ b/RGB.NET.Presets/Textures/ImageTexture.cs @@ -0,0 +1,76 @@ +using System; +using HPPH; +using RGB.NET.Core; +using RGB.NET.Presets.Extensions; + +namespace RGB.NET.Presets.Textures; + +/// +/// +/// Represents a texture drawing an . +/// +public sealed class ImageTexture : ITexture +{ + #region Properties & Fields + + private readonly IImage _image; + + /// + public Size Size { get; } + + /// + public Color this[Point point] + { + get + { + int x = (int)MathF.Round((Size.Width - 1) * point.X.Clamp(0, 1)); + int y = (int)MathF.Round((Size.Height - 1) * point.Y.Clamp(0, 1)); + + return _image[x, y].ToColor(); + } + } + + /// + public Color this[Rectangle rectangle] + { + get + { + int x = (int)MathF.Round((Size.Width - 1) * rectangle.Location.X.Clamp(0, 1)); + int y = (int)MathF.Round((Size.Height - 1) * rectangle.Location.Y.Clamp(0, 1)); + int width = (int)MathF.Round(Size.Width * rectangle.Size.Width.Clamp(0, 1)); + int height = (int)MathF.Round(Size.Height * rectangle.Size.Height.Clamp(0, 1)); + + if ((width == 0) && (rectangle.Size.Width > 0)) width = 1; + if ((height == 0) && (rectangle.Size.Height > 0)) height = 1; + + return this[x, y, width, height]; + } + } + + /// + /// Gets the sampled color inside the specified region. + /// + /// The x-location of the region. + /// The y-location of the region. + /// The with of the region. + /// The height of the region. + /// The sampled color. + public Color this[int x, int y, int width, int height] => _image[x, y, width, height].Average().ToColor(); + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + /// The image represented by the texture. + public ImageTexture(IImage image) + { + this._image = image; + + Size = new Size(image.Width, image.Height); + } + + #endregion +} \ No newline at end of file diff --git a/RGB.NET.sln.DotSettings b/RGB.NET.sln.DotSettings index f0e61dd..a13f331 100644 --- a/RGB.NET.sln.DotSettings +++ b/RGB.NET.sln.DotSettings @@ -278,6 +278,7 @@ GEZ GSDK HID + HPPH HS HSV IBAN From cfbbdc60691b536523989877dedcf8b9e1054b67 Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Sun, 21 Jul 2024 23:52:06 +0200 Subject: [PATCH 16/38] Changed ImageTexture Image to be public --- RGB.NET.Presets/Textures/ImageTexture.cs | 25 +++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/RGB.NET.Presets/Textures/ImageTexture.cs b/RGB.NET.Presets/Textures/ImageTexture.cs index fc05b74..e63793a 100644 --- a/RGB.NET.Presets/Textures/ImageTexture.cs +++ b/RGB.NET.Presets/Textures/ImageTexture.cs @@ -7,13 +7,26 @@ namespace RGB.NET.Presets.Textures; /// /// -/// Represents a texture drawing an . +/// Represents a texture drawing an . /// public sealed class ImageTexture : ITexture { #region Properties & Fields - private readonly IImage _image; + private IImage _image; + + /// + /// The image drawn by this texture. + /// + public IImage Image + { + get => _image; + set + { + ArgumentNullException.ThrowIfNull(value); + _image = value; + } + } /// public Size Size { get; } @@ -26,7 +39,7 @@ public sealed class ImageTexture : ITexture int x = (int)MathF.Round((Size.Width - 1) * point.X.Clamp(0, 1)); int y = (int)MathF.Round((Size.Height - 1) * point.Y.Clamp(0, 1)); - return _image[x, y].ToColor(); + return Image[x, y].ToColor(); } } @@ -55,7 +68,7 @@ public sealed class ImageTexture : ITexture /// The with of the region. /// The height of the region. /// The sampled color. - public Color this[int x, int y, int width, int height] => _image[x, y, width, height].Average().ToColor(); + public Color this[int x, int y, int width, int height] => Image[x, y, width, height].Average().ToColor(); #endregion @@ -65,9 +78,11 @@ public sealed class ImageTexture : ITexture /// Initializes a new instance of the class. ///
/// The image represented by the texture. +#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. public ImageTexture(IImage image) +#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. { - this._image = image; + this.Image = image; Size = new Size(image.Width, image.Height); } From 1396e978db8299883d2d54779d54f94da13a3b9e Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Mon, 22 Jul 2024 00:00:28 +0200 Subject: [PATCH 17/38] Fixed doc-comment mistake --- RGB.NET.Presets/Extensions/HPPHExtensions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RGB.NET.Presets/Extensions/HPPHExtensions.cs b/RGB.NET.Presets/Extensions/HPPHExtensions.cs index 363b9bc..e0b37de 100644 --- a/RGB.NET.Presets/Extensions/HPPHExtensions.cs +++ b/RGB.NET.Presets/Extensions/HPPHExtensions.cs @@ -9,14 +9,14 @@ namespace RGB.NET.Presets.Extensions; public static class HPPHExtensions { /// - /// Converts the given HPPH to a RGB.NET . + /// Converts the given HPPH to a RGB.NET . /// /// The color to convert. /// The converted color. public static Color ToColor(this IColor color) => new(color.A, color.R, color.G, color.B); /// - /// Converts the given HPPH to a RGB.NET . + /// Converts the given HPPH to a RGB.NET . /// /// The color to convert. /// The color-type of the HPPH color. From 9a997694a56477754d740ca3b5bf03d1f96986e7 Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Mon, 22 Jul 2024 00:01:50 +0200 Subject: [PATCH 18/38] Updated build-files --- .github/workflows/ci.yml | 14 -------------- .github/workflows/pr_verify.yml | 2 -- .github/workflows/release.yml | 14 -------------- 3 files changed, 30 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5dd87e2..61ca30f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,26 +25,12 @@ jobs: with: dotnet-version: | 8.0.x - 7.0.x - 6.0.x - name: Restore dependencies run: dotnet restore - name: Build run: dotnet build --no-restore --configuration Release /p:Version=${{ github.event.inputs.version }}-prerelease.${{ github.event.inputs.increment }} - name: Test run: dotnet test --no-build --verbosity normal --configuration Release - - name: Upload a Build Artifact NET6 - uses: actions/upload-artifact@v4.3.1 - with: - name: RGB.NET-NET6 - path: bin/net6.0/RGB.NET.*.dll - if-no-files-found: error - - name: Upload a Build Artifact NET7 - uses: actions/upload-artifact@v4.3.1 - with: - name: RGB.NET-NET7 - path: bin/net7.0/RGB.NET.*.dll - if-no-files-found: error - name: Upload a Build Artifact NET8 uses: actions/upload-artifact@v4.3.1 with: diff --git a/.github/workflows/pr_verify.yml b/.github/workflows/pr_verify.yml index 539b728..59a1544 100644 --- a/.github/workflows/pr_verify.yml +++ b/.github/workflows/pr_verify.yml @@ -16,8 +16,6 @@ jobs: with: dotnet-version: | 8.0.x - 7.0.x - 6.0.x - name: Restore dependencies run: dotnet restore - name: Build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2504782..f8bae37 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,26 +21,12 @@ jobs: with: dotnet-version: | 8.0.x - 7.0.x - 6.0.x - name: Restore dependencies run: dotnet restore - name: Build run: dotnet build --no-restore --configuration Release /p:Version=${{ github.event.inputs.version }} - name: Test run: dotnet test --no-build --verbosity normal --configuration Release - - name: Upload a Build Artifact NET6 - uses: actions/upload-artifact@v4.3.1 - with: - name: RGB.NET-NET6 - path: bin/net6.0/RGB.NET.*.dll - if-no-files-found: error - - name: Upload a Build Artifact NET7 - uses: actions/upload-artifact@v4.3.1 - with: - name: RGB.NET-NET7 - path: bin/net7.0/RGB.NET.*.dll - if-no-files-found: error - name: Upload a Build Artifact NET8 uses: actions/upload-artifact@v4.3.1 with: From 54b4eac1f3516e750997d8496e10a9fb332d1566 Mon Sep 17 00:00:00 2001 From: Diogo Trindade Date: Sun, 28 Jul 2024 17:17:08 +0100 Subject: [PATCH 19/38] Update OpenRGB.NET --- RGB.NET.Devices.OpenRGB/RGB.NET.Devices.OpenRGB.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RGB.NET.Devices.OpenRGB/RGB.NET.Devices.OpenRGB.csproj b/RGB.NET.Devices.OpenRGB/RGB.NET.Devices.OpenRGB.csproj index 9662dea..0ad0819 100644 --- a/RGB.NET.Devices.OpenRGB/RGB.NET.Devices.OpenRGB.csproj +++ b/RGB.NET.Devices.OpenRGB/RGB.NET.Devices.OpenRGB.csproj @@ -57,7 +57,7 @@ - + From 466d13608919b1880dd29faf5c8e55e1d942239f Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Fri, 20 Sep 2024 09:29:03 +0200 Subject: [PATCH 20/38] Added pid for Razer Firefly v2 Pro --- RGB.NET.Devices.Razer/RazerDeviceProvider.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/RGB.NET.Devices.Razer/RazerDeviceProvider.cs b/RGB.NET.Devices.Razer/RazerDeviceProvider.cs index 1ab31c8..e316827 100644 --- a/RGB.NET.Devices.Razer/RazerDeviceProvider.cs +++ b/RGB.NET.Devices.Razer/RazerDeviceProvider.cs @@ -240,6 +240,7 @@ public sealed class RazerDeviceProvider : AbstractRGBDeviceProvider { 0x0C01, RGBDeviceType.Mousepad, "Goliathus", LedMappings.Mousepad, RazerEndpointType.ChromaLink }, { 0x0C02, RGBDeviceType.Mousepad, "Goliathus Extended", LedMappings.Mousepad, RazerEndpointType.ChromaLink }, { 0x0C04, RGBDeviceType.Mousepad, "Firefly v2", LedMappings.Mousepad, RazerEndpointType.Mousepad }, + { 0x0C08, RGBDeviceType.Mousepad, "Firefly v2 Pro", LedMappings.Mousepad, RazerEndpointType.Mousepad }, // Headsets { 0x0501, RGBDeviceType.Headset, "Kraken 7.1", LedMappings.Headset, RazerEndpointType.Headset }, From c34435b9582f12aec950d75e984ecd63f8792fc9 Mon Sep 17 00:00:00 2001 From: Shaun Tonstad Date: Sat, 12 Oct 2024 13:01:53 -0500 Subject: [PATCH 21/38] Remove CustomUpdateData heap allocation in OnUpdate hot path. Added CustomUpdateData.Empty property. Remove CustomUpdateData heap allocation in OnUpdate hot path. Added CustomUpdateData.Empty property. --- RGB.NET.Core/Update/AbstractUpdateTrigger.cs | 4 ++-- RGB.NET.Core/Update/CustomUpdateData.cs | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/RGB.NET.Core/Update/AbstractUpdateTrigger.cs b/RGB.NET.Core/Update/AbstractUpdateTrigger.cs index 974e0b0..22dcca7 100644 --- a/RGB.NET.Core/Update/AbstractUpdateTrigger.cs +++ b/RGB.NET.Core/Update/AbstractUpdateTrigger.cs @@ -29,13 +29,13 @@ public abstract class AbstractUpdateTrigger : AbstractBindable, IUpdateTrigger /// Invokes the -event. ///
/// Optional custom-data passed to the subscribers of the .event. - protected virtual void OnStartup(CustomUpdateData? updateData = null) => Starting?.Invoke(this, updateData ?? new CustomUpdateData()); + protected virtual void OnStartup(CustomUpdateData? updateData = null) => Starting?.Invoke(this, updateData ?? CustomUpdateData.Empty); /// /// Invokes the -event. /// /// Optional custom-data passed to the subscribers of the .event. - protected virtual void OnUpdate(CustomUpdateData? updateData = null) => Update?.Invoke(this, updateData ?? new CustomUpdateData()); + protected virtual void OnUpdate(CustomUpdateData? updateData = null) => Update?.Invoke(this, updateData ?? CustomUpdateData.Empty); /// public abstract void Start(); diff --git a/RGB.NET.Core/Update/CustomUpdateData.cs b/RGB.NET.Core/Update/CustomUpdateData.cs index 736723a..27b1f52 100644 --- a/RGB.NET.Core/Update/CustomUpdateData.cs +++ b/RGB.NET.Core/Update/CustomUpdateData.cs @@ -51,6 +51,7 @@ public interface ICustomUpdateData public sealed class CustomUpdateData : ICustomUpdateData { #region Properties & Fields + public static readonly CustomUpdateData Empty = new CustomUpdateData(); private readonly Dictionary _data = []; From 7cfe08921e4094468ce0978ca7bfddd243793561 Mon Sep 17 00:00:00 2001 From: Diogo Trindade Date: Thu, 17 Oct 2024 12:05:54 +0100 Subject: [PATCH 22/38] Fixed incorrect 80he international keys --- RGB.NET.Devices.Wooting/Generic/WootingLedMappings.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RGB.NET.Devices.Wooting/Generic/WootingLedMappings.cs b/RGB.NET.Devices.Wooting/Generic/WootingLedMappings.cs index 3ad37e1..1ed0790 100644 --- a/RGB.NET.Devices.Wooting/Generic/WootingLedMappings.cs +++ b/RGB.NET.Devices.Wooting/Generic/WootingLedMappings.cs @@ -199,9 +199,9 @@ internal static class WootingLedMappings { LedId.Keyboard_LeftCtrl, (5, 0) }, { LedId.Keyboard_LeftGui, (5, 1) }, { LedId.Keyboard_LeftAlt, (5, 2) }, - { LedId.Keyboard_International3, (4, 3) },//JIS key + { LedId.Keyboard_International3, (5, 3) },//JIS key { LedId.Keyboard_Space, (5, 6) }, - { LedId.Keyboard_International4, (4, 9) },//JIS key + { LedId.Keyboard_International4, (5, 9) },//JIS key { LedId.Keyboard_RightAlt, (5, 10) }, { LedId.Keyboard_RightGui, (5, 11) }, { LedId.Keyboard_Function, (5, 12) }, From f2491038a3b2acbf05a831985521ac5440d5b2d9 Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Sun, 20 Oct 2024 11:06:40 +0200 Subject: [PATCH 23/38] Fixed crash in logitech device provider, when multiple lightspeed devices with the same usage are connected --- RGB.NET.Devices.Logitech/HID/LightspeedHidLoader.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/RGB.NET.Devices.Logitech/HID/LightspeedHidLoader.cs b/RGB.NET.Devices.Logitech/HID/LightspeedHidLoader.cs index de49881..4d0aeac 100644 --- a/RGB.NET.Devices.Logitech/HID/LightspeedHidLoader.cs +++ b/RGB.NET.Devices.Logitech/HID/LightspeedHidLoader.cs @@ -104,7 +104,9 @@ public sealed class LightspeedHIDLoader : IEnumerable deviceUsages = DeviceList.Local .GetHidDevices(VendorId, pid) .Where(d => d.DevicePath.Contains("mi_02")) - .ToDictionary(x => (byte)x.GetUsage(), x => x); + .Select(x => ((byte)x.GetUsage(), x)) + .DistinctBy(x => x.Item1) + .ToDictionary(x => x.Item1, x => x.x); foreach ((int wirelessPid, byte _) in GetWirelessDevices(deviceUsages)) yield return wirelessPid; From 54c09a1d6fb19183e7c65e5ea3744784f36a703e Mon Sep 17 00:00:00 2001 From: DarthAffe Date: Sun, 20 Oct 2024 11:23:23 +0200 Subject: [PATCH 24/38] Fixed default name for Asus Keyboards --- RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs b/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs index 608405f..8516bec 100644 --- a/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs @@ -36,7 +36,7 @@ public sealed class AsusKeyboardRGBDeviceInfo : AsusRGBDeviceInfo, IKeyboardDevi #region Methods - private static string? GetKeyboardModel(string deviceName) => GENERIC_DEVICE_NAMES.Contains(deviceName) ? "Asus Motherboard" : deviceName; + private static string? GetKeyboardModel(string deviceName) => GENERIC_DEVICE_NAMES.Contains(deviceName) ? "Asus Keyboard" : deviceName; #endregion } \ No newline at end of file From da51871e0494073efc97db348f4633d045f7e800 Mon Sep 17 00:00:00 2001 From: Shaun Tonstad Date: Tue, 29 Oct 2024 20:19:29 -0500 Subject: [PATCH 25/38] Update RGB.NET.Core/Update/CustomUpdateData.cs Co-authored-by: DarthAffe --- RGB.NET.Core/Update/CustomUpdateData.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/RGB.NET.Core/Update/CustomUpdateData.cs b/RGB.NET.Core/Update/CustomUpdateData.cs index 27b1f52..0d85aa7 100644 --- a/RGB.NET.Core/Update/CustomUpdateData.cs +++ b/RGB.NET.Core/Update/CustomUpdateData.cs @@ -51,7 +51,9 @@ public interface ICustomUpdateData public sealed class CustomUpdateData : ICustomUpdateData { #region Properties & Fields - public static readonly CustomUpdateData Empty = new CustomUpdateData(); + + // ReSharper disable once InconsistentNaming + public static readonly CustomUpdateData Empty = new(); private readonly Dictionary _data = []; From aa7bfd39768057ef65fb5afb96be79b1e10f8df6 Mon Sep 17 00:00:00 2001 From: "Nick S." <33859387+Nick026@users.noreply.github.com> Date: Fri, 29 Nov 2024 15:56:33 +0100 Subject: [PATCH 26/38] Added Razer Chroma Wireless ARGB Controller support --- RGB.NET.Devices.Razer/RazerDeviceProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RGB.NET.Devices.Razer/RazerDeviceProvider.cs b/RGB.NET.Devices.Razer/RazerDeviceProvider.cs index e316827..295fd1f 100644 --- a/RGB.NET.Devices.Razer/RazerDeviceProvider.cs +++ b/RGB.NET.Devices.Razer/RazerDeviceProvider.cs @@ -276,7 +276,7 @@ public sealed class RazerDeviceProvider : AbstractRGBDeviceProvider { 0x0F13, RGBDeviceType.Unknown, "Lian Li O11", LedMappings.ChromaLink, RazerEndpointType.ChromaLink }, { 0x0F1D, RGBDeviceType.Unknown, "Mouse Bungee V3 Chroma", LedMappings.ChromaLink, RazerEndpointType.ChromaLink }, { 0x0F1F, RGBDeviceType.LedController, "Addressable RGB Controller", LedMappings.ChromaLink, RazerEndpointType.ChromaLink }, - + { 0x0F2C, RGBDeviceType.LedController, "Chroma Wireless ARGB Controller", LedMappings.ChromaLink, RazerEndpointType.ChromaLink }, }; #endregion From f8a530e313668377dd558d4ea241c7b5b1a41714 Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Sun, 1 Dec 2024 21:02:35 +0100 Subject: [PATCH 27/38] Fixed mapping for StellSeries Apex 3 --- .../Generic/LedMappings.cs | 19 ++++++++++++++++++- .../SteelSeriesDeviceProvider.cs | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/RGB.NET.Devices.SteelSeries/Generic/LedMappings.cs b/RGB.NET.Devices.SteelSeries/Generic/LedMappings.cs index 59310bd..18d7173 100644 --- a/RGB.NET.Devices.SteelSeries/Generic/LedMappings.cs +++ b/RGB.NET.Devices.SteelSeries/Generic/LedMappings.cs @@ -480,7 +480,7 @@ public static class LedMappings { LedId.Mouse9, SteelSeriesLedId.ZoneNine }, { LedId.Mouse10, SteelSeriesLedId.ZoneTen } }; - + /// /// Gets the mapping for two-zone headsets. /// @@ -627,4 +627,21 @@ public static class LedMappings { LedId.LedStripe102, SteelSeriesLedId.ZoneOneHundredTwo }, { LedId.LedStripe103, SteelSeriesLedId.ZoneOneHundredThree } }; + + /// + /// Gets the mapping for 10-zone kayboard. + /// + public static LedMapping KeyboardTenZone { get; } = new() + { + { LedId.Keyboard_Custom1, SteelSeriesLedId.ZoneOne }, + { LedId.Keyboard_Custom2, SteelSeriesLedId.ZoneTwo }, + { LedId.Keyboard_Custom3, SteelSeriesLedId.ZoneThree }, + { LedId.Keyboard_Custom4, SteelSeriesLedId.ZoneFour }, + { LedId.Keyboard_Custom5, SteelSeriesLedId.ZoneFive }, + { LedId.Keyboard_Custom6, SteelSeriesLedId.ZoneSix }, + { LedId.Keyboard_Custom7, SteelSeriesLedId.ZoneSeven }, + { LedId.Keyboard_Custom8, SteelSeriesLedId.ZoneEight }, + { LedId.Keyboard_Custom9, SteelSeriesLedId.ZoneNine }, + { LedId.Keyboard_Custom10, SteelSeriesLedId.ZoneTen } + }; } \ No newline at end of file diff --git a/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs b/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs index 60b797c..7e7c92a 100644 --- a/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs +++ b/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs @@ -69,7 +69,7 @@ public sealed class SteelSeriesDeviceProvider : AbstractRGBDeviceProvider { 0x1852, RGBDeviceType.Mouse, "Aerox 5 Wireless", LedMappings.MouseThreeZone, SteelSeriesDeviceType.ThreeZone }, //Keyboards - { 0x161A, RGBDeviceType.Keyboard, "Apex 3", LedMappings.KeyboardMappingUk, SteelSeriesDeviceType.TenZone }, + { 0x161A, RGBDeviceType.Keyboard, "Apex 3", LedMappings.KeyboardTenZone, SteelSeriesDeviceType.TenZone }, { 0x161C, RGBDeviceType.Keyboard, "Apex 5", LedMappings.KeyboardMappingUk, SteelSeriesDeviceType.PerKey }, { 0x1612, RGBDeviceType.Keyboard, "Apex 7", LedMappings.KeyboardMappingUk, SteelSeriesDeviceType.PerKey }, { 0x1618, RGBDeviceType.Keyboard, "Apex 7 TKL", LedMappings.KeyboardTklMappingUk, SteelSeriesDeviceType.PerKey }, From a2a25bc40af0d73f508d73fb9bb06b0c31cf2bbc Mon Sep 17 00:00:00 2001 From: harrisck Date: Sun, 29 Dec 2024 20:46:57 +0000 Subject: [PATCH 28/38] Update SteelSeriesDeviceProvider.cs for Apex Pro TKL Wireless Gen3 Added Device ID for Apex Pro TKL Wireless Gen3 --- RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs b/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs index 4f5a399..011b4ed 100644 --- a/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs +++ b/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs @@ -76,6 +76,7 @@ public sealed class SteelSeriesDeviceProvider : AbstractRGBDeviceProvider { 0x1600, RGBDeviceType.Keyboard, "Apex M800", LedMappings.KeyboardMappingUk, SteelSeriesDeviceType.PerKey }, { 0x1610, RGBDeviceType.Keyboard, "Apex Pro", LedMappings.KeyboardMappingUk, SteelSeriesDeviceType.PerKey }, { 0x1614, RGBDeviceType.Keyboard, "Apex Pro TKL", LedMappings.KeyboardTklMappingUk, SteelSeriesDeviceType.PerKey }, + { 0x1644, RGBDeviceType.Keyboard, "Apex Pro TKL Wireless Gen3", LedMappings.KeyboardTklMappingUk, SteelSeriesDeviceType.PerKey }, { 0x2036, RGBDeviceType.Keyboard, "MSI Notebook", LedMappings.KeyboardNotebookMappingUk, SteelSeriesDeviceType.PerKey }, { 0x113A, RGBDeviceType.Keyboard, "MSI GE78HX", LedMappings.KeyboardMSIGE78Mapping, SteelSeriesDeviceType.PerKey }, { 0x1122, RGBDeviceType.Keyboard, "MSI Notebook", LedMappings.KeyboardNotebookMappingUk, SteelSeriesDeviceType.PerKey }, @@ -162,4 +163,4 @@ public sealed class SteelSeriesDeviceProvider : AbstractRGBDeviceProvider } #endregion -} \ No newline at end of file +} From 1d47894dac8993640d52c9197cb3275202f0bd52 Mon Sep 17 00:00:00 2001 From: DarthAffe Date: Fri, 3 Jan 2025 15:45:07 +0100 Subject: [PATCH 29/38] Added .net9 build target --- RGB.NET.Core/RGB.NET.Core.csproj | 2 +- RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj | 2 +- .../RGB.NET.Devices.CoolerMaster.csproj | 2 +- RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj | 2 +- .../RGB.NET.Devices.Corsair_Legacy.csproj | 2 +- RGB.NET.Devices.DMX/RGB.NET.Devices.DMX.csproj | 2 +- RGB.NET.Devices.Debug/RGB.NET.Devices.Debug.csproj | 2 +- RGB.NET.Devices.Logitech/RGB.NET.Devices.Logitech.csproj | 2 +- RGB.NET.Devices.Msi/RGB.NET.Devices.Msi.csproj | 2 +- RGB.NET.Devices.Novation/RGB.NET.Devices.Novation.csproj | 2 +- RGB.NET.Devices.OpenRGB/RGB.NET.Devices.OpenRGB.csproj | 2 +- RGB.NET.Devices.PicoPi/RGB.NET.Devices.PicoPi.csproj | 2 +- RGB.NET.Devices.Razer/RGB.NET.Devices.Razer.csproj | 2 +- RGB.NET.Devices.SteelSeries/RGB.NET.Devices.SteelSeries.csproj | 2 +- RGB.NET.Devices.WLED/RGB.NET.Devices.WLED.csproj | 2 +- RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj | 2 +- RGB.NET.Devices.Wooting/RGB.NET.Devices.Wooting.csproj | 2 +- RGB.NET.HID/RGB.NET.HID.csproj | 2 +- RGB.NET.Layout/RGB.NET.Layout.csproj | 2 +- RGB.NET.Presets/RGB.NET.Presets.csproj | 2 +- Tests/RGB.NET.Core.Tests/RGB.NET.Core.Tests.csproj | 2 +- Tests/RGB.NET.Presets.Tests/RGB.NET.Presets.Tests.csproj | 2 +- 22 files changed, 22 insertions(+), 22 deletions(-) diff --git a/RGB.NET.Core/RGB.NET.Core.csproj b/RGB.NET.Core/RGB.NET.Core.csproj index 415101b..7a4e2c4 100644 --- a/RGB.NET.Core/RGB.NET.Core.csproj +++ b/RGB.NET.Core/RGB.NET.Core.csproj @@ -1,6 +1,6 @@  - net8.0 + net9.0;net8.0 latest enable diff --git a/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj b/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj index 113d7b8..08d6fd3 100644 --- a/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj +++ b/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj @@ -1,6 +1,6 @@  - net8.0 + net9.0;net8.0 latest enable diff --git a/RGB.NET.Devices.CoolerMaster/RGB.NET.Devices.CoolerMaster.csproj b/RGB.NET.Devices.CoolerMaster/RGB.NET.Devices.CoolerMaster.csproj index 2e0c5ff..88a58d0 100644 --- a/RGB.NET.Devices.CoolerMaster/RGB.NET.Devices.CoolerMaster.csproj +++ b/RGB.NET.Devices.CoolerMaster/RGB.NET.Devices.CoolerMaster.csproj @@ -1,6 +1,6 @@  - net8.0 + net9.0;net8.0 latest enable diff --git a/RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj b/RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj index 5426319..51228f4 100644 --- a/RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj +++ b/RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj @@ -1,6 +1,6 @@  - net8.0 + net9.0;net8.0 latest enable diff --git a/RGB.NET.Devices.Corsair_Legacy/RGB.NET.Devices.Corsair_Legacy.csproj b/RGB.NET.Devices.Corsair_Legacy/RGB.NET.Devices.Corsair_Legacy.csproj index 148ac07..7604e5b 100644 --- a/RGB.NET.Devices.Corsair_Legacy/RGB.NET.Devices.Corsair_Legacy.csproj +++ b/RGB.NET.Devices.Corsair_Legacy/RGB.NET.Devices.Corsair_Legacy.csproj @@ -1,6 +1,6 @@  - net8.0 + net9.0;net8.0 latest enable diff --git a/RGB.NET.Devices.DMX/RGB.NET.Devices.DMX.csproj b/RGB.NET.Devices.DMX/RGB.NET.Devices.DMX.csproj index 28b54c1..7056936 100644 --- a/RGB.NET.Devices.DMX/RGB.NET.Devices.DMX.csproj +++ b/RGB.NET.Devices.DMX/RGB.NET.Devices.DMX.csproj @@ -1,6 +1,6 @@  - net8.0 + net9.0;net8.0 latest enable diff --git a/RGB.NET.Devices.Debug/RGB.NET.Devices.Debug.csproj b/RGB.NET.Devices.Debug/RGB.NET.Devices.Debug.csproj index 3bee8a9..fa11d56 100644 --- a/RGB.NET.Devices.Debug/RGB.NET.Devices.Debug.csproj +++ b/RGB.NET.Devices.Debug/RGB.NET.Devices.Debug.csproj @@ -1,6 +1,6 @@  - net8.0 + net9.0;net8.0 latest enable diff --git a/RGB.NET.Devices.Logitech/RGB.NET.Devices.Logitech.csproj b/RGB.NET.Devices.Logitech/RGB.NET.Devices.Logitech.csproj index 2bd68a2..2659fed 100644 --- a/RGB.NET.Devices.Logitech/RGB.NET.Devices.Logitech.csproj +++ b/RGB.NET.Devices.Logitech/RGB.NET.Devices.Logitech.csproj @@ -1,6 +1,6 @@  - net8.0 + net9.0;net8.0 latest enable diff --git a/RGB.NET.Devices.Msi/RGB.NET.Devices.Msi.csproj b/RGB.NET.Devices.Msi/RGB.NET.Devices.Msi.csproj index 6c3067d..a0b1d32 100644 --- a/RGB.NET.Devices.Msi/RGB.NET.Devices.Msi.csproj +++ b/RGB.NET.Devices.Msi/RGB.NET.Devices.Msi.csproj @@ -1,6 +1,6 @@  - net8.0 + net9.0;net8.0 latest enable diff --git a/RGB.NET.Devices.Novation/RGB.NET.Devices.Novation.csproj b/RGB.NET.Devices.Novation/RGB.NET.Devices.Novation.csproj index 85255e4..c75ab22 100644 --- a/RGB.NET.Devices.Novation/RGB.NET.Devices.Novation.csproj +++ b/RGB.NET.Devices.Novation/RGB.NET.Devices.Novation.csproj @@ -1,6 +1,6 @@  - net8.0 + net9.0;net8.0 latest enable diff --git a/RGB.NET.Devices.OpenRGB/RGB.NET.Devices.OpenRGB.csproj b/RGB.NET.Devices.OpenRGB/RGB.NET.Devices.OpenRGB.csproj index 0ad0819..dbcb857 100644 --- a/RGB.NET.Devices.OpenRGB/RGB.NET.Devices.OpenRGB.csproj +++ b/RGB.NET.Devices.OpenRGB/RGB.NET.Devices.OpenRGB.csproj @@ -1,6 +1,6 @@ - net8.0 + net9.0;net8.0 latest enable diff --git a/RGB.NET.Devices.PicoPi/RGB.NET.Devices.PicoPi.csproj b/RGB.NET.Devices.PicoPi/RGB.NET.Devices.PicoPi.csproj index 9f21613..de287c0 100644 --- a/RGB.NET.Devices.PicoPi/RGB.NET.Devices.PicoPi.csproj +++ b/RGB.NET.Devices.PicoPi/RGB.NET.Devices.PicoPi.csproj @@ -1,6 +1,6 @@  - net8.0 + net9.0;net8.0 latest enable diff --git a/RGB.NET.Devices.Razer/RGB.NET.Devices.Razer.csproj b/RGB.NET.Devices.Razer/RGB.NET.Devices.Razer.csproj index 199f17e..84dc712 100644 --- a/RGB.NET.Devices.Razer/RGB.NET.Devices.Razer.csproj +++ b/RGB.NET.Devices.Razer/RGB.NET.Devices.Razer.csproj @@ -1,6 +1,6 @@  - net8.0 + net9.0;net8.0 latest enable diff --git a/RGB.NET.Devices.SteelSeries/RGB.NET.Devices.SteelSeries.csproj b/RGB.NET.Devices.SteelSeries/RGB.NET.Devices.SteelSeries.csproj index 6ee494a..aed6e92 100644 --- a/RGB.NET.Devices.SteelSeries/RGB.NET.Devices.SteelSeries.csproj +++ b/RGB.NET.Devices.SteelSeries/RGB.NET.Devices.SteelSeries.csproj @@ -1,6 +1,6 @@  - net8.0 + net9.0;net8.0 latest enable diff --git a/RGB.NET.Devices.WLED/RGB.NET.Devices.WLED.csproj b/RGB.NET.Devices.WLED/RGB.NET.Devices.WLED.csproj index fc71677..a7893b4 100644 --- a/RGB.NET.Devices.WLED/RGB.NET.Devices.WLED.csproj +++ b/RGB.NET.Devices.WLED/RGB.NET.Devices.WLED.csproj @@ -1,6 +1,6 @@  - net8.0 + net9.0;net8.0 latest enable diff --git a/RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj b/RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj index 17930a7..1cc4fac 100644 --- a/RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj +++ b/RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj @@ -1,6 +1,6 @@  - net8.0 + net9.0;net8.0 latest enable diff --git a/RGB.NET.Devices.Wooting/RGB.NET.Devices.Wooting.csproj b/RGB.NET.Devices.Wooting/RGB.NET.Devices.Wooting.csproj index 47808ff..5ea6bbe 100644 --- a/RGB.NET.Devices.Wooting/RGB.NET.Devices.Wooting.csproj +++ b/RGB.NET.Devices.Wooting/RGB.NET.Devices.Wooting.csproj @@ -1,6 +1,6 @@  - net8.0 + net9.0;net8.0 latest enable diff --git a/RGB.NET.HID/RGB.NET.HID.csproj b/RGB.NET.HID/RGB.NET.HID.csproj index 5edef08..3dd2ce3 100644 --- a/RGB.NET.HID/RGB.NET.HID.csproj +++ b/RGB.NET.HID/RGB.NET.HID.csproj @@ -1,6 +1,6 @@ - net8.0 + net9.0;net8.0 latest enable diff --git a/RGB.NET.Layout/RGB.NET.Layout.csproj b/RGB.NET.Layout/RGB.NET.Layout.csproj index 4b76a64..ab00d34 100644 --- a/RGB.NET.Layout/RGB.NET.Layout.csproj +++ b/RGB.NET.Layout/RGB.NET.Layout.csproj @@ -1,6 +1,6 @@ - net8.0 + net9.0;net8.0 latest enable diff --git a/RGB.NET.Presets/RGB.NET.Presets.csproj b/RGB.NET.Presets/RGB.NET.Presets.csproj index d495956..f2db2c1 100644 --- a/RGB.NET.Presets/RGB.NET.Presets.csproj +++ b/RGB.NET.Presets/RGB.NET.Presets.csproj @@ -1,6 +1,6 @@  - net8.0 + net9.0;net8.0 latest enable 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 7fb09e7..4cbe2e3 100644 --- a/Tests/RGB.NET.Core.Tests/RGB.NET.Core.Tests.csproj +++ b/Tests/RGB.NET.Core.Tests/RGB.NET.Core.Tests.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 false diff --git a/Tests/RGB.NET.Presets.Tests/RGB.NET.Presets.Tests.csproj b/Tests/RGB.NET.Presets.Tests/RGB.NET.Presets.Tests.csproj index ba91ec3..89dac17 100644 --- a/Tests/RGB.NET.Presets.Tests/RGB.NET.Presets.Tests.csproj +++ b/Tests/RGB.NET.Presets.Tests/RGB.NET.Presets.Tests.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 false From 39da0fd59c2d4b8654336c11d814738a9dd42411 Mon Sep 17 00:00:00 2001 From: DarthAffe Date: Fri, 3 Jan 2025 15:48:07 +0100 Subject: [PATCH 30/38] Updated dependencies --- RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj | 2 +- Tests/RGB.NET.Core.Tests/RGB.NET.Core.Tests.csproj | 6 +++--- Tests/RGB.NET.Presets.Tests/RGB.NET.Presets.Tests.csproj | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj b/RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj index 1cc4fac..a954a85 100644 --- a/RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj +++ b/RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj @@ -57,7 +57,7 @@ - + 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 4cbe2e3..0e33247 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 @@ - - - + + + diff --git a/Tests/RGB.NET.Presets.Tests/RGB.NET.Presets.Tests.csproj b/Tests/RGB.NET.Presets.Tests/RGB.NET.Presets.Tests.csproj index 89dac17..7ff0fb7 100644 --- a/Tests/RGB.NET.Presets.Tests/RGB.NET.Presets.Tests.csproj +++ b/Tests/RGB.NET.Presets.Tests/RGB.NET.Presets.Tests.csproj @@ -7,9 +7,9 @@ - - - + + + From ed9871443976f392a16bf9568f9d93d15fe65194 Mon Sep 17 00:00:00 2001 From: DarthAffe Date: Tue, 14 Jan 2025 22:12:54 +0100 Subject: [PATCH 31/38] Added logitech G915 X (TKL) --- RGB.NET.Devices.Logitech/LogitechDeviceProvider.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/RGB.NET.Devices.Logitech/LogitechDeviceProvider.cs b/RGB.NET.Devices.Logitech/LogitechDeviceProvider.cs index da892ba..2acbd31 100644 --- a/RGB.NET.Devices.Logitech/LogitechDeviceProvider.cs +++ b/RGB.NET.Devices.Logitech/LogitechDeviceProvider.cs @@ -70,6 +70,8 @@ public class LogitechDeviceProvider : AbstractRGBDeviceProvider { 0xC342, RGBDeviceType.Keyboard, "G512", LedMappings.PerKey, 0 }, { 0xC343, RGBDeviceType.Keyboard, "G915 TKL", LedMappings.PerKey, 0 }, { 0xC541, RGBDeviceType.Keyboard, "G915", LedMappings.PerKey, 0 }, + { 0xC359, RGBDeviceType.Keyboard, "G915 X", LedMappings.PerKey, 0 }, + { 0xC547, RGBDeviceType.Keyboard, "G915 X TKL", LedMappings.PerKey, 0 }, //non-rgb { 0xC333, RGBDeviceType.Keyboard, "G610", LedMappings.PerKey, 0 }, From 9945a5f7cb179241f2db46effc6beab57f092fa4 Mon Sep 17 00:00:00 2001 From: DarthAffe Date: Tue, 14 Jan 2025 22:16:03 +0100 Subject: [PATCH 32/38] Updated build-scripts to net9 --- .github/workflows/ci.yml | 7 +++++++ .github/workflows/pr_verify.yml | 1 + .github/workflows/release.yml | 9 ++++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 61ca30f..3d23092 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,6 +24,7 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: | + 9.0.x 8.0.x - name: Restore dependencies run: dotnet restore @@ -31,6 +32,12 @@ jobs: run: dotnet build --no-restore --configuration Release /p:Version=${{ github.event.inputs.version }}-prerelease.${{ github.event.inputs.increment }} - name: Test run: dotnet test --no-build --verbosity normal --configuration Release + - name: Upload a Build Artifact NET9 + uses: actions/upload-artifact@v4.3.1 + with: + name: RGB.NET-NET9 + path: bin/net9.0/RGB.NET.*.dll + if-no-files-found: error - name: Upload a Build Artifact NET8 uses: actions/upload-artifact@v4.3.1 with: diff --git a/.github/workflows/pr_verify.yml b/.github/workflows/pr_verify.yml index 59a1544..e4cc59e 100644 --- a/.github/workflows/pr_verify.yml +++ b/.github/workflows/pr_verify.yml @@ -15,6 +15,7 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: | + 9.0.x 8.0.x - name: Restore dependencies run: dotnet restore diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f8bae37..943dea6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,6 +20,7 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: | + 9.0.x 8.0.x - name: Restore dependencies run: dotnet restore @@ -27,6 +28,12 @@ jobs: run: dotnet build --no-restore --configuration Release /p:Version=${{ github.event.inputs.version }} - name: Test run: dotnet test --no-build --verbosity normal --configuration Release + - name: Upload a Build Artifact NET9 + uses: actions/upload-artifact@v4.3.1 + with: + name: RGB.NET-NET9 + path: bin/net9.0/RGB.NET.*.dll + if-no-files-found: error - name: Upload a Build Artifact NET8 uses: actions/upload-artifact@v4.3.1 with: @@ -44,6 +51,6 @@ jobs: with: tag_name: v${{ github.event.inputs.version }} generate_release_notes: true - files: bin/net8.0/RGB.NET.*.dll + files: bin/net9.0/RGB.NET.*.dll - name: Nuget Push run: dotnet nuget push **\*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_TOKEN }} --source https://api.nuget.org/v3/index.json From 77f55d2eb3be2bac9d9e4dbb88d7039ffa2b3a8a Mon Sep 17 00:00:00 2001 From: Danielle Date: Sat, 18 Jan 2025 10:33:15 +1100 Subject: [PATCH 33/38] Added additional Razer & SteelSeries devices Added device references for: * Razer BlackWidow V4 X * Razer Cobra * SteelSeries Apex Pro 3 * SteelSeries Aerox 9 Wireless --- RGB.NET.Devices.Razer/RazerDeviceProvider.cs | 2 ++ RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/RGB.NET.Devices.Razer/RazerDeviceProvider.cs b/RGB.NET.Devices.Razer/RazerDeviceProvider.cs index 295fd1f..7a7c2a8 100644 --- a/RGB.NET.Devices.Razer/RazerDeviceProvider.cs +++ b/RGB.NET.Devices.Razer/RazerDeviceProvider.cs @@ -142,6 +142,7 @@ public sealed class RazerDeviceProvider : AbstractRGBDeviceProvider { 0x028D, RGBDeviceType.Keyboard, "BlackWidow V4 Pro", LedMappings.Keyboard, RazerEndpointType.Keyboard }, { 0x0290, RGBDeviceType.Keyboard, "DeathStalker V2 Pro", LedMappings.Keyboard, RazerEndpointType.Keyboard }, // Wireless { 0x0292, RGBDeviceType.Keyboard, "DeathStalker V2 Pro", LedMappings.Keyboard, RazerEndpointType.Keyboard }, // Wired + { 0x0293, RGBDeviceType.Keyboard, "BlackWidow V4 X", LedMappings.Keyboard, RazerEndpointType.Keyboard }, { 0x0294, RGBDeviceType.Keyboard, "Ornata V3 X", LedMappings.Keyboard, RazerEndpointType.Keyboard }, { 0x0295, RGBDeviceType.Keyboard, "DeathStalker V2", LedMappings.Keyboard, RazerEndpointType.Keyboard }, { 0x0296, RGBDeviceType.Keyboard, "DeathStalker V2 Pro TKL", LedMappings.Keyboard, RazerEndpointType.Keyboard }, // Wireless @@ -225,6 +226,7 @@ public sealed class RazerDeviceProvider : AbstractRGBDeviceProvider { 0x009A, RGBDeviceType.Mouse, "Pro Click Mini (Wireless)", LedMappings.Mouse, RazerEndpointType.Mouse }, { 0x009C, RGBDeviceType.Mouse, "DeathAdder V2 X Hyperspeed", LedMappings.Mouse, RazerEndpointType.Mouse }, { 0x00A1, RGBDeviceType.Mouse, "DeathAdder V2 Lite", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x00A3, RGBDeviceType.Mouse, "Cobra", LedMappings.Mouse, RazerEndpointType.Mouse }, { 0x00A5, RGBDeviceType.Mouse, "Viper V2 Pro (Wired)", LedMappings.Mouse, RazerEndpointType.Mouse }, { 0x00A6, RGBDeviceType.Mouse, "Viper V2 Pro (Wireless)", LedMappings.Mouse, RazerEndpointType.Mouse }, { 0x00A7, RGBDeviceType.Mouse, "Naga V2 Pro", LedMappings.Mouse, RazerEndpointType.Mouse }, diff --git a/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs b/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs index 7e7c92a..63f7706 100644 --- a/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs +++ b/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs @@ -46,6 +46,7 @@ public sealed class SteelSeriesDeviceProvider : AbstractRGBDeviceProvider //Mice { 0x1836, RGBDeviceType.Mouse, "Aerox 3", LedMappings.MouseThreeZone, SteelSeriesDeviceType.ThreeZone }, { 0x183A, RGBDeviceType.Mouse, "Aerox 3 Wireless", LedMappings.MouseThreeZone, SteelSeriesDeviceType.ThreeZone }, + { 0x1858, RGBDeviceType.Mouse, "Aerox 9 Wireless", LedMappings.MouseThreeZone, SteelSeriesDeviceType.ThreeZone }, { 0x1702, RGBDeviceType.Mouse, "Rival 100", LedMappings.MouseOneZone, SteelSeriesDeviceType.OneZone }, { 0x1814, RGBDeviceType.Mouse, "Rival 105", LedMappings.MouseOneZone, SteelSeriesDeviceType.OneZone }, { 0x1816, RGBDeviceType.Mouse, "Rival 106", LedMappings.MouseOneZone, SteelSeriesDeviceType.OneZone }, @@ -78,6 +79,7 @@ public sealed class SteelSeriesDeviceProvider : AbstractRGBDeviceProvider { 0x1610, RGBDeviceType.Keyboard, "Apex Pro", LedMappings.KeyboardMappingUk, SteelSeriesDeviceType.PerKey }, { 0x1614, RGBDeviceType.Keyboard, "Apex Pro TKL", LedMappings.KeyboardTklMappingUk, SteelSeriesDeviceType.PerKey }, { 0x1630, RGBDeviceType.Keyboard, "Apex Pro TKL", LedMappings.KeyboardTklMappingUk, SteelSeriesDeviceType.PerKey }, // DarthAffe 27.05.2024: This could be a generic wireless connector + { 0x1640, RGBDeviceType.Keyboard, "Apex Pro 3", LedMappings.KeyboardMappingUk, SteelSeriesDeviceType.PerKey }, { 0x2036, RGBDeviceType.Keyboard, "MSI Notebook", LedMappings.KeyboardNotebookMappingUk, SteelSeriesDeviceType.PerKey }, { 0x113A, RGBDeviceType.Keyboard, "MSI GE78HX", LedMappings.KeyboardMSIGE78Mapping, SteelSeriesDeviceType.PerKey }, { 0x1122, RGBDeviceType.Keyboard, "MSI Notebook", LedMappings.KeyboardNotebookMappingUk, SteelSeriesDeviceType.PerKey }, From 12a353574a67e042d7b3958747c2e81b1d208dc4 Mon Sep 17 00:00:00 2001 From: DarthAffe Date: Thu, 6 Feb 2025 20:07:06 +0100 Subject: [PATCH 34/38] Added SteelSeries Arena 9 --- RGB.NET.Devices.SteelSeries/Generic/LedMappings.cs | 11 +++++++++++ .../SteelSeriesDeviceProvider.cs | 3 +++ 2 files changed, 14 insertions(+) diff --git a/RGB.NET.Devices.SteelSeries/Generic/LedMappings.cs b/RGB.NET.Devices.SteelSeries/Generic/LedMappings.cs index 18d7173..5f637fa 100644 --- a/RGB.NET.Devices.SteelSeries/Generic/LedMappings.cs +++ b/RGB.NET.Devices.SteelSeries/Generic/LedMappings.cs @@ -644,4 +644,15 @@ public static class LedMappings { LedId.Keyboard_Custom9, SteelSeriesLedId.ZoneNine }, { LedId.Keyboard_Custom10, SteelSeriesLedId.ZoneTen } }; + + /// + /// Gets the mapping for 4-zone speakers. + /// + public static LedMapping SpeakerFourZone { get; } = new() + { + { LedId.Speaker1, SteelSeriesLedId.ZoneOne }, + { LedId.Speaker2, SteelSeriesLedId.ZoneTwo }, + { LedId.Speaker3, SteelSeriesLedId.ZoneThree }, + { LedId.Speaker4, SteelSeriesLedId.ZoneFour }, + }; } \ No newline at end of file diff --git a/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs b/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs index 7e7c92a..154a28e 100644 --- a/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs +++ b/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs @@ -95,6 +95,9 @@ public sealed class SteelSeriesDeviceProvider : AbstractRGBDeviceProvider //Monitors { 0x1126, RGBDeviceType.Monitor, "MGP27C", LedMappings.MonitorOnehundredandthreeZone, SteelSeriesDeviceType.OneHundredAndThreeZone }, + + //Speaker + { 0x1A05, RGBDeviceType.Speaker, "Arena 9", LedMappings.SpeakerFourZone, SteelSeriesDeviceType.FourZone }, }; #endregion From f40190da01f9e6cba540783f5517127f8bdac6a7 Mon Sep 17 00:00:00 2001 From: DarthAffe Date: Thu, 6 Feb 2025 20:22:36 +0100 Subject: [PATCH 35/38] Updated dependencies --- RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj | 2 +- Tests/RGB.NET.Core.Tests/RGB.NET.Core.Tests.csproj | 4 ++-- Tests/RGB.NET.Presets.Tests/RGB.NET.Presets.Tests.csproj | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj b/RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj index a954a85..57c1c15 100644 --- a/RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj +++ b/RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj @@ -57,7 +57,7 @@ - + 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 0e33247..ef3cd53 100644 --- a/Tests/RGB.NET.Core.Tests/RGB.NET.Core.Tests.csproj +++ b/Tests/RGB.NET.Core.Tests/RGB.NET.Core.Tests.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/Tests/RGB.NET.Presets.Tests/RGB.NET.Presets.Tests.csproj b/Tests/RGB.NET.Presets.Tests/RGB.NET.Presets.Tests.csproj index 7ff0fb7..52aff58 100644 --- a/Tests/RGB.NET.Presets.Tests/RGB.NET.Presets.Tests.csproj +++ b/Tests/RGB.NET.Presets.Tests/RGB.NET.Presets.Tests.csproj @@ -8,8 +8,8 @@ - - + + From 47770c00b84ca74b0f3c91924e8a5173ba689182 Mon Sep 17 00:00:00 2001 From: DarthAffe Date: Sat, 8 Feb 2025 12:07:48 +0100 Subject: [PATCH 36/38] Used new collection-initialization --- RGB.NET.Core/Devices/AbstractRGBDevice.cs | 4 ++-- RGB.NET.Core/Groups/ListLedGroup.cs | 4 ++-- RGB.NET.Core/RGBSurface.cs | 4 ++-- RGB.NET.Core/Update/CustomUpdateData.cs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/RGB.NET.Core/Devices/AbstractRGBDevice.cs b/RGB.NET.Core/Devices/AbstractRGBDevice.cs index 07663f3..311c468 100644 --- a/RGB.NET.Core/Devices/AbstractRGBDevice.cs +++ b/RGB.NET.Core/Devices/AbstractRGBDevice.cs @@ -43,7 +43,7 @@ public abstract class AbstractRGBDevice : Placeable, IRGBDevice DeviceInfo; /// - public IList ColorCorrections { get; } = new List(); + public IList ColorCorrections { get; } = []; /// /// Gets or sets if the device needs to be flushed on every update. @@ -63,7 +63,7 @@ public abstract class AbstractRGBDevice : Placeable, IRGBDevice - Led? IRGBDevice.this[LedId ledId] => LedMapping.TryGetValue(ledId, out Led? led) ? led : null; + Led? IRGBDevice.this[LedId ledId] => LedMapping.GetValueOrDefault(ledId); /// Led? IRGBDevice.this[Point location] => LedMapping.Values.FirstOrDefault(x => x.Boundary.Contains(location)); diff --git a/RGB.NET.Core/Groups/ListLedGroup.cs b/RGB.NET.Core/Groups/ListLedGroup.cs index 4bca2fb..511cdad 100644 --- a/RGB.NET.Core/Groups/ListLedGroup.cs +++ b/RGB.NET.Core/Groups/ListLedGroup.cs @@ -20,7 +20,7 @@ public sealed class ListLedGroup : AbstractLedGroup /// /// Gets the list containing the of this . /// - private readonly IList _groupLeds = new List(); + private readonly IList _groupLeds = []; #endregion @@ -142,7 +142,7 @@ public sealed class ListLedGroup : AbstractLedGroup public override IList ToList() { lock (_groupLeds) - return new List(_groupLeds); + return [.._groupLeds]; } protected override IDisposable ToListUnsafe(out IList leds) diff --git a/RGB.NET.Core/RGBSurface.cs b/RGB.NET.Core/RGBSurface.cs index 5c3387f..2de9c13 100644 --- a/RGB.NET.Core/RGBSurface.cs +++ b/RGB.NET.Core/RGBSurface.cs @@ -20,8 +20,8 @@ public sealed class RGBSurface : AbstractBindable, IDisposable private readonly Stopwatch _deltaTimeCounter; - private readonly IList _devices = new List(); - private readonly IList _updateTriggers = new List(); + private readonly IList _devices = []; + private readonly IList _updateTriggers = []; private readonly List _ledGroups = []; /// diff --git a/RGB.NET.Core/Update/CustomUpdateData.cs b/RGB.NET.Core/Update/CustomUpdateData.cs index 0d85aa7..bce97f3 100644 --- a/RGB.NET.Core/Update/CustomUpdateData.cs +++ b/RGB.NET.Core/Update/CustomUpdateData.cs @@ -68,7 +68,7 @@ public sealed class CustomUpdateData : ICustomUpdateData /// The value represented by the specified key. public object? this[string key] { - get => _data.TryGetValue(key, out object? data) ? data : default; + get => _data.GetValueOrDefault(key); set => _data[key] = value; } From 5633f82b3bb22f61f09c2cc85ee39a05b2998d57 Mon Sep 17 00:00:00 2001 From: DarthAffe Date: Sat, 8 Feb 2025 12:08:12 +0100 Subject: [PATCH 37/38] Changed locks to use the new Lock-type for .net9 --- RGB.NET.Core/Compatibility/Lock.cs | 7 +++++++ RGB.NET.Core/Helper/TimerHelper.cs | 2 +- RGB.NET.Core/RGB.NET.Core.csproj | 4 ++++ RGB.NET.Core/Update/Devices/UpdateQueue.cs | 3 ++- RGB.NET.Core/Update/TimerUpdateTrigger.cs | 2 +- RGB.NET.Devices.Asus/AsusDeviceProvider.cs | 3 ++- RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj | 4 ++++ RGB.NET.Devices.CoolerMaster/CoolerMasterDeviceProvider.cs | 3 ++- .../RGB.NET.Devices.CoolerMaster.csproj | 4 ++++ RGB.NET.Devices.Corsair/CorsairDeviceProvider.cs | 2 +- RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj | 4 ++++ .../CorsairLegacyDeviceProvider.cs | 3 ++- .../RGB.NET.Devices.Corsair_Legacy.csproj | 4 ++++ RGB.NET.Devices.DMX/DMXDeviceProvider.cs | 3 ++- RGB.NET.Devices.DMX/RGB.NET.Devices.DMX.csproj | 4 ++++ RGB.NET.Devices.Debug/DebugDeviceProvider.cs | 3 ++- RGB.NET.Devices.Debug/RGB.NET.Devices.Debug.csproj | 4 ++++ RGB.NET.Devices.Logitech/LogitechDeviceProvider.cs | 3 ++- RGB.NET.Devices.Logitech/RGB.NET.Devices.Logitech.csproj | 4 ++++ RGB.NET.Devices.Msi/MsiDeviceProvider.cs | 3 ++- RGB.NET.Devices.Msi/RGB.NET.Devices.Msi.csproj | 4 ++++ RGB.NET.Devices.Novation/NovationDeviceProvider.cs | 3 ++- RGB.NET.Devices.Novation/RGB.NET.Devices.Novation.csproj | 4 ++++ RGB.NET.Devices.OpenRGB/OpenRGBDeviceProvider.cs | 3 ++- RGB.NET.Devices.OpenRGB/RGB.NET.Devices.OpenRGB.csproj | 4 ++++ RGB.NET.Devices.PicoPi/PicoPiDeviceProvider.cs | 3 ++- RGB.NET.Devices.PicoPi/RGB.NET.Devices.PicoPi.csproj | 4 ++++ RGB.NET.Devices.Razer/RGB.NET.Devices.Razer.csproj | 4 ++++ RGB.NET.Devices.Razer/RazerDeviceProvider.cs | 3 ++- .../RGB.NET.Devices.SteelSeries.csproj | 4 ++++ RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs | 3 ++- RGB.NET.Devices.WLED/RGB.NET.Devices.WLED.csproj | 4 ++++ RGB.NET.Devices.WLED/WLedDeviceProvider.cs | 3 ++- RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj | 4 ++++ RGB.NET.Devices.WS281X/WS281XDeviceProvider.cs | 3 ++- RGB.NET.Devices.Wooting/RGB.NET.Devices.Wooting.csproj | 4 ++++ RGB.NET.Devices.Wooting/WootingDeviceProvider.cs | 3 ++- RGB.NET.HID/RGB.NET.HID.csproj | 4 ++++ RGB.NET.Layout/RGB.NET.Layout.csproj | 4 ++++ RGB.NET.Presets/RGB.NET.Presets.csproj | 4 ++++ RGB.NET.sln.DotSettings | 6 ++++++ 41 files changed, 128 insertions(+), 19 deletions(-) create mode 100644 RGB.NET.Core/Compatibility/Lock.cs diff --git a/RGB.NET.Core/Compatibility/Lock.cs b/RGB.NET.Core/Compatibility/Lock.cs new file mode 100644 index 0000000..e8e5af1 --- /dev/null +++ b/RGB.NET.Core/Compatibility/Lock.cs @@ -0,0 +1,7 @@ +#if NET8_0 + +namespace RGB.NET.Core.Compatibility.Net8; + +public sealed class Lock; + +#endif \ No newline at end of file diff --git a/RGB.NET.Core/Helper/TimerHelper.cs b/RGB.NET.Core/Helper/TimerHelper.cs index e2742ab..1da32e6 100644 --- a/RGB.NET.Core/Helper/TimerHelper.cs +++ b/RGB.NET.Core/Helper/TimerHelper.cs @@ -24,7 +24,7 @@ public static class TimerHelper #region Properties & Fields - private static readonly object HIGH_RESOLUTION_TIMER_LOCK = new(); + private static readonly Lock HIGH_RESOLUTION_TIMER_LOCK = new(); private static bool _areHighResolutionTimersEnabled = false; diff --git a/RGB.NET.Core/RGB.NET.Core.csproj b/RGB.NET.Core/RGB.NET.Core.csproj index 7a4e2c4..a945aa4 100644 --- a/RGB.NET.Core/RGB.NET.Core.csproj +++ b/RGB.NET.Core/RGB.NET.Core.csproj @@ -52,6 +52,10 @@ RELEASE + + + + diff --git a/RGB.NET.Core/Update/Devices/UpdateQueue.cs b/RGB.NET.Core/Update/Devices/UpdateQueue.cs index 7db3517..ba9e3bb 100644 --- a/RGB.NET.Core/Update/Devices/UpdateQueue.cs +++ b/RGB.NET.Core/Update/Devices/UpdateQueue.cs @@ -1,6 +1,7 @@ using System; using System.Buffers; using System.Collections.Generic; +using System.Threading; namespace RGB.NET.Core; @@ -14,7 +15,7 @@ public abstract class UpdateQueue : AbstractReferenceCountin { #region Properties & Fields - private readonly object _dataLock = new(); + private readonly Lock _dataLock = new(); private readonly IDeviceUpdateTrigger _updateTrigger; private readonly Dictionary _currentDataSet = []; diff --git a/RGB.NET.Core/Update/TimerUpdateTrigger.cs b/RGB.NET.Core/Update/TimerUpdateTrigger.cs index 6b94b3f..303b517 100644 --- a/RGB.NET.Core/Update/TimerUpdateTrigger.cs +++ b/RGB.NET.Core/Update/TimerUpdateTrigger.cs @@ -14,7 +14,7 @@ public sealed class TimerUpdateTrigger : AbstractUpdateTrigger { #region Properties & Fields - private readonly object _lock = new(); + private readonly Lock _lock = new(); private readonly CustomUpdateData? _customUpdateData; diff --git a/RGB.NET.Devices.Asus/AsusDeviceProvider.cs b/RGB.NET.Devices.Asus/AsusDeviceProvider.cs index 5515bc1..f6ea312 100644 --- a/RGB.NET.Devices.Asus/AsusDeviceProvider.cs +++ b/RGB.NET.Devices.Asus/AsusDeviceProvider.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Threading; using AuraServiceLib; using RGB.NET.Core; @@ -17,7 +18,7 @@ public sealed class AsusDeviceProvider : AbstractRGBDeviceProvider #region Properties & Fields // ReSharper disable once InconsistentNaming - private static readonly object _lock = new(); + private static readonly Lock _lock = new(); private static AsusDeviceProvider? _instance; /// diff --git a/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj b/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj index 08d6fd3..b04586c 100644 --- a/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj +++ b/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj @@ -51,6 +51,10 @@ RELEASE + + + + diff --git a/RGB.NET.Devices.CoolerMaster/CoolerMasterDeviceProvider.cs b/RGB.NET.Devices.CoolerMaster/CoolerMasterDeviceProvider.cs index cecc41d..d681384 100644 --- a/RGB.NET.Devices.CoolerMaster/CoolerMasterDeviceProvider.cs +++ b/RGB.NET.Devices.CoolerMaster/CoolerMasterDeviceProvider.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Threading; using RGB.NET.Core; using RGB.NET.Devices.CoolerMaster.Helper; using RGB.NET.Devices.CoolerMaster.Native; @@ -18,7 +19,7 @@ public sealed class CoolerMasterDeviceProvider : AbstractRGBDeviceProvider #region Properties & Fields // ReSharper disable once InconsistentNaming - private static readonly object _lock = new(); + private static readonly Lock _lock = new(); private static CoolerMasterDeviceProvider? _instance; /// diff --git a/RGB.NET.Devices.CoolerMaster/RGB.NET.Devices.CoolerMaster.csproj b/RGB.NET.Devices.CoolerMaster/RGB.NET.Devices.CoolerMaster.csproj index 88a58d0..c54ced2 100644 --- a/RGB.NET.Devices.CoolerMaster/RGB.NET.Devices.CoolerMaster.csproj +++ b/RGB.NET.Devices.CoolerMaster/RGB.NET.Devices.CoolerMaster.csproj @@ -51,6 +51,10 @@ RELEASE + + + + diff --git a/RGB.NET.Devices.Corsair/CorsairDeviceProvider.cs b/RGB.NET.Devices.Corsair/CorsairDeviceProvider.cs index 4dba9ea..1d0e7d6 100644 --- a/RGB.NET.Devices.Corsair/CorsairDeviceProvider.cs +++ b/RGB.NET.Devices.Corsair/CorsairDeviceProvider.cs @@ -18,7 +18,7 @@ public sealed class CorsairDeviceProvider : AbstractRGBDeviceProvider #region Properties & Fields // ReSharper disable once InconsistentNaming - private static readonly object _lock = new(); + private static readonly Lock _lock = new(); private static CorsairDeviceProvider? _instance; /// diff --git a/RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj b/RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj index 51228f4..ff0914d 100644 --- a/RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj +++ b/RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj @@ -52,6 +52,10 @@ RELEASE + + + + diff --git a/RGB.NET.Devices.Corsair_Legacy/CorsairLegacyDeviceProvider.cs b/RGB.NET.Devices.Corsair_Legacy/CorsairLegacyDeviceProvider.cs index 9f770e8..d893dfd 100644 --- a/RGB.NET.Devices.Corsair_Legacy/CorsairLegacyDeviceProvider.cs +++ b/RGB.NET.Devices.Corsair_Legacy/CorsairLegacyDeviceProvider.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; +using System.Threading; using RGB.NET.Core; using RGB.NET.Devices.CorsairLegacy.Native; @@ -19,7 +20,7 @@ public sealed class CorsairLegacyDeviceProvider : AbstractRGBDeviceProvider #region Properties & Fields // ReSharper disable once InconsistentNaming - private static readonly object _lock = new(); + private static readonly Lock _lock = new(); private static CorsairLegacyDeviceProvider? _instance; /// diff --git a/RGB.NET.Devices.Corsair_Legacy/RGB.NET.Devices.Corsair_Legacy.csproj b/RGB.NET.Devices.Corsair_Legacy/RGB.NET.Devices.Corsair_Legacy.csproj index 7604e5b..e9c4509 100644 --- a/RGB.NET.Devices.Corsair_Legacy/RGB.NET.Devices.Corsair_Legacy.csproj +++ b/RGB.NET.Devices.Corsair_Legacy/RGB.NET.Devices.Corsair_Legacy.csproj @@ -52,6 +52,10 @@ RELEASE + + + + diff --git a/RGB.NET.Devices.DMX/DMXDeviceProvider.cs b/RGB.NET.Devices.DMX/DMXDeviceProvider.cs index b5d725c..5e65459 100644 --- a/RGB.NET.Devices.DMX/DMXDeviceProvider.cs +++ b/RGB.NET.Devices.DMX/DMXDeviceProvider.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Threading; using RGB.NET.Core; using RGB.NET.Devices.DMX.E131; @@ -17,7 +18,7 @@ public sealed class DMXDeviceProvider : AbstractRGBDeviceProvider #region Properties & Fields // ReSharper disable once InconsistentNaming - private static readonly object _lock = new(); + private static readonly Lock _lock = new(); private static DMXDeviceProvider? _instance; /// diff --git a/RGB.NET.Devices.DMX/RGB.NET.Devices.DMX.csproj b/RGB.NET.Devices.DMX/RGB.NET.Devices.DMX.csproj index 7056936..679d94d 100644 --- a/RGB.NET.Devices.DMX/RGB.NET.Devices.DMX.csproj +++ b/RGB.NET.Devices.DMX/RGB.NET.Devices.DMX.csproj @@ -51,6 +51,10 @@ RELEASE + + + + diff --git a/RGB.NET.Devices.Debug/DebugDeviceProvider.cs b/RGB.NET.Devices.Debug/DebugDeviceProvider.cs index 636e57f..cbd97a2 100644 --- a/RGB.NET.Devices.Debug/DebugDeviceProvider.cs +++ b/RGB.NET.Devices.Debug/DebugDeviceProvider.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Threading; using RGB.NET.Core; using RGB.NET.Layout; @@ -17,7 +18,7 @@ public sealed class DebugDeviceProvider : AbstractRGBDeviceProvider #region Properties & Fields // ReSharper disable once InconsistentNaming - private static readonly object _lock = new(); + private static readonly Lock _lock = new(); private static DebugDeviceProvider? _instance; /// diff --git a/RGB.NET.Devices.Debug/RGB.NET.Devices.Debug.csproj b/RGB.NET.Devices.Debug/RGB.NET.Devices.Debug.csproj index fa11d56..14db0ca 100644 --- a/RGB.NET.Devices.Debug/RGB.NET.Devices.Debug.csproj +++ b/RGB.NET.Devices.Debug/RGB.NET.Devices.Debug.csproj @@ -51,6 +51,10 @@ RELEASE + + + + diff --git a/RGB.NET.Devices.Logitech/LogitechDeviceProvider.cs b/RGB.NET.Devices.Logitech/LogitechDeviceProvider.cs index 2acbd31..edf61ec 100644 --- a/RGB.NET.Devices.Logitech/LogitechDeviceProvider.cs +++ b/RGB.NET.Devices.Logitech/LogitechDeviceProvider.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading; using HidSharp; using RGB.NET.Core; using RGB.NET.Devices.Logitech.Native; @@ -21,7 +22,7 @@ public class LogitechDeviceProvider : AbstractRGBDeviceProvider #region Properties & Fields // ReSharper disable once InconsistentNaming - private static readonly object _lock = new(); + private static readonly Lock _lock = new(); private static LogitechDeviceProvider? _instance; /// diff --git a/RGB.NET.Devices.Logitech/RGB.NET.Devices.Logitech.csproj b/RGB.NET.Devices.Logitech/RGB.NET.Devices.Logitech.csproj index 2659fed..4c27d96 100644 --- a/RGB.NET.Devices.Logitech/RGB.NET.Devices.Logitech.csproj +++ b/RGB.NET.Devices.Logitech/RGB.NET.Devices.Logitech.csproj @@ -52,6 +52,10 @@ RELEASE + + + + diff --git a/RGB.NET.Devices.Msi/MsiDeviceProvider.cs b/RGB.NET.Devices.Msi/MsiDeviceProvider.cs index 54be621..d7022a3 100644 --- a/RGB.NET.Devices.Msi/MsiDeviceProvider.cs +++ b/RGB.NET.Devices.Msi/MsiDeviceProvider.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Threading; using RGB.NET.Core; using RGB.NET.Devices.Msi.Exceptions; using RGB.NET.Devices.Msi.Native; @@ -18,7 +19,7 @@ public class MsiDeviceProvider : AbstractRGBDeviceProvider #region Properties & Fields // ReSharper disable once InconsistentNaming - private static readonly object _lock = new(); + private static readonly Lock _lock = new(); private static MsiDeviceProvider? _instance; /// diff --git a/RGB.NET.Devices.Msi/RGB.NET.Devices.Msi.csproj b/RGB.NET.Devices.Msi/RGB.NET.Devices.Msi.csproj index a0b1d32..4409e88 100644 --- a/RGB.NET.Devices.Msi/RGB.NET.Devices.Msi.csproj +++ b/RGB.NET.Devices.Msi/RGB.NET.Devices.Msi.csproj @@ -51,6 +51,10 @@ RELEASE + + + + diff --git a/RGB.NET.Devices.Novation/NovationDeviceProvider.cs b/RGB.NET.Devices.Novation/NovationDeviceProvider.cs index e3c9b77..c2e2435 100644 --- a/RGB.NET.Devices.Novation/NovationDeviceProvider.cs +++ b/RGB.NET.Devices.Novation/NovationDeviceProvider.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading; using RGB.NET.Core; using Sanford.Multimedia.Midi; @@ -18,7 +19,7 @@ public sealed class NovationDeviceProvider : AbstractRGBDeviceProvider #region Properties & Fields // ReSharper disable once InconsistentNaming - private static readonly object _lock = new(); + private static readonly Lock _lock = new(); private static NovationDeviceProvider? _instance; /// diff --git a/RGB.NET.Devices.Novation/RGB.NET.Devices.Novation.csproj b/RGB.NET.Devices.Novation/RGB.NET.Devices.Novation.csproj index c75ab22..a526cfb 100644 --- a/RGB.NET.Devices.Novation/RGB.NET.Devices.Novation.csproj +++ b/RGB.NET.Devices.Novation/RGB.NET.Devices.Novation.csproj @@ -51,6 +51,10 @@ RELEASE + + + + diff --git a/RGB.NET.Devices.OpenRGB/OpenRGBDeviceProvider.cs b/RGB.NET.Devices.OpenRGB/OpenRGBDeviceProvider.cs index 26b3a2a..33ac334 100644 --- a/RGB.NET.Devices.OpenRGB/OpenRGBDeviceProvider.cs +++ b/RGB.NET.Devices.OpenRGB/OpenRGBDeviceProvider.cs @@ -3,6 +3,7 @@ using RGB.NET.Core; using System; using System.Collections.Generic; using System.Linq; +using System.Threading; namespace RGB.NET.Devices.OpenRGB; @@ -15,7 +16,7 @@ public sealed class OpenRGBDeviceProvider : AbstractRGBDeviceProvider #region Properties & Fields // ReSharper disable once InconsistentNaming - private static readonly object _lock = new(); + private static readonly Lock _lock = new(); private readonly List _clients = []; diff --git a/RGB.NET.Devices.OpenRGB/RGB.NET.Devices.OpenRGB.csproj b/RGB.NET.Devices.OpenRGB/RGB.NET.Devices.OpenRGB.csproj index dbcb857..5f7a014 100644 --- a/RGB.NET.Devices.OpenRGB/RGB.NET.Devices.OpenRGB.csproj +++ b/RGB.NET.Devices.OpenRGB/RGB.NET.Devices.OpenRGB.csproj @@ -51,6 +51,10 @@ RELEASE + + + + diff --git a/RGB.NET.Devices.PicoPi/PicoPiDeviceProvider.cs b/RGB.NET.Devices.PicoPi/PicoPiDeviceProvider.cs index ebcdff5..f5b879d 100644 --- a/RGB.NET.Devices.PicoPi/PicoPiDeviceProvider.cs +++ b/RGB.NET.Devices.PicoPi/PicoPiDeviceProvider.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading; using HidSharp; using RGB.NET.Core; using RGB.NET.Devices.PicoPi.Enum; @@ -26,7 +27,7 @@ public sealed class PicoPiDeviceProvider : AbstractRGBDeviceProvider #region Properties & Fields // ReSharper disable once InconsistentNaming - private static readonly object _lock = new(); + private static readonly Lock _lock = new(); private static PicoPiDeviceProvider? _instance; /// diff --git a/RGB.NET.Devices.PicoPi/RGB.NET.Devices.PicoPi.csproj b/RGB.NET.Devices.PicoPi/RGB.NET.Devices.PicoPi.csproj index de287c0..b42f361 100644 --- a/RGB.NET.Devices.PicoPi/RGB.NET.Devices.PicoPi.csproj +++ b/RGB.NET.Devices.PicoPi/RGB.NET.Devices.PicoPi.csproj @@ -51,6 +51,10 @@ RELEASE + + + + diff --git a/RGB.NET.Devices.Razer/RGB.NET.Devices.Razer.csproj b/RGB.NET.Devices.Razer/RGB.NET.Devices.Razer.csproj index 84dc712..bf46462 100644 --- a/RGB.NET.Devices.Razer/RGB.NET.Devices.Razer.csproj +++ b/RGB.NET.Devices.Razer/RGB.NET.Devices.Razer.csproj @@ -52,6 +52,10 @@ RELEASE + + + + diff --git a/RGB.NET.Devices.Razer/RazerDeviceProvider.cs b/RGB.NET.Devices.Razer/RazerDeviceProvider.cs index 7a7c2a8..e7e3d87 100644 --- a/RGB.NET.Devices.Razer/RazerDeviceProvider.cs +++ b/RGB.NET.Devices.Razer/RazerDeviceProvider.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading; using RGB.NET.Core; using RGB.NET.Devices.Razer.Native; using RGB.NET.HID; @@ -20,7 +21,7 @@ public sealed class RazerDeviceProvider : AbstractRGBDeviceProvider #region Properties & Fields // ReSharper disable once InconsistentNaming - private static readonly object _lock = new(); + private static readonly Lock _lock = new(); private static RazerDeviceProvider? _instance; /// diff --git a/RGB.NET.Devices.SteelSeries/RGB.NET.Devices.SteelSeries.csproj b/RGB.NET.Devices.SteelSeries/RGB.NET.Devices.SteelSeries.csproj index aed6e92..fd5b281 100644 --- a/RGB.NET.Devices.SteelSeries/RGB.NET.Devices.SteelSeries.csproj +++ b/RGB.NET.Devices.SteelSeries/RGB.NET.Devices.SteelSeries.csproj @@ -51,6 +51,10 @@ RELEASE + + + + diff --git a/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs b/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs index 7a3f101..5748511 100644 --- a/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs +++ b/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Threading; using RGB.NET.Core; using RGB.NET.Devices.SteelSeries.API; using RGB.NET.HID; @@ -21,7 +22,7 @@ public sealed class SteelSeriesDeviceProvider : AbstractRGBDeviceProvider #region Properties & Fields // ReSharper disable once InconsistentNaming - private static readonly object _lock = new(); + private static readonly Lock _lock = new(); private static SteelSeriesDeviceProvider? _instance; /// diff --git a/RGB.NET.Devices.WLED/RGB.NET.Devices.WLED.csproj b/RGB.NET.Devices.WLED/RGB.NET.Devices.WLED.csproj index a7893b4..65bd108 100644 --- a/RGB.NET.Devices.WLED/RGB.NET.Devices.WLED.csproj +++ b/RGB.NET.Devices.WLED/RGB.NET.Devices.WLED.csproj @@ -51,6 +51,10 @@ RELEASE + + + + diff --git a/RGB.NET.Devices.WLED/WLedDeviceProvider.cs b/RGB.NET.Devices.WLED/WLedDeviceProvider.cs index 978565e..e49b5e8 100644 --- a/RGB.NET.Devices.WLED/WLedDeviceProvider.cs +++ b/RGB.NET.Devices.WLED/WLedDeviceProvider.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; +using System.Threading; using RGB.NET.Core; namespace RGB.NET.Devices.WLED; @@ -23,7 +24,7 @@ public sealed class WledDeviceProvider : AbstractRGBDeviceProvider #region Properties & Fields // ReSharper disable once InconsistentNaming - private static readonly object _lock = new(); + private static readonly Lock _lock = new(); private static WledDeviceProvider? _instance; /// diff --git a/RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj b/RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj index 57c1c15..f7a0dfd 100644 --- a/RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj +++ b/RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj @@ -51,6 +51,10 @@ RELEASE + + + + diff --git a/RGB.NET.Devices.WS281X/WS281XDeviceProvider.cs b/RGB.NET.Devices.WS281X/WS281XDeviceProvider.cs index 109877a..de7e6ee 100644 --- a/RGB.NET.Devices.WS281X/WS281XDeviceProvider.cs +++ b/RGB.NET.Devices.WS281X/WS281XDeviceProvider.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; +using System.Threading; using RGB.NET.Core; namespace RGB.NET.Devices.WS281X; @@ -17,7 +18,7 @@ public sealed class WS281XDeviceProvider : AbstractRGBDeviceProvider #region Properties & Fields // ReSharper disable once InconsistentNaming - private static readonly object _lock = new(); + private static readonly Lock _lock = new(); private static WS281XDeviceProvider? _instance; /// diff --git a/RGB.NET.Devices.Wooting/RGB.NET.Devices.Wooting.csproj b/RGB.NET.Devices.Wooting/RGB.NET.Devices.Wooting.csproj index 5ea6bbe..778d0b9 100644 --- a/RGB.NET.Devices.Wooting/RGB.NET.Devices.Wooting.csproj +++ b/RGB.NET.Devices.Wooting/RGB.NET.Devices.Wooting.csproj @@ -52,6 +52,10 @@ RELEASE + + + + diff --git a/RGB.NET.Devices.Wooting/WootingDeviceProvider.cs b/RGB.NET.Devices.Wooting/WootingDeviceProvider.cs index 8b36ff7..cb58d18 100644 --- a/RGB.NET.Devices.Wooting/WootingDeviceProvider.cs +++ b/RGB.NET.Devices.Wooting/WootingDeviceProvider.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Runtime.InteropServices; +using System.Threading; using RGB.NET.Core; using RGB.NET.Devices.Wooting.Enum; using RGB.NET.Devices.Wooting.Generic; @@ -19,7 +20,7 @@ public sealed class WootingDeviceProvider : AbstractRGBDeviceProvider #region Properties & Fields // ReSharper disable once InconsistentNaming - private static readonly object _lock = new(); + private static readonly Lock _lock = new(); private static WootingDeviceProvider? _instance; /// diff --git a/RGB.NET.HID/RGB.NET.HID.csproj b/RGB.NET.HID/RGB.NET.HID.csproj index 3dd2ce3..22196ce 100644 --- a/RGB.NET.HID/RGB.NET.HID.csproj +++ b/RGB.NET.HID/RGB.NET.HID.csproj @@ -51,6 +51,10 @@ RELEASE + + + + diff --git a/RGB.NET.Layout/RGB.NET.Layout.csproj b/RGB.NET.Layout/RGB.NET.Layout.csproj index ab00d34..163c204 100644 --- a/RGB.NET.Layout/RGB.NET.Layout.csproj +++ b/RGB.NET.Layout/RGB.NET.Layout.csproj @@ -51,6 +51,10 @@ RELEASE + + + + diff --git a/RGB.NET.Presets/RGB.NET.Presets.csproj b/RGB.NET.Presets/RGB.NET.Presets.csproj index f2db2c1..04ecdb6 100644 --- a/RGB.NET.Presets/RGB.NET.Presets.csproj +++ b/RGB.NET.Presets/RGB.NET.Presets.csproj @@ -52,6 +52,10 @@ RELEASE + + + + diff --git a/RGB.NET.sln.DotSettings b/RGB.NET.sln.DotSettings index a13f331..c7ee5e7 100644 --- a/RGB.NET.sln.DotSettings +++ b/RGB.NET.sln.DotSettings @@ -308,6 +308,11 @@ <Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /> <Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /> <Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /> + <Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static readonly fields (private)"><ElementKinds><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="" Suffix="" Style="AA_BB" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Private" Description="Constant fields (private)"><ElementKinds><Kind Name="CONSTANT_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="" Suffix="" Style="AA_BB" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Protected, ProtectedInternal, Internal, Public, PrivateProtected" Description="Constant fields (not private)"><ElementKinds><Kind Name="CONSTANT_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="" Suffix="" Style="AA_BB" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Any" Description="Local constants"><ElementKinds><Kind Name="LOCAL_CONSTANT" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="" Suffix="" Style="AA_BB" /></Policy> + <Policy><Descriptor Staticness="Static" AccessRightKinds="Protected, ProtectedInternal, Internal, Public, PrivateProtected" Description="Static readonly fields (not private)"><ElementKinds><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="" Suffix="" Style="AA_BB" /></Policy> <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> @@ -358,6 +363,7 @@ True True True + True True True True \ No newline at end of file From aae509b275a2e9c003126ecd4fc13c03e72e0399 Mon Sep 17 00:00:00 2001 From: DarthAffe Date: Sat, 8 Feb 2025 12:13:14 +0100 Subject: [PATCH 38/38] More code issues fixed --- RGB.NET.Core/Compatibility/Lock.cs | 1 + RGB.NET.Core/Extensions/RectangleExtensions.cs | 6 +++--- RGB.NET.Core/Helper/ConversionHelper.cs | 2 +- .../Keyboard/AsusKeyboardRGBDevice.cs | 4 ++-- .../Keyboard/AsusKeyboardRGBDeviceInfo.cs | 2 +- RGB.NET.Devices.Corsair/Native/_CUESDK.cs | 2 +- .../Custom/CorsairCustomRGBDeviceInfo.cs | 13 ++++++++----- RGB.NET.Devices.Corsair_Legacy/Native/_CUESDK.cs | 2 +- RGB.NET.Devices.Logitech/HID/LightspeedHidLoader.cs | 8 ++++---- RGB.NET.Devices.Logitech/Native/_LogitechGSDK.cs | 2 +- RGB.NET.Devices.Msi/Native/_MsiSDK.cs | 2 +- RGB.NET.Devices.Razer/Native/_RazerSDK.cs | 2 +- RGB.NET.Devices.Wooting/Native/_WootingSDK.cs | 2 +- 13 files changed, 26 insertions(+), 22 deletions(-) diff --git a/RGB.NET.Core/Compatibility/Lock.cs b/RGB.NET.Core/Compatibility/Lock.cs index e8e5af1..0a28501 100644 --- a/RGB.NET.Core/Compatibility/Lock.cs +++ b/RGB.NET.Core/Compatibility/Lock.cs @@ -1,5 +1,6 @@ #if NET8_0 +// ReSharper disable once CheckNamespace namespace RGB.NET.Core.Compatibility.Net8; public sealed class Lock; diff --git a/RGB.NET.Core/Extensions/RectangleExtensions.cs b/RGB.NET.Core/Extensions/RectangleExtensions.cs index 741742b..077c193 100644 --- a/RGB.NET.Core/Extensions/RectangleExtensions.cs +++ b/RGB.NET.Core/Extensions/RectangleExtensions.cs @@ -154,9 +154,9 @@ public static class RectangleExtensions Point[] points = [ rect.Location, // top left - new Point(rect.Location.X + rect.Size.Width, rect.Location.Y), // top right - new Point(rect.Location.X + rect.Size.Width, rect.Location.Y + rect.Size.Height), // bottom right - new Point(rect.Location.X, rect.Location.Y + rect.Size.Height), // bottom right + new(rect.Location.X + rect.Size.Width, rect.Location.Y), // top right + new(rect.Location.X + rect.Size.Width, rect.Location.Y + rect.Size.Height), // bottom right + new(rect.Location.X, rect.Location.Y + rect.Size.Height), // bottom right ]; float sin = MathF.Sin(rotation.Radians); diff --git a/RGB.NET.Core/Helper/ConversionHelper.cs b/RGB.NET.Core/Helper/ConversionHelper.cs index 0be3dfb..d05b94b 100644 --- a/RGB.NET.Core/Helper/ConversionHelper.cs +++ b/RGB.NET.Core/Helper/ConversionHelper.cs @@ -40,7 +40,7 @@ public static class ConversionHelper public static byte[] HexToBytes(ReadOnlySpan hexString) { if ((hexString.Length == 0) || ((hexString.Length % 2) != 0)) - return Array.Empty(); + return []; byte[] buffer = new byte[hexString.Length / 2]; for (int bx = 0, sx = 0; bx < buffer.Length; ++bx, ++sx) diff --git a/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDevice.cs b/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDevice.cs index 1200429..50a0878 100644 --- a/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDevice.cs +++ b/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDevice.cs @@ -37,8 +37,8 @@ public sealed class AsusKeyboardRGBDevice : AsusRGBDevice ExtraLedMappings = [ - new AsusKeyboardExtraMapping(new Regex("(ROG Zephyrus Duo 15).*?"), LedMappings.ROGZephyrusDuo15), - new AsusKeyboardExtraMapping(new Regex("(ROG Strix G513QM).*?"), LedMappings.ROGStrixG15) + new(new Regex("(ROG Zephyrus Duo 15).*?"), LedMappings.ROGZephyrusDuo15), + new(new Regex("(ROG Strix G513QM).*?"), LedMappings.ROGStrixG15) ]; #endregion diff --git a/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs b/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs index 8516bec..3baf728 100644 --- a/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs @@ -36,7 +36,7 @@ public sealed class AsusKeyboardRGBDeviceInfo : AsusRGBDeviceInfo, IKeyboardDevi #region Methods - private static string? GetKeyboardModel(string deviceName) => GENERIC_DEVICE_NAMES.Contains(deviceName) ? "Asus Keyboard" : deviceName; + private static string GetKeyboardModel(string deviceName) => GENERIC_DEVICE_NAMES.Contains(deviceName) ? "Asus Keyboard" : deviceName; #endregion } \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Native/_CUESDK.cs b/RGB.NET.Devices.Corsair/Native/_CUESDK.cs index 38324e3..6c48745 100644 --- a/RGB.NET.Devices.Corsair/Native/_CUESDK.cs +++ b/RGB.NET.Devices.Corsair/Native/_CUESDK.cs @@ -133,7 +133,7 @@ internal static unsafe class _CUESDK if (OperatingSystem.IsWindows()) possibleLibraryPaths = Environment.Is64BitProcess ? CorsairDeviceProvider.PossibleX64NativePaths : CorsairDeviceProvider.PossibleX86NativePaths; else - possibleLibraryPaths = Enumerable.Empty(); + possibleLibraryPaths = []; return possibleLibraryPaths.Select(Environment.ExpandEnvironmentVariables); } diff --git a/RGB.NET.Devices.Corsair_Legacy/Custom/CorsairCustomRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair_Legacy/Custom/CorsairCustomRGBDeviceInfo.cs index 783089e..967bd5d 100644 --- a/RGB.NET.Devices.Corsair_Legacy/Custom/CorsairCustomRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair_Legacy/Custom/CorsairCustomRGBDeviceInfo.cs @@ -124,16 +124,19 @@ public class CorsairCustomRGBDeviceInfo : CorsairRGBDeviceInfo // 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 ((model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 138)) return "LS100 LED Strip (dual monitor)"; - else if ((model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 84)) + + if ((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 ((model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 15)) + if ((model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 15)) return "LS100 LED Strip (short)"; - else if ((model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 27)) + + if ((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"; + return "LED Strip"; case CorsairChannelDeviceType.DAP: return "DAP Fan"; diff --git a/RGB.NET.Devices.Corsair_Legacy/Native/_CUESDK.cs b/RGB.NET.Devices.Corsair_Legacy/Native/_CUESDK.cs index 3ace435..dda97dd 100644 --- a/RGB.NET.Devices.Corsair_Legacy/Native/_CUESDK.cs +++ b/RGB.NET.Devices.Corsair_Legacy/Native/_CUESDK.cs @@ -64,7 +64,7 @@ internal static class _CUESDK if (OperatingSystem.IsWindows()) possibleLibraryPaths = Environment.Is64BitProcess ? CorsairLegacyDeviceProvider.PossibleX64NativePaths : CorsairLegacyDeviceProvider.PossibleX86NativePaths; else - possibleLibraryPaths = Enumerable.Empty(); + possibleLibraryPaths = []; return possibleLibraryPaths.Select(Environment.ExpandEnvironmentVariables); } diff --git a/RGB.NET.Devices.Logitech/HID/LightspeedHidLoader.cs b/RGB.NET.Devices.Logitech/HID/LightspeedHidLoader.cs index 4d0aeac..e1dc242 100644 --- a/RGB.NET.Devices.Logitech/HID/LightspeedHidLoader.cs +++ b/RGB.NET.Devices.Logitech/HID/LightspeedHidLoader.cs @@ -139,7 +139,7 @@ public sealed class LightspeedHIDLoader : IEnumerable : IEnumerable : IEnumerable : IEnumerable(); + possibleLibraryPaths = []; return possibleLibraryPaths.Select(Environment.ExpandEnvironmentVariables); } diff --git a/RGB.NET.Devices.Msi/Native/_MsiSDK.cs b/RGB.NET.Devices.Msi/Native/_MsiSDK.cs index 1bc63fd..91fbd92 100644 --- a/RGB.NET.Devices.Msi/Native/_MsiSDK.cs +++ b/RGB.NET.Devices.Msi/Native/_MsiSDK.cs @@ -68,7 +68,7 @@ internal static class _MsiSDK if (OperatingSystem.IsWindows()) possibleLibraryPaths = Environment.Is64BitProcess ? MsiDeviceProvider.PossibleX64NativePaths : MsiDeviceProvider.PossibleX86NativePaths; else - possibleLibraryPaths = Enumerable.Empty(); + possibleLibraryPaths = []; return possibleLibraryPaths.Select(Environment.ExpandEnvironmentVariables); } diff --git a/RGB.NET.Devices.Razer/Native/_RazerSDK.cs b/RGB.NET.Devices.Razer/Native/_RazerSDK.cs index 4b99cc6..e7f7196 100644 --- a/RGB.NET.Devices.Razer/Native/_RazerSDK.cs +++ b/RGB.NET.Devices.Razer/Native/_RazerSDK.cs @@ -64,7 +64,7 @@ internal static class _RazerSDK if (OperatingSystem.IsWindows()) possibleLibraryPaths = Environment.Is64BitProcess ? RazerDeviceProvider.PossibleX64NativePaths : RazerDeviceProvider.PossibleX86NativePaths; else - possibleLibraryPaths = Enumerable.Empty(); + possibleLibraryPaths = []; return possibleLibraryPaths.Select(Environment.ExpandEnvironmentVariables); } diff --git a/RGB.NET.Devices.Wooting/Native/_WootingSDK.cs b/RGB.NET.Devices.Wooting/Native/_WootingSDK.cs index cc0018c..0d4f7bb 100644 --- a/RGB.NET.Devices.Wooting/Native/_WootingSDK.cs +++ b/RGB.NET.Devices.Wooting/Native/_WootingSDK.cs @@ -64,7 +64,7 @@ internal static class _WootingSDK else if (OperatingSystem.IsMacOS()) possibleLibraryPaths = WootingDeviceProvider.PossibleNativePathsMacOS; else - possibleLibraryPaths = Enumerable.Empty(); + possibleLibraryPaths = []; return possibleLibraryPaths.Select(Environment.ExpandEnvironmentVariables); }