mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2026-11-11 13:06:24 +00:00
Added generic DeviceInfo to Devices
This commit is contained in:
1 parent
86bc26233b
commit
67fcc8e52e
38 files changed
+210
-246
No files matched your search
@@ -0,0 +1,12 @@
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.Logitech
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a logitech RGB-device.
|
||||
/// </summary>
|
||||
internal interface ILogitechRGBDevice : IRGBDevice
|
||||
{
|
||||
void Initialize();
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,8 @@ namespace RGB.NET.Devices.Logitech
|
||||
/// <summary>
|
||||
/// Represents a generic Logitech-device. (keyboard, mouse, headset, mousepad).
|
||||
/// </summary>
|
||||
public abstract class LogitechRGBDevice : AbstractRGBDevice
|
||||
public abstract class LogitechRGBDevice<TDeviceInfo> : AbstractRGBDevice<TDeviceInfo>, ILogitechRGBDevice
|
||||
where TDeviceInfo : LogitechRGBDeviceInfo
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
@@ -18,17 +19,17 @@ namespace RGB.NET.Devices.Logitech
|
||||
/// <summary>
|
||||
/// Gets information about the <see cref="T:RGB.NET.Devices.Logitech.LogitechRGBDevice" />.
|
||||
/// </summary>
|
||||
public override IRGBDeviceInfo DeviceInfo { get; }
|
||||
public override TDeviceInfo DeviceInfo { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LogitechRGBDevice"/> class.
|
||||
/// Initializes a new instance of the <see cref="LogitechRGBDevice{TDeviceInfo}"/> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The generic information provided by Logitech for the device.</param>
|
||||
protected LogitechRGBDevice(IRGBDeviceInfo info)
|
||||
protected LogitechRGBDevice(TDeviceInfo info)
|
||||
{
|
||||
this.DeviceInfo = info;
|
||||
}
|
||||
@@ -40,7 +41,7 @@ namespace RGB.NET.Devices.Logitech
|
||||
/// <summary>
|
||||
/// Initializes the device.
|
||||
/// </summary>
|
||||
internal void Initialize()
|
||||
public void Initialize()
|
||||
{
|
||||
InitializeLayout();
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace RGB.NET.Devices.Logitech
|
||||
if (DeviceChecker.IsPerKeyDeviceConnected)
|
||||
{
|
||||
(string model, RGBDeviceType deviceType, int _, string imageBasePath, string imageLayout, string layoutPath) = DeviceChecker.PerKeyDeviceData;
|
||||
LogitechRGBDevice device = new LogitechPerKeyRGBDevice(new LogitechRGBDeviceInfo(deviceType, model, LogitechDeviceCaps.PerKeyRGB, imageBasePath, imageLayout, layoutPath));
|
||||
ILogitechRGBDevice device = new LogitechPerKeyRGBDevice(new LogitechRGBDeviceInfo(deviceType, model, LogitechDeviceCaps.PerKeyRGB, imageBasePath, imageLayout, layoutPath));
|
||||
device.Initialize();
|
||||
devices.Add(device);
|
||||
}
|
||||
@@ -113,7 +113,7 @@ namespace RGB.NET.Devices.Logitech
|
||||
if (DeviceChecker.IsPerDeviceDeviceConnected)
|
||||
{
|
||||
(string model, RGBDeviceType deviceType, int _, string imageBasePath, string imageLayout, string layoutPath) = DeviceChecker.PerDeviceDeviceData;
|
||||
LogitechRGBDevice device = new LogitechPerDeviceRGBDevice(new LogitechRGBDeviceInfo(deviceType, model, LogitechDeviceCaps.DeviceRGB, imageBasePath, imageLayout, layoutPath));
|
||||
ILogitechRGBDevice device = new LogitechPerDeviceRGBDevice(new LogitechRGBDeviceInfo(deviceType, model, LogitechDeviceCaps.DeviceRGB, imageBasePath, imageLayout, layoutPath));
|
||||
device.Initialize();
|
||||
devices.Add(device);
|
||||
}
|
||||
|
||||
@@ -10,17 +10,8 @@ namespace RGB.NET.Devices.Logitech
|
||||
/// <summary>
|
||||
/// Represents a logitech per-device-lightable device.
|
||||
/// </summary>
|
||||
public class LogitechPerDeviceRGBDevice : LogitechRGBDevice
|
||||
public class LogitechPerDeviceRGBDevice : LogitechRGBDevice<LogitechRGBDeviceInfo>
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
/// <summary>
|
||||
/// Gets information about the <see cref="LogitechPerDeviceRGBDevice"/>.
|
||||
/// </summary>
|
||||
public LogitechRGBDeviceInfo PerDeviceDeviceInfo { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -30,9 +21,7 @@ namespace RGB.NET.Devices.Logitech
|
||||
/// <param name="info">The specific information provided by logitech for the per-device-lightable device</param>
|
||||
internal LogitechPerDeviceRGBDevice(LogitechRGBDeviceInfo info)
|
||||
: base(info)
|
||||
{
|
||||
this.PerDeviceDeviceInfo = info;
|
||||
}
|
||||
{ }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -10,17 +10,8 @@ namespace RGB.NET.Devices.Logitech
|
||||
/// <summary>
|
||||
/// Represents a logitech per-key-lightable device.
|
||||
/// </summary>
|
||||
public class LogitechPerKeyRGBDevice : LogitechRGBDevice
|
||||
public class LogitechPerKeyRGBDevice : LogitechRGBDevice<LogitechRGBDeviceInfo>
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
/// <summary>
|
||||
/// Gets information about the <see cref="LogitechPerKeyRGBDevice"/>.
|
||||
/// </summary>
|
||||
public LogitechRGBDeviceInfo PerKeyDeviceInfo { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -30,9 +21,7 @@ namespace RGB.NET.Devices.Logitech
|
||||
/// <param name="info">The specific information provided by logitech for the per-key-lightable device</param>
|
||||
internal LogitechPerKeyRGBDevice(LogitechRGBDeviceInfo info)
|
||||
: base(info)
|
||||
{
|
||||
this.PerKeyDeviceInfo = info;
|
||||
}
|
||||
{ }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
<Compile Include="Enum\LogitechPhysicalKeyboardLayout.cs" />
|
||||
<Compile Include="Enum\LogitechDeviceCaps.cs" />
|
||||
<Compile Include="Enum\LogitechLedIds.cs" />
|
||||
<Compile Include="Generic\ILogitechRGBDevice.cs" />
|
||||
<Compile Include="Generic\LogitechLedId.cs" />
|
||||
<Compile Include="Generic\LogitechRGBDevice.cs" />
|
||||
<Compile Include="Generic\LogitechRGBDeviceInfo.cs" />
|
||||
|
||||
Reference in new issue
Block a user