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

Merge pull request #76 from DarthAffe/SDK/Asus

Updated asus-provider to use the v3-SDK
This commit is contained in:
DarthAffe 2019-06-16 17:30:39 +02:00 committed by GitHub
commit cf20bd1a0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
39 changed files with 1310 additions and 425 deletions

View File

@ -5,9 +5,8 @@ using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Runtime.InteropServices;
using AuraServiceLib;
using RGB.NET.Core;
using RGB.NET.Devices.Asus.Native;
namespace RGB.NET.Devices.Asus
{
@ -25,29 +24,12 @@ namespace RGB.NET.Devices.Asus
/// </summary>
public static AsusDeviceProvider Instance => _instance ?? new AsusDeviceProvider();
/// <summary>
/// Gets a modifiable list of paths used to find the native SDK-dlls for x86 applications.
/// The first match will be used.
/// </summary>
public static List<string> PossibleX86NativePaths { get; } = new List<string> { "x86/AURA_SDK.dll" };
/// <summary>
/// Gets a modifiable list of paths used to find the native SDK-dlls for x64 applications.
/// The first match will be used.
/// </summary>
public static List<string> PossibleX64NativePaths { get; } = new List<string> { };
/// <inheritdoc />
/// <summary>
/// Indicates if the SDK is initialized and ready to use.
/// </summary>
public bool IsInitialized { get; private set; }
/// <summary>
/// Gets the loaded architecture (x64/x86).
/// </summary>
public string LoadedArchitecture => _AsusSDK.LoadedArchitecture;
/// <inheritdoc />
/// <summary>
/// Gets whether the application has exclusive access to the SDK or not.
@ -68,6 +50,8 @@ namespace RGB.NET.Devices.Asus
/// </summary>
public DeviceUpdateTrigger UpdateTrigger { get; private set; }
private IAuraSdk2 _sdk;
#endregion
#region Constructors
@ -97,137 +81,73 @@ namespace RGB.NET.Devices.Asus
{
UpdateTrigger?.Stop();
_AsusSDK.Reload();
// ReSharper disable once SuspiciousTypeConversion.Global
_sdk = (IAuraSdk2)new AuraSdk();
_sdk.SwitchMode();
IList<IRGBDevice> devices = new List<IRGBDevice>();
#region Mainboard
if (loadFilter.HasFlag(RGBDeviceType.Mainboard))
foreach (IAuraSyncDevice device in _sdk.Enumerate(0))
{
try
{
//TODO DarthAffe 26.11.2017: This is not a fix! There might really be a second controller on the mainboard, but for now this should prevent the random crash for some guys.
// DarthAffe 26.11.2017: https://rog.asus.com/forum/showthread.php?97754-Access-Violation-Wrong-EnumerateMB-Result&p=688901#post688901
int mainboardCount = Math.Min(1, _AsusSDK.EnumerateMbController(IntPtr.Zero, 0));
if (mainboardCount > 0)
IAsusRGBDevice rgbDevice = null;
switch (device.Type)
{
IntPtr mainboardHandles = Marshal.AllocHGlobal(mainboardCount * IntPtr.Size);
_AsusSDK.EnumerateMbController(mainboardHandles, mainboardCount);
case 0x00010000: //Motherboard
rgbDevice = new AsusMainboardRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Mainboard, device, WMIHelper.GetMainboardInfo()?.model ?? device.Name));
break;
for (int i = 0; i < mainboardCount; i++)
{
try
{
IntPtr handle = Marshal.ReadIntPtr(mainboardHandles, i);
_AsusSDK.SetMbMode(handle, 1);
AsusMainboardRGBDevice device = new AsusMainboardRGBDevice(new AsusMainboardRGBDeviceInfo(RGBDeviceType.Mainboard, handle));
device.Initialize(UpdateTrigger);
devices.Add(device);
}
catch { if (throwExceptions) throw; }
}
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; }
#endregion
#region Graphics cards
//TODO DarthAffe 21.10.2017: This somehow returns non-existant gpus (at least for me) which cause huge lags (if a real asus-ready gpu is connected this doesn't happen)
if (loadFilter.HasFlag(RGBDeviceType.GraphicsCard))
try
catch
{
int graphicCardCount = _AsusSDK.EnumerateGPU(IntPtr.Zero, 0);
if (graphicCardCount > 0)
{
IntPtr grapicsCardHandles = Marshal.AllocHGlobal(graphicCardCount * IntPtr.Size);
_AsusSDK.EnumerateGPU(grapicsCardHandles, graphicCardCount);
for (int i = 0; i < graphicCardCount; i++)
{
try
{
IntPtr handle = Marshal.ReadIntPtr(grapicsCardHandles, i);
_AsusSDK.SetGPUMode(handle, 1);
AsusGraphicsCardRGBDevice device = new AsusGraphicsCardRGBDevice(new AsusGraphicsCardRGBDeviceInfo(RGBDeviceType.GraphicsCard, handle));
device.Initialize(UpdateTrigger);
devices.Add(device);
}
catch { if (throwExceptions) throw; }
}
}
if (throwExceptions)
throw;
}
catch { if (throwExceptions) throw; }
}
#endregion
#region DRAM
//TODO DarthAffe 29.10.2017: I don't know why they are even documented, but the asus guy said they aren't in the SDK right now.
//try
//{
//int dramCount = _AsusSDK.EnumerateDram(IntPtr.Zero, 0);
//if (dramCount > 0)
//{
// IntPtr dramHandles = Marshal.AllocHGlobal(dramCount * IntPtr.Size);
// _AsusSDK.EnumerateDram(dramHandles, dramCount);
// for (int i = 0; i < dramCount; i++)
// {
//try
//{
// IntPtr handle = Marshal.ReadIntPtr(dramHandles, i);
// _AsusSDK.SetDramMode(handle, 1);
// AsusDramRGBDevice device = new AsusDramRGBDevice(new AsusDramRGBDeviceInfo(RGBDeviceType.DRAM, handle));
// device.Initialize(UpdateTrigger);
// devices.Add(device);
// }
//catch { if (throwExceptions) throw; }
// }
//}
//}
// catch { if (throwExceptions) throw; }
#endregion
#region Keyboard
if (loadFilter.HasFlag(RGBDeviceType.Keyboard))
try
{
IntPtr keyboardHandle = Marshal.AllocHGlobal(IntPtr.Size);
if (_AsusSDK.CreateClaymoreKeyboard(keyboardHandle))
{
_AsusSDK.SetClaymoreKeyboardMode(keyboardHandle, 1);
AsusKeyboardRGBDevice device = new AsusKeyboardRGBDevice(new AsusKeyboardRGBDeviceInfo(RGBDeviceType.Keyboard, keyboardHandle, GetCulture()));
device.Initialize(UpdateTrigger);
devices.Add(device);
}
}
catch { if (throwExceptions) throw; }
#endregion
#region Mouse
if (loadFilter.HasFlag(RGBDeviceType.Mouse))
try
{
IntPtr mouseHandle = Marshal.AllocHGlobal(IntPtr.Size);
if (_AsusSDK.CreateRogMouse(mouseHandle))
{
_AsusSDK.SetRogMouseMode(mouseHandle, 1);
AsusMouseRGBDevice device = new AsusMouseRGBDevice(new AsusMouseRGBDeviceInfo(RGBDeviceType.Mouse, mouseHandle));
device.Initialize(UpdateTrigger);
devices.Add(device);
}
}
catch { if (throwExceptions) throw; }
#endregion
UpdateTrigger?.Start();
Devices = new ReadOnlyCollection<IRGBDevice>(devices);
@ -239,34 +159,22 @@ namespace RGB.NET.Devices.Asus
throw;
return false;
}
return true;
}
/// <inheritdoc />
public void ResetDevices()
{
foreach (IRGBDevice device in Devices)
{
AsusRGBDeviceInfo deviceInfo = (AsusRGBDeviceInfo)device.DeviceInfo;
switch (deviceInfo.DeviceType)
{
case RGBDeviceType.Mainboard:
_AsusSDK.SetMbMode(deviceInfo.Handle, 0);
break;
case RGBDeviceType.GraphicsCard:
_AsusSDK.SetGPUMode(deviceInfo.Handle, 0);
break;
//case RGBDeviceType.DRAM:
// _AsusSDK.SetDramMode(deviceInfo.Handle, 0);
// break;
}
}
_sdk?.ReleaseControl(0);
_sdk?.SwitchMode();
}
/// <inheritdoc />
public void Dispose()
{ }
{
_sdk?.ReleaseControl(0);
_sdk = null;
}
#endregion
}

