using System;
using System.Collections.Generic;
using RGB.NET.Core;
using RGB.NET.Devices.CoolerMaster.Helper;
namespace RGB.NET.Devices.CoolerMaster
{
///
/// Represents a CoolerMaster keyboard.
///
public class CoolerMasterKeyboardRGBDevice : CoolerMasterRGBDevice
{
#region Properties & Fields
///
/// Gets information about the .
///
public CoolerMasterKeyboardRGBDeviceInfo KeyboardDeviceInfo { get; }
#endregion
#region Constructors
///
/// Initializes a new instance of the class.
///
/// The specific information provided by CoolerMaster for the keyboard
internal CoolerMasterKeyboardRGBDevice(CoolerMasterKeyboardRGBDeviceInfo info)
: base(info)
{
this.KeyboardDeviceInfo = info;
}
#endregion
#region Methods
///
protected override void InitializeLayout()
{
Dictionary> mapping = CoolerMasterKeyboardLedMappings.Mapping[KeyboardDeviceInfo.DeviceIndex][KeyboardDeviceInfo.PhysicalLayout];
foreach (KeyValuePair> led in mapping)
InitializeLed(new CoolerMasterLedId(this, led.Key, led.Value.Item1, led.Value.Item2),
new Rectangle(led.Value.Item2 * 19, led.Value.Item1 * 19, 19, 19));
string model = KeyboardDeviceInfo.Model.Replace(" ", string.Empty).ToUpper();
ApplyLayoutFromFile(PathHelper.GetAbsolutePath(
$@"Layouts\CoolerMaster\Keyboards\{model}\{KeyboardDeviceInfo.PhysicalLayout.ToString().ToUpper()}.xml"),
KeyboardDeviceInfo.LogicalLayout.ToString(), PathHelper.GetAbsolutePath($@"Images\CoolerMaster\Keyboards"));
}
#endregion
}
}