Moved current Asus-Implementation (v2-SDK) to a legacy-project

This commit is contained in:
DarthAffe committed 2019-06-16 12:19:45 +02:00
1 parent 4ee6d3c70a
commit b7099aa7e2
26 files changed
+16 -5

No files matched your search

@@ -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
}
}
@@ -0,0 +1,33 @@
using System;
using RGB.NET.Core;
namespace RGB.NET.Devices.Asus
{
/// <inheritdoc />
/// <summary>
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Asus.AsusMainboardRGBDevice" />.
/// </summary>
public class AsusMainboardRGBDeviceInfo : AsusRGBDeviceInfo
{
#region Properties & Fields
/// <inheritdoc />
public override bool SupportsSyncBack => true;
#endregion
#region Constructors
/// <inheritdoc />
/// <summary>
/// Internal constructor of managed <see cref="T:RGB.NET.Devices.Asus.AsusMainboardRGBDeviceInfo" />.
/// </summary>
/// <param name="deviceType">The type of the <see cref="IRGBDevice"/>.</param>
/// <param name="handle">The handle of the <see cref="IRGBDevice"/>.</param>
internal AsusMainboardRGBDeviceInfo(RGBDeviceType deviceType, IntPtr handle)
: base(deviceType, handle, WMIHelper.GetMainboardInfo()?.model ?? "Generic Asus-Device")
{ }
#endregion
}
}