Small refactorings to unify code styling

This commit is contained in:
DarthAffe committed 2018-01-14 11:57:45 +01:00
1 parent ac0350a9f8
commit efe77cedbc
10 files changed
+80 -101

No files matched your search

@@ -0,0 +1,22 @@
using System.Runtime.InteropServices;
namespace RGB.NET.Devices.CoolerMaster.Native
{
// ReSharper disable once InconsistentNaming
internal struct _CoolerMasterColorMatrix
{
#region Constants
internal const int ROWS = 6;
internal const int COLUMNS = 22;
#endregion
#region Properties & Fields
[MarshalAs(UnmanagedType.ByValArray, SizeConst = ROWS * COLUMNS)]
public _CoolerMasterKeyColor[,] KeyColor;
#endregion
}
}
@@ -0,0 +1,30 @@
// ReSharper disable UnusedMethodReturnValue.Global
// ReSharper disable UnusedMember.Global
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable NotAccessedField.Global
namespace RGB.NET.Devices.CoolerMaster.Native
{
// ReSharper disable once InconsistentNaming
internal struct _CoolerMasterKeyColor
{
#region Properties & Fields
public byte R;
public byte G;
public byte B;
#endregion
#region Constructors
internal _CoolerMasterKeyColor(byte r, byte g, byte b)
{
this.R = r;
this.G = g;
this.B = b;
}
#endregion
}
}
@@ -74,31 +74,6 @@ namespace RGB.NET.Devices.CoolerMaster.Native
#region SDK-METHODS
#region Structs
// ReSharper disable InconsistentNaming
internal struct KEY_COLOR
{
public byte r;
public byte g;
public byte b;
public KEY_COLOR(byte colR, byte colG, byte colB)
{
r = colR;
g = colG;
b = colB;
}
}
internal struct COLOR_MATRIX
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 132)] public KEY_COLOR[,] KeyColor;
}
// ReSharper restore InconsistentNaming
#endregion
#region Pointers
private static GetSDKVersionPointer _getSDKVersionPointer;
@@ -141,7 +116,7 @@ namespace RGB.NET.Devices.CoolerMaster.Native
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
private delegate bool SetAllLedColorPointer(COLOR_MATRIX colorMatrix);
private delegate bool SetAllLedColorPointer(_CoolerMasterColorMatrix colorMatrix);
#endregion
@@ -150,66 +125,42 @@ namespace RGB.NET.Devices.CoolerMaster.Native
/// <summary>
/// CM-SDK: Get SDK Dll's Version.
/// </summary>
internal static int GetSDKVersion()
{
return _getSDKVersionPointer();
}
internal static int GetSDKVersion() => _getSDKVersionPointer();
/// <summary>
/// CM-SDK: set operating device
/// </summary>
internal static void SetControlDevice(CoolerMasterDevicesIndexes devicesIndexes)
{
_setControlDevicenPointer(devicesIndexes);
}
internal static void SetControlDevice(CoolerMasterDevicesIndexes devicesIndexes) => _setControlDevicenPointer(devicesIndexes);
/// <summary>
/// CM-SDK: verify if the deviced is plugged in
/// </summary>
internal static bool IsDevicePlugged()
{
return _isDevicePlugPointer();
}
internal static bool IsDevicePlugged() => _isDevicePlugPointer();
/// <summary>
/// CM-SDK: Obtain current device layout
/// </summary>
internal static CoolerMasterPhysicalKeyboardLayout GetDeviceLayout()
{
return _getDeviceLayoutPointer();
}
internal static CoolerMasterPhysicalKeyboardLayout GetDeviceLayout() => _getDeviceLayoutPointer();
/// <summary>
/// CM-SDK: set control over device’s LED
/// </summary>
internal static bool EnableLedControl(bool value)
{
return _enableLedControlPointer(value);
}
internal static bool EnableLedControl(bool value) => _enableLedControlPointer(value);
/// <summary>
/// CM-SDK: Print out the lights setting from Buffer to LED
/// </summary>
internal static bool RefreshLed(bool autoRefresh)
{
return _refreshLedPointer(autoRefresh);
}
internal static bool RefreshLed(bool autoRefresh) => _refreshLedPointer(autoRefresh);
/// <summary>
/// CM-SDK: Set single Key LED color
/// </summary>
internal static bool SetLedColor(int row, int column, byte r, byte g, byte b)
{
return _setLedColorPointer(row, column, r, g, b);
}
internal static bool SetLedColor(int row, int column, byte r, byte g, byte b) => _setLedColorPointer(row, column, r, g, b);
/// <summary>
/// CM-SDK: Set Keyboard "every LED" color
/// </summary>
internal static bool SetAllLedColor(COLOR_MATRIX colorMatrix)
{
return _setAllLedColorPointer(colorMatrix);
}
internal static bool SetAllLedColor(_CoolerMasterColorMatrix colorMatrix) => _setAllLedColorPointer(colorMatrix);
// ReSharper restore EventExceptionNotDocumented