View File

@ -1,56 +1,44 @@
//using RGB.NET.Core;
//using RGB.NET.Devices.Asus.Native;
using RGB.NET.Core;
//namespace RGB.NET.Devices.Asus
//{
// /// <inheritdoc />
// /// <summary>
// /// Represents a Asus dram.
// /// </summary>
// public class AsusDramRGBDevice : AsusRGBDevice
// {
// #region Properties & Fields
namespace RGB.NET.Devices.Asus
{
/// <inheritdoc />
/// <summary>
/// Represents a Asus dram.
/// </summary>
public class AsusDramRGBDevice : AsusRGBDevice<AsusRGBDeviceInfo>
{
#region Constructors
// /// <summary>
// /// Gets information about the <see cref="AsusDramRGBDevice"/>.
// /// </summary>
// public AsusDramRGBDeviceInfo DramDeviceInfo { get; }
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Asus.AsusDramRGBDevice" /> class.
/// </summary>
/// <param name="info">The specific information provided by Asus for the DRAM.</param>
internal AsusDramRGBDevice(AsusRGBDeviceInfo info)
: base(info)
{ }
// #endregion
#endregion
// #region Constructors
#region Methods
// /// <inheritdoc />
// /// <summary>
// /// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Asus.AsusDramRGBDevice" /> class.
// /// </summary>
// /// <param name="info">The specific information provided by Asus for the DRAM.</param>
// internal AsusDramRGBDevice(AsusDramRGBDeviceInfo info)
// : base(info)
// {
// this.DramDeviceInfo = info;
// }
/// <inheritdoc />
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));
// #endregion
//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);
}
// #region Methods
/// <inheritdoc />
protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.DRAM1;
// /// <inheritdoc />
// protected override void InitializeLayout()
// {
// //TODO DarthAffe 21.10.2017: Look for a good default layout
// int ledCount = _AsusSDK.GetGPULedCount(DramDeviceInfo.Handle);
// for (int i = 0; i < ledCount; i++)
// InitializeLed(new AsusLedId(this, AsusLedIds.DramLed1 + i, 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?
// ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Asus\Drams\{DramDeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"),
// null, PathHelper.GetAbsolutePath(@"Images\Asus\Drams"));
// }
// /// <inheritdoc />
// protected override void ApplyColorData() => _AsusSDK.SetDramColor(DramDeviceInfo.Handle, ColorData);
// #endregion
// }
//}
#endregion
}
}

View File

@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using RGB.NET.Core;
namespace RGB.NET.Devices.Asus
@ -59,7 +57,7 @@ namespace RGB.NET.Devices.Asus
}
UpdateQueue = new AsusUpdateQueue(updateTrigger);
UpdateQueue.Initialize(GetUpdateColorAction(), DeviceInfo.Handle, LedMapping.Count);
UpdateQueue.Initialize(DeviceInfo.Device);
}
/// <summary>
@ -70,20 +68,16 @@ namespace RGB.NET.Devices.Asus
/// <inheritdoc />
protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate) => UpdateQueue.SetData(ledsToUpdate.Where(x => x.Color.A > 0));
/// <summary>
/// Gets a action to update the physical device.
/// </summary>
/// <returns></returns>
protected abstract Action<IntPtr, byte[]> GetUpdateColorAction();
/// <inheritdoc cref="IDisposable.Dispose" />
/// <inheritdoc cref="AbstractRGBDevice{TDeviceInfo}.Dispose" />
public override void Dispose()
/// <inheritdoc />
public override void SyncBack()
{
if ((DeviceInfo is AsusRGBDeviceInfo deviceInfo) && (deviceInfo.Handle != IntPtr.Zero))
Marshal.FreeHGlobal(deviceInfo.Handle);
base.Dispose();
// 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

View File

@ -1,4 +1,5 @@
using System;
using AuraServiceLib;
using RGB.NET.Core;
namespace RGB.NET.Devices.Asus
@ -7,7 +8,7 @@ namespace RGB.NET.Devices.Asus
/// <summary>
/// Represents a generic information for a Corsair-<see cref="T:RGB.NET.Core.IRGBDevice" />.
/// </summary>
public abstract class AsusRGBDeviceInfo : IRGBDeviceInfo
public class AsusRGBDeviceInfo : IRGBDeviceInfo
{
#region Properties & Fields
@ -30,12 +31,9 @@ namespace RGB.NET.Devices.Asus
public RGBDeviceLighting Lighting => RGBDeviceLighting.Key;
/// <inheritdoc />
public abstract bool SupportsSyncBack { get; }
public bool SupportsSyncBack => false;
/// <summary>
/// Gets the index of the <see cref="AsusRGBDevice{TDeviceInfo}"/>.
/// </summary>
internal IntPtr Handle { get; }
public IAuraSyncDevice Device { get; }
#endregion
@ -45,14 +43,14 @@ namespace RGB.NET.Devices.Asus
/// Internal constructor of managed <see cref="AsusRGBDeviceInfo"/>.
/// </summary>
/// <param name="deviceType">The type of the <see cref="IRGBDevice"/>.</param>
/// <param name="handle">The handle of the <see cref="IRGBDevice"/>.</param>
/// <param name="device">The <see cref="IAuraSyncDevice"/> backing this RGB.NET device.</param>
/// <param name="manufacturer">The manufacturer-name of the <see cref="IRGBDevice"/>.</param>
/// <param name="model">The model-name of the <see cref="IRGBDevice"/>.</param>
internal AsusRGBDeviceInfo(RGBDeviceType deviceType, IntPtr handle, string model = "Generic Asus-Device", string manufacturer = "Asus")
internal AsusRGBDeviceInfo(RGBDeviceType deviceType, IAuraSyncDevice device, string model = null, string manufacturer = "Asus")
{
this.DeviceType = deviceType;
this.Handle = handle;
this.Model = model;
this.Device = device;
this.Model = model ?? device.Name;
this.Manufacturer = manufacturer;
DeviceName = $"{Manufacturer} {Model}";

View File

@ -0,0 +1,49 @@
using RGB.NET.Core;
namespace RGB.NET.Devices.Asus
{
/// <inheritdoc />
/// <summary>
/// Represents a Asus headset.
/// </summary>
public class AsusUnspecifiedRGBDevice : AsusRGBDevice<AsusRGBDeviceInfo>
{
#region Properties & Fields
private LedId _baseLedId;
#endregion
#region Constructors
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Asus.AsusHeadsetRGBDevice" /> class.
/// </summary>
/// <param name="info">The specific information provided by Asus for the headset.</param>
internal AsusUnspecifiedRGBDevice(AsusRGBDeviceInfo info, LedId baseLedId)
: base(info)
{
this._baseLedId = baseLedId;
}
#endregion
#region Methods
/// <inheritdoc />
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
}
/// <inheritdoc />
protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)_baseLedId;
#endregion
}
}

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using AuraServiceLib;
using RGB.NET.Core;
namespace RGB.NET.Devices.Asus
@ -13,13 +14,9 @@ namespace RGB.NET.Devices.Asus
#region Properties & Fields
/// <summary>
/// Gets or sets the internal color-data cache.
/// The device to be updated.
/// </summary>
// ReSharper disable once MemberCanBePrivate.Global
protected byte[] ColorData { get; private set; }
private Action<IntPtr, byte[]> _updateAction;
private IntPtr _handle;
protected IAuraSyncDevice Device { get; private set; }
#endregion
@ -40,29 +37,31 @@ namespace RGB.NET.Devices.Asus
/// <summary>
/// Initializes the queue.
/// </summary>
/// <param name="updateAction">The update-action called by the queue to perform updates.</param>
/// <param name="handle">The handle of the device this queue performs updates for.</param>
/// <param name="ledCount">The amount of leds of the device this queue performs updates for.</param>
public void Initialize(Action<IntPtr, byte[]> updateAction, IntPtr handle, int ledCount)
/// <param name="device">The device to be updated.</param>
public void Initialize(IAuraSyncDevice device)
{
_updateAction = updateAction;
_handle = handle;
ColorData = new byte[ledCount * 3];
Device = device;
}
/// <inheritdoc />
protected override void Update(Dictionary<object, Color> dataSet)
{
foreach (KeyValuePair<object, Color> data in dataSet)
try
{
int index = ((int)data.Key) * 3;
ColorData[index] = data.Value.GetR();
ColorData[index + 1] = data.Value.GetB();
ColorData[index + 2] = data.Value.GetG();
}
foreach (KeyValuePair<object, Color> 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;
}
_updateAction(_handle, ColorData);
Device.Apply();
}
catch (Exception ex)
{ /* "The server threw an exception." seems to be a thing here ... */ }
}
#endregion

