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,50 +1,49 @@
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 zone-lightable device.
/// </summary>
public class LogitechZoneRGBDevice : 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<int> _ledMapping;
#endregion
#region Constructors
/// <inheritdoc />
/// <summary>
/// Represents a logitech zone-lightable device.
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Logitech.LogitechZoneRGBDevice" /> class.
/// </summary>
public class LogitechZoneRGBDevice : 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 LogitechZoneRGBDevice(LogitechRGBDeviceInfo info, IUpdateQueue updateQueue, LedMapping<int> ledMapping)
: base(info, updateQueue)
{
#region Properties & Fields
this._ledMapping = ledMapping;
private readonly LedMapping<int> _ledMapping;
#endregion
#region Constructors
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Logitech.LogitechZoneRGBDevice" /> class.
/// </summary>
internal LogitechZoneRGBDevice(LogitechRGBDeviceInfo info, IUpdateQueue updateQueue, LedMapping<int> ledMapping)
: base(info, updateQueue)
{
this._ledMapping = ledMapping;
InitializeLayout();
}
#endregion
#region Methods
private void InitializeLayout()
{
for (int i = 0; i < DeviceInfo.Zones; i++)
AddLed(_ledMapping[i], new Point(i * 10, 0), new Size(10, 10));
}
/// <inheritdoc />
protected override object GetLedCustomData(LedId ledId) => _ledMapping[ledId];
/// <inheritdoc />
protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate) => UpdateQueue.SetData(GetUpdateData(ledsToUpdate));
#endregion
InitializeLayout();
}
}
#endregion
#region Methods
private void InitializeLayout()
{
for (int i = 0; i < DeviceInfo.Zones; i++)
AddLed(_ledMapping[i], new Point(i * 10, 0), new Size(10, 10));
}
/// <inheritdoc />
protected override object GetLedCustomData(LedId ledId) => _ledMapping[ledId];
/// <inheritdoc />
protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate) => UpdateQueue.SetData(GetUpdateData(ledsToUpdate));
#endregion
}
@@ -2,51 +2,50 @@
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 zone devices.
/// </summary>
public class LogitechZoneUpdateQueue : UpdateQueue
{
#region Properties & Fields
private readonly LogitechDeviceType _deviceType;
#endregion
#region Constructors
/// <summary>
/// Represents the update-queue performing updates for logitech zone devices.
/// Initializes a new instance of the <see cref="LogitechZoneUpdateQueue"/> class.
/// </summary>
public class LogitechZoneUpdateQueue : UpdateQueue
/// <param name="updateTrigger">The update trigger used by this queue.</param>
/// <param name="deviceType">The tpye of the device this queue is updating.</param>
public LogitechZoneUpdateQueue(IDeviceUpdateTrigger updateTrigger, LogitechDeviceType deviceType)
: base(updateTrigger)
{
#region Properties & Fields
private readonly LogitechDeviceType _deviceType;
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="LogitechZoneUpdateQueue"/> class.
/// </summary>
/// <param name="updateTrigger">The update trigger used by this queue.</param>
/// <param name="deviceType">The tpye of the device this queue is updating.</param>
public LogitechZoneUpdateQueue(IDeviceUpdateTrigger updateTrigger, LogitechDeviceType deviceType)
: base(updateTrigger)
{
this._deviceType = deviceType;
}
#endregion
#region Methods
/// <inheritdoc />
protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet)
{
_LogitechGSDK.LogiLedSetTargetDevice(LogitechDeviceCaps.All);
foreach ((object key, Color color) in dataSet)
{
int zone = (int)key;
_LogitechGSDK.LogiLedSetLightingForTargetZone(_deviceType, zone,
(int)MathF.Round(color.R * 100),
(int)MathF.Round(color.G * 100),
(int)MathF.Round(color.B * 100));
}
}
#endregion
this._deviceType = deviceType;
}
}
#endregion
#region Methods
/// <inheritdoc />
protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet)
{
_LogitechGSDK.LogiLedSetTargetDevice(LogitechDeviceCaps.All);
foreach ((object key, Color color) in dataSet)
{
int zone = (int)key;
_LogitechGSDK.LogiLedSetLightingForTargetZone(_deviceType, zone,
(int)MathF.Round(color.R * 100),
(int)MathF.Round(color.G * 100),
(int)MathF.Round(color.B * 100));
}
}
#endregion
}