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