View File

@ -1,6 +1,4 @@
using System;
using RGB.NET.Core;
using RGB.NET.Devices.Asus.Native;
using RGB.NET.Core;
namespace RGB.NET.Devices.Asus
{
@ -8,7 +6,7 @@ namespace RGB.NET.Devices.Asus
/// <summary>
/// Represents a Asus graphicsCard.
/// </summary>
public class AsusGraphicsCardRGBDevice : AsusRGBDevice<AsusGraphicsCardRGBDeviceInfo>
public class AsusGraphicsCardRGBDevice : AsusRGBDevice<AsusRGBDeviceInfo>
{
#region Constructors
@ -17,7 +15,7 @@ namespace RGB.NET.Devices.Asus
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Asus.AsusGraphicsCardRGBDevice" /> class.
/// </summary>
/// <param name="info">The specific information provided by Asus for the graphics card.</param>
internal AsusGraphicsCardRGBDevice(AsusGraphicsCardRGBDeviceInfo info)
internal AsusGraphicsCardRGBDevice(AsusRGBDeviceInfo info)
: base(info)
{ }
@ -29,7 +27,7 @@ namespace RGB.NET.Devices.Asus
protected override void InitializeLayout()
{
//TODO DarthAffe 07.10.2017: Look for a good default layout
int ledCount = _AsusSDK.GetGPULedCount(DeviceInfo.Handle);
int ledCount = DeviceInfo.Device.Lights.Count;
for (int i = 0; i < ledCount; i++)
InitializeLed(LedId.GraphicsCard1 + i, new Rectangle(i * 10, 0, 10, 10));
@ -40,9 +38,6 @@ namespace RGB.NET.Devices.Asus
/// <inheritdoc />
protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.GraphicsCard1;
/// <inheritdoc />
protected override Action<IntPtr, byte[]> GetUpdateColorAction() => _AsusSDK.SetGPUColor;
#endregion
}
}

View File

@ -0,0 +1,43 @@
using RGB.NET.Core;
namespace RGB.NET.Devices.Asus
{
/// <inheritdoc />
/// <summary>
/// Represents a Asus headset.
/// </summary>
public class AsusHeadsetRGBDevice : AsusRGBDevice<AsusRGBDeviceInfo>
{
#region Constructors
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Asus.AsusHeadsetRGBDevice" /> class.
/// </summary>
/// <param name="info">The specific information provided by Asus for the headset.</param>
internal AsusHeadsetRGBDevice(AsusRGBDeviceInfo info)
: base(info)
{ }
#endregion
#region Methods
/// <inheritdoc />
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);
}
/// <inheritdoc />
protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Headset1;
#endregion
}
}

View File

@ -1,6 +1,4 @@
using System;
using RGB.NET.Core;
using RGB.NET.Devices.Asus.Native;
using RGB.NET.Core;
namespace RGB.NET.Devices.Asus
{
@ -29,7 +27,7 @@ namespace RGB.NET.Devices.Asus
protected override void InitializeLayout()
{
//TODO DarthAffe 07.10.2017: This doesn't make sense at all ... Find someone with such a keyboard!
int ledCount = _AsusSDK.GetClaymoreKeyboardLedCount(DeviceInfo.Handle);
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));
@ -40,9 +38,6 @@ namespace RGB.NET.Devices.Asus
/// <inheritdoc />
protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Keyboard_Escape;
/// <inheritdoc />
protected override Action<IntPtr, byte[]> GetUpdateColorAction() => _AsusSDK.SetClaymoreKeyboardColor;
#endregion
}
}

View File

