diff --git a/Demo/Demo.csproj b/Demo/Demo.csproj
index 458fe26..c2c5e02 100644
--- a/Demo/Demo.csproj
+++ b/Demo/Demo.csproj
@@ -1,12 +1,12 @@
-
+
Exe
net5.0
-
+
-
+
diff --git a/Demo/Program.cs b/Demo/Program.cs
index c7e6839..1f353f6 100644
--- a/Demo/Program.cs
+++ b/Demo/Program.cs
@@ -14,49 +14,49 @@ namespace Demo {
}
Console.WriteLine("Setting all lights to blue");
- IllumilibLighting.SetAllLighting(r: 0, g: 0, b: 1);
+ IllumilibLighting.SetAllLighting(0, 0, 1);
Thread.Sleep(TimeSpan.FromSeconds(3));
- IllumilibLighting.SetAllLighting(r: 0, g: 0, b: 0);
+ IllumilibLighting.SetAllLighting(0, 0, 0);
Console.WriteLine("Setting specific positions");
- IllumilibLighting.SetKeyboardLighting(x: 6, y: 1, r: 1, g: 0, b: 1);
- IllumilibLighting.SetKeyboardLighting(x: 16, y: 5, r: 1, g: 0, b: 1);
+ IllumilibLighting.SetKeyboardLighting(6, 1, 1, 0, 1);
+ IllumilibLighting.SetKeyboardLighting(16, 5, 1, 0, 1);
Thread.Sleep(TimeSpan.FromSeconds(5));
- IllumilibLighting.SetKeyboardLighting(r: 0, g: 0, b: 0);
- IllumilibLighting.SetKeyboardLighting(x: 8, y: 2, width: 2, height: 2, r: 0, g: 1, b: 0);
+ IllumilibLighting.SetKeyboardLighting(0, 0, 0);
+ IllumilibLighting.SetKeyboardLighting(8, 2, 2, 2, 0, 1, 0);
Thread.Sleep(TimeSpan.FromSeconds(5));
- IllumilibLighting.SetKeyboardLighting(r: 0, g: 0, b: 0);
+ IllumilibLighting.SetKeyboardLighting(0, 0, 0);
Console.WriteLine("Doing a fun effect");
for (var x = 0; x < IllumilibLighting.KeyboardWidth; x++) {
- IllumilibLighting.SetKeyboardLighting(x: x, y: 0, width: 1, height: IllumilibLighting.KeyboardHeight, r: 0, g: 0, b: 1);
+ IllumilibLighting.SetKeyboardLighting(x, 0, 1, IllumilibLighting.KeyboardHeight, 0, 0, 1);
Thread.Sleep(TimeSpan.FromSeconds(0.25F));
}
for (var x = IllumilibLighting.KeyboardWidth - 1; x >= 0; x--) {
- IllumilibLighting.SetKeyboardLighting(x: x, y: 0, width: 1, height: IllumilibLighting.KeyboardHeight, r: 0, g: 0, b: 0);
+ IllumilibLighting.SetKeyboardLighting(x, 0, 1, IllumilibLighting.KeyboardHeight, 0, 0, 0);
Thread.Sleep(TimeSpan.FromSeconds(0.25F));
}
Console.WriteLine("Going through the alphabet");
for (var i = 65; i <= 90; i++) {
var key = (KeyboardKeys) i;
- IllumilibLighting.SetKeyboardLighting(key: key, r: 0, g: 1, b: 0);
+ IllumilibLighting.SetKeyboardLighting(key, 0, 1, 0);
Thread.Sleep(TimeSpan.FromSeconds(0.25F));
- IllumilibLighting.SetKeyboardLighting(key: key, r: 0, g: 0, b: 0);
+ IllumilibLighting.SetKeyboardLighting(key, 0, 0, 0);
}
Thread.Sleep(TimeSpan.FromSeconds(1));
Console.WriteLine("Pulsing");
for (var i = 0; i < 500; i++) {
var value = (MathF.Sin(i / 50F * MathF.PI) + 1) / 2;
- IllumilibLighting.SetAllLighting(r: value, g: 0, b: value);
+ IllumilibLighting.SetAllLighting(value, 0, value);
Thread.Sleep(10);
}
- IllumilibLighting.SetAllLighting(r: 0, g: 0, b: 0);
+ IllumilibLighting.SetAllLighting(0, 0, 0);
Console.WriteLine("Setting all supported keys");
foreach (var key in Enum.GetValues()) {
- IllumilibLighting.SetKeyboardLighting(key: key, r: 1, g: 0, b: 0);
+ IllumilibLighting.SetKeyboardLighting(key, 1, 0, 0);
Thread.Sleep(50);
}
Thread.Sleep(TimeSpan.FromSeconds(15));
diff --git a/Illumilib/Illumilib.csproj b/Illumilib/Illumilib.csproj
index 687fbfb..5172310 100644
--- a/Illumilib/Illumilib.csproj
+++ b/Illumilib/Illumilib.csproj
@@ -1,5 +1,5 @@
-
+
netstandard2.0
true
@@ -14,7 +14,7 @@
1.2.4
NU1701
-
+
PreserveNewest
@@ -23,7 +23,7 @@
-
+
diff --git a/Illumilib/IllumilibLighting.cs b/Illumilib/IllumilibLighting.cs
index 910d86c..479b776 100644
--- a/Illumilib/IllumilibLighting.cs
+++ b/Illumilib/IllumilibLighting.cs
@@ -22,7 +22,7 @@ namespace Illumilib {
///
/// A property that returns whether Illumilib is currently initialized
///
- public static bool Initialized => systems != null;
+ public static bool Initialized => IllumilibLighting.systems != null;
///
/// Initializes Illumilib, starting all of the supported lighting systems.
@@ -31,25 +31,25 @@ namespace Illumilib {
/// Whether at least one lighting system was successfully initialized
/// Thrown if Illumilib has already been
public static bool Initialize() {
- if (Initialized)
+ if (IllumilibLighting.Initialized)
throw new InvalidOperationException("Illumilib has already been initialized");
- systems = new Dictionary();
+ IllumilibLighting.systems = new Dictionary();
foreach (var system in new LightingSystem[] {new LogitechLighting(), new RazerLighting(), new CorsairLighting()}) {
if (system.Initialize())
- systems.Add(system.Type, system);
+ IllumilibLighting.systems.Add(system.Type, system);
}
- return systems.Count > 0;
+ return IllumilibLighting.systems.Count > 0;
}
///
/// Disposes Illumilib, disposing all of the underlying lighting systems
///
public static void Dispose() {
- if (!Initialized)
+ if (!IllumilibLighting.Initialized)
return;
- foreach (var system in systems.Values)
+ foreach (var system in IllumilibLighting.systems.Values)
system.Dispose();
- systems = null;
+ IllumilibLighting.systems = null;
}
///
@@ -58,8 +58,8 @@ namespace Illumilib {
/// The to query.
/// Whether the given has been initialized and is enabled.
public static bool IsEnabled(LightingType type) {
- EnsureInitialized();
- return systems.ContainsKey(type);
+ IllumilibLighting.EnsureInitialized();
+ return IllumilibLighting.systems.ContainsKey(type);
}
///
@@ -69,8 +69,8 @@ namespace Illumilib {
/// The color's green value, between 0 and 1
/// The color's blue value, between 0 and 1
public static void SetAllLighting(float r, float g, float b) {
- EnsureInitialized();
- foreach (var system in systems.Values)
+ IllumilibLighting.EnsureInitialized();
+ foreach (var system in IllumilibLighting.systems.Values)
system.SetAllLighting(r, g, b);
}
@@ -81,8 +81,8 @@ namespace Illumilib {
/// The color's green value, between 0 and 1
/// The color's blue value, between 0 and 1
public static void SetKeyboardLighting(float r, float g, float b) {
- EnsureInitialized();
- foreach (var system in systems.Values)
+ IllumilibLighting.EnsureInitialized();
+ foreach (var system in IllumilibLighting.systems.Values)
system.SetKeyboardLighting(r, g, b);
}
@@ -97,12 +97,12 @@ namespace Illumilib {
/// The color's blue value, between 0 and 1
/// Thrown if the positions are out of range in relation to and
public static void SetKeyboardLighting(int x, int y, float r, float g, float b) {
- EnsureInitialized();
- if (x < 0 || x >= KeyboardWidth)
+ IllumilibLighting.EnsureInitialized();
+ if (x < 0 || x >= IllumilibLighting.KeyboardWidth)
throw new ArgumentOutOfRangeException(nameof(x));
- if (y < 0 || y >= KeyboardHeight)
+ if (y < 0 || y >= IllumilibLighting.KeyboardHeight)
throw new ArgumentOutOfRangeException(nameof(y));
- foreach (var system in systems.Values)
+ foreach (var system in IllumilibLighting.systems.Values)
system.SetKeyboardLighting(x, y, r, g, b);
}
@@ -120,12 +120,12 @@ namespace Illumilib {
/// The color's blue value, between 0 and 1
/// Thrown if the positions are out of range in relation to and
public static void SetKeyboardLighting(int x, int y, int width, int height, float r, float g, float b) {
- EnsureInitialized();
- if (x < 0 || x + width > KeyboardWidth)
+ IllumilibLighting.EnsureInitialized();
+ if (x < 0 || x + width > IllumilibLighting.KeyboardWidth)
throw new ArgumentOutOfRangeException(nameof(x));
- if (y < 0 || y + height > KeyboardHeight)
+ if (y < 0 || y + height > IllumilibLighting.KeyboardHeight)
throw new ArgumentOutOfRangeException(nameof(y));
- foreach (var system in systems.Values)
+ foreach (var system in IllumilibLighting.systems.Values)
system.SetKeyboardLighting(x, y, width, height, r, g, b);
}
@@ -138,8 +138,8 @@ namespace Illumilib {
/// The color's green value, between 0 and 1
/// The color's blue value, between 0 and 1
public static void SetKeyboardLighting(KeyboardKeys key, float r, float g, float b) {
- EnsureInitialized();
- foreach (var system in systems.Values)
+ IllumilibLighting.EnsureInitialized();
+ foreach (var system in IllumilibLighting.systems.Values)
system.SetKeyboardLighting(key, r, g, b);
}
@@ -150,13 +150,13 @@ namespace Illumilib {
/// The color's green value, between 0 and 1
/// The color's blue value, between 0 and 1
public static void SetMouseLighting(float r, float g, float b) {
- EnsureInitialized();
- foreach (var system in systems.Values)
+ IllumilibLighting.EnsureInitialized();
+ foreach (var system in IllumilibLighting.systems.Values)
system.SetMouseLighting(r, g, b);
}
private static void EnsureInitialized() {
- if (!Initialized)
+ if (!IllumilibLighting.Initialized)
throw new InvalidOperationException("Illumilib has not been initialized yet");
}
diff --git a/Illumilib/Lib/LogitechGsdk.cs b/Illumilib/Lib/LogitechGsdk.cs
index 59ee5ef..2bf3aa0 100644
--- a/Illumilib/Lib/LogitechGsdk.cs
+++ b/Illumilib/Lib/LogitechGsdk.cs
@@ -138,16 +138,16 @@ namespace Illumilib.Lib {
private const int LogiDevicetypeRgbOrd = 1;
private const int LogiDevicetypePerkeyRgbOrd = 2;
- public const int LogiDevicetypeMonochrome = (1 << LogiDevicetypeMonochromeOrd);
- public const int LogiDevicetypeRgb = (1 << LogiDevicetypeRgbOrd);
- public const int LogiDevicetypePerkeyRgb = (1 << LogiDevicetypePerkeyRgbOrd);
- public const int LogiDevicetypeAll = (LogiDevicetypeMonochrome | LogiDevicetypeRgb | LogiDevicetypePerkeyRgb);
+ public const int LogiDevicetypeMonochrome = 1 << LogitechGsdk.LogiDevicetypeMonochromeOrd;
+ public const int LogiDevicetypeRgb = 1 << LogitechGsdk.LogiDevicetypeRgbOrd;
+ public const int LogiDevicetypePerkeyRgb = 1 << LogitechGsdk.LogiDevicetypePerkeyRgbOrd;
+ public const int LogiDevicetypeAll = LogitechGsdk.LogiDevicetypeMonochrome | LogitechGsdk.LogiDevicetypeRgb | LogitechGsdk.LogiDevicetypePerkeyRgb;
public const int LogiLedBitmapWidth = 21;
public const int LogiLedBitmapHeight = 6;
public const int LogiLedBitmapBytesPerKey = 4;
- public const int LogiLedBitmapSize = LogiLedBitmapWidth * LogiLedBitmapHeight * LogiLedBitmapBytesPerKey;
+ public const int LogiLedBitmapSize = LogitechGsdk.LogiLedBitmapWidth * LogitechGsdk.LogiLedBitmapHeight * LogitechGsdk.LogiLedBitmapBytesPerKey;
public const int LogiLedDurationInfinite = 0;
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
diff --git a/Illumilib/System/CorsairLighting.cs b/Illumilib/System/CorsairLighting.cs
index d902e3a..d3d887d 100644
--- a/Illumilib/System/CorsairLighting.cs
+++ b/Illumilib/System/CorsairLighting.cs
@@ -75,7 +75,7 @@ namespace Illumilib.System {
}
public override void SetKeyboardLighting(KeyboardKeys key, float r, float g, float b) {
- var id = ConvertKey(key);
+ var id = CorsairLighting.ConvertKey(key);
foreach (var device in this.devices) {
if (!device.IsKeyboard())
continue;
@@ -344,12 +344,12 @@ namespace Illumilib.System {
public void SetAllColors(float r, float g, float b) {
foreach (var color in this.colors)
- SetColor(color, r, g, b);
+ DeviceInfo.SetColor(color, r, g, b);
}
public bool SetColorForId(CorsairLedId id, float r, float g, float b) {
if (this.ledIdToColorIndex.TryGetValue(id, out var index)) {
- SetColor(this.colors[index], r, g, b);
+ DeviceInfo.SetColor(this.colors[index], r, g, b);
return true;
}
return false;
diff --git a/Illumilib/System/LogitechLighting.cs b/Illumilib/System/LogitechLighting.cs
index 80a29d5..77fe1d7 100644
--- a/Illumilib/System/LogitechLighting.cs
+++ b/Illumilib/System/LogitechLighting.cs
@@ -52,7 +52,7 @@ namespace Illumilib.System {
public override void SetKeyboardLighting(KeyboardKeys key, float r, float g, float b) {
this.ClearBitmap();
- LogitechGsdk.LogiLedSetLightingForKeyWithKeyName(ConvertKey(key), (int) (r * 100), (int) (g * 100), (int) (b * 100));
+ LogitechGsdk.LogiLedSetLightingForKeyWithKeyName(LogitechLighting.ConvertKey(key), (int) (r * 100), (int) (g * 100), (int) (b * 100));
}
public override void SetMouseLighting(float r, float g, float b) {
diff --git a/Illumilib/System/RazerLighting.cs b/Illumilib/System/RazerLighting.cs
index d842d9e..180d507 100644
--- a/Illumilib/System/RazerLighting.cs
+++ b/Illumilib/System/RazerLighting.cs
@@ -59,7 +59,7 @@ namespace Illumilib.System {
}
public override void SetKeyboardLighting(KeyboardKeys key, float r, float g, float b) {
- this.chroma.Keyboard?.SetKeyAsync(ConvertKey(key), new Color(r, g, b));
+ this.chroma.Keyboard?.SetKeyAsync(RazerLighting.ConvertKey(key), new Color(r, g, b));
this.effectOutdated = true;
}