Skip to content

Commit

Permalink
update all rgb.net libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
Aytackydln committed Jul 2, 2024
1 parent ec945c4 commit 6d7cb13
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 7 deletions.
13 changes: 13 additions & 0 deletions Project-Aurora/AuroraCommon/Devices/VariableRegistry.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;
using System.Globalization;
using System.Text.Json;
using System.Text.Json.Serialization;
Expand Down Expand Up @@ -62,11 +63,13 @@ public VariableRegistryItem(object? value, object @default, object? max = null,
return value;
}

[Pure]
private static object GetColor(JsonElement jsonElement)
{
return jsonElement.Deserialize<SimpleColor>();
}

[Pure]
private static object? GetStringOrColor(JsonElement jsonElement)
{
var str = jsonElement.GetString();
Expand Down Expand Up @@ -97,6 +100,7 @@ SimpleColor FromArgb()
}
}

[Pure]
private static object GetNumber(JsonElement jsonElement)
{
if (int.TryParse(jsonElement.GetDecimal().ToString(CultureInfo.InvariantCulture), CultureInfo.InvariantCulture, out var intVal))
Expand Down Expand Up @@ -185,6 +189,7 @@ public void Combine(VariableRegistry otherRegistry, bool removeMissing = false)
Variables = vars;
}

[Pure]
public IEnumerable<string> GetRegisteredVariableKeys()
{
return Variables.Keys.ToArray();
Expand Down Expand Up @@ -218,6 +223,7 @@ public void ResetVariable(string name)
}
}

[Pure]
public string GetString(string name)
{
if (Variables.TryGetValue(name, out var value) && value.Value is string strVal)
Expand All @@ -226,6 +232,7 @@ public string GetString(string name)
return string.Empty;
}

[Pure]
public T GetVariable<T>(string name) where T : new()
{
if (Variables.TryGetValue(name, out var value))
Expand All @@ -234,6 +241,7 @@ public string GetString(string name)
return default(T) ?? new T();
}

[Pure]
public bool GetVariableMax<T>(string name, out T? value)
{
if (Variables.TryGetValue(name, out var outVal) && outVal is { Max: not null, Value: T })
Expand All @@ -246,6 +254,7 @@ public bool GetVariableMax<T>(string name, out T? value)
return false;
}

[Pure]
public bool GetVariableMin<T>(string name, out T value)
{
if (Variables.TryGetValue(name, out var outVal) && outVal is { Min: not null, Value: T })
Expand All @@ -258,6 +267,7 @@ public bool GetVariableMin<T>(string name, out T value)
return false;
}

[Pure]
public Type GetVariableType(string name)
{
if (Variables.TryGetValue(name, out var value) && value.Value != null)
Expand All @@ -266,16 +276,19 @@ public Type GetVariableType(string name)
return typeof(object);
}

[Pure]
public string GetTitle(string name)
{
return Variables.TryGetValue(name, out var variable) ? variable.Title : string.Empty;
}

[Pure]
public string GetRemark(string name)
{
return Variables.TryGetValue(name, out var variable) ? variable.Remark : string.Empty;
}

[Pure]
public IntVariableDisplay GetFlags(string name)
{
return Variables.TryGetValue(name, out var variable) ? variable.Flags : IntVariableDisplay.None;
Expand Down
12 changes: 6 additions & 6 deletions Project-Aurora/AuroraDeviceManager/AuroraDeviceManager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@
<PackageReference Include="RGB.NET.Core" Version="2.0.0-prerelease.83" />
<PackageReference Include="RGB.NET.Devices.OpenRGB" Version="2.0.0-prerelease.83" />
-->
<PackageReference Include="RGB.NET.Devices.CorsairLegacy" Version="2.0.0"/>
<PackageReference Include="RGB.NET.Devices.CoolerMaster" Version="2.0.0"/>
<PackageReference Include="RGB.NET.Devices.Logitech" Version="2.0.4-prerelease.16"/>
<PackageReference Include="RGB.NET.Devices.Razer" Version="2.0.4-prerelease.14"/>
<PackageReference Include="RGB.NET.Devices.SteelSeries" Version="2.0.0"/>
<PackageReference Include="RGB.NET.Devices.Wooting" Version="2.0.0"/>
<PackageReference Include="RGB.NET.Devices.CorsairLegacy" Version="2.2.0-prerelease.1" />
<PackageReference Include="RGB.NET.Devices.CoolerMaster" Version="2.2.0-prerelease.1" />
<PackageReference Include="RGB.NET.Devices.Logitech" Version="2.2.0-prerelease.1" />
<PackageReference Include="RGB.NET.Devices.Razer" Version="2.2.0-prerelease.1" />
<PackageReference Include="RGB.NET.Devices.SteelSeries" Version="2.2.0-prerelease.1" />
<PackageReference Include="RGB.NET.Devices.Wooting" Version="2.2.0-prerelease.1" />
<PackageReference Include="Serilog.Exceptions" Version="8.4.0" />
<PackageReference Include="System.Drawing.Primitives" Version="4.3.0"/>
<PackageReference Include="System.Management" Version="8.0.0"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,56 @@ public class RazerRgbNetDevice : RgbNetDevice
protected override async Task ConfigureProvider(CancellationToken cancellationToken)
{
await base.ConfigureProvider(cancellationToken);

var loadDevices = RazerEndpointType.None;
if (Global.DeviceConfig.VarRegistry.GetVariable<bool>($"{DeviceName}_force_all"))
{
loadDevices |= RazerEndpointType.All;
}
if (Global.DeviceConfig.VarRegistry.GetVariable<bool>($"{DeviceName}_force_keyboard"))
{
loadDevices |= RazerEndpointType.Keyboard;
}
if (Global.DeviceConfig.VarRegistry.GetVariable<bool>($"{DeviceName}_force_laptop_keyboard"))
{
loadDevices |= RazerEndpointType.LaptopKeyboard;
}
if (Global.DeviceConfig.VarRegistry.GetVariable<bool>($"{DeviceName}_force_mouse"))
{
loadDevices |= RazerEndpointType.Mouse;
}
if (Global.DeviceConfig.VarRegistry.GetVariable<bool>($"{DeviceName}_force_headset"))
{
loadDevices |= RazerEndpointType.Headset;
}
if (Global.DeviceConfig.VarRegistry.GetVariable<bool>($"{DeviceName}_force_mousepad"))
{
loadDevices |= RazerEndpointType.Mousepad;
}
if (Global.DeviceConfig.VarRegistry.GetVariable<bool>($"{DeviceName}_force_keypad"))
{
loadDevices |= RazerEndpointType.Keypad;
}
if (Global.DeviceConfig.VarRegistry.GetVariable<bool>($"{DeviceName}_force_link"))
{
loadDevices |= RazerEndpointType.ChromaLink;
}


Provider.LoadEmulatorDevices = Global.DeviceConfig.VarRegistry.GetVariable<bool>($"{DeviceName}_force_all");
Provider.LoadEmulatorDevices = loadDevices;
}

protected override void RegisterVariables(VariableRegistry variableRegistry)
{
base.RegisterVariables(variableRegistry);

variableRegistry.Register($"{DeviceName}_force_all", false, "Force enable all devices");
variableRegistry.Register($"{DeviceName}_force_keyboard", false, "Force enable keyboard");
variableRegistry.Register($"{DeviceName}_force_laptop_keyboard", false, "Force enable laptop keyboard");
variableRegistry.Register($"{DeviceName}_force_mouse", false, "Force enable mouse");
variableRegistry.Register($"{DeviceName}_force_headset", false, "Force enable headset");
variableRegistry.Register($"{DeviceName}_force_mousepad", false, "Force enable mousepad");
variableRegistry.Register($"{DeviceName}_force_keypad", false, "Force enable keypad");
variableRegistry.Register($"{DeviceName}_force_link", false, "Force enable chroma link");
}
}
Binary file modified Project-Aurora/AuroraDeviceManager/RGB.NET.Core.dll
Binary file not shown.
Binary file modified Project-Aurora/AuroraDeviceManager/RGB.NET.Devices.Asus.dll
Binary file not shown.
Binary file modified Project-Aurora/AuroraDeviceManager/RGB.NET.Devices.OpenRGB.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 6d7cb13

Please sign in to comment.