@ -1,5 +1,5 @@
using System;
using System.Globalization;
using System.Globalization;
using AuraServiceLib;
using RGB.NET.Core;
namespace RGB.NET.Devices.Asus
@ -12,9 +12,6 @@ namespace RGB.NET.Devices.Asus
{
#region Properties & Fields
/// <inheritdoc />
public override bool SupportsSyncBack => false;
/// <summary>
/// Gets the physical layout of the keyboard.
/// </summary>
@ -33,11 +30,10 @@ namespace RGB.NET.Devices.Asus
/// <summary>
/// Internal constructor of managed <see cref="T:RGB.NET.Devices.Asus.AsusKeyboardRGBDeviceInfo" />.
/// </summary>
/// <param name="deviceType">The type of the <see cref="IRGBDevice"/>.</param>
/// <param name="handle">The handle of the <see cref="IRGBDevice"/>.</param>
/// <param name="device">The <see cref="IAuraSyncDevice"/> backing this RGB.NET device.</param>
/// <param name="culture">The <see cref="T:System.Globalization.CultureInfo" /> of the layout this keyboard is using.</param>
internal AsusKeyboardRGBDeviceInfo(RGBDeviceType deviceType, IntPtr handle, CultureInfo culture)
: base(deviceType, handle, "Claymore")
internal AsusKeyboardRGBDeviceInfo(IAuraSyncDevice device, CultureInfo culture)
: base(RGBDeviceType.Keyboard, device, "Claymore")
{
SetLayouts(culture.KeyboardLayoutId);
}

View File

@ -1,53 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Device xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Name>Asus Prime X370-PRO</Name>
<Description>Asus Prime X370-PRO Mainboard</Description>
<Author>Darth Affe</Author>
<Type>Mainboard</Type>
<Lighting>Key</Lighting>
<Vendor>Asus</Vendor>
<Model>Prime X370-PRO</Model>
<Width>252</Width>
<Height>305</Height>
<ImageBasePath>Images\Asus\Mainboards</ImageBasePath>
<DeviceImage>PRIMEX370-PRO.png</DeviceImage>
<Leds>
<Led Id="Mainboard1">
<X>0</X>
<Y>131</Y>
<Width>35mm</Width>
<Height>57mm</Height>
<Shape>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</Shape>
</Led>
<Led Id="Mainboard2">
<X>0</X>
<Y>+</Y>
<Width>17mm</Width>
<Height>40mm</Height>
<Shape>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</Shape>
</Led>
<Led Id="Mainboard3">
<X>0</X>
<Y>+</Y>
<Width>44mm</Width>
<Height>41mm</Height>
<Shape>
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
</Shape>
</Led>
<Led Id="Mainboard4">
<X>0</X>
<Y>+</Y>
<Width>68mm</Width>
<Height>35mm</Height>
<Shape>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</Shape>
</Led>
<Led Id="Mainboard5">
<X>80</X>
<Y>132</Y>
<Width>5mm</Width>
<Height>13mm</Height>
</Led>
</Leds>
</Device>

View File

@ -1,66 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified">
<xsd:element name="Device">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Name" type="xsd:string" />
<xsd:element name="Description" type="xsd:string" />
<xsd:element name="Author" type="xsd:string" />
<xsd:element name="Type" type="xsd:string" />
<xsd:element name="Lighting" type="xsd:string" />
<xsd:element name="Vendor" type="xsd:string" />
<xsd:element name="Model" type="xsd:string" />
<xsd:element name="Shape" type="xsd:string" />
<xsd:element name="Width" type="xsd:double" />
<xsd:element name="Height" type="xsd:double" />
<xsd:element name="ImageBasePath" type="xsd:string" />
<xsd:element name="DeviceImage" type="xsd:string" />
<xsd:element name="LedUnitWidth" type="xsd:double" />
<xsd:element name="LedUnitHeight" type="xsd:double" />
<xsd:element name="Leds">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" name="Led">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Shape" type="xsd:string" />
<xsd:element name="X" type="xsd:string" />
<xsd:element name="Y" type="xsd:string" />
<xsd:element name="Width" type="xsd:string" />
<xsd:element name="Height" type="xsd:string" />
</xsd:sequence>
<xsd:attribute name="Id" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="LedImageLayouts">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" name="LedImageLayout">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="LedImages">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" name="LedImage">
<xsd:complexType>
<xsd:attribute name="Id" type="xsd:string" use="required" />
<xsd:attribute name="Image" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="Layout" type="xsd:string" />
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xs:schema>

View File

@ -1,6 +1,4 @@
using System;
using RGB.NET.Core;
using RGB.NET.Devices.Asus.Native;
using RGB.NET.Core;
namespace RGB.NET.Devices.Asus
{
@ -8,7 +6,7 @@ namespace RGB.NET.Devices.Asus
/// <summary>
/// Represents a Asus mainboard.
/// </summary>
public class AsusMainboardRGBDevice : AsusRGBDevice<AsusMainboardRGBDeviceInfo>
public class AsusMainboardRGBDevice : AsusRGBDevice<AsusRGBDeviceInfo>
{
#region Constructors
@ -17,7 +15,7 @@ namespace RGB.NET.Devices.Asus
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Asus.AsusMainboardRGBDevice" /> class.
/// </summary>
/// <param name="info">The specific information provided by Asus for the mainboard.</param>
internal AsusMainboardRGBDevice(AsusMainboardRGBDeviceInfo info)
internal AsusMainboardRGBDevice(AsusRGBDeviceInfo info)
: base(info)
{ }
@ -29,7 +27,7 @@ namespace RGB.NET.Devices.Asus
protected override void InitializeLayout()
{
//TODO DarthAffe 07.10.2017: Look for a good default layout
int ledCount = _AsusSDK.GetMbLedCount(DeviceInfo.Handle);
int ledCount = DeviceInfo.Device.Lights.Count;
for (int i = 0; i < ledCount; i++)
InitializeLed(LedId.Mainboard1 + i, new Rectangle(i * 40, 0, 40, 8));
@ -40,17 +38,6 @@ namespace RGB.NET.Devices.Asus
/// <inheritdoc />
protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mainboard1;
/// <inheritdoc />
public override void SyncBack()
{
byte[] colorData = _AsusSDK.GetMbColor(DeviceInfo.Handle);
for (int i = 0; i < LedMapping.Count; i++)
SetLedColorWithoutRequest(LedMapping[LedId.Mainboard1 + i], new Color(colorData[(i * 3)], colorData[(i * 3) + 2], colorData[(i * 3) + 1]));
}
/// <inheritdoc />
protected override Action<IntPtr, byte[]> GetUpdateColorAction() => _AsusSDK.SetMbColor;
#endregion
}
}

View File

@ -1,6 +1,4 @@
using System;
using RGB.NET.Core;
using RGB.NET.Devices.Asus.Native;
using RGB.NET.Core;
namespace RGB.NET.Devices.Asus
{
@ -8,7 +6,7 @@ namespace RGB.NET.Devices.Asus
/// <summary>
/// Represents a Asus mouse.
/// </summary>
public class AsusMouseRGBDevice : AsusRGBDevice<AsusMouseRGBDeviceInfo>
public class AsusMouseRGBDevice : AsusRGBDevice<AsusRGBDeviceInfo>
{
#region Constructors
@ -17,7 +15,7 @@ namespace RGB.NET.Devices.Asus
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Asus.AsusMouseRGBDevice" /> class.
/// </summary>
/// <param name="info">The specific information provided by Asus for the mouse.</param>
internal AsusMouseRGBDevice(AsusMouseRGBDeviceInfo info)
internal AsusMouseRGBDevice(AsusRGBDeviceInfo info)
: base(info)
{ }
@ -29,7 +27,7 @@ namespace RGB.NET.Devices.Asus
protected override void InitializeLayout()
{
//TODO DarthAffe 07.10.2017: Look for a good default layout
int ledCount = _AsusSDK.GetRogMouseLedCount(DeviceInfo.Handle);
int ledCount = DeviceInfo.Device.Lights.Count;
for (int i = 0; i < ledCount; i++)
InitializeLed(LedId.Mouse1 + i, new Rectangle(i * 10, 0, 10, 10));
@ -39,9 +37,6 @@ namespace RGB.NET.Devices.Asus
/// <inheritdoc />
protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mouse1;
/// <inheritdoc />
protected override Action<IntPtr, byte[]> GetUpdateColorAction() => _AsusSDK.SetRogMouseColor;
#endregion
}
}

View File

@ -58,6 +58,31 @@
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
<ItemGroup>
<COMReference Include="AuraServiceLib.dll">
<Guid>f1aa5209-5217-4b82-ba7e-a68198999afa</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<WrapperTool>tlbimp</WrapperTool>
<Lcid>0</Lcid>
<Isolated>false</Isolated>
</COMReference>
</ItemGroup>
<ItemGroup>
<_PackageFiles Include="$(OutputPath)\net45\Interop.AuraServiceLib.dll">
<BuildAction>None</BuildAction>
<PackagePath>lib\net45\</PackagePath>
</_PackageFiles>
</ItemGroup>
<ItemGroup>
<_PackageFiles Include="$(OutputPath)\netstandard2.0\Interop.AuraServiceLib.dll">
<BuildAction>None</BuildAction>
<PackagePath>lib\netstandard2.0\</PackagePath>
</_PackageFiles>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RGB.NET.Core\RGB.NET.Core.csproj" />
</ItemGroup>

View File

@ -4,6 +4,7 @@
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=generic/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=generic_005Cupdate/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=graphicscard/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=headset/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=helper/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=keyboard/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=mainboard/@EntryIndexedValue">True</s:Boolean>

View File

@ -0,0 +1,274 @@
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedMember.Global
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Runtime.InteropServices;
using RGB.NET.Core;
using RGB.NET.Devices.Asus.Native;
namespace RGB.NET.Devices.Asus
{
/// <inheritdoc />
/// <summary>
/// Represents a device provider responsible for Cooler Master devices.
/// </summary>
[Obsolete("Use this only if you need syncback-capability")]
public class AsusDeviceProvider : IRGBDeviceProvider
{
#region Properties & Fields
private static AsusDeviceProvider _instance;
/// <summary>
/// Gets the singleton <see cref="AsusDeviceProvider"/> instance.
/// </summary>
public static AsusDeviceProvider Instance => _instance ?? new AsusDeviceProvider();
/// <summary>
/// Gets a modifiable list of paths used to find the native SDK-dlls for x86 applications.
/// The first match will be used.
/// </summary>
public static List<string> PossibleX86NativePaths { get; } = new List<string> { "x86/AURA_SDK.dll" };
/// <summary>
/// Gets a modifiable list of paths used to find the native SDK-dlls for x64 applications.
/// The first match will be used.
/// </summary>
public static List<string> PossibleX64NativePaths { get; } = new List<string> { };
/// <inheritdoc />
/// <summary>
/// Indicates if the SDK is initialized and ready to use.
/// </summary>
public bool IsInitialized { get; private set; }
/// <summary>
/// Gets the loaded architecture (x64/x86).
/// </summary>
public string LoadedArchitecture => _AsusSDK.LoadedArchitecture;
/// <inheritdoc />
/// <summary>
/// Gets whether the application has exclusive access to the SDK or not.
/// </summary>
public bool HasExclusiveAccess { get; private set; }
/// <inheritdoc />
public IEnumerable<IRGBDevice> Devices { get; private set; }
/// <summary>
/// Gets or sets a function to get the culture for a specific device.
/// </summary>
// ReSharper disable once AutoPropertyCanBeMadeGetOnly.Global
public Func<CultureInfo> GetCulture { get; set; } = CultureHelper.GetCurrentCulture;
/// <summary>
/// The <see cref="DeviceUpdateTrigger"/> used to trigger the updates for asus devices.
/// </summary>
public DeviceUpdateTrigger UpdateTrigger { get; private set; }
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="AsusDeviceProvider"/> class.
/// </summary>
/// <exception cref="InvalidOperationException">Thrown if this constructor is called even if there is already an instance of this class.</exception>
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
/// <inheritdoc />
public bool Initialize(RGBDeviceType loadFilter = RGBDeviceType.All, bool exclusiveAccessIfPossible = false, bool throwExceptions = false)
{
IsInitialized = false;
try
{
UpdateTrigger?.Stop();
_AsusSDK.Reload();
IList<IRGBDevice> devices = new List<IRGBDevice>();
#region Mainboard
if (loadFilter.HasFlag(RGBDeviceType.Mainboard))
try
{
//TODO DarthAffe 26.11.2017: This is not a fix! There might really be a second controller on the mainboard, but for now this should prevent the random crash for some guys.
// DarthAffe 26.11.2017: https://rog.asus.com/forum/showthread.php?97754-Access-Violation-Wrong-EnumerateMB-Result&p=688901#post688901
int mainboardCount = Math.Min(1, _AsusSDK.EnumerateMbController(IntPtr.Zero, 0));
if (mainboardCount > 0)
{
IntPtr mainboardHandles = Marshal.AllocHGlobal(mainboardCount * IntPtr.Size);
_AsusSDK.EnumerateMbController(mainboardHandles, mainboardCount);
for (int i = 0; i < mainboardCount; i++)
{
try
{
IntPtr handle = Marshal.ReadIntPtr(mainboardHandles, i);
_AsusSDK.SetMbMode(handle, 1);
AsusMainboardRGBDevice device = new AsusMainboardRGBDevice(new AsusMainboardRGBDeviceInfo(RGBDeviceType.Mainboard, handle));
device.Initialize(UpdateTrigger);
devices.Add(device);
}
catch { if (throwExceptions) throw; }
}
}
}
catch { if (throwExceptions) throw; }
#endregion
#region Graphics cards
//TODO DarthAffe 21.10.2017: This somehow returns non-existant gpus (at least for me) which cause huge lags (if a real asus-ready gpu is connected this doesn't happen)
if (loadFilter.HasFlag(RGBDeviceType.GraphicsCard))
try
{
int graphicCardCount = _AsusSDK.EnumerateGPU(IntPtr.Zero, 0);
if (graphicCardCount > 0)
{
IntPtr grapicsCardHandles = Marshal.AllocHGlobal(graphicCardCount * IntPtr.Size);
_AsusSDK.EnumerateGPU(grapicsCardHandles, graphicCardCount);
for (int i = 0; i < graphicCardCount; i++)
{
try
{
IntPtr handle = Marshal.ReadIntPtr(grapicsCardHandles, i);
_AsusSDK.SetGPUMode(handle, 1);
AsusGraphicsCardRGBDevice device = new AsusGraphicsCardRGBDevice(new AsusGraphicsCardRGBDeviceInfo(RGBDeviceType.GraphicsCard, handle));
device.Initialize(UpdateTrigger);
devices.Add(device);
}
catch { if (throwExceptions) throw; }
}
}
}
catch { if (throwExceptions) throw; }
#endregion
#region DRAM
//TODO DarthAffe 29.10.2017: I don't know why they are even documented, but the asus guy said they aren't in the SDK right now.
//try
//{
//int dramCount = _AsusSDK.EnumerateDram(IntPtr.Zero, 0);
//if (dramCount > 0)
//{
// IntPtr dramHandles = Marshal.AllocHGlobal(dramCount * IntPtr.Size);
// _AsusSDK.EnumerateDram(dramHandles, dramCount);
// for (int i = 0; i < dramCount; i++)
// {
//try
//{
// IntPtr handle = Marshal.ReadIntPtr(dramHandles, i);
// _AsusSDK.SetDramMode(handle, 1);
// AsusDramRGBDevice device = new AsusDramRGBDevice(new AsusDramRGBDeviceInfo(RGBDeviceType.DRAM, handle));
// device.Initialize(UpdateTrigger);
// devices.Add(device);
// }
//catch { if (throwExceptions) throw; }
// }
//}
//}
// catch { if (throwExceptions) throw; }
#endregion
#region Keyboard
if (loadFilter.HasFlag(RGBDeviceType.Keyboard))
try
{
IntPtr keyboardHandle = Marshal.AllocHGlobal(IntPtr.Size);
if (_AsusSDK.CreateClaymoreKeyboard(keyboardHandle))
{
_AsusSDK.SetClaymoreKeyboardMode(keyboardHandle, 1);
AsusKeyboardRGBDevice device = new AsusKeyboardRGBDevice(new AsusKeyboardRGBDeviceInfo(RGBDeviceType.Keyboard, keyboardHandle, GetCulture()));
device.Initialize(UpdateTrigger);
devices.Add(device);
}
}
catch { if (throwExceptions) throw; }
#endregion
#region Mouse
if (loadFilter.HasFlag(RGBDeviceType.Mouse))
try
{
IntPtr mouseHandle = Marshal.AllocHGlobal(IntPtr.Size);
if (_AsusSDK.CreateRogMouse(mouseHandle))
{
_AsusSDK.SetRogMouseMode(mouseHandle, 1);
AsusMouseRGBDevice device = new AsusMouseRGBDevice(new AsusMouseRGBDeviceInfo(RGBDeviceType.Mouse, mouseHandle));
device.Initialize(UpdateTrigger);
devices.Add(device);
}
}
catch { if (throwExceptions) throw; }
#endregion
UpdateTrigger?.Start();
Devices = new ReadOnlyCollection<IRGBDevice>(devices);
IsInitialized = true;
}
catch
{
if (throwExceptions)
throw;
return false;
}
return true;
}
/// <inheritdoc />
public void ResetDevices()
{
foreach (IRGBDevice device in Devices)
{
AsusRGBDeviceInfo deviceInfo = (AsusRGBDeviceInfo)device.DeviceInfo;
switch (deviceInfo.DeviceType)
{
case RGBDeviceType.Mainboard:
_AsusSDK.SetMbMode(deviceInfo.Handle, 0);
break;
case RGBDeviceType.GraphicsCard:
_AsusSDK.SetGPUMode(deviceInfo.Handle, 0);
break;
//case RGBDeviceType.DRAM:
// _AsusSDK.SetDramMode(deviceInfo.Handle, 0);
// break;
}
}
}
/// <inheritdoc />
public void Dispose()
{ }
#endregion
}
}

View File

@ -0,0 +1,24 @@
using RGB.NET.Core;
namespace RGB.NET.Devices.Asus
{
/// <summary>
/// Represents a device provider loaded used to dynamically load asus devices into an application.
/// </summary>
public class AsusDeviceProviderLoader : IRGBDeviceProviderLoader
{
#region Properties & Fields
/// <inheritdoc />
public bool RequiresInitialization => false;
#endregion
#region Methods
/// <inheritdoc />
public IRGBDeviceProvider GetDeviceProvider() => AsusDeviceProvider.Instance;
#endregion
}
}

View File

@ -0,0 +1,56 @@
//using RGB.NET.Core;
//using RGB.NET.Devices.Asus.Native;
//namespace RGB.NET.Devices.Asus
//{
// /// <inheritdoc />
// /// <summary>
// /// Represents a Asus dram.
// /// </summary>
// public class AsusDramRGBDevice : AsusRGBDevice
// {
// #region Properties & Fields
// /// <summary>
// /// Gets information about the <see cref="AsusDramRGBDevice"/>.
// /// </summary>
// public AsusDramRGBDeviceInfo DramDeviceInfo { get; }
// #endregion
// #region Constructors
// /// <inheritdoc />
// /// <summary>
// /// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Asus.AsusDramRGBDevice" /> class.
// /// </summary>
// /// <param name="info">The specific information provided by Asus for the DRAM.</param>
// internal AsusDramRGBDevice(AsusDramRGBDeviceInfo info)
// : base(info)
// {
// this.DramDeviceInfo = info;
// }
// #endregion
// #region Methods
// /// <inheritdoc />
// protected override void InitializeLayout()
// {
// //TODO DarthAffe 21.10.2017: Look for a good default layout
// int ledCount = _AsusSDK.GetGPULedCount(DramDeviceInfo.Handle);
// for (int i = 0; i < ledCount; i++)
// InitializeLed(new AsusLedId(this, AsusLedIds.DramLed1 + i, 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?
// ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Asus\Drams\{DramDeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"),
// null, PathHelper.GetAbsolutePath(@"Images\Asus\Drams"));
// }
// /// <inheritdoc />
// protected override void ApplyColorData() => _AsusSDK.SetDramColor(DramDeviceInfo.Handle, ColorData);
// #endregion
// }
//}

View File

@ -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
{
/// <summary>
/// Contains list of available logical layouts for asus keyboards.
/// </summary>
public enum AsusLogicalKeyboardLayout
{
TODO
};
}

View File

@ -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
{
/// <summary>
/// Contains list of available physical layouts for asus keyboards.
/// </summary>
public enum AsusPhysicalKeyboardLayout
{
TODO
}
}

View File

@ -0,0 +1,91 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using RGB.NET.Core;
namespace RGB.NET.Devices.Asus
{
/// <inheritdoc cref="AbstractRGBDevice{TDeviceInfo}" />
/// <inheritdoc cref="IAsusRGBDevice" />
/// <summary>
/// Represents a generic Asus-device. (keyboard, mouse, headset, mousepad).
/// </summary>
public abstract class AsusRGBDevice<TDeviceInfo> : AbstractRGBDevice<TDeviceInfo>, IAsusRGBDevice
where TDeviceInfo : AsusRGBDeviceInfo
{
#region Properties & Fields
/// <inheritdoc />
/// <summary>
/// Gets information about the <see cref="T:RGB.NET.Devices.Asus.AsusRGBDevice" />.
/// </summary>
public override TDeviceInfo DeviceInfo { get; }
/// <summary>
/// Gets or sets the update queue performing updates for this device.
/// </summary>
// ReSharper disable once MemberCanBePrivate.Global
protected AsusUpdateQueue UpdateQueue { get; set; }
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="AsusRGBDevice{TDeviceInfo}"/> class.
/// </summary>
/// <param name="info">The generic information provided by Asus for the device.</param>
protected AsusRGBDevice(TDeviceInfo info)
{
this.DeviceInfo = info;
}
#endregion
#region Methods
/// <summary>
/// Initializes the device.
/// </summary>
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(GetUpdateColorAction(), DeviceInfo.Handle, LedMapping.Count);
}
/// <summary>
/// Initializes the <see cref="Led"/> and <see cref="Size"/> of the device.
/// </summary>
protected abstract void InitializeLayout();
/// <inheritdoc />
protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate) => UpdateQueue.SetData(ledsToUpdate.Where(x => x.Color.A > 0));
/// <summary>
/// Gets a action to update the physical device.
/// </summary>
/// <returns></returns>
protected abstract Action<IntPtr, byte[]> GetUpdateColorAction();
/// <inheritdoc cref="IDisposable.Dispose" />
/// <inheritdoc cref="AbstractRGBDevice{TDeviceInfo}.Dispose" />
public override void Dispose()
{
if ((DeviceInfo is AsusRGBDeviceInfo deviceInfo) && (deviceInfo.Handle != IntPtr.Zero))
Marshal.FreeHGlobal(deviceInfo.Handle);
base.Dispose();
}
#endregion
}
}

View File

@ -0,0 +1,63 @@
using System;
using RGB.NET.Core;
namespace RGB.NET.Devices.Asus
{
/// <inheritdoc />
/// <summary>
/// Represents a generic information for a Corsair-<see cref="T:RGB.NET.Core.IRGBDevice" />.
/// </summary>
public abstract class AsusRGBDeviceInfo : IRGBDeviceInfo
{
#region Properties & Fields
/// <inheritdoc />
public RGBDeviceType DeviceType { get; }
/// <inheritdoc />
public string DeviceName { get; }
/// <inheritdoc />
public string Manufacturer { get; }
/// <inheritdoc />
public string Model { get; }
/// <inheritdoc />
public Uri Image { get; set; }
/// <inheritdoc />
public RGBDeviceLighting Lighting => RGBDeviceLighting.Key;
/// <inheritdoc />
public abstract bool SupportsSyncBack { get; }
/// <summary>
/// Gets the index of the <see cref="AsusRGBDevice{TDeviceInfo}"/>.
/// </summary>
internal IntPtr Handle { get; }
#endregion
#region Constructors
/// <summary>
/// Internal constructor of managed <see cref="AsusRGBDeviceInfo"/>.
/// </summary>
/// <param name="deviceType">The type of the <see cref="IRGBDevice"/>.</param>
/// <param name="handle">The handle of the <see cref="IRGBDevice"/>.</param>
/// <param name="manufacturer">The manufacturer-name of the <see cref="IRGBDevice"/>.</param>
/// <param name="model">The model-name of the <see cref="IRGBDevice"/>.</param>
internal AsusRGBDeviceInfo(RGBDeviceType deviceType, IntPtr handle, string model = "Generic Asus-Device", string manufacturer = "Asus")
{
this.DeviceType = deviceType;
this.Handle = handle;
this.Model = model;
this.Manufacturer = manufacturer;
DeviceName = $"{Manufacturer} {Model}";
}
#endregion
}
}

View File

@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using RGB.NET.Core;
namespace RGB.NET.Devices.Asus
{
/// <inheritdoc />
/// <summary>
/// Represents the update-queue performing updates for asus devices.
/// </summary>
public class AsusUpdateQueue : UpdateQueue
{
#region Properties & Fields
/// <summary>
/// Gets or sets the internal color-data cache.
/// </summary>
// ReSharper disable once MemberCanBePrivate.Global
protected byte[] ColorData { get; private set; }
private Action<IntPtr, byte[]> _updateAction;
private IntPtr _handle;
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="AsusUpdateQueue"/> class.
/// </summary>
/// <param name="updateTrigger">The update trigger used by this queue.</param>
public AsusUpdateQueue(IDeviceUpdateTrigger updateTrigger)
: base(updateTrigger)
{ }
#endregion
#region Methods
/// <summary>
/// Initializes the queue.
/// </summary>
/// <param name="updateAction">The update-action called by the queue to perform updates.</param>
/// <param name="handle">The handle of the device this queue performs updates for.</param>
/// <param name="ledCount">The amount of leds of the device this queue performs updates for.</param>
public void Initialize(Action<IntPtr, byte[]> updateAction, IntPtr handle, int ledCount)
{
_updateAction = updateAction;
_handle = handle;
ColorData = new byte[ledCount * 3];
}
/// <inheritdoc />
protected override void Update(Dictionary<object, Color> dataSet)
{
foreach (KeyValuePair<object, Color> data in dataSet)
{
int index = ((int)data.Key) * 3;
ColorData[index] = data.Value.GetR();
ColorData[index + 1] = data.Value.GetB();
ColorData[index + 2] = data.Value.GetG();
}
_updateAction(_handle, ColorData);
}
#endregion
}
}

View File

@ -0,0 +1,12 @@
using RGB.NET.Core;
namespace RGB.NET.Devices.Asus
{
/// <summary>
/// Represents a asus RGB-device.
/// </summary>
internal interface IAsusRGBDevice : IRGBDevice
{
void Initialize(IDeviceUpdateTrigger updateTrigger);
}
}

View File

@ -0,0 +1,48 @@
using System;
using RGB.NET.Core;
using RGB.NET.Devices.Asus.Native;
namespace RGB.NET.Devices.Asus
{
/// <inheritdoc />
/// <summary>
/// Represents a Asus graphicsCard.
/// </summary>
public class AsusGraphicsCardRGBDevice : AsusRGBDevice<AsusGraphicsCardRGBDeviceInfo>
{
#region Constructors
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Asus.AsusGraphicsCardRGBDevice" /> class.
/// </summary>
/// <param name="info">The specific information provided by Asus for the graphics card.</param>
internal AsusGraphicsCardRGBDevice(AsusGraphicsCardRGBDeviceInfo info)
: base(info)
{ }
#endregion
#region Methods
/// <inheritdoc />
protected override void InitializeLayout()
{
//TODO DarthAffe 07.10.2017: Look for a good default layout
int ledCount = _AsusSDK.GetGPULedCount(DeviceInfo.Handle);
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);
}
/// <inheritdoc />
protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.GraphicsCard1;
/// <inheritdoc />
protected override Action<IntPtr, byte[]> GetUpdateColorAction() => _AsusSDK.SetGPUColor;
#endregion
}
}

