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

@@ -12,24 +12,25 @@ namespace RGB.NET.Devices.CoolerMaster
/// <summary>
/// Represents a generic CoolerMaster-device. (keyboard, mouse, headset, mousepad).
/// </summary>
public abstract class CoolerMasterRGBDevice : AbstractRGBDevice
public abstract class CoolerMasterRGBDevice<TDeviceInfo> : AbstractRGBDevice<TDeviceInfo>, ICoolerMasterRGBDevice
where TDeviceInfo : CoolerMasterRGBDeviceInfo
{
#region Properties & Fields
/// <inheritdoc />
/// <summary>
/// Gets information about the <see cref="T:RGB.NET.Devices.CoolerMaster.CoolerMasterRGBDevice" />.
/// </summary>
public override IRGBDeviceInfo DeviceInfo { get; }
public override TDeviceInfo DeviceInfo { get; }
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="CoolerMasterRGBDevice"/> class.
/// Initializes a new instance of the <see cref="CoolerMasterRGBDevice{TDeviceInfo}"/> class.
/// </summary>
/// <param name="info">The generic information provided by CoolerMaster for the device.</param>
protected CoolerMasterRGBDevice(IRGBDeviceInfo info)
protected CoolerMasterRGBDevice(TDeviceInfo info)
{
this.DeviceInfo = info;
}
@@ -42,7 +43,7 @@ namespace RGB.NET.Devices.CoolerMaster
/// <summary>
/// Initializes the device.
/// </summary>
internal void Initialize()
public void Initialize()
{
InitializeLayout();
@@ -105,7 +106,7 @@ namespace RGB.NET.Devices.CoolerMaster
if (leds.Count > 0)
{
_CoolerMasterSDK.SetControlDevice(((CoolerMasterRGBDeviceInfo)DeviceInfo).DeviceIndex);
_CoolerMasterSDK.SetControlDevice(DeviceInfo.DeviceIndex);
foreach (Led led in leds)
{
@@ -120,7 +121,7 @@ namespace RGB.NET.Devices.CoolerMaster
/// <inheritdoc />
public override void Dispose()
{
_CoolerMasterSDK.SetControlDevice(((CoolerMasterRGBDeviceInfo)DeviceInfo).DeviceIndex);
_CoolerMasterSDK.SetControlDevice(DeviceInfo.DeviceIndex);
_CoolerMasterSDK.EnableLedControl(false);
base.Dispose();
@@ -0,0 +1,12 @@
using RGB.NET.Core;
namespace RGB.NET.Devices.CoolerMaster
{
/// <summary>
/// Represents a CoolerMaster RGB-device.
/// </summary>
internal interface ICoolerMasterRGBDevice : IRGBDevice
{
void Initialize();
}
}