mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2026-11-11 04:57:15 +00:00
Implemented corsair devices
This commit is contained in:
1 parent
89194c4cb4
commit
f3128a3dd0
31 files changed
+1731
No files matched your search
@@ -0,0 +1,68 @@
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Core.Exceptions;
|
||||
|
||||
namespace RGB.NET.Devices.Corsair
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a corsair mouse.
|
||||
/// </summary>
|
||||
public class CorsairMouseRGBDevice : CorsairRGBDevice
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
/// <summary>
|
||||
/// Gets information about the <see cref="CorsairMouseRGBDevice"/>.
|
||||
/// </summary>
|
||||
public CorsairMouseRGBDeviceInfo MouseDeviceInfo { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CorsairMouseRGBDevice"/> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by CUE for the mouse</param>
|
||||
internal CorsairMouseRGBDevice(CorsairMouseRGBDeviceInfo info)
|
||||
: base(info)
|
||||
{
|
||||
this.MouseDeviceInfo = info;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the <see cref="Led"/> of the mouse.
|
||||
/// </summary>
|
||||
protected override void InitializeLeds()
|
||||
{
|
||||
switch (MouseDeviceInfo.PhysicalLayout)
|
||||
{
|
||||
case CorsairPhysicalMouseLayout.Zones1:
|
||||
InitializeLed(new CorsairLedId(CorsairLedIds.B1), new Rectangle(0, 0, 10, 10));
|
||||
break;
|
||||
case CorsairPhysicalMouseLayout.Zones2:
|
||||
InitializeLed(new CorsairLedId(CorsairLedIds.B1), new Rectangle(0, 0, 10, 10));
|
||||
InitializeLed(new CorsairLedId(CorsairLedIds.B2), new Rectangle(10, 0, 10, 10));
|
||||
break;
|
||||
case CorsairPhysicalMouseLayout.Zones3:
|
||||
InitializeLed(new CorsairLedId(CorsairLedIds.B1), new Rectangle(0, 0, 10, 10));
|
||||
InitializeLed(new CorsairLedId(CorsairLedIds.B2), new Rectangle(10, 0, 10, 10));
|
||||
InitializeLed(new CorsairLedId(CorsairLedIds.B3), new Rectangle(20, 0, 10, 10));
|
||||
break;
|
||||
case CorsairPhysicalMouseLayout.Zones4:
|
||||
InitializeLed(new CorsairLedId(CorsairLedIds.B1), new Rectangle(0, 0, 10, 10));
|
||||
InitializeLed(new CorsairLedId(CorsairLedIds.B2), new Rectangle(10, 0, 10, 10));
|
||||
InitializeLed(new CorsairLedId(CorsairLedIds.B3), new Rectangle(20, 0, 10, 10));
|
||||
InitializeLed(new CorsairLedId(CorsairLedIds.B4), new Rectangle(30, 0, 10, 10));
|
||||
break;
|
||||
default:
|
||||
throw new RGBDeviceException($"Can't initial mouse with layout '{MouseDeviceInfo.PhysicalLayout}'");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using RGB.NET.Devices.Corsair.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Corsair
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a generic information for a <see cref="CorsairMouseRGBDevice"/>.
|
||||
/// </summary>
|
||||
public class CorsairMouseRGBDeviceInfo : CorsairRGBDeviceInfo
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
/// <summary>
|
||||
/// Gets the physical layout of the mouse.
|
||||
/// </summary>
|
||||
public CorsairPhysicalMouseLayout PhysicalLayout { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Internal constructor of managed <see cref="CorsairMouseRGBDeviceInfo"/>.
|
||||
/// </summary>
|
||||
/// <param name="deviceIndex">The index of the <see cref="CorsairMouseRGBDevice"/>.</param>
|
||||
/// <param name="nativeInfo">The native <see cref="_CorsairDeviceInfo" />-struct</param>
|
||||
internal CorsairMouseRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo)
|
||||
: base(deviceIndex, Core.DeviceType.Mouse, nativeInfo)
|
||||
{
|
||||
this.PhysicalLayout = (CorsairPhysicalMouseLayout)nativeInfo.physicalLayout;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user