View File

@ -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

View File

@ -0,0 +1,48 @@
using System;
using RGB.NET.Core;
using RGB.NET.Devices.Asus.Native;
namespace RGB.NET.Devices.Asus
{
/// <inheritdoc />
/// <summary>
/// Represents a Asus keyboard.
/// </summary>
public class AsusKeyboardRGBDevice : AsusRGBDevice<AsusKeyboardRGBDeviceInfo>
{
#region Constructors
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Asus.AsusKeyboardRGBDevice" /> class.
/// </summary>
/// <param name="info">The specific information provided by Asus for the keyboard.</param>
internal AsusKeyboardRGBDevice(AsusKeyboardRGBDeviceInfo info)
: base(info)
{ }
#endregion
#region Methods
/// <inheritdoc />
protected override void InitializeLayout()
{
//TODO DarthAffe 07.10.2017: This doesn't make sense at all ... Find someone with such a keyboard!
int ledCount = _AsusSDK.GetClaymoreKeyboardLedCount(DeviceInfo.Handle);
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());
}
/// <inheritdoc />
protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Keyboard_Escape;
/// <inheritdoc />
protected override Action<IntPtr, byte[]> GetUpdateColorAction() => _AsusSDK.SetClaymoreKeyboardColor;
#endregion
}
}

View File

@ -0,0 +1,63 @@
using System;
using System.Globalization;
using RGB.NET.Core;
namespace RGB.NET.Devices.Asus
{
/// <inheritdoc />
/// <summary>
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Asus.AsusKeyboardRGBDevice" />.
/// </summary>
public class AsusKeyboardRGBDeviceInfo : AsusRGBDeviceInfo
{
#region Properties & Fields
/// <inheritdoc />
public override bool SupportsSyncBack => false;
/// <summary>
/// Gets the physical layout of the keyboard.
/// </summary>
public AsusPhysicalKeyboardLayout PhysicalLayout { get; private set; }
/// <summary>
/// Gets the logical layout of the keyboard.
/// </summary>
public AsusLogicalKeyboardLayout LogicalLayout { get; private set; }
#endregion
#region Constructors
/// <inheritdoc />
/// <summary>
/// Internal constructor of managed <see cref="T:RGB.NET.Devices.Asus.AsusKeyboardRGBDeviceInfo" />.
/// </summary>
/// <param name="deviceType">The type of the <see cref="IRGBDevice"/>.</param>
/// <param name="handle">The handle of the <see cref="IRGBDevice"/>.</param>
/// <param name="culture">The <see cref="T:System.Globalization.CultureInfo" /> of the layout this keyboard is using.</param>
internal AsusKeyboardRGBDeviceInfo(RGBDeviceType deviceType, IntPtr handle, CultureInfo culture)
: base(deviceType, handle, "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
}
}

View File

@ -0,0 +1,56 @@
using System;
using RGB.NET.Core;
using RGB.NET.Devices.Asus.Native;
namespace RGB.NET.Devices.Asus
{
/// <inheritdoc />
/// <summary>
/// Represents a Asus mainboard.
/// </summary>
public class AsusMainboardRGBDevice : AsusRGBDevice<AsusMainboardRGBDeviceInfo>
{
#region Constructors
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Asus.AsusMainboardRGBDevice" /> class.
/// </summary>
/// <param name="info">The specific information provided by Asus for the mainboard.</param>
internal AsusMainboardRGBDevice(AsusMainboardRGBDeviceInfo info)
: base(info)
{ }
#endregion
#region Methods
/// <inheritdoc />
protected override void InitializeLayout()
{
//TODO DarthAffe 07.10.2017: Look for a good default layout
int ledCount = _AsusSDK.GetMbLedCount(DeviceInfo.Handle);
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);
}
/// <inheritdoc />
protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mainboard1;
/// <inheritdoc />
public override void SyncBack()
{
byte[] colorData = _AsusSDK.GetMbColor(DeviceInfo.Handle);
for (int i = 0; i < LedMapping.Count; i++)
SetLedColorWithoutRequest(LedMapping[LedId.Mainboard1 + i], new Color(colorData[(i * 3)], colorData[(i * 3) + 2], colorData[(i * 3) + 1]));
}
/// <inheritdoc />
protected override Action<IntPtr, byte[]> GetUpdateColorAction() => _AsusSDK.SetMbColor;
#endregion
}
}

View File

@ -0,0 +1,47 @@
using System;
using RGB.NET.Core;
using RGB.NET.Devices.Asus.Native;
namespace RGB.NET.Devices.Asus
{
/// <inheritdoc />
/// <summary>
/// Represents a Asus mouse.
/// </summary>
public class AsusMouseRGBDevice : AsusRGBDevice<AsusMouseRGBDeviceInfo>
{
#region Constructors
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Asus.AsusMouseRGBDevice" /> class.
/// </summary>
/// <param name="info">The specific information provided by Asus for the mouse.</param>
internal AsusMouseRGBDevice(AsusMouseRGBDeviceInfo info)
: base(info)
{ }
#endregion
#region Methods
/// <inheritdoc />
protected override void InitializeLayout()
{
//TODO DarthAffe 07.10.2017: Look for a good default layout
int ledCount = _AsusSDK.GetRogMouseLedCount(DeviceInfo.Handle);
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);
}
/// <inheritdoc />
protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mouse1;
/// <inheritdoc />
protected override Action<IntPtr, byte[]> GetUpdateColorAction() => _AsusSDK.SetRogMouseColor;
#endregion
}
}

View File

@ -0,0 +1,69 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
<RuntimeIdentifiers>win7-x86;win7-x64</RuntimeIdentifiers>
<Authors>Darth Affe</Authors>
<Company>Wyrez</Company>
<Language>en-US</Language>
<NeutralLanguage>en-US</NeutralLanguage>
<Title>RGB.NET.Devices.Asus</Title>
<AssemblyName>RGB.NET.Devices.Asus_Legacy</AssemblyName>
<AssemblyTitle>RGB.NET.Devices.Asus</AssemblyTitle>
<PackageId>RGB.NET.Devices.Asus_Legacy</PackageId>
<RootNamespace>RGB.NET.Devices.Asus</RootNamespace>
<Description>Asus-Device-Implementations of RGB.NET based on the v2-SDK</Description>
<Summary>Asus-Device-Implementations of RGB.NET, a C# (.NET) library for accessing various RGB-peripherals</Summary>
<Copyright>Copyright © Wyrez 2017</Copyright>
<PackageCopyright>Copyright © Wyrez 2017</PackageCopyright>
<PackageIconUrl>http://lib.arge.be/icon.png</PackageIconUrl>
<PackageProjectUrl>https://github.com/DarthAffe/RGB.NET</PackageProjectUrl>
<PackageLicenseUrl>https://raw.githubusercontent.com/DarthAffe/RGB.NET/master/LICENSE</PackageLicenseUrl>
<RepositoryType>Github</RepositoryType>
<RepositoryUrl>https://github.com/DarthAffe/RGB.NET</RepositoryUrl>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<PackageReleaseNotes></PackageReleaseNotes>
<Version>0.0.1</Version>
<AssemblyVersion>0.0.1</AssemblyVersion>
<FileVersion>0.0.1</FileVersion>
<OutputPath>..\bin\</OutputPath>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IncludeSource>True</IncludeSource>
<IncludeSymbols>True</IncludeSymbols>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<DefineConstants>NETCORE;NETSTANDARD;NETSTANDARD2_0</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net45'">
<DefineConstants>NET45;NETFULL</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<DefineConstants>$(DefineConstants);TRACE;DEBUG</DefineConstants>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<NoWarn>$(NoWarn);CS1591;CS1572;CS1573</NoWarn>
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\RGB.NET.Core\RGB.NET.Core.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net45'">
<PackageReference Include="System.ValueTuple" Version="4.4.0" />
<PackageReference Include="System.Management" Version="4.0.0" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,10 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=dram/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=enum/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=generic/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=generic_005Cupdate/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=graphicscard/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=keyboard/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=mainboard/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=mouse/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=helper/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@ -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,9 @@ 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
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
@ -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}