Changed all namespaces to file-scope

This commit is contained in:
DarthAffe committed 2021-11-13 17:35:08 +01:00
1 parent a0c6ccebea
commit 30624035f1
353 files changed
+35775 -36129

No files matched your search

@@ -2,39 +2,38 @@
using RGB.NET.Core;
using RGB.NET.Devices.CoolerMaster.Native;
namespace RGB.NET.Devices.CoolerMaster
namespace RGB.NET.Devices.CoolerMaster;
/// <inheritdoc cref="AbstractRGBDevice{TDeviceInfo}" />
/// <summary>
/// Represents a generic CoolerMaster-device. (keyboard, mouse, headset, mousepad).
/// </summary>
public abstract class CoolerMasterRGBDevice<TDeviceInfo> : AbstractRGBDevice<TDeviceInfo>, ICoolerMasterRGBDevice
where TDeviceInfo : CoolerMasterRGBDeviceInfo
{
/// <inheritdoc cref="AbstractRGBDevice{TDeviceInfo}" />
#region Constructors
/// <summary>
/// Represents a generic CoolerMaster-device. (keyboard, mouse, headset, mousepad).
/// Initializes a new instance of the <see cref="CoolerMasterRGBDevice{TDeviceInfo}"/> class.
/// </summary>
public abstract class CoolerMasterRGBDevice<TDeviceInfo> : AbstractRGBDevice<TDeviceInfo>, ICoolerMasterRGBDevice
where TDeviceInfo : CoolerMasterRGBDeviceInfo
/// <param name="info">The generic information provided by CoolerMaster for the device.</param>
/// <param name="updateTrigger">The update trigger used to update this device.</param>
protected CoolerMasterRGBDevice(TDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
: base(info, new CoolerMasterUpdateQueue(updateTrigger, info.DeviceIndex))
{ }
#endregion
#region Methods
/// <inheritdoc cref="IDisposable.Dispose" />
/// <inheritdoc cref="AbstractRGBDevice{TDeviceInfo}.Dispose" />
public override void Dispose()
{
#region Constructors
_CoolerMasterSDK.EnableLedControl(false, DeviceInfo.DeviceIndex);
/// <summary>
/// Initializes a new instance of the <see cref="CoolerMasterRGBDevice{TDeviceInfo}"/> class.
/// </summary>
/// <param name="info">The generic information provided by CoolerMaster for the device.</param>
/// <param name="updateTrigger">The update trigger used to update this device.</param>
protected CoolerMasterRGBDevice(TDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
: base(info, new CoolerMasterUpdateQueue(updateTrigger, info.DeviceIndex))
{ }
#endregion
#region Methods
/// <inheritdoc cref="IDisposable.Dispose" />
/// <inheritdoc cref="AbstractRGBDevice{TDeviceInfo}.Dispose" />
public override void Dispose()
{
_CoolerMasterSDK.EnableLedControl(false, DeviceInfo.DeviceIndex);
base.Dispose();
}
#endregion
base.Dispose();
}
}
#endregion
}
@@ -1,54 +1,53 @@
using RGB.NET.Core;
using RGB.NET.Devices.CoolerMaster.Helper;
namespace RGB.NET.Devices.CoolerMaster
namespace RGB.NET.Devices.CoolerMaster;
/// <inheritdoc />
/// <summary>
/// Represents a generic information for a Corsair-<see cref="T:RGB.NET.Core.IRGBDevice" />.
/// </summary>
public class CoolerMasterRGBDeviceInfo : IRGBDeviceInfo
{
#region Properties & Fields
/// <inheritdoc />
public RGBDeviceType DeviceType { get; }
/// <inheritdoc />
public string DeviceName { get; }
/// <inheritdoc />
public string Manufacturer => "Cooler Master";
/// <inheritdoc />
public string Model { get; }
/// <inheritdoc />
public object? LayoutMetadata { get; set; }
/// <summary>
/// Represents a generic information for a Corsair-<see cref="T:RGB.NET.Core.IRGBDevice" />.
/// Gets the <see cref="CoolerMasterDevicesIndexes"/> of the <see cref="CoolerMasterRGBDevice{TDeviceInfo}"/>.
/// </summary>
public class CoolerMasterRGBDeviceInfo : IRGBDeviceInfo
public CoolerMasterDevicesIndexes DeviceIndex { get; }
#endregion
#region Constructors
/// <summary>
/// Internal constructor of managed <see cref="CoolerMasterRGBDeviceInfo"/>.
/// </summary>
/// <param name="deviceType">The type of the <see cref="IRGBDevice"/>.</param>
/// <param name="deviceIndex">The <see cref="CoolerMasterDevicesIndexes"/> of the <see cref="IRGBDevice"/>.</param>
internal CoolerMasterRGBDeviceInfo(RGBDeviceType deviceType, CoolerMasterDevicesIndexes deviceIndex)
{
#region Properties & Fields
this.DeviceType = deviceType;
this.DeviceIndex = deviceIndex;
/// <inheritdoc />
public RGBDeviceType DeviceType { get; }
/// <inheritdoc />
public string DeviceName { get; }
/// <inheritdoc />
public string Manufacturer => "Cooler Master";
/// <inheritdoc />
public string Model { get; }
/// <inheritdoc />
public object? LayoutMetadata { get; set; }
/// <summary>
/// Gets the <see cref="CoolerMasterDevicesIndexes"/> of the <see cref="CoolerMasterRGBDevice{TDeviceInfo}"/>.
/// </summary>
public CoolerMasterDevicesIndexes DeviceIndex { get; }
#endregion
#region Constructors
/// <summary>
/// Internal constructor of managed <see cref="CoolerMasterRGBDeviceInfo"/>.
/// </summary>
/// <param name="deviceType">The type of the <see cref="IRGBDevice"/>.</param>
/// <param name="deviceIndex">The <see cref="CoolerMasterDevicesIndexes"/> of the <see cref="IRGBDevice"/>.</param>
internal CoolerMasterRGBDeviceInfo(RGBDeviceType deviceType, CoolerMasterDevicesIndexes deviceIndex)
{
this.DeviceType = deviceType;
this.DeviceIndex = deviceIndex;
Model = deviceIndex.GetDescription();
DeviceName = DeviceHelper.CreateDeviceName(Manufacturer, Model);
}
#endregion
Model = deviceIndex.GetDescription();
DeviceName = DeviceHelper.CreateDeviceName(Manufacturer, Model);
}
}
#endregion
}
@@ -2,52 +2,51 @@
using RGB.NET.Core;
using RGB.NET.Devices.CoolerMaster.Native;
namespace RGB.NET.Devices.CoolerMaster
namespace RGB.NET.Devices.CoolerMaster;
/// <inheritdoc />
/// <summary>
/// Represents the update-queue performing updates for cooler master devices.
/// </summary>
public class CoolerMasterUpdateQueue : UpdateQueue
{
/// <inheritdoc />
#region Properties & Fields
private readonly CoolerMasterDevicesIndexes _deviceIndex;
private readonly _CoolerMasterColorMatrix _deviceMatrix;
#endregion
#region Constructors
/// <summary>
/// Represents the update-queue performing updates for cooler master devices.
/// Initializes a new instance of the <see cref="CoolerMasterUpdateQueue"/> class.
/// </summary>
public class CoolerMasterUpdateQueue : UpdateQueue
/// <param name="updateTrigger">The update trigger used by this queue.</param>
/// <param name="deviceIndex">The <see cref="CoolerMasterDevicesIndexes"/> of the device this queue performs updates for.</param>
public CoolerMasterUpdateQueue(IDeviceUpdateTrigger updateTrigger, CoolerMasterDevicesIndexes deviceIndex)
: base(updateTrigger)
{
#region Properties & Fields
this._deviceIndex = deviceIndex;
private readonly CoolerMasterDevicesIndexes _deviceIndex;
private readonly _CoolerMasterColorMatrix _deviceMatrix;
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="CoolerMasterUpdateQueue"/> class.
/// </summary>
/// <param name="updateTrigger">The update trigger used by this queue.</param>
/// <param name="deviceIndex">The <see cref="CoolerMasterDevicesIndexes"/> of the device this queue performs updates for.</param>
public CoolerMasterUpdateQueue(IDeviceUpdateTrigger updateTrigger, CoolerMasterDevicesIndexes deviceIndex)
: base(updateTrigger)
{
this._deviceIndex = deviceIndex;
_deviceMatrix = new _CoolerMasterColorMatrix { KeyColor = new _CoolerMasterKeyColor[_CoolerMasterColorMatrix.ROWS, _CoolerMasterColorMatrix.COLUMNS] };
}
#endregion
#region Methods
/// <inheritdoc />
protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet)
{
foreach ((object key, Color color) in dataSet)
{
(int row, int column) = ((int, int))key;
_deviceMatrix.KeyColor[row, column] = new _CoolerMasterKeyColor(color.GetR(), color.GetG(), color.GetB());
}
_CoolerMasterSDK.SetAllLedColor(_deviceMatrix, _deviceIndex);
}
#endregion
_deviceMatrix = new _CoolerMasterColorMatrix { KeyColor = new _CoolerMasterKeyColor[_CoolerMasterColorMatrix.ROWS, _CoolerMasterColorMatrix.COLUMNS] };
}
}
#endregion
#region Methods
/// <inheritdoc />
protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet)
{
foreach ((object key, Color color) in dataSet)
{
(int row, int column) = ((int, int))key;
_deviceMatrix.KeyColor[row, column] = new _CoolerMasterKeyColor(color.GetR(), color.GetG(), color.GetB());
}
_CoolerMasterSDK.SetAllLedColor(_deviceMatrix, _deviceIndex);
}
#endregion
}
@@ -1,10 +1,9 @@
using RGB.NET.Core;
namespace RGB.NET.Devices.CoolerMaster
{
/// <summary>
/// Represents a CoolerMaster RGB-device.
/// </summary>
public interface ICoolerMasterRGBDevice : IRGBDevice
{ }
}
namespace RGB.NET.Devices.CoolerMaster;
/// <summary>
/// Represents a CoolerMaster RGB-device.
/// </summary>
public interface ICoolerMasterRGBDevice : IRGBDevice
{ }