Compare commits

..

No commits in common. "887eb922e933d7da2c283c23e0a63342eb85f5bb" and "01575ed42dc45d3837eb051d459e4657b96555af" have entirely different histories.

4 changed files with 24 additions and 16 deletions

View file

@ -11,7 +11,7 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>Logo.png</PackageIcon>
<VersionPrefix>1.2.7</VersionPrefix>
<VersionPrefix>1.2.6</VersionPrefix>
<NoWarn>NU1701</NoWarn>
</PropertyGroup>

View file

@ -5,6 +5,10 @@ namespace Illumilib.System {
public abstract LightingType Type { get; }
~LightingSystem() {
this.Dispose();
}
public abstract bool Initialize();
public abstract void SetAllLighting(float r, float g, float b);
@ -19,7 +23,9 @@ namespace Illumilib.System {
public abstract void SetMouseLighting(float r, float g, float b);
public virtual void Dispose() {}
public virtual void Dispose() {
GC.SuppressFinalize(this);
}
}
}

View file

@ -18,6 +18,7 @@ namespace Illumilib.System {
}
public override void Dispose() {
base.Dispose();
this.ClearBitmap();
try {
LogitechGsdk.LogiLedShutdown();

View file

@ -20,31 +20,32 @@ namespace Illumilib.System {
}
}
public override async void Dispose() {
public override void Dispose() {
base.Dispose();
try {
await this.chroma?.UninitializeAsync();
this.chroma?.UninitializeAsync();
} catch {
// ignored
}
this.effectOutdated = true;
}
public override async void SetAllLighting(float r, float g, float b) {
await this.chroma.SetAllAsync(new Color(r, g, b));
public override void SetAllLighting(float r, float g, float b) {
this.chroma.SetAllAsync(new Color(r, g, b));
this.effectOutdated = true;
}
public override async void SetKeyboardLighting(float r, float g, float b) {
await this.chroma.Keyboard?.SetAllAsync(new Color(r, g, b));
public override void SetKeyboardLighting(float r, float g, float b) {
this.chroma.Keyboard?.SetAllAsync(new Color(r, g, b));
this.effectOutdated = true;
}
public override async void SetKeyboardLighting(int x, int y, float r, float g, float b) {
await this.chroma.Keyboard?.SetPositionAsync(y, x, new Color(r, g, b));
public override void SetKeyboardLighting(int x, int y, float r, float g, float b) {
this.chroma.Keyboard?.SetPositionAsync(y, x, new Color(r, g, b));
this.effectOutdated = true;
}
public override async void SetKeyboardLighting(int x, int y, int width, int height, float r, float g, float b) {
public override void SetKeyboardLighting(int x, int y, int width, int height, float r, float g, float b) {
if (this.chroma.Keyboard == null)
return;
if (this.effectOutdated) {
@ -58,16 +59,16 @@ namespace Illumilib.System {
for (var yAdd = 0; yAdd < height; yAdd++)
this.effect[y + yAdd, x + xAdd] = new Color(r, g, b);
}
await this.chroma.Keyboard.SetCustomAsync(this.effect);
this.chroma.Keyboard.SetCustomAsync(this.effect);
}
public override async void SetKeyboardLighting(KeyboardKeys key, float r, float g, float b) {
await this.chroma.Keyboard?.SetKeyAsync(RazerLighting.ConvertKey(key), new Color(r, g, b));
public override void SetKeyboardLighting(KeyboardKeys key, float r, float g, float b) {
this.chroma.Keyboard?.SetKeyAsync(RazerLighting.ConvertKey(key), new Color(r, g, b));
this.effectOutdated = true;
}
public override async void SetMouseLighting(float r, float g, float b) {
await this.chroma.Mouse?.SetAllAsync(new Color(r, g, b));
public override void SetMouseLighting(float r, float g, float b) {
this.chroma.Mouse?.SetAllAsync(new Color(r, g, b));
}
private static Key ConvertKey(KeyboardKeys key) {