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

@@ -3,8 +3,9 @@ using RGB.NET.Core;
namespace RGB.NET.Devices.CoolerMaster.Attributes
{
/// <inheritdoc />
/// <summary>
/// Specifies the <see cref="RGBDeviceType"/> of a field.
/// Specifies the <see cref="T:RGB.NET.Core.RGBDeviceType" /> of a field.
/// </summary>
[AttributeUsage(AttributeTargets.Field)]
public class DeviceTypeAttribute : Attribute
@@ -20,10 +21,11 @@ namespace RGB.NET.Devices.CoolerMaster.Attributes
#region Constructors
/// <inheritdoc />
/// <summary>
/// Internal constructor of the <see cref="DeviceTypeAttribute"/> class.
/// Internal constructor of the <see cref="T:RGB.NET.Devices.CoolerMaster.Attributes.DeviceTypeAttribute" /> class.
/// </summary>
/// <param name="deviceType">The <see cref="RGBDeviceType"/>.</param>
/// <param name="deviceType">The <see cref="T:RGB.NET.Core.RGBDeviceType" />.</param>
public DeviceTypeAttribute(RGBDeviceType deviceType)
{
this.DeviceType = deviceType;
@@ -12,6 +12,7 @@ using RGB.NET.Devices.CoolerMaster.Native;
namespace RGB.NET.Devices.CoolerMaster
{
/// <inheritdoc />
/// <summary>
/// Represents a device provider responsible for Cooler Master devices.
/// </summary>
@@ -37,6 +38,7 @@ namespace RGB.NET.Devices.CoolerMaster
/// </summary>
public static List<string> PossibleX64NativePaths { get; } = new List<string> { "x64/CMSDK.dll" };
/// <inheritdoc />
/// <summary>
/// Indicates if the SDK is initialized and ready to use.
/// </summary>
@@ -47,6 +49,7 @@ namespace RGB.NET.Devices.CoolerMaster
/// </summary>
public string LoadedArchitecture => _CoolerMasterSDK.LoadedArchitecture;
/// <inheritdoc />
/// <summary>
/// Gets whether the application has exclusive access to the SDK or not.
/// </summary>
@@ -58,7 +61,7 @@ namespace RGB.NET.Devices.CoolerMaster
/// <summary>
/// Gets or sets a function to get the culture for a specific device.
/// </summary>
public Func<CultureInfo> GetCulture { get; set; } = () => CultureHelper.GetCurrentCulture();
public Func<CultureInfo> GetCulture { get; set; } = CultureHelper.GetCurrentCulture;
#endregion
@@ -97,7 +100,7 @@ namespace RGB.NET.Devices.CoolerMaster
{
try
{
CoolerMasterRGBDevice device = null;
CoolerMasterRGBDevice device;
switch (index.GetDeviceType())
{
case RGBDeviceType.Keyboard:
@@ -3,8 +3,9 @@ using RGB.NET.Core;
namespace RGB.NET.Devices.CoolerMaster
{
/// <inheritdoc />
/// <summary>
/// Represents a Id of a <see cref="Led"/> on a <see cref="CoolerMasterRGBDevice"/>.
/// Represents a Id of a <see cref="T:RGB.NET.Core.Led" /> on a <see cref="T:RGB.NET.Devices.CoolerMaster.CoolerMasterRGBDevice" />.
/// </summary>
[DebuggerDisplay("{" + nameof(LedId) + "}")]
public class CoolerMasterLedId : ILedId
@@ -8,14 +8,16 @@ using RGB.NET.Devices.CoolerMaster.Native;
namespace RGB.NET.Devices.CoolerMaster
{
/// <inheritdoc />
/// <summary>
/// Represents a generic CoolerMaster-device. (keyboard, mouse, headset, mousepad).
/// </summary>
public abstract class CoolerMasterRGBDevice : AbstractRGBDevice
{
#region Properties & Fields
/// <inheritdoc />
/// <summary>
/// Gets information about the <see cref="CoolerMasterRGBDevice"/>.
/// Gets information about the <see cref="T:RGB.NET.Devices.CoolerMaster.CoolerMasterRGBDevice" />.
/// </summary>
public override IRGBDeviceInfo DeviceInfo { get; }
@@ -74,11 +76,9 @@ namespace RGB.NET.Devices.CoolerMaster
if (layout.Leds != null)
foreach (LedLayout layoutLed in layout.Leds)
{
CoolerMasterLedIds ledId;
if (Enum.TryParse(layoutLed.Id, true, out ledId))
if (Enum.TryParse(layoutLed.Id, true, out CoolerMasterLedIds ledId))
{
Led led;
if (LedMapping.TryGetValue(new CoolerMasterLedId(this, ledId), out led))
if (LedMapping.TryGetValue(new CoolerMasterLedId(this, ledId), out Led led))
{
led.LedRectangle.Location.X = layoutLed.X;
led.LedRectangle.Location.Y = layoutLed.Y;
@@ -4,8 +4,9 @@ using RGB.NET.Devices.CoolerMaster.Helper;
namespace RGB.NET.Devices.CoolerMaster
{
/// <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 CoolerMasterRGBDeviceInfo : IRGBDeviceInfo
{
@@ -4,6 +4,7 @@ using RGB.NET.Core;
namespace RGB.NET.Devices.CoolerMaster
{
/// <inheritdoc />
/// <summary>
/// Represents a CoolerMaster keyboard.
/// </summary>
@@ -20,8 +21,9 @@ namespace RGB.NET.Devices.CoolerMaster
#region Constructors
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="CoolerMasterKeyboardRGBDevice"/> class.
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.CoolerMaster.CoolerMasterKeyboardRGBDevice" /> class.
/// </summary>
/// <param name="info">The specific information provided by CoolerMaster for the keyboard</param>
internal CoolerMasterKeyboardRGBDevice(CoolerMasterKeyboardRGBDeviceInfo info)
@@ -46,7 +48,7 @@ namespace RGB.NET.Devices.CoolerMaster
string model = KeyboardDeviceInfo.Model.Replace(" ", string.Empty).ToUpper();
ApplyLayoutFromFile(PathHelper.GetAbsolutePath(
$@"Layouts\CoolerMaster\Keyboards\{model}\{KeyboardDeviceInfo.PhysicalLayout.ToString().ToUpper()}.xml"),
KeyboardDeviceInfo.LogicalLayout.ToString(), PathHelper.GetAbsolutePath($@"Images\CoolerMaster\Keyboards"));
KeyboardDeviceInfo.LogicalLayout.ToString(), PathHelper.GetAbsolutePath(@"Images\CoolerMaster\Keyboards"));
}
#endregion
@@ -4,8 +4,9 @@ using RGB.NET.Core;
namespace RGB.NET.Devices.CoolerMaster
{
/// <inheritdoc />
/// <summary>
/// Represents a generic information for a <see cref="CoolerMasterKeyboardRGBDevice"/>.
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.CoolerMaster.CoolerMasterKeyboardRGBDevice" />.
/// </summary>
public class CoolerMasterKeyboardRGBDeviceInfo : CoolerMasterRGBDeviceInfo
{
@@ -25,12 +26,13 @@ namespace RGB.NET.Devices.CoolerMaster
#region Constructors
/// <inheritdoc />
/// <summary>
/// Internal constructor of managed <see cref="CoolerMasterKeyboardRGBDeviceInfo"/>.
/// Internal constructor of managed <see cref="T:RGB.NET.Devices.CoolerMaster.CoolerMasterKeyboardRGBDeviceInfo" />.
/// </summary>
/// <param name="deviceIndex">The index of the <see cref="CoolerMasterKeyboardRGBDevice"/>.</param>
/// <param name="physicalKeyboardLayout">The <see cref="CoolerMasterPhysicalKeyboardLayout" /> of the <see cref="CoolerMasterKeyboardRGBDevice"/>.</param>
/// <param name="culture">The <see cref="CultureInfo"/> of the layout this keyboard is using</param>
/// <param name="deviceIndex">The index of the <see cref="T:RGB.NET.Devices.CoolerMaster.CoolerMasterKeyboardRGBDevice" />.</param>
/// <param name="physicalKeyboardLayout">The <see cref="T:RGB.NET.Devices.CoolerMaster.CoolerMasterPhysicalKeyboardLayout" /> of the <see cref="T:RGB.NET.Devices.CoolerMaster.CoolerMasterKeyboardRGBDevice" />.</param>
/// <param name="culture">The <see cref="T:System.Globalization.CultureInfo" /> of the layout this keyboard is using</param>
internal CoolerMasterKeyboardRGBDeviceInfo(CoolerMasterDevicesIndexes deviceIndex, CoolerMasterPhysicalKeyboardLayout physicalKeyboardLayout, CultureInfo culture)
: base(RGBDeviceType.Keyboard, deviceIndex)
{