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

@@ -1,42 +1,41 @@
using System.Collections.Generic;
using RGB.NET.Core;
namespace RGB.NET.Devices.Logitech
namespace RGB.NET.Devices.Logitech;
/// <inheritdoc cref="LogitechRGBDevice{TDeviceInfo}" />
/// <summary>
/// Represents a logitech per-key-lightable device.
/// </summary>
public class LogitechPerKeyRGBDevice : LogitechRGBDevice<LogitechRGBDeviceInfo>, IUnknownDevice //TODO DarthAffe 18.04.2020: It's know which kind of device this is, but they would need to be separated
{
/// <inheritdoc cref="LogitechRGBDevice{TDeviceInfo}" />
#region Properties & Fields
private readonly LedMapping<LogitechLedId> _ledMapping;
#endregion
#region Constructors
/// <inheritdoc />
/// <summary>
/// Represents a logitech per-key-lightable device.
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Logitech.LogitechPerKeyRGBDevice" /> class.
/// </summary>
public class LogitechPerKeyRGBDevice : LogitechRGBDevice<LogitechRGBDeviceInfo>, IUnknownDevice //TODO DarthAffe 18.04.2020: It's know which kind of device this is, but they would need to be separated
internal LogitechPerKeyRGBDevice(LogitechRGBDeviceInfo info, IUpdateQueue updateQueue, LedMapping<LogitechLedId> ledMapping)
: base(info, updateQueue)
{
#region Properties & Fields
private readonly LedMapping<LogitechLedId> _ledMapping;
#endregion
#region Constructors
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Logitech.LogitechPerKeyRGBDevice" /> class.
/// </summary>
internal LogitechPerKeyRGBDevice(LogitechRGBDeviceInfo info, IUpdateQueue updateQueue, LedMapping<LogitechLedId> ledMapping)
: base(info, updateQueue)
{
this._ledMapping = ledMapping;
}
#endregion
#region Methods
/// <inheritdoc />
protected override object GetLedCustomData(LedId ledId) => _ledMapping.TryGetValue(ledId, out LogitechLedId logitechLedId) ? logitechLedId : -1;
/// <inheritdoc />
protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate) => UpdateQueue.SetData(GetUpdateData(ledsToUpdate));
#endregion
this._ledMapping = ledMapping;
}
}
#endregion
#region Methods
/// <inheritdoc />
protected override object GetLedCustomData(LedId ledId) => _ledMapping.TryGetValue(ledId, out LogitechLedId logitechLedId) ? logitechLedId : -1;
/// <inheritdoc />
protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate) => UpdateQueue.SetData(GetUpdateData(ledsToUpdate));
#endregion
}
@@ -2,44 +2,43 @@
using RGB.NET.Core;
using RGB.NET.Devices.Logitech.Native;
namespace RGB.NET.Devices.Logitech
namespace RGB.NET.Devices.Logitech;
/// <summary>
/// Represents the update-queue performing updates for logitech per-key devices.
/// </summary>
public class LogitechPerKeyUpdateQueue : UpdateQueue
{
#region Constructors
/// <summary>
/// Represents the update-queue performing updates for logitech per-key devices.
/// Initializes a new instance of the <see cref="LogitechPerKeyUpdateQueue"/> class.
/// </summary>
public class LogitechPerKeyUpdateQueue : UpdateQueue
/// <param name="updateTrigger">The update trigger used by this queue.</param>
public LogitechPerKeyUpdateQueue(IDeviceUpdateTrigger updateTrigger)
: base(updateTrigger)
{
#region Constructors
}
/// <summary>
/// Initializes a new instance of the <see cref="LogitechPerKeyUpdateQueue"/> class.
/// </summary>
/// <param name="updateTrigger">The update trigger used by this queue.</param>
public LogitechPerKeyUpdateQueue(IDeviceUpdateTrigger updateTrigger)
: base(updateTrigger)
#endregion
#region Methods
/// <inheritdoc />
protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet)
{
_LogitechGSDK.LogiLedSetTargetDevice(LogitechDeviceCaps.PerKeyRGB);
foreach ((object key, Color color) in dataSet)
{
}
#endregion
#region Methods
/// <inheritdoc />
protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet)
{
_LogitechGSDK.LogiLedSetTargetDevice(LogitechDeviceCaps.PerKeyRGB);
foreach ((object key, Color color) in dataSet)
{
// These will be LogitechLedId but the SDK expects an int and doesn't care about invalid values
int keyName = (int)key;
_LogitechGSDK.LogiLedSetLightingForKeyWithKeyName(keyName,
// These will be LogitechLedId but the SDK expects an int and doesn't care about invalid values
int keyName = (int)key;
_LogitechGSDK.LogiLedSetLightingForKeyWithKeyName(keyName,
(int)MathF.Round(color.R * 100),
(int)MathF.Round(color.G * 100),
(int)MathF.Round(color.B * 100));
}
}
#endregion
}
}
#endregion
}