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

@@ -5,6 +5,6 @@ namespace RGB.NET.Devices.SteelSeries.API.Model
internal class CoreProps
{
[JsonPropertyName("address")]
public string Address { get; set; }
public string? Address { get; set; }
}
}
@@ -8,13 +8,13 @@ namespace RGB.NET.Devices.SteelSeries.API.Model
#region Properties & Fields
[JsonPropertyName("game")]
public string Game { get; set; }
public string? Game { get; set; }
[JsonPropertyName("event")]
public string Name { get; set; }
public string? Name { get; set; }
[JsonPropertyName("data")]
public Dictionary<string, object> Data { get; } = new Dictionary<string, object>();
public Dictionary<string, object> Data { get; } = new();
#endregion
@@ -7,10 +7,10 @@ namespace RGB.NET.Devices.SteelSeries.API.Model
#region Properties & Fields
[JsonPropertyName("game")]
public string Name { get; set; }
public string? Name { get; set; }
[JsonPropertyName("game_display_name")]
public string DisplayName { get; set; }
public string? DisplayName { get; set; }
#endregion
@@ -7,10 +7,10 @@ namespace RGB.NET.Devices.SteelSeries.API.Model
#region Properties & Fields
[JsonPropertyName("game")]
public string Game { get; set; }
public string? Game { get; set; }
[JsonPropertyName("golisp")]
public string Handler { get; set; }
public string? Handler { get; set; }
#endregion
@@ -6,7 +6,6 @@ using System.Net.Http;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using RGB.NET.Devices.SteelSeries.API.Model;
namespace RGB.NET.Devices.SteelSeries.API
@@ -55,10 +54,10 @@ namespace RGB.NET.Devices.SteelSeries.API
#region Properties & Fields
// ReSharper disable InconsistentNaming
private static readonly HttpClient _client = new HttpClient();
private static readonly Game _game = new Game(GAME_NAME, GAME_DISPLAYNAME);
private static readonly Event _event = new Event(_game, EVENT_NAME);
private static string _baseUrl;
private static readonly HttpClient _client = new();
private static readonly Game _game = new(GAME_NAME, GAME_DISPLAYNAME);
private static readonly Event _event = new(_game, EVENT_NAME);
private static string? _baseUrl;
internal static bool IsInitialized => !string.IsNullOrWhiteSpace(_baseUrl);
@@ -74,7 +73,7 @@ namespace RGB.NET.Devices.SteelSeries.API
string corePropsPath = GetCorePropsPath();
if (!string.IsNullOrWhiteSpace(corePropsPath) && File.Exists(corePropsPath))
{
CoreProps coreProps = JsonSerializer.Deserialize<CoreProps>(File.ReadAllText(corePropsPath));
CoreProps? coreProps = JsonSerializer.Deserialize<CoreProps>(File.ReadAllText(corePropsPath));
_baseUrl = coreProps?.Address;
if (_baseUrl != null)
{
@@ -93,12 +92,12 @@ namespace RGB.NET.Devices.SteelSeries.API
return IsInitialized;
}
internal static void UpdateLeds(string device, Dictionary<string, int[]> data)
internal static void UpdateLeds(string device, IList<(string zone, int[] color)> data)
{
_event.Data.Clear();
_event.Data.Add("value", device);
_event.Data.Add("colors", data.Values.ToList());
_event.Data.Add("zones", data.Keys.ToList());
_event.Data.Add("colors", data.Select(x => x.color).ToList());
_event.Data.Add("zones", data.Select(x => x.zone).ToList());
TriggerEvent(_event);
}