Fixed warnings

This commit is contained in:
DarthAffe committed 2021-02-02 23:37:56 +01:00
1 parent 57dc9afb32
commit a0a1521658
118 files changed
+802 -1181

No files matched your search

@@ -35,9 +35,9 @@ namespace RGB.NET.Devices.SteelSeries
#region Methods
protected override void OnUpdate(object sender, CustomUpdateData customData)
protected override void OnUpdate(object? sender, CustomUpdateData customData)
{
if ((customData != null) && (customData["refresh"] as bool? ?? false))
if (customData["refresh"] as bool? ?? false)
SteelSeriesSDK.SendHeartbeat();
else
base.OnUpdate(sender, customData);
@@ -45,7 +45,7 @@ namespace RGB.NET.Devices.SteelSeries
/// <inheritdoc />
protected override void Update(Dictionary<object, Color> dataSet)
=> SteelSeriesSDK.UpdateLeds(_deviceType, dataSet.ToDictionary(x => ((SteelSeriesLedId)x.Key).GetAPIName(), x => x.Value.ToIntArray()));
=> SteelSeriesSDK.UpdateLeds(_deviceType, dataSet.Select(x => (((SteelSeriesLedId)x.Key).GetAPIName(), x.Value.ToIntArray())).Where(x => x.Item1 != null).ToList()!);
#endregion
}
@@ -71,7 +71,7 @@ namespace RGB.NET.Devices.SteelSeries
}
/// <inheritdoc />
protected override void OnUpdate(CustomUpdateData updateData = null)
protected override void OnUpdate(CustomUpdateData? updateData = null)
{
base.OnUpdate(updateData);
_lastUpdateTimestamp = Stopwatch.GetTimestamp();
@@ -13,7 +13,7 @@ namespace RGB.NET.Devices.SteelSeries
{
#region Properties & Fields
private Dictionary<LedId, SteelSeriesLedId> _ledMapping;
private Dictionary<LedId, SteelSeriesLedId> _ledMapping = new();
/// <inheritdoc />
/// <summary>
@@ -25,7 +25,7 @@ namespace RGB.NET.Devices.SteelSeries
/// Gets or sets the update queue performing updates for this device.
/// </summary>
// ReSharper disable once MemberCanBePrivate.Global
protected UpdateQueue UpdateQueue { get; set; }
protected UpdateQueue? UpdateQueue { get; set; }
#endregion
@@ -68,7 +68,7 @@ namespace RGB.NET.Devices.SteelSeries
protected override object GetLedCustomData(LedId ledId) => _ledMapping[ledId];
/// <inheritdoc />
protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate) => UpdateQueue.SetData(ledsToUpdate.Where(x => x.Color.A > 0));
protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate) => UpdateQueue?.SetData(ledsToUpdate.Where(x => x.Color.A > 0));
/// <inheritdoc />
public override void Dispose()
@@ -1,5 +1,4 @@
using System;
using RGB.NET.Core;
using RGB.NET.Core;
namespace RGB.NET.Devices.SteelSeries
{
@@ -27,17 +26,7 @@ namespace RGB.NET.Devices.SteelSeries
public object? LayoutMetadata { get; set; }
public SteelSeriesDeviceType SteelSeriesDeviceType { get; }
/// <summary>
/// Gets the layout used to decide which images to load.
/// </summary>
internal string ImageLayout { get; }
/// <summary>
/// Gets the path/name of the layout-file.
/// </summary>
internal string LayoutPath { get; }
#endregion
#region Constructors
@@ -50,13 +39,11 @@ namespace RGB.NET.Devices.SteelSeries
/// <param name="deviceCaps">The lighting-capabilities of the device.</param>
/// <param name="imageLayout">The layout used to decide which images to load.</param>
/// <param name="layoutPath">The path/name of the layout-file.</param>
internal SteelSeriesRGBDeviceInfo(RGBDeviceType deviceType, string model, SteelSeriesDeviceType steelSeriesDeviceType, string imageLayout, string layoutPath)
internal SteelSeriesRGBDeviceInfo(RGBDeviceType deviceType, string model, SteelSeriesDeviceType steelSeriesDeviceType)
{
this.DeviceType = deviceType;
this.Model = model;
this.SteelSeriesDeviceType = steelSeriesDeviceType;
this.ImageLayout = imageLayout;
this.LayoutPath = layoutPath;
DeviceName = $"{Manufacturer} {Model}";
}