Fixed some code issues

This commit is contained in:
DarthAffe committed 2017-09-05 14:02:12 +02:00
1 parent 2086b3729d
commit 8e212190ae
76 files changed
+375 -241

No files matched your search

@@ -12,6 +12,7 @@ using RGB.NET.Devices.Corsair.SpecialParts;
namespace RGB.NET.Devices.Corsair
{
/// <inheritdoc />
/// <summary>
/// Represents a device provider responsible for corsair (CUE) devices.
/// </summary>
@@ -37,6 +38,7 @@ namespace RGB.NET.Devices.Corsair
/// </summary>
public static List<string> PossibleX64NativePaths { get; } = new List<string> { "x64/CUESDK.dll", "x64/CUESDK_2015.dll", "x64/CUESDK_2013.dll" };
/// <inheritdoc />
/// <summary>
/// Indicates if the SDK is initialized and ready to use.
/// </summary>
@@ -52,6 +54,7 @@ namespace RGB.NET.Devices.Corsair
/// </summary>
public CorsairProtocolDetails ProtocolDetails { get; private set; }
/// <inheritdoc />
/// <summary>
/// Gets whether the application has exclusive access to the SDK or not.
/// </summary>
@@ -5,6 +5,7 @@ using System;
namespace RGB.NET.Devices.Corsair
{
/// <inheritdoc />
/// <summary>
/// Represents an exception thrown by the CUE.
/// </summary>
@@ -21,10 +22,11 @@ namespace RGB.NET.Devices.Corsair
#region Constructors
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="CUEException"/> class.
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Corsair.CUEException" /> class.
/// </summary>
/// <param name="error">The <see cref="CorsairError" /> provided by CUE, which leads to this exception.</param>
/// <param name="error">The <see cref="T:RGB.NET.Devices.Corsair.CorsairError" /> provided by CUE, which leads to this exception.</param>
public CUEException(CorsairError error)
{
this.Error = error;
@@ -3,8 +3,9 @@ using RGB.NET.Core;
namespace RGB.NET.Devices.Corsair
{
/// <inheritdoc />
/// <summary>
/// Represents a Id of a <see cref="Led"/> on a <see cref="CorsairRGBDevice"/>.
/// Represents a Id of a <see cref="T:RGB.NET.Core.Led" /> on a <see cref="T:RGB.NET.Devices.Corsair.CorsairRGBDevice" />.
/// </summary>
[DebuggerDisplay("{" + nameof(LedId) + "}")]
public class CorsairLedId : ILedId
@@ -9,6 +9,7 @@ using RGB.NET.Devices.Corsair.Native;
namespace RGB.NET.Devices.Corsair
{
/// <inheritdoc />
/// <summary>
/// Represents a generic CUE-device. (keyboard, mouse, headset, mousepad).
/// </summary>
@@ -16,8 +17,9 @@ namespace RGB.NET.Devices.Corsair
{
#region Properties & Fields
/// <inheritdoc />
/// <summary>
/// Gets information about the <see cref="CorsairRGBDevice"/>.
/// Gets information about the <see cref="T:RGB.NET.Devices.Corsair.CorsairRGBDevice" />.
/// </summary>
public override IRGBDeviceInfo DeviceInfo { get; }
@@ -75,11 +77,9 @@ namespace RGB.NET.Devices.Corsair
if (layout.Leds != null)
foreach (LedLayout layoutLed in layout.Leds)
{
CorsairLedIds ledId;
if (Enum.TryParse(layoutLed.Id, true, out ledId))
if (Enum.TryParse(layoutLed.Id, true, out CorsairLedIds ledId))
{
Led led;
if (LedMapping.TryGetValue(new CorsairLedId(this, ledId), out led))
if (LedMapping.TryGetValue(new CorsairLedId(this, ledId), out Led led))
{
led.LedRectangle.Location.X = layoutLed.X;
led.LedRectangle.Location.Y = layoutLed.Y;
@@ -5,8 +5,9 @@ using RGB.NET.Devices.Corsair.Native;
namespace RGB.NET.Devices.Corsair
{
/// <inheritdoc />
/// <summary>
/// Represents a generic information for a Corsair-<see cref="IRGBDevice"/>.
/// Represents a generic information for a Corsair-<see cref="T:RGB.NET.Core.IRGBDevice" />.
/// </summary>
public class CorsairRGBDeviceInfo : IRGBDeviceInfo
{
@@ -5,6 +5,7 @@ using RGB.NET.Core;
namespace RGB.NET.Devices.Corsair
{
/// <inheritdoc />
/// <summary>
/// Represents a corsair headset.
/// </summary>
@@ -21,8 +22,9 @@ namespace RGB.NET.Devices.Corsair
#region Constructors
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="CorsairHeadsetRGBDevice"/> class.
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Corsair.CorsairHeadsetRGBDevice" /> class.
/// </summary>
/// <param name="info">The specific information provided by CUE for the headset</param>
internal CorsairHeadsetRGBDevice(CorsairHeadsetRGBDeviceInfo info)
@@ -4,18 +4,20 @@ using RGB.NET.Devices.Corsair.Native;
namespace RGB.NET.Devices.Corsair
{
/// <inheritdoc />
/// <summary>
/// Represents a generic information for a <see cref="CorsairHeadsetRGBDevice"/>.
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Corsair.CorsairHeadsetRGBDevice" />.
/// </summary>
public class CorsairHeadsetRGBDeviceInfo : CorsairRGBDeviceInfo
{
#region Constructors
/// <inheritdoc />
/// <summary>
/// Internal constructor of managed <see cref="CorsairHeadsetRGBDeviceInfo"/>.
/// Internal constructor of managed <see cref="T:RGB.NET.Devices.Corsair.CorsairHeadsetRGBDeviceInfo" />.
/// </summary>
/// <param name="deviceIndex">The index of the <see cref="CorsairHeadsetRGBDevice"/>.</param>
/// <param name="nativeInfo">The native <see cref="_CorsairDeviceInfo" />-struct</param>
/// <param name="deviceIndex">The index of the <see cref="T:RGB.NET.Devices.Corsair.CorsairHeadsetRGBDevice" />.</param>
/// <param name="nativeInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairDeviceInfo" />-struct</param>
internal CorsairHeadsetRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo)
: base(deviceIndex, RGBDeviceType.Headset, nativeInfo)
{
@@ -8,6 +8,7 @@ using RGB.NET.Devices.Corsair.Native;
namespace RGB.NET.Devices.Corsair
{
/// <inheritdoc />
/// <summary>
/// Represents a corsair keyboard.
/// </summary>
@@ -24,8 +25,9 @@ namespace RGB.NET.Devices.Corsair
#region Constructors
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="CorsairKeyboardRGBDevice"/> class.
/// 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>
internal CorsairKeyboardRGBDevice(CorsairKeyboardRGBDeviceInfo info)
@@ -59,7 +61,7 @@ namespace RGB.NET.Devices.Corsair
string model = KeyboardDeviceInfo.Model.Replace(" ", string.Empty).ToUpper();
ApplyLayoutFromFile(PathHelper.GetAbsolutePath(
$@"Layouts\Corsair\Keyboards\{model}\{KeyboardDeviceInfo.PhysicalLayout.ToString().ToUpper()}.xml"),
KeyboardDeviceInfo.LogicalLayout.ToString(), PathHelper.GetAbsolutePath($@"Images\Corsair\Keyboards"));
KeyboardDeviceInfo.LogicalLayout.ToString(), PathHelper.GetAbsolutePath(@"Images\Corsair\Keyboards"));
}
#endregion
@@ -7,8 +7,9 @@ using RGB.NET.Devices.Corsair.Native;
namespace RGB.NET.Devices.Corsair
{
/// <inheritdoc />
/// <summary>
/// Represents a generic information for a <see cref="CorsairKeyboardRGBDevice"/>.
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Corsair.CorsairKeyboardRGBDevice" />.
/// </summary>
public class CorsairKeyboardRGBDeviceInfo : CorsairRGBDeviceInfo
{
@@ -28,11 +29,12 @@ namespace RGB.NET.Devices.Corsair
#region Constructors
/// <inheritdoc />
/// <summary>
/// Internal constructor of managed <see cref="CorsairKeyboardRGBDeviceInfo"/>.
/// Internal constructor of managed <see cref="T:RGB.NET.Devices.Corsair.CorsairKeyboardRGBDeviceInfo" />.
/// </summary>
/// <param name="deviceIndex">The index of the <see cref="CorsairKeyboardRGBDevice"/>.</param>
/// <param name="nativeInfo">The native <see cref="_CorsairDeviceInfo" />-struct</param>
/// <param name="deviceIndex">The index of the <see cref="T:RGB.NET.Devices.Corsair.CorsairKeyboardRGBDevice" />.</param>
/// <param name="nativeInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairDeviceInfo" />-struct</param>
internal CorsairKeyboardRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo)
: base(deviceIndex, RGBDeviceType.Keyboard, nativeInfo)
{
@@ -6,6 +6,7 @@ using RGB.NET.Core.Exceptions;
namespace RGB.NET.Devices.Corsair
{
/// <inheritdoc />
/// <summary>
/// Represents a corsair mouse.
/// </summary>
@@ -22,8 +23,9 @@ namespace RGB.NET.Devices.Corsair
#region Constructors
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="CorsairMouseRGBDevice"/> class.
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Corsair.CorsairMouseRGBDevice" /> class.
/// </summary>
/// <param name="info">The specific information provided by CUE for the mouse</param>
internal CorsairMouseRGBDevice(CorsairMouseRGBDeviceInfo info)
@@ -4,8 +4,9 @@ using RGB.NET.Devices.Corsair.Native;
namespace RGB.NET.Devices.Corsair
{
/// <inheritdoc />
/// <summary>
/// Represents a generic information for a <see cref="CorsairMouseRGBDevice"/>.
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Corsair.CorsairMouseRGBDevice" />.
/// </summary>
public class CorsairMouseRGBDeviceInfo : CorsairRGBDeviceInfo
{
@@ -20,11 +21,12 @@ namespace RGB.NET.Devices.Corsair
#region Constructors
/// <inheritdoc />
/// <summary>
/// Internal constructor of managed <see cref="CorsairMouseRGBDeviceInfo"/>.
/// Internal constructor of managed <see cref="T:RGB.NET.Devices.Corsair.CorsairMouseRGBDeviceInfo" />.
/// </summary>
/// <param name="deviceIndex">The index of the <see cref="CorsairMouseRGBDevice"/>.</param>
/// <param name="nativeInfo">The native <see cref="_CorsairDeviceInfo" />-struct</param>
/// <param name="deviceIndex">The index of the <see cref="T:RGB.NET.Devices.Corsair.CorsairMouseRGBDevice" />.</param>
/// <param name="nativeInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairDeviceInfo" />-struct</param>
internal CorsairMouseRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo)
: base(deviceIndex, RGBDeviceType.Mouse, nativeInfo)
{
@@ -10,6 +10,7 @@ using RGB.NET.Devices.Corsair.Native;
namespace RGB.NET.Devices.Corsair
{
/// <inheritdoc />
/// <summary>
/// Represents a corsair mousepad.
/// </summary>
@@ -26,8 +27,9 @@ namespace RGB.NET.Devices.Corsair
#region Constructors
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="CorsairMousepadRGBDevice"/> class.
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Corsair.CorsairMousepadRGBDevice" /> class.
/// </summary>
/// <param name="info">The specific information provided by CUE for the mousepad</param>
internal CorsairMousepadRGBDevice(CorsairMousepadRGBDeviceInfo info)
@@ -4,18 +4,20 @@ using RGB.NET.Devices.Corsair.Native;
namespace RGB.NET.Devices.Corsair
{
/// <inheritdoc />
/// <summary>
/// Represents a generic information for a <see cref="CorsairMousepadRGBDevice"/>.
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Corsair.CorsairMousepadRGBDevice" />.
/// </summary>
public class CorsairMousepadRGBDeviceInfo : CorsairRGBDeviceInfo
{
#region Constructors
/// <inheritdoc />
/// <summary>
/// Internal constructor of managed <see cref="CorsairMousepadRGBDeviceInfo"/>.
/// Internal constructor of managed <see cref="T:RGB.NET.Devices.Corsair.CorsairMousepadRGBDeviceInfo" />.
/// </summary>
/// <param name="deviceIndex">The index if the <see cref="CorsairMousepadRGBDevice"/>.</param>
/// <param name="nativeInfo">The native <see cref="_CorsairDeviceInfo" />-struct</param>
/// <param name="deviceIndex">The index if the <see cref="T:RGB.NET.Devices.Corsair.CorsairMousepadRGBDevice" />.</param>
/// <param name="nativeInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairDeviceInfo" />-struct</param>
internal CorsairMousepadRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo)
: base(deviceIndex, RGBDeviceType.Mousepad, nativeInfo)
{
@@ -9,8 +9,9 @@ using RGB.NET.Core;
namespace RGB.NET.Devices.Corsair.SpecialParts
{
/// <inheritdoc />
/// <summary>
/// Represents a lightbar attached to a <see cref="IRGBDevice"/>
/// Represents a lightbar attached to a <see cref="T:RGB.NET.Core.IRGBDevice" />
/// </summary>
public class LightbarSpecialPart : IRGBDeviceSpecialPart
{
@@ -59,16 +60,18 @@ namespace RGB.NET.Devices.Corsair.SpecialParts
#region Methods
/// <inheritdoc />
/// <summary>
/// Returns an enumerator that iterates over all <see cref="Led"/> of the <see cref="IRGBDeviceSpecialPart"/>.
/// Returns an enumerator that iterates over all <see cref="T:RGB.NET.Core.Led" /> of the <see cref="T:RGB.NET.Core.IRGBDeviceSpecialPart" />.
/// </summary>
/// <returns>An enumerator for all <see cref="Led"/> of the <see cref="IRGBDeviceSpecialPart"/>.</returns>
/// <returns>An enumerator for all <see cref="T:RGB.NET.Core.Led" /> of the <see cref="T:RGB.NET.Core.IRGBDeviceSpecialPart" />.</returns>
public IEnumerator<Led> GetEnumerator() => _leds.GetEnumerator();
/// <inheritdoc />
/// <summary>
/// Returns an enumerator that iterates over all <see cref="Led"/> of the <see cref="IRGBDeviceSpecialPart"/>.
/// Returns an enumerator that iterates over all <see cref="T:RGB.NET.Core.Led" /> of the <see cref="T:RGB.NET.Core.IRGBDeviceSpecialPart" />.
/// </summary>
/// <returns>An enumerator for all <see cref="Led"/> of the <see cref="IRGBDeviceSpecialPart"/>.</returns>
/// <returns>An enumerator for all <see cref="T:RGB.NET.Core.Led" /> of the <see cref="T:RGB.NET.Core.IRGBDeviceSpecialPart" />.</returns>
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
#endregion