Fixed code issues

This commit is contained in:
DarthAffe committed 2021-08-01 16:40:13 +02:00
1 parent 59e11e5b82
commit 7c0a216ccd
64 files changed
+278 -34

No files matched your search

@@ -63,6 +63,7 @@ namespace RGB.NET.Devices.Corsair
#region Methods
/// <inheritdoc />
protected override void InitializeSDK()
{
_CUESDK.Reload();
@@ -193,6 +194,7 @@ namespace RGB.NET.Devices.Corsair
};
}
/// <inheritdoc />
protected override void Reset()
{
ProtocolDetails = null;
@@ -17,8 +17,19 @@ namespace RGB.NET.Devices.Corsair
{
#region Properties & Fields
/// <summary>
/// Gets the corsair-id of the first LED of this device.
/// </summary>
public CorsairLedId ReferenceCorsairLed { get; }
/// <summary>
/// Gets the amount of LEDs this device contains.
/// </summary>
public int LedCount { get; }
/// <summary>
/// Gets the offset used to access the LEDs of this device.
/// </summary>
internal int LedOffset { get; }
#endregion
@@ -33,7 +44,8 @@ namespace RGB.NET.Devices.Corsair
/// <param name="deviceIndex">The index of the <see cref="T:RGB.NET.Devices.Corsair._CorsairChannelDeviceInfo" />.</param>
/// <param name="nativeInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairDeviceInfo" />-struct</param>
/// <param name="channelDeviceInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairChannelDeviceInfo"/> representing this device.</param>
/// <param name="referenceCorsairLed">The id of the first led of this device.</param>
/// <param name="referenceCorsairLed">The id of the first LED of this device.</param>
/// <param name="ledOffset">The offset used to find the LEDs of this device.</param>
internal CorsairCustomRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo, _CorsairChannelDeviceInfo channelDeviceInfo, CorsairLedId referenceCorsairLed, int ledOffset)
: base(deviceIndex, GetDeviceType(channelDeviceInfo.type), nativeInfo,
GetModelName(nativeInfo.model == IntPtr.Zero ? string.Empty : Regex.Replace(Marshal.PtrToStringAnsi(nativeInfo.model) ?? string.Empty, " ?DEMO", string.Empty, RegexOptions.IgnoreCase), channelDeviceInfo))
@@ -14,6 +14,9 @@ namespace RGB.NET.Devices.Corsair
{
#region Properties & Fields
/// <summary>
/// Gets the mapping of <see cref="LedId"/> to <see cref="CorsairLedId"/> used to update the LEDs of this device.
/// </summary>
protected LedMapping<CorsairLedId> Mapping { get; }
#endregion
@@ -24,6 +27,8 @@ namespace RGB.NET.Devices.Corsair
/// Initializes a new instance of the <see cref="CorsairRGBDevice{TDeviceInfo}"/> class.
/// </summary>
/// <param name="info">The generic information provided by CUE for the device.</param>
/// <param name="mapping">The mapping <see cref="LedId"/> to <see cref="CorsairLedId"/> used to update the LEDs of this device.</param>
/// <param name="updateQueue">The queue used to update this device.</param>
protected CorsairRGBDevice(TDeviceInfo info, LedMapping<CorsairLedId> mapping, CorsairDeviceUpdateQueue updateQueue)
: base(info, updateQueue)
{
@@ -35,7 +40,10 @@ namespace RGB.NET.Devices.Corsair
#region Methods
void ICorsairRGBDevice.Initialize() => InitializeLayout();
/// <summary>
/// Initializes the LEDs of the device based on the data provided by the SDK.
/// </summary>
protected virtual void InitializeLayout()
{
_CorsairLedPositions? nativeLedPositions = (_CorsairLedPositions?)Marshal.PtrToStructure(_CUESDK.CorsairGetLedPositionsByDeviceIndex(DeviceInfo.CorsairDeviceIndex), typeof(_CorsairLedPositions));
@@ -23,7 +23,7 @@ namespace RGB.NET.Devices.Corsair
/// <summary>
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Corsair.CorsairKeyboardRGBDevice" /> class.
/// </summary>
/// <param name="info">The specific information provided by CUE for the keyboard</param>
/// <param name="info">The specific information provided by CUE for the keyboard.</param>
/// <param name="updateQueue">The queue used to update this device.</param>
internal CorsairKeyboardRGBDevice(CorsairKeyboardRGBDeviceInfo info, CorsairDeviceUpdateQueue updateQueue)
: base(info, LedMappings.Keyboard, updateQueue)