Added generic DeviceInfo to Devices

This commit is contained in:
DarthAffe committed 2017-11-26 09:37:14 +01:00
1 parent 86bc26233b
commit 67fcc8e52e
38 files changed
+210 -246

No files matched your search

@@ -8,17 +8,8 @@ namespace RGB.NET.Devices.CoolerMaster
/// <summary>
/// Represents a CoolerMaster keyboard.
/// </summary>
public class CoolerMasterKeyboardRGBDevice : CoolerMasterRGBDevice
public class CoolerMasterKeyboardRGBDevice : CoolerMasterRGBDevice<CoolerMasterKeyboardRGBDeviceInfo>
{
#region Properties & Fields
/// <summary>
/// Gets information about the <see cref="CoolerMasterKeyboardRGBDevice"/>.
/// </summary>
public CoolerMasterKeyboardRGBDeviceInfo KeyboardDeviceInfo { get; }
#endregion
#region Constructors
/// <inheritdoc />
@@ -28,9 +19,7 @@ namespace RGB.NET.Devices.CoolerMaster
/// <param name="info">The specific information provided by CoolerMaster for the keyboard</param>
internal CoolerMasterKeyboardRGBDevice(CoolerMasterKeyboardRGBDeviceInfo info)
: base(info)
{
this.KeyboardDeviceInfo = info;
}
{ }
#endregion
@@ -39,16 +28,16 @@ namespace RGB.NET.Devices.CoolerMaster
/// <inheritdoc />
protected override void InitializeLayout()
{
Dictionary<CoolerMasterLedIds, Tuple<int, int>> mapping = CoolerMasterKeyboardLedMappings.Mapping[KeyboardDeviceInfo.DeviceIndex][KeyboardDeviceInfo.PhysicalLayout];
Dictionary<CoolerMasterLedIds, Tuple<int, int>> mapping = CoolerMasterKeyboardLedMappings.Mapping[DeviceInfo.DeviceIndex][DeviceInfo.PhysicalLayout];
foreach (KeyValuePair<CoolerMasterLedIds, Tuple<int, int>> 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();
string model = DeviceInfo.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"));
$@"Layouts\CoolerMaster\Keyboards\{model}\{DeviceInfo.PhysicalLayout.ToString().ToUpper()}.xml"),
DeviceInfo.LogicalLayout.ToString(), PathHelper.GetAbsolutePath(@"Images\CoolerMaster\Keyboards"));
}
#endregion