From b7099aa7e2b08bbb9352faad0e1577b1531a4979 Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Sun, 16 Jun 2019 12:19:45 +0200 Subject: [PATCH 1/4] Moved current Asus-Implementation (v2-SDK) to a legacy-project --- .../AsusDeviceProvider.cs | 1 + .../AsusDeviceProviderLoader.cs | 0 .../Dram/AsusDramRGBDevice.cs | 0 .../Dram/AsusDramRGBDeviceInfo.cs | 0 .../Enum/AsusLogicalKeyboardLayout.cs | 0 .../Enum/AsusPhysicalKeyboardLayout.cs | 0 .../Generic/AsusRGBDevice.cs | 0 .../Generic/AsusRGBDeviceInfo.cs | 0 .../Generic/AsusUpdateQueue.cs | 0 .../Generic/IAsusRGBDevice.cs | 0 .../GraphicsCard/AsusGraphicsCardRGBDevice.cs | 0 .../GraphicsCard/AsusGraphicsCardRGBDeviceInfo.cs | 0 .../Helper/WMIHelper.cs | 0 .../Keyboard/AsusKeyboardRGBDevice.cs | 0 .../Keyboard/AsusKeyboardRGBDeviceInfo.cs | 0 .../Layouts/Asus/Mainboards/PRIMEX370-PRO.xml | 0 .../Layouts/DeviceLayout.xsd | 0 .../Mainboard/AsusMainboardRGBDevice.cs | 0 .../Mainboard/AsusMainboardRGBDeviceInfo.cs | 0 .../Mouse/AsusMouseRGBDevice.cs | 0 .../Mouse/AsusMouseRGBDeviceInfo.cs | 0 .../Native/_AsusSDK.cs | 0 .../RGB.NET.Devices.Asus.csproj.DotSettings | 0 .../RGB.NET.Devices.Asus_Legacy.csproj | 6 +++--- .../RGB.NET.Devices.Asus_Legacy.csproj.DotSettings | 10 ++++++++++ RGB.NET.sln | 4 ++-- 26 files changed, 16 insertions(+), 5 deletions(-) rename {RGB.NET.Devices.Asus => RGB.NET.Devices.Asus_Legacy}/AsusDeviceProvider.cs (99%) rename {RGB.NET.Devices.Asus => RGB.NET.Devices.Asus_Legacy}/AsusDeviceProviderLoader.cs (100%) rename {RGB.NET.Devices.Asus => RGB.NET.Devices.Asus_Legacy}/Dram/AsusDramRGBDevice.cs (100%) rename {RGB.NET.Devices.Asus => RGB.NET.Devices.Asus_Legacy}/Dram/AsusDramRGBDeviceInfo.cs (100%) rename {RGB.NET.Devices.Asus => RGB.NET.Devices.Asus_Legacy}/Enum/AsusLogicalKeyboardLayout.cs (100%) rename {RGB.NET.Devices.Asus => RGB.NET.Devices.Asus_Legacy}/Enum/AsusPhysicalKeyboardLayout.cs (100%) rename {RGB.NET.Devices.Asus => RGB.NET.Devices.Asus_Legacy}/Generic/AsusRGBDevice.cs (100%) rename {RGB.NET.Devices.Asus => RGB.NET.Devices.Asus_Legacy}/Generic/AsusRGBDeviceInfo.cs (100%) rename {RGB.NET.Devices.Asus => RGB.NET.Devices.Asus_Legacy}/Generic/AsusUpdateQueue.cs (100%) rename {RGB.NET.Devices.Asus => RGB.NET.Devices.Asus_Legacy}/Generic/IAsusRGBDevice.cs (100%) rename {RGB.NET.Devices.Asus => RGB.NET.Devices.Asus_Legacy}/GraphicsCard/AsusGraphicsCardRGBDevice.cs (100%) rename {RGB.NET.Devices.Asus => RGB.NET.Devices.Asus_Legacy}/GraphicsCard/AsusGraphicsCardRGBDeviceInfo.cs (100%) rename {RGB.NET.Devices.Asus => RGB.NET.Devices.Asus_Legacy}/Helper/WMIHelper.cs (100%) rename {RGB.NET.Devices.Asus => RGB.NET.Devices.Asus_Legacy}/Keyboard/AsusKeyboardRGBDevice.cs (100%) rename {RGB.NET.Devices.Asus => RGB.NET.Devices.Asus_Legacy}/Keyboard/AsusKeyboardRGBDeviceInfo.cs (100%) rename {RGB.NET.Devices.Asus => RGB.NET.Devices.Asus_Legacy}/Layouts/Asus/Mainboards/PRIMEX370-PRO.xml (100%) rename {RGB.NET.Devices.Asus => RGB.NET.Devices.Asus_Legacy}/Layouts/DeviceLayout.xsd (100%) rename {RGB.NET.Devices.Asus => RGB.NET.Devices.Asus_Legacy}/Mainboard/AsusMainboardRGBDevice.cs (100%) rename {RGB.NET.Devices.Asus => RGB.NET.Devices.Asus_Legacy}/Mainboard/AsusMainboardRGBDeviceInfo.cs (100%) rename {RGB.NET.Devices.Asus => RGB.NET.Devices.Asus_Legacy}/Mouse/AsusMouseRGBDevice.cs (100%) rename {RGB.NET.Devices.Asus => RGB.NET.Devices.Asus_Legacy}/Mouse/AsusMouseRGBDeviceInfo.cs (100%) rename {RGB.NET.Devices.Asus => RGB.NET.Devices.Asus_Legacy}/Native/_AsusSDK.cs (100%) rename {RGB.NET.Devices.Asus => RGB.NET.Devices.Asus_Legacy}/RGB.NET.Devices.Asus.csproj.DotSettings (100%) rename RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj => RGB.NET.Devices.Asus_Legacy/RGB.NET.Devices.Asus_Legacy.csproj (92%) create mode 100644 RGB.NET.Devices.Asus_Legacy/RGB.NET.Devices.Asus_Legacy.csproj.DotSettings diff --git a/RGB.NET.Devices.Asus/AsusDeviceProvider.cs b/RGB.NET.Devices.Asus_Legacy/AsusDeviceProvider.cs similarity index 99% rename from RGB.NET.Devices.Asus/AsusDeviceProvider.cs rename to RGB.NET.Devices.Asus_Legacy/AsusDeviceProvider.cs index 4d60169..4ca979a 100644 --- a/RGB.NET.Devices.Asus/AsusDeviceProvider.cs +++ b/RGB.NET.Devices.Asus_Legacy/AsusDeviceProvider.cs @@ -15,6 +15,7 @@ namespace RGB.NET.Devices.Asus /// /// Represents a device provider responsible for Cooler Master devices. /// + [Obsolete("Use this only if you need syncback-capability")] public class AsusDeviceProvider : IRGBDeviceProvider { #region Properties & Fields diff --git a/RGB.NET.Devices.Asus/AsusDeviceProviderLoader.cs b/RGB.NET.Devices.Asus_Legacy/AsusDeviceProviderLoader.cs similarity index 100% rename from RGB.NET.Devices.Asus/AsusDeviceProviderLoader.cs rename to RGB.NET.Devices.Asus_Legacy/AsusDeviceProviderLoader.cs diff --git a/RGB.NET.Devices.Asus/Dram/AsusDramRGBDevice.cs b/RGB.NET.Devices.Asus_Legacy/Dram/AsusDramRGBDevice.cs similarity index 100% rename from RGB.NET.Devices.Asus/Dram/AsusDramRGBDevice.cs rename to RGB.NET.Devices.Asus_Legacy/Dram/AsusDramRGBDevice.cs diff --git a/RGB.NET.Devices.Asus/Dram/AsusDramRGBDeviceInfo.cs b/RGB.NET.Devices.Asus_Legacy/Dram/AsusDramRGBDeviceInfo.cs similarity index 100% rename from RGB.NET.Devices.Asus/Dram/AsusDramRGBDeviceInfo.cs rename to RGB.NET.Devices.Asus_Legacy/Dram/AsusDramRGBDeviceInfo.cs diff --git a/RGB.NET.Devices.Asus/Enum/AsusLogicalKeyboardLayout.cs b/RGB.NET.Devices.Asus_Legacy/Enum/AsusLogicalKeyboardLayout.cs similarity index 100% rename from RGB.NET.Devices.Asus/Enum/AsusLogicalKeyboardLayout.cs rename to RGB.NET.Devices.Asus_Legacy/Enum/AsusLogicalKeyboardLayout.cs diff --git a/RGB.NET.Devices.Asus/Enum/AsusPhysicalKeyboardLayout.cs b/RGB.NET.Devices.Asus_Legacy/Enum/AsusPhysicalKeyboardLayout.cs similarity index 100% rename from RGB.NET.Devices.Asus/Enum/AsusPhysicalKeyboardLayout.cs rename to RGB.NET.Devices.Asus_Legacy/Enum/AsusPhysicalKeyboardLayout.cs diff --git a/RGB.NET.Devices.Asus/Generic/AsusRGBDevice.cs b/RGB.NET.Devices.Asus_Legacy/Generic/AsusRGBDevice.cs similarity index 100% rename from RGB.NET.Devices.Asus/Generic/AsusRGBDevice.cs rename to RGB.NET.Devices.Asus_Legacy/Generic/AsusRGBDevice.cs diff --git a/RGB.NET.Devices.Asus/Generic/AsusRGBDeviceInfo.cs b/RGB.NET.Devices.Asus_Legacy/Generic/AsusRGBDeviceInfo.cs similarity index 100% rename from RGB.NET.Devices.Asus/Generic/AsusRGBDeviceInfo.cs rename to RGB.NET.Devices.Asus_Legacy/Generic/AsusRGBDeviceInfo.cs diff --git a/RGB.NET.Devices.Asus/Generic/AsusUpdateQueue.cs b/RGB.NET.Devices.Asus_Legacy/Generic/AsusUpdateQueue.cs similarity index 100% rename from RGB.NET.Devices.Asus/Generic/AsusUpdateQueue.cs rename to RGB.NET.Devices.Asus_Legacy/Generic/AsusUpdateQueue.cs diff --git a/RGB.NET.Devices.Asus/Generic/IAsusRGBDevice.cs b/RGB.NET.Devices.Asus_Legacy/Generic/IAsusRGBDevice.cs similarity index 100% rename from RGB.NET.Devices.Asus/Generic/IAsusRGBDevice.cs rename to RGB.NET.Devices.Asus_Legacy/Generic/IAsusRGBDevice.cs diff --git a/RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDevice.cs b/RGB.NET.Devices.Asus_Legacy/GraphicsCard/AsusGraphicsCardRGBDevice.cs similarity index 100% rename from RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDevice.cs rename to RGB.NET.Devices.Asus_Legacy/GraphicsCard/AsusGraphicsCardRGBDevice.cs diff --git a/RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDeviceInfo.cs b/RGB.NET.Devices.Asus_Legacy/GraphicsCard/AsusGraphicsCardRGBDeviceInfo.cs similarity index 100% rename from RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDeviceInfo.cs rename to RGB.NET.Devices.Asus_Legacy/GraphicsCard/AsusGraphicsCardRGBDeviceInfo.cs diff --git a/RGB.NET.Devices.Asus/Helper/WMIHelper.cs b/RGB.NET.Devices.Asus_Legacy/Helper/WMIHelper.cs similarity index 100% rename from RGB.NET.Devices.Asus/Helper/WMIHelper.cs rename to RGB.NET.Devices.Asus_Legacy/Helper/WMIHelper.cs diff --git a/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDevice.cs b/RGB.NET.Devices.Asus_Legacy/Keyboard/AsusKeyboardRGBDevice.cs similarity index 100% rename from RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDevice.cs rename to RGB.NET.Devices.Asus_Legacy/Keyboard/AsusKeyboardRGBDevice.cs diff --git a/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs b/RGB.NET.Devices.Asus_Legacy/Keyboard/AsusKeyboardRGBDeviceInfo.cs similarity index 100% rename from RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs rename to RGB.NET.Devices.Asus_Legacy/Keyboard/AsusKeyboardRGBDeviceInfo.cs diff --git a/RGB.NET.Devices.Asus/Layouts/Asus/Mainboards/PRIMEX370-PRO.xml b/RGB.NET.Devices.Asus_Legacy/Layouts/Asus/Mainboards/PRIMEX370-PRO.xml similarity index 100% rename from RGB.NET.Devices.Asus/Layouts/Asus/Mainboards/PRIMEX370-PRO.xml rename to RGB.NET.Devices.Asus_Legacy/Layouts/Asus/Mainboards/PRIMEX370-PRO.xml diff --git a/RGB.NET.Devices.Asus/Layouts/DeviceLayout.xsd b/RGB.NET.Devices.Asus_Legacy/Layouts/DeviceLayout.xsd similarity index 100% rename from RGB.NET.Devices.Asus/Layouts/DeviceLayout.xsd rename to RGB.NET.Devices.Asus_Legacy/Layouts/DeviceLayout.xsd diff --git a/RGB.NET.Devices.Asus/Mainboard/AsusMainboardRGBDevice.cs b/RGB.NET.Devices.Asus_Legacy/Mainboard/AsusMainboardRGBDevice.cs similarity index 100% rename from RGB.NET.Devices.Asus/Mainboard/AsusMainboardRGBDevice.cs rename to RGB.NET.Devices.Asus_Legacy/Mainboard/AsusMainboardRGBDevice.cs diff --git a/RGB.NET.Devices.Asus/Mainboard/AsusMainboardRGBDeviceInfo.cs b/RGB.NET.Devices.Asus_Legacy/Mainboard/AsusMainboardRGBDeviceInfo.cs similarity index 100% rename from RGB.NET.Devices.Asus/Mainboard/AsusMainboardRGBDeviceInfo.cs rename to RGB.NET.Devices.Asus_Legacy/Mainboard/AsusMainboardRGBDeviceInfo.cs diff --git a/RGB.NET.Devices.Asus/Mouse/AsusMouseRGBDevice.cs b/RGB.NET.Devices.Asus_Legacy/Mouse/AsusMouseRGBDevice.cs similarity index 100% rename from RGB.NET.Devices.Asus/Mouse/AsusMouseRGBDevice.cs rename to RGB.NET.Devices.Asus_Legacy/Mouse/AsusMouseRGBDevice.cs diff --git a/RGB.NET.Devices.Asus/Mouse/AsusMouseRGBDeviceInfo.cs b/RGB.NET.Devices.Asus_Legacy/Mouse/AsusMouseRGBDeviceInfo.cs similarity index 100% rename from RGB.NET.Devices.Asus/Mouse/AsusMouseRGBDeviceInfo.cs rename to RGB.NET.Devices.Asus_Legacy/Mouse/AsusMouseRGBDeviceInfo.cs diff --git a/RGB.NET.Devices.Asus/Native/_AsusSDK.cs b/RGB.NET.Devices.Asus_Legacy/Native/_AsusSDK.cs similarity index 100% rename from RGB.NET.Devices.Asus/Native/_AsusSDK.cs rename to RGB.NET.Devices.Asus_Legacy/Native/_AsusSDK.cs diff --git a/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj.DotSettings b/RGB.NET.Devices.Asus_Legacy/RGB.NET.Devices.Asus.csproj.DotSettings similarity index 100% rename from RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj.DotSettings rename to RGB.NET.Devices.Asus_Legacy/RGB.NET.Devices.Asus.csproj.DotSettings diff --git a/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj b/RGB.NET.Devices.Asus_Legacy/RGB.NET.Devices.Asus_Legacy.csproj similarity index 92% rename from RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj rename to RGB.NET.Devices.Asus_Legacy/RGB.NET.Devices.Asus_Legacy.csproj index 5172398..3be7e47 100644 --- a/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj +++ b/RGB.NET.Devices.Asus_Legacy/RGB.NET.Devices.Asus_Legacy.csproj @@ -8,11 +8,11 @@ en-US en-US RGB.NET.Devices.Asus - RGB.NET.Devices.Asus + RGB.NET.Devices.Asus_Legacy RGB.NET.Devices.Asus - RGB.NET.Devices.Asus + RGB.NET.Devices.Asus_Legacy RGB.NET.Devices.Asus - Asus-Device-Implementations of RGB.NET + Asus-Device-Implementations of RGB.NET based on the v2-SDK Asus-Device-Implementations of RGB.NET, a C# (.NET) library for accessing various RGB-peripherals Copyright © Wyrez 2017 Copyright © Wyrez 2017 diff --git a/RGB.NET.Devices.Asus_Legacy/RGB.NET.Devices.Asus_Legacy.csproj.DotSettings b/RGB.NET.Devices.Asus_Legacy/RGB.NET.Devices.Asus_Legacy.csproj.DotSettings new file mode 100644 index 0000000..a88918e --- /dev/null +++ b/RGB.NET.Devices.Asus_Legacy/RGB.NET.Devices.Asus_Legacy.csproj.DotSettings @@ -0,0 +1,10 @@ + + True + True + True + True + True + True + True + True + True \ No newline at end of file diff --git a/RGB.NET.sln b/RGB.NET.sln index c61b57f..2cb5ae3 100644 --- a/RGB.NET.sln +++ b/RGB.NET.sln @@ -9,7 +9,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Presets", "Presets", "{EBC3 EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Core", "RGB.NET.Core\RGB.NET.Core.csproj", "{F3ED5768-7251-4347-8D8F-2866313DA658}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Devices.Asus", "RGB.NET.Devices.Asus\RGB.NET.Devices.Asus.csproj", "{105FD573-D165-49D1-B8EC-937570616F29}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Devices.Asus_Legacy", "RGB.NET.Devices.Asus_Legacy\RGB.NET.Devices.Asus_Legacy.csproj", "{105FD573-D165-49D1-B8EC-937570616F29}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Devices.CoolerMaster", "RGB.NET.Devices.CoolerMaster\RGB.NET.Devices.CoolerMaster.csproj", "{E8F927F5-E7CF-464A-B9AE-824C2B29A7D1}" EndProject @@ -43,7 +43,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Devices.SteelSeries EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{92D7C263-D4C9-4D26-93E2-93C1F9C2CD16}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RGB.NET.Core.Tests", "Tests\RGB.NET.Core.Tests\RGB.NET.Core.Tests.csproj", "{A3FD5AD7-040A-47CA-A278-53493A25FF8A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Core.Tests", "Tests\RGB.NET.Core.Tests\RGB.NET.Core.Tests.csproj", "{A3FD5AD7-040A-47CA-A278-53493A25FF8A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution From 8e20faa65df346002716802964e77f045b7c5454 Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Sun, 16 Jun 2019 12:25:12 +0200 Subject: [PATCH 2/4] Added new Asus-implementation based on the v3-SDK --- RGB.NET.Devices.Asus/AsusDeviceProvider.cs | 181 ++++++++++++++++++ .../AsusDeviceProviderLoader.cs | 24 +++ .../Dram/AsusDramRGBDevice.cs | 44 +++++ .../Enum/AsusLogicalKeyboardLayout.cs | 15 ++ .../Enum/AsusPhysicalKeyboardLayout.cs | 15 ++ RGB.NET.Devices.Asus/Generic/AsusRGBDevice.cs | 85 ++++++++ .../Generic/AsusRGBDeviceInfo.cs | 61 ++++++ .../Generic/AsusUnspecifiedRGBDevice.cs | 49 +++++ .../Generic/AsusUpdateQueue.cs | 69 +++++++ .../Generic/IAsusRGBDevice.cs | 12 ++ .../GraphicsCard/AsusGraphicsCardRGBDevice.cs | 43 +++++ .../Headset/AsusHeadsetRGBDevice.cs | 43 +++++ RGB.NET.Devices.Asus/Helper/WMIHelper.cs | 63 ++++++ .../Keyboard/AsusKeyboardRGBDevice.cs | 43 +++++ .../Keyboard/AsusKeyboardRGBDeviceInfo.cs | 59 ++++++ .../Layouts/Asus/Mainboards/PRIMEX370-PRO.xml | 53 +++++ RGB.NET.Devices.Asus/Layouts/DeviceLayout.xsd | 66 +++++++ .../Mainboard/AsusMainboardRGBDevice.cs | 43 +++++ .../Mouse/AsusMouseRGBDevice.cs | 42 ++++ .../RGB.NET.Devices.Asus.csproj | 80 ++++++++ .../RGB.NET.Devices.Asus.csproj.DotSettings | 1 + RGB.NET.sln | 7 + 22 files changed, 1098 insertions(+) create mode 100644 RGB.NET.Devices.Asus/AsusDeviceProvider.cs create mode 100644 RGB.NET.Devices.Asus/AsusDeviceProviderLoader.cs create mode 100644 RGB.NET.Devices.Asus/Dram/AsusDramRGBDevice.cs create mode 100644 RGB.NET.Devices.Asus/Enum/AsusLogicalKeyboardLayout.cs create mode 100644 RGB.NET.Devices.Asus/Enum/AsusPhysicalKeyboardLayout.cs create mode 100644 RGB.NET.Devices.Asus/Generic/AsusRGBDevice.cs create mode 100644 RGB.NET.Devices.Asus/Generic/AsusRGBDeviceInfo.cs create mode 100644 RGB.NET.Devices.Asus/Generic/AsusUnspecifiedRGBDevice.cs create mode 100644 RGB.NET.Devices.Asus/Generic/AsusUpdateQueue.cs create mode 100644 RGB.NET.Devices.Asus/Generic/IAsusRGBDevice.cs create mode 100644 RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDevice.cs create mode 100644 RGB.NET.Devices.Asus/Headset/AsusHeadsetRGBDevice.cs create mode 100644 RGB.NET.Devices.Asus/Helper/WMIHelper.cs create mode 100644 RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDevice.cs create mode 100644 RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs create mode 100644 RGB.NET.Devices.Asus/Layouts/Asus/Mainboards/PRIMEX370-PRO.xml create mode 100644 RGB.NET.Devices.Asus/Layouts/DeviceLayout.xsd create mode 100644 RGB.NET.Devices.Asus/Mainboard/AsusMainboardRGBDevice.cs create mode 100644 RGB.NET.Devices.Asus/Mouse/AsusMouseRGBDevice.cs create mode 100644 RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj rename {RGB.NET.Devices.Asus_Legacy => RGB.NET.Devices.Asus}/RGB.NET.Devices.Asus.csproj.DotSettings (91%) diff --git a/RGB.NET.Devices.Asus/AsusDeviceProvider.cs b/RGB.NET.Devices.Asus/AsusDeviceProvider.cs new file mode 100644 index 0000000..f8e3834 --- /dev/null +++ b/RGB.NET.Devices.Asus/AsusDeviceProvider.cs @@ -0,0 +1,181 @@ +// ReSharper disable MemberCanBePrivate.Global +// ReSharper disable UnusedMember.Global + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Globalization; +using AuraServiceLib; +using RGB.NET.Core; + +namespace RGB.NET.Devices.Asus +{ + /// + /// + /// Represents a device provider responsible for Cooler Master devices. + /// + public class AsusDeviceProvider : IRGBDeviceProvider + { + #region Properties & Fields + + private static AsusDeviceProvider _instance; + /// + /// Gets the singleton instance. + /// + public static AsusDeviceProvider Instance => _instance ?? new AsusDeviceProvider(); + + /// + /// + /// Indicates if the SDK is initialized and ready to use. + /// + public bool IsInitialized { get; private set; } + + /// + /// + /// Gets whether the application has exclusive access to the SDK or not. + /// + public bool HasExclusiveAccess { get; private set; } + + /// + public IEnumerable Devices { get; private set; } + + /// + /// Gets or sets a function to get the culture for a specific device. + /// + // ReSharper disable once AutoPropertyCanBeMadeGetOnly.Global + public Func GetCulture { get; set; } = CultureHelper.GetCurrentCulture; + + /// + /// The used to trigger the updates for asus devices. + /// + public DeviceUpdateTrigger UpdateTrigger { get; private set; } + + private IAuraSdk2 _sdk; + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + /// Thrown if this constructor is called even if there is already an instance of this class. + public AsusDeviceProvider() + { + if (_instance != null) throw new InvalidOperationException($"There can be only one instance of type {nameof(AsusDeviceProvider)}"); + _instance = this; + + UpdateTrigger = new DeviceUpdateTrigger(); + } + + #endregion + + #region Methods + + /// + public bool Initialize(RGBDeviceType loadFilter = RGBDeviceType.All, bool exclusiveAccessIfPossible = false, bool throwExceptions = false) + { + IsInitialized = false; + + try + { + UpdateTrigger?.Stop(); + + // ReSharper disable once SuspiciousTypeConversion.Global + _sdk = (IAuraSdk2)new AuraSdk(); + _sdk.SwitchMode(); + + IList devices = new List(); + foreach (IAuraSyncDevice device in _sdk.Enumerate(0)) + { + try + { + IAsusRGBDevice rgbDevice = null; + switch (device.Type) + { + case 0x00010000: //Motherboard + rgbDevice = new AsusMainboardRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Mainboard, device, WMIHelper.GetMainboardInfo()?.model ?? device.Name)); + break; + + case 0x00011000: //Motherboard LED Strip + rgbDevice = new AsusUnspecifiedRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.LedStripe, device), LedId.LedStripe1); + break; + + case 0x00020000: //VGA + rgbDevice = new AsusGraphicsCardRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.GraphicsCard, device)); + break; + + case 0x00040000: //Headset + rgbDevice = new AsusHeadsetRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Headset, device)); + break; + + case 0x00070000: //DRAM + rgbDevice = new AsusDramRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.DRAM, device)); + break; + + case 0x00080000: //Keyboard + case 0x00081000: //Notebook Keyboard + case 0x00081001: //Notebook Keyboard(4 - zone type) + rgbDevice = new AsusKeyboardRGBDevice(new AsusKeyboardRGBDeviceInfo(device, CultureInfo.CurrentCulture)); + break; + + case 0x00090000: //Mouse + rgbDevice = new AsusMouseRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Mouse, device)); + break; + + case 0x00000000: //All + case 0x00012000: //All - In - One PC + case 0x00030000: //Display + case 0x00050000: //Microphone + case 0x00060000: //External HDD + case 0x00061000: //External BD Drive + case 0x000B0000: //Chassis + case 0x000C0000: //Projector + rgbDevice = new AsusUnspecifiedRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Unknown, device), LedId.Custom1); + break; + } + + if ((rgbDevice != null) && loadFilter.HasFlag(rgbDevice.DeviceInfo.DeviceType)) + { + rgbDevice.Initialize(UpdateTrigger); + devices.Add(rgbDevice); + } + } + catch + { + if (throwExceptions) + throw; + } + } + + UpdateTrigger?.Start(); + + Devices = new ReadOnlyCollection(devices); + IsInitialized = true; + } + catch + { + if (throwExceptions) + throw; + return false; + } + return true; + } + + /// + public void ResetDevices() + { + _sdk?.ReleaseControl(0); + _sdk?.SwitchMode(); + } + + /// + public void Dispose() + { + _sdk?.ReleaseControl(0); + _sdk = null; + } + + #endregion + } +} diff --git a/RGB.NET.Devices.Asus/AsusDeviceProviderLoader.cs b/RGB.NET.Devices.Asus/AsusDeviceProviderLoader.cs new file mode 100644 index 0000000..576dfb5 --- /dev/null +++ b/RGB.NET.Devices.Asus/AsusDeviceProviderLoader.cs @@ -0,0 +1,24 @@ +using RGB.NET.Core; + +namespace RGB.NET.Devices.Asus +{ + /// + /// Represents a device provider loaded used to dynamically load asus devices into an application. + /// + public class AsusDeviceProviderLoader : IRGBDeviceProviderLoader + { + #region Properties & Fields + + /// + public bool RequiresInitialization => false; + + #endregion + + #region Methods + + /// + public IRGBDeviceProvider GetDeviceProvider() => AsusDeviceProvider.Instance; + + #endregion + } +} diff --git a/RGB.NET.Devices.Asus/Dram/AsusDramRGBDevice.cs b/RGB.NET.Devices.Asus/Dram/AsusDramRGBDevice.cs new file mode 100644 index 0000000..7e74550 --- /dev/null +++ b/RGB.NET.Devices.Asus/Dram/AsusDramRGBDevice.cs @@ -0,0 +1,44 @@ +using RGB.NET.Core; + +namespace RGB.NET.Devices.Asus +{ + /// + /// + /// Represents a Asus dram. + /// + public class AsusDramRGBDevice : AsusRGBDevice + { + #region Constructors + + /// + /// + /// Initializes a new instance of the class. + /// + /// The specific information provided by Asus for the DRAM. + internal AsusDramRGBDevice(AsusRGBDeviceInfo info) + : base(info) + { } + + #endregion + + #region Methods + + /// + protected override void InitializeLayout() + { + //TODO DarthAffe 07.10.2017: Look for a good default layout + int ledCount = DeviceInfo.Device.Lights.Count; + for (int i = 0; i < ledCount; i++) + InitializeLed(LedId.DRAM1 + i, new Rectangle(i * 10, 0, 10, 10)); + + //TODO DarthAffe 21.10.2017: We don't know the model, how to save layouts and images? + //TODO DarthAffe 07.10.2017: We don't know the model, how to save layouts and images? + ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Asus\Drams\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null); + } + + /// + protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.DRAM1; + + #endregion + } +} diff --git a/RGB.NET.Devices.Asus/Enum/AsusLogicalKeyboardLayout.cs b/RGB.NET.Devices.Asus/Enum/AsusLogicalKeyboardLayout.cs new file mode 100644 index 0000000..60105e5 --- /dev/null +++ b/RGB.NET.Devices.Asus/Enum/AsusLogicalKeyboardLayout.cs @@ -0,0 +1,15 @@ +// ReSharper disable InconsistentNaming +// ReSharper disable UnusedMember.Global + +#pragma warning disable 1591 // Missing XML comment for publicly visible type or member + +namespace RGB.NET.Devices.Asus +{ + /// + /// Contains list of available logical layouts for asus keyboards. + /// + public enum AsusLogicalKeyboardLayout + { + TODO + }; +} diff --git a/RGB.NET.Devices.Asus/Enum/AsusPhysicalKeyboardLayout.cs b/RGB.NET.Devices.Asus/Enum/AsusPhysicalKeyboardLayout.cs new file mode 100644 index 0000000..b5e80de --- /dev/null +++ b/RGB.NET.Devices.Asus/Enum/AsusPhysicalKeyboardLayout.cs @@ -0,0 +1,15 @@ +// ReSharper disable UnusedMember.Global +// ReSharper disable InconsistentNaming + +#pragma warning disable 1591 // Missing XML comment for publicly visible type or member + +namespace RGB.NET.Devices.Asus +{ + /// + /// Contains list of available physical layouts for asus keyboards. + /// + public enum AsusPhysicalKeyboardLayout + { + TODO + } +} diff --git a/RGB.NET.Devices.Asus/Generic/AsusRGBDevice.cs b/RGB.NET.Devices.Asus/Generic/AsusRGBDevice.cs new file mode 100644 index 0000000..0241828 --- /dev/null +++ b/RGB.NET.Devices.Asus/Generic/AsusRGBDevice.cs @@ -0,0 +1,85 @@ +using System.Collections.Generic; +using System.Linq; +using RGB.NET.Core; + +namespace RGB.NET.Devices.Asus +{ + /// + /// + /// + /// Represents a generic Asus-device. (keyboard, mouse, headset, mousepad). + /// + public abstract class AsusRGBDevice : AbstractRGBDevice, IAsusRGBDevice + where TDeviceInfo : AsusRGBDeviceInfo + { + #region Properties & Fields + + /// + /// + /// Gets information about the . + /// + public override TDeviceInfo DeviceInfo { get; } + + /// + /// Gets or sets the update queue performing updates for this device. + /// + // ReSharper disable once MemberCanBePrivate.Global + protected AsusUpdateQueue UpdateQueue { get; set; } + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + /// The generic information provided by Asus for the device. + protected AsusRGBDevice(TDeviceInfo info) + { + this.DeviceInfo = info; + } + + #endregion + + #region Methods + + /// + /// Initializes the device. + /// + public void Initialize(IDeviceUpdateTrigger updateTrigger) + { + InitializeLayout(); + + if (Size == Size.Invalid) + { + Rectangle ledRectangle = new Rectangle(this.Select(x => x.LedRectangle)); + Size = ledRectangle.Size + new Size(ledRectangle.Location.X, ledRectangle.Location.Y); + } + + UpdateQueue = new AsusUpdateQueue(updateTrigger); + UpdateQueue.Initialize(DeviceInfo.Device); + } + + /// + /// Initializes the and of the device. + /// + protected abstract void InitializeLayout(); + + /// + protected override void UpdateLeds(IEnumerable ledsToUpdate) => UpdateQueue.SetData(ledsToUpdate.Where(x => x.Color.A > 0)); + + /// + public override void SyncBack() + { + // DarthAffe 16.06.2019: This doesn't work since the SDK only returns the colors we set. + //foreach (Led led in LedMapping.Values) + //{ + // int index = (int)led.CustomData; + // IAuraRgbLight light = DeviceInfo.Device.Lights[index]; + // SetLedColorWithoutRequest(led, new Color(light.Red, light.Green, light.Blue)); + //} + } + + #endregion + } +} diff --git a/RGB.NET.Devices.Asus/Generic/AsusRGBDeviceInfo.cs b/RGB.NET.Devices.Asus/Generic/AsusRGBDeviceInfo.cs new file mode 100644 index 0000000..62c7ea9 --- /dev/null +++ b/RGB.NET.Devices.Asus/Generic/AsusRGBDeviceInfo.cs @@ -0,0 +1,61 @@ +using System; +using AuraServiceLib; +using RGB.NET.Core; + +namespace RGB.NET.Devices.Asus +{ + /// + /// + /// Represents a generic information for a Corsair-. + /// + public class AsusRGBDeviceInfo : IRGBDeviceInfo + { + #region Properties & Fields + + /// + public RGBDeviceType DeviceType { get; } + + /// + public string DeviceName { get; } + + /// + public string Manufacturer { get; } + + /// + public string Model { get; } + + /// + public Uri Image { get; set; } + + /// + public RGBDeviceLighting Lighting => RGBDeviceLighting.Key; + + /// + public bool SupportsSyncBack => false; + + public IAuraSyncDevice Device { get; } + + #endregion + + #region Constructors + + /// + /// Internal constructor of managed . + /// + /// The type of the . + /// The backing this RGB.NET device. + /// The manufacturer-name of the . + /// The model-name of the . + internal AsusRGBDeviceInfo(RGBDeviceType deviceType, IAuraSyncDevice device, string model = null, string manufacturer = "Asus") + { + this.DeviceType = deviceType; + this.Device = device; + this.Model = model ?? device.Name; + this.Manufacturer = manufacturer; + + DeviceName = $"{Manufacturer} {Model}"; + } + + #endregion + } +} diff --git a/RGB.NET.Devices.Asus/Generic/AsusUnspecifiedRGBDevice.cs b/RGB.NET.Devices.Asus/Generic/AsusUnspecifiedRGBDevice.cs new file mode 100644 index 0000000..3515596 --- /dev/null +++ b/RGB.NET.Devices.Asus/Generic/AsusUnspecifiedRGBDevice.cs @@ -0,0 +1,49 @@ +using RGB.NET.Core; + +namespace RGB.NET.Devices.Asus +{ + /// + /// + /// Represents a Asus headset. + /// + public class AsusUnspecifiedRGBDevice : AsusRGBDevice + { + #region Properties & Fields + + private LedId _baseLedId; + + #endregion + + #region Constructors + + /// + /// + /// Initializes a new instance of the class. + /// + /// The specific information provided by Asus for the headset. + internal AsusUnspecifiedRGBDevice(AsusRGBDeviceInfo info, LedId baseLedId) + : base(info) + { + this._baseLedId = baseLedId; + } + + #endregion + + #region Methods + + /// + protected override void InitializeLayout() + { + int ledCount = DeviceInfo.Device.Lights.Count; + for (int i = 0; i < ledCount; i++) + InitializeLed(_baseLedId + i, new Rectangle(i * 10, 0, 10, 10)); + + //TODO DarthAffe 19.05.2019: Add a way to define a layout for this kind of devies + } + + /// + protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)_baseLedId; + + #endregion + } +} diff --git a/RGB.NET.Devices.Asus/Generic/AsusUpdateQueue.cs b/RGB.NET.Devices.Asus/Generic/AsusUpdateQueue.cs new file mode 100644 index 0000000..fb32a3e --- /dev/null +++ b/RGB.NET.Devices.Asus/Generic/AsusUpdateQueue.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using AuraServiceLib; +using RGB.NET.Core; + +namespace RGB.NET.Devices.Asus +{ + /// + /// + /// Represents the update-queue performing updates for asus devices. + /// + public class AsusUpdateQueue : UpdateQueue + { + #region Properties & Fields + + /// + /// The device to be updated. + /// + protected IAuraSyncDevice Device { get; private set; } + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + /// The update trigger used by this queue. + public AsusUpdateQueue(IDeviceUpdateTrigger updateTrigger) + : base(updateTrigger) + { } + + #endregion + + #region Methods + + /// + /// Initializes the queue. + /// + /// The device to be updated. + public void Initialize(IAuraSyncDevice device) + { + Device = device; + } + + /// + protected override void Update(Dictionary dataSet) + { + try + { + foreach (KeyValuePair data in dataSet) + { + int index = (int)data.Key; + IAuraRgbLight light = Device.Lights[index]; + (_, byte r, byte g, byte b) = data.Value.GetRGBBytes(); + light.Red = r; + light.Green = g; + light.Blue = b; + } + + Device.Apply(); + } + catch (Exception ex) + { /* "The server threw an exception." seems to be a thing here ... */ } + } + + #endregion + } +} diff --git a/RGB.NET.Devices.Asus/Generic/IAsusRGBDevice.cs b/RGB.NET.Devices.Asus/Generic/IAsusRGBDevice.cs new file mode 100644 index 0000000..720fd3c --- /dev/null +++ b/RGB.NET.Devices.Asus/Generic/IAsusRGBDevice.cs @@ -0,0 +1,12 @@ +using RGB.NET.Core; + +namespace RGB.NET.Devices.Asus +{ + /// + /// Represents a asus RGB-device. + /// + internal interface IAsusRGBDevice : IRGBDevice + { + void Initialize(IDeviceUpdateTrigger updateTrigger); + } +} diff --git a/RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDevice.cs b/RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDevice.cs new file mode 100644 index 0000000..679dd4a --- /dev/null +++ b/RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDevice.cs @@ -0,0 +1,43 @@ +using RGB.NET.Core; + +namespace RGB.NET.Devices.Asus +{ + /// + /// + /// Represents a Asus graphicsCard. + /// + public class AsusGraphicsCardRGBDevice : AsusRGBDevice + { + #region Constructors + + /// + /// + /// Initializes a new instance of the class. + /// + /// The specific information provided by Asus for the graphics card. + internal AsusGraphicsCardRGBDevice(AsusRGBDeviceInfo info) + : base(info) + { } + + #endregion + + #region Methods + + /// + protected override void InitializeLayout() + { + //TODO DarthAffe 07.10.2017: Look for a good default layout + int ledCount = DeviceInfo.Device.Lights.Count; + for (int i = 0; i < ledCount; i++) + InitializeLed(LedId.GraphicsCard1 + i, new Rectangle(i * 10, 0, 10, 10)); + + //TODO DarthAffe 07.10.2017: We don't know the model, how to save layouts and images? + ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Asus\GraphicsCards\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null); + } + + /// + protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.GraphicsCard1; + + #endregion + } +} diff --git a/RGB.NET.Devices.Asus/Headset/AsusHeadsetRGBDevice.cs b/RGB.NET.Devices.Asus/Headset/AsusHeadsetRGBDevice.cs new file mode 100644 index 0000000..c221e1e --- /dev/null +++ b/RGB.NET.Devices.Asus/Headset/AsusHeadsetRGBDevice.cs @@ -0,0 +1,43 @@ +using RGB.NET.Core; + +namespace RGB.NET.Devices.Asus +{ + /// + /// + /// Represents a Asus headset. + /// + public class AsusHeadsetRGBDevice : AsusRGBDevice + { + #region Constructors + + /// + /// + /// Initializes a new instance of the class. + /// + /// The specific information provided by Asus for the headset. + internal AsusHeadsetRGBDevice(AsusRGBDeviceInfo info) + : base(info) + { } + + #endregion + + #region Methods + + /// + protected override void InitializeLayout() + { + //TODO DarthAffe 07.10.2017: Look for a good default layout + int ledCount = DeviceInfo.Device.Lights.Count; + for (int i = 0; i < ledCount; i++) + InitializeLed(LedId.Headset1 + i, new Rectangle(i * 40, 0, 40, 8)); + + //TODO DarthAffe 07.10.2017: We don't know the model, how to save layouts and images? + ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Asus\Headsets\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null); + } + + /// + protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Headset1; + + #endregion + } +} diff --git a/RGB.NET.Devices.Asus/Helper/WMIHelper.cs b/RGB.NET.Devices.Asus/Helper/WMIHelper.cs new file mode 100644 index 0000000..0ea746e --- /dev/null +++ b/RGB.NET.Devices.Asus/Helper/WMIHelper.cs @@ -0,0 +1,63 @@ +#if NETFULL +using System.Management; + +namespace RGB.NET.Devices.Asus +{ + // ReSharper disable once InconsistentNaming + internal static class WMIHelper + { + #region Properties & Fields + + private static ManagementObjectSearcher _mainboardSearcher = new ManagementObjectSearcher(@"root\CIMV2", "SELECT Manufacturer,Product FROM Win32_BaseBoard"); + private static ManagementObjectSearcher _graphicsCardSearcher = new ManagementObjectSearcher(@"root\CIMV2", "SELECT Name FROM Win32_VideoController"); + + private static (string manufacturer, string model)? _mainboardInfo; + private static string _graphicsCardInfo; + + #endregion + + #region Methods + + internal static (string manufacturer, string model)? GetMainboardInfo() + { + if (!_mainboardInfo.HasValue) + foreach (ManagementBaseObject managementBaseObject in _mainboardSearcher.Get()) + { + _mainboardInfo = (managementBaseObject["Manufacturer"]?.ToString(), managementBaseObject["Product"]?.ToString()); + break; + } + + return _mainboardInfo; + } + + internal static string GetGraphicsCardsInfo() + { + if (_graphicsCardInfo == null) + foreach (ManagementBaseObject managementBaseObject in _graphicsCardSearcher.Get()) + { + _graphicsCardInfo = managementBaseObject["Name"]?.ToString(); + break; + } + + return _graphicsCardInfo; + } + + #endregion + } +} +#else +namespace RGB.NET.Devices.Asus +{ + // ReSharper disable once InconsistentNaming + internal static class WMIHelper + { + #region Methods + + internal static (string manufacturer, string model)? GetMainboardInfo() => null; + + internal static string GetGraphicsCardsInfo() => null; + + #endregion + } +} +#endif diff --git a/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDevice.cs b/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDevice.cs new file mode 100644 index 0000000..320f39a --- /dev/null +++ b/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDevice.cs @@ -0,0 +1,43 @@ +using RGB.NET.Core; + +namespace RGB.NET.Devices.Asus +{ + /// + /// + /// Represents a Asus keyboard. + /// + public class AsusKeyboardRGBDevice : AsusRGBDevice + { + #region Constructors + + /// + /// + /// Initializes a new instance of the class. + /// + /// The specific information provided by Asus for the keyboard. + internal AsusKeyboardRGBDevice(AsusKeyboardRGBDeviceInfo info) + : base(info) + { } + + #endregion + + #region Methods + + /// + protected override void InitializeLayout() + { + //TODO DarthAffe 07.10.2017: This doesn't make sense at all ... Find someone with such a keyboard! + int ledCount = DeviceInfo.Device.Lights.Count; + for (int i = 0; i < ledCount; i++) + InitializeLed(LedId.Keyboard_Escape + i, new Rectangle(i * 19, 0, 19, 19)); + + string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper(); + ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Asus\Keyboards\{model}\{DeviceInfo.PhysicalLayout.ToString().ToUpper()}.xml"), DeviceInfo.LogicalLayout.ToString()); + } + + /// + protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Keyboard_Escape; + + #endregion + } +} diff --git a/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs b/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs new file mode 100644 index 0000000..bf020a6 --- /dev/null +++ b/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs @@ -0,0 +1,59 @@ +using System.Globalization; +using AuraServiceLib; +using RGB.NET.Core; + +namespace RGB.NET.Devices.Asus +{ + /// + /// + /// Represents a generic information for a . + /// + public class AsusKeyboardRGBDeviceInfo : AsusRGBDeviceInfo + { + #region Properties & Fields + + /// + /// Gets the physical layout of the keyboard. + /// + public AsusPhysicalKeyboardLayout PhysicalLayout { get; private set; } + + /// + /// Gets the logical layout of the keyboard. + /// + public AsusLogicalKeyboardLayout LogicalLayout { get; private set; } + + #endregion + + #region Constructors + + /// + /// + /// Internal constructor of managed . + /// + /// The backing this RGB.NET device. + /// The of the layout this keyboard is using. + internal AsusKeyboardRGBDeviceInfo(IAuraSyncDevice device, CultureInfo culture) + : base(RGBDeviceType.Keyboard, device, "Claymore") + { + SetLayouts(culture.KeyboardLayoutId); + } + + #endregion + + #region Methods + + private void SetLayouts(int keyboardLayoutId) + { + switch (keyboardLayoutId) + { + //TODO DarthAffe 07.10.2017: Implement + default: + PhysicalLayout = AsusPhysicalKeyboardLayout.TODO; + LogicalLayout = AsusLogicalKeyboardLayout.TODO; + break; + } + } + + #endregion + } +} diff --git a/RGB.NET.Devices.Asus/Layouts/Asus/Mainboards/PRIMEX370-PRO.xml b/RGB.NET.Devices.Asus/Layouts/Asus/Mainboards/PRIMEX370-PRO.xml new file mode 100644 index 0000000..ad9c378 --- /dev/null +++ b/RGB.NET.Devices.Asus/Layouts/Asus/Mainboards/PRIMEX370-PRO.xml @@ -0,0 +1,53 @@ + + + Asus Prime X370-PRO + Asus Prime X370-PRO Mainboard + Darth Affe + Mainboard + Key + Asus + Prime X370-PRO + 252 + 305 + Images\Asus\Mainboards + PRIMEX370-PRO.png + + + 0 + 131 + 35mm + 57mm + M 0,0 L 0,1 L 0.325,1 L 0.325,0 Z M 0.862,0 L 0.822,0.06 L 0.904,0.11 L 0.91,0.505 L 0.86,0.532 L 0.74,0.532 L 0.6575,0.485 L 0.54,0.485 L 0.425,0.55 L 0.425,0.64 L0.44,0.66 L0.44,0.755 L 0.4,0.78 L 0.4,1 L 0.5,1 L 0.5,0.805 L 0.53,0.785 L 0.53,0.6325 L 0.515,0.6225 L 0.515,0.575 L 0.575,0.543 L 0.6225,0.543 L 0.705,0.59 L 0.9,0.59 L 1,0.525 L 1,0.08 Z + + + 0 + + + 17mm + 40mm + M 0.83,0 L 0.83,1 L1,1 L 1,0 Z M 0,0 L 0,1 L 0.6691,1 L 0.6691,0 Z + + + 0 + + + 44mm + 41mm + + M 0,0 L 0,1 L 0.26,1 L 0.26,0 Z M 0.32,0 L 0.32,0.29 L 0.365,0.325 L 0.395,0.325 L 0.395,0.36 L 0.455,0.41 L 0.49,0.345 L 0.4675,0.32 L 0.455,0.2475 L 0.4675,0.26 L 0.395,0.2475 L 0.395,0 Z + M 0.935,0.715 L 0.935,0.84 L 0.865,0.915 L 0.865,1 L 0.9375,1 L 0.9375,0.95 L 1,0.88 L 1,0.715 Z + + + + 0 + + + 68mm + 35mm + M 0,0 L 0,1 L 0.94,1 L 0.94,0.95 L 0.206,0.95 Q 0.168,0.95 0.165,0.875 L 0.165,0 Z M 0.55,0.019 L 0.55,0.132 L 0.578,0.19 L 0.578,0.2078 L 0.612,0.271 L 0.612,0.6625 L 0.635,0.7125 L0.735,0.7125 L0.755,0.75 L 0.915,0.75 L 0.92,0.76 L 0.942,0.76 L 0.94,1 L 0.99,1 L 0.99,0.72 L 0.965,0.67 L 0.935,0.67 L 0.93,0.66 L 0.772,0.66 L 0.752,0.62 L 0.66,0.62 L 0.66,0.237 L 0.622,0.16 L 0.622,0.145 L 0.5975,0.095 L 0.5975,0.019 Z + + + 80 + 132 + 5mm + 13mm + + + \ No newline at end of file diff --git a/RGB.NET.Devices.Asus/Layouts/DeviceLayout.xsd b/RGB.NET.Devices.Asus/Layouts/DeviceLayout.xsd new file mode 100644 index 0000000..91ced39 --- /dev/null +++ b/RGB.NET.Devices.Asus/Layouts/DeviceLayout.xsd @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/RGB.NET.Devices.Asus/Mainboard/AsusMainboardRGBDevice.cs b/RGB.NET.Devices.Asus/Mainboard/AsusMainboardRGBDevice.cs new file mode 100644 index 0000000..907b704 --- /dev/null +++ b/RGB.NET.Devices.Asus/Mainboard/AsusMainboardRGBDevice.cs @@ -0,0 +1,43 @@ +using RGB.NET.Core; + +namespace RGB.NET.Devices.Asus +{ + /// + /// + /// Represents a Asus mainboard. + /// + public class AsusMainboardRGBDevice : AsusRGBDevice + { + #region Constructors + + /// + /// + /// Initializes a new instance of the class. + /// + /// The specific information provided by Asus for the mainboard. + internal AsusMainboardRGBDevice(AsusRGBDeviceInfo info) + : base(info) + { } + + #endregion + + #region Methods + + /// + protected override void InitializeLayout() + { + //TODO DarthAffe 07.10.2017: Look for a good default layout + int ledCount = DeviceInfo.Device.Lights.Count; + for (int i = 0; i < ledCount; i++) + InitializeLed(LedId.Mainboard1 + i, new Rectangle(i * 40, 0, 40, 8)); + + //TODO DarthAffe 07.10.2017: We don't know the model, how to save layouts and images? + ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Asus\Mainboards\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null); + } + + /// + protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mainboard1; + + #endregion + } +} diff --git a/RGB.NET.Devices.Asus/Mouse/AsusMouseRGBDevice.cs b/RGB.NET.Devices.Asus/Mouse/AsusMouseRGBDevice.cs new file mode 100644 index 0000000..bc9df80 --- /dev/null +++ b/RGB.NET.Devices.Asus/Mouse/AsusMouseRGBDevice.cs @@ -0,0 +1,42 @@ +using RGB.NET.Core; + +namespace RGB.NET.Devices.Asus +{ + /// + /// + /// Represents a Asus mouse. + /// + public class AsusMouseRGBDevice : AsusRGBDevice + { + #region Constructors + + /// + /// + /// Initializes a new instance of the class. + /// + /// The specific information provided by Asus for the mouse. + internal AsusMouseRGBDevice(AsusRGBDeviceInfo info) + : base(info) + { } + + #endregion + + #region Methods + + /// + protected override void InitializeLayout() + { + //TODO DarthAffe 07.10.2017: Look for a good default layout + int ledCount = DeviceInfo.Device.Lights.Count; + for (int i = 0; i < ledCount; i++) + InitializeLed(LedId.Mouse1 + i, new Rectangle(i * 10, 0, 10, 10)); + + ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Asus\Mouses\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null); + } + + /// + protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mouse1; + + #endregion + } +} diff --git a/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj b/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj new file mode 100644 index 0000000..f70f96b --- /dev/null +++ b/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj @@ -0,0 +1,80 @@ + + + netstandard2.0;net45 + win7-x86;win7-x64 + + Darth Affe + Wyrez + en-US + en-US + RGB.NET.Devices.Asus + RGB.NET.Devices.Asus + RGB.NET.Devices.Asus + RGB.NET.Devices.Asus + RGB.NET.Devices.Asus + Asus-Device-Implementations of RGB.NET + Asus-Device-Implementations of RGB.NET, a C# (.NET) library for accessing various RGB-peripherals + Copyright © Wyrez 2017 + Copyright © Wyrez 2017 + http://lib.arge.be/icon.png + https://github.com/DarthAffe/RGB.NET + https://raw.githubusercontent.com/DarthAffe/RGB.NET/master/LICENSE + Github + https://github.com/DarthAffe/RGB.NET + True + + + + 0.0.1 + 0.0.1 + 0.0.1 + + ..\bin\ + true + True + True + latest + + + + NETCORE;NETSTANDARD;NETSTANDARD2_0 + + + + NET45;NETFULL + + + + $(DefineConstants);TRACE;DEBUG + true + full + false + + + + pdbonly + true + $(NoWarn);CS1591;CS1572;CS1573 + $(DefineConstants);RELEASE + + + + + f1aa5209-5217-4b82-ba7e-a68198999afa + 1 + 0 + tlbimp + 0 + false + + + + + + + + + + + + \ No newline at end of file diff --git a/RGB.NET.Devices.Asus_Legacy/RGB.NET.Devices.Asus.csproj.DotSettings b/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj.DotSettings similarity index 91% rename from RGB.NET.Devices.Asus_Legacy/RGB.NET.Devices.Asus.csproj.DotSettings rename to RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj.DotSettings index 3818a29..942f886 100644 --- a/RGB.NET.Devices.Asus_Legacy/RGB.NET.Devices.Asus.csproj.DotSettings +++ b/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj.DotSettings @@ -4,6 +4,7 @@ True True True + True True True True diff --git a/RGB.NET.sln b/RGB.NET.sln index 2cb5ae3..e3edb01 100644 --- a/RGB.NET.sln +++ b/RGB.NET.sln @@ -45,6 +45,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{92D7C263 EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Core.Tests", "Tests\RGB.NET.Core.Tests\RGB.NET.Core.Tests.csproj", "{A3FD5AD7-040A-47CA-A278-53493A25FF8A}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Devices.Asus", "RGB.NET.Devices.Asus\RGB.NET.Devices.Asus.csproj", "{E0732B34-3F96-4DD9-AFD5-0E34B833AD6D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -123,6 +125,10 @@ Global {A3FD5AD7-040A-47CA-A278-53493A25FF8A}.Debug|Any CPU.Build.0 = Debug|Any CPU {A3FD5AD7-040A-47CA-A278-53493A25FF8A}.Release|Any CPU.ActiveCfg = Release|Any CPU {A3FD5AD7-040A-47CA-A278-53493A25FF8A}.Release|Any CPU.Build.0 = Release|Any CPU + {E0732B34-3F96-4DD9-AFD5-0E34B833AD6D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E0732B34-3F96-4DD9-AFD5-0E34B833AD6D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E0732B34-3F96-4DD9-AFD5-0E34B833AD6D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E0732B34-3F96-4DD9-AFD5-0E34B833AD6D}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -145,6 +151,7 @@ Global {0AD382DA-E999-4F74-9658-8D402EE9BF3F} = {D13032C6-432E-4F43-8A32-071133C22B16} {FFDE4387-60F2-47B6-9704-3A57D02B8C64} = {D13032C6-432E-4F43-8A32-071133C22B16} {A3FD5AD7-040A-47CA-A278-53493A25FF8A} = {92D7C263-D4C9-4D26-93E2-93C1F9C2CD16} + {E0732B34-3F96-4DD9-AFD5-0E34B833AD6D} = {D13032C6-432E-4F43-8A32-071133C22B16} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {7F222AD4-1F9E-4AAB-9D69-D62372D4C1BA} From ca1c193b6d2f2da5e58d01b9f74b0f5ca89f1f64 Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Sun, 16 Jun 2019 12:37:22 +0200 Subject: [PATCH 3/4] Included sdk-lib in nuget-package --- RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj b/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj index f70f96b..4ac5677 100644 --- a/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj +++ b/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj @@ -69,6 +69,20 @@ + + <_PackageFiles Include="$(OutputPath)\net45\Interop.AuraServiceLib.dll"> + None + lib\net45\ + + + + + <_PackageFiles Include="$(OutputPath)\netstandard2.0\Interop.AuraServiceLib.dll"> + None + lib\netstandard2.0\ + + + From 95d70bf9aa99020cc2325db85ff12b5baa2e40c0 Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Sun, 16 Jun 2019 12:37:41 +0200 Subject: [PATCH 4/4] Removed layouts from asus-device-project --- .../Layouts/Asus/Mainboards/PRIMEX370-PRO.xml | 53 --------------- RGB.NET.Devices.Asus/Layouts/DeviceLayout.xsd | 66 ------------------- .../Layouts/Asus/Mainboards/PRIMEX370-PRO.xml | 53 --------------- .../Layouts/DeviceLayout.xsd | 66 ------------------- 4 files changed, 238 deletions(-) delete mode 100644 RGB.NET.Devices.Asus/Layouts/Asus/Mainboards/PRIMEX370-PRO.xml delete mode 100644 RGB.NET.Devices.Asus/Layouts/DeviceLayout.xsd delete mode 100644 RGB.NET.Devices.Asus_Legacy/Layouts/Asus/Mainboards/PRIMEX370-PRO.xml delete mode 100644 RGB.NET.Devices.Asus_Legacy/Layouts/DeviceLayout.xsd diff --git a/RGB.NET.Devices.Asus/Layouts/Asus/Mainboards/PRIMEX370-PRO.xml b/RGB.NET.Devices.Asus/Layouts/Asus/Mainboards/PRIMEX370-PRO.xml deleted file mode 100644 index ad9c378..0000000 --- a/RGB.NET.Devices.Asus/Layouts/Asus/Mainboards/PRIMEX370-PRO.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - Asus Prime X370-PRO - Asus Prime X370-PRO Mainboard - Darth Affe - Mainboard - Key - Asus - Prime X370-PRO - 252 - 305 - Images\Asus\Mainboards - PRIMEX370-PRO.png - - - 0 - 131 - 35mm - 57mm - M 0,0 L 0,1 L 0.325,1 L 0.325,0 Z M 0.862,0 L 0.822,0.06 L 0.904,0.11 L 0.91,0.505 L 0.86,0.532 L 0.74,0.532 L 0.6575,0.485 L 0.54,0.485 L 0.425,0.55 L 0.425,0.64 L0.44,0.66 L0.44,0.755 L 0.4,0.78 L 0.4,1 L 0.5,1 L 0.5,0.805 L 0.53,0.785 L 0.53,0.6325 L 0.515,0.6225 L 0.515,0.575 L 0.575,0.543 L 0.6225,0.543 L 0.705,0.59 L 0.9,0.59 L 1,0.525 L 1,0.08 Z - - - 0 - + - 17mm - 40mm - M 0.83,0 L 0.83,1 L1,1 L 1,0 Z M 0,0 L 0,1 L 0.6691,1 L 0.6691,0 Z - - - 0 - + - 44mm - 41mm - - M 0,0 L 0,1 L 0.26,1 L 0.26,0 Z M 0.32,0 L 0.32,0.29 L 0.365,0.325 L 0.395,0.325 L 0.395,0.36 L 0.455,0.41 L 0.49,0.345 L 0.4675,0.32 L 0.455,0.2475 L 0.4675,0.26 L 0.395,0.2475 L 0.395,0 Z - M 0.935,0.715 L 0.935,0.84 L 0.865,0.915 L 0.865,1 L 0.9375,1 L 0.9375,0.95 L 1,0.88 L 1,0.715 Z - - - - 0 - + - 68mm - 35mm - M 0,0 L 0,1 L 0.94,1 L 0.94,0.95 L 0.206,0.95 Q 0.168,0.95 0.165,0.875 L 0.165,0 Z M 0.55,0.019 L 0.55,0.132 L 0.578,0.19 L 0.578,0.2078 L 0.612,0.271 L 0.612,0.6625 L 0.635,0.7125 L0.735,0.7125 L0.755,0.75 L 0.915,0.75 L 0.92,0.76 L 0.942,0.76 L 0.94,1 L 0.99,1 L 0.99,0.72 L 0.965,0.67 L 0.935,0.67 L 0.93,0.66 L 0.772,0.66 L 0.752,0.62 L 0.66,0.62 L 0.66,0.237 L 0.622,0.16 L 0.622,0.145 L 0.5975,0.095 L 0.5975,0.019 Z - - - 80 - 132 - 5mm - 13mm - - - \ No newline at end of file diff --git a/RGB.NET.Devices.Asus/Layouts/DeviceLayout.xsd b/RGB.NET.Devices.Asus/Layouts/DeviceLayout.xsd deleted file mode 100644 index 91ced39..0000000 --- a/RGB.NET.Devices.Asus/Layouts/DeviceLayout.xsd +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/RGB.NET.Devices.Asus_Legacy/Layouts/Asus/Mainboards/PRIMEX370-PRO.xml b/RGB.NET.Devices.Asus_Legacy/Layouts/Asus/Mainboards/PRIMEX370-PRO.xml deleted file mode 100644 index ad9c378..0000000 --- a/RGB.NET.Devices.Asus_Legacy/Layouts/Asus/Mainboards/PRIMEX370-PRO.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - Asus Prime X370-PRO - Asus Prime X370-PRO Mainboard - Darth Affe - Mainboard - Key - Asus - Prime X370-PRO - 252 - 305 - Images\Asus\Mainboards - PRIMEX370-PRO.png - - - 0 - 131 - 35mm - 57mm - M 0,0 L 0,1 L 0.325,1 L 0.325,0 Z M 0.862,0 L 0.822,0.06 L 0.904,0.11 L 0.91,0.505 L 0.86,0.532 L 0.74,0.532 L 0.6575,0.485 L 0.54,0.485 L 0.425,0.55 L 0.425,0.64 L0.44,0.66 L0.44,0.755 L 0.4,0.78 L 0.4,1 L 0.5,1 L 0.5,0.805 L 0.53,0.785 L 0.53,0.6325 L 0.515,0.6225 L 0.515,0.575 L 0.575,0.543 L 0.6225,0.543 L 0.705,0.59 L 0.9,0.59 L 1,0.525 L 1,0.08 Z - - - 0 - + - 17mm - 40mm - M 0.83,0 L 0.83,1 L1,1 L 1,0 Z M 0,0 L 0,1 L 0.6691,1 L 0.6691,0 Z - - - 0 - + - 44mm - 41mm - - M 0,0 L 0,1 L 0.26,1 L 0.26,0 Z M 0.32,0 L 0.32,0.29 L 0.365,0.325 L 0.395,0.325 L 0.395,0.36 L 0.455,0.41 L 0.49,0.345 L 0.4675,0.32 L 0.455,0.2475 L 0.4675,0.26 L 0.395,0.2475 L 0.395,0 Z - M 0.935,0.715 L 0.935,0.84 L 0.865,0.915 L 0.865,1 L 0.9375,1 L 0.9375,0.95 L 1,0.88 L 1,0.715 Z - - - - 0 - + - 68mm - 35mm - M 0,0 L 0,1 L 0.94,1 L 0.94,0.95 L 0.206,0.95 Q 0.168,0.95 0.165,0.875 L 0.165,0 Z M 0.55,0.019 L 0.55,0.132 L 0.578,0.19 L 0.578,0.2078 L 0.612,0.271 L 0.612,0.6625 L 0.635,0.7125 L0.735,0.7125 L0.755,0.75 L 0.915,0.75 L 0.92,0.76 L 0.942,0.76 L 0.94,1 L 0.99,1 L 0.99,0.72 L 0.965,0.67 L 0.935,0.67 L 0.93,0.66 L 0.772,0.66 L 0.752,0.62 L 0.66,0.62 L 0.66,0.237 L 0.622,0.16 L 0.622,0.145 L 0.5975,0.095 L 0.5975,0.019 Z - - - 80 - 132 - 5mm - 13mm - - - \ No newline at end of file diff --git a/RGB.NET.Devices.Asus_Legacy/Layouts/DeviceLayout.xsd b/RGB.NET.Devices.Asus_Legacy/Layouts/DeviceLayout.xsd deleted file mode 100644 index 91ced39..0000000 --- a/RGB.NET.Devices.Asus_Legacy/Layouts/DeviceLayout.xsd +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file