Skip to content

Commit

Permalink
fix "Restore Device Control" button for chroma
Browse files Browse the repository at this point in the history
  • Loading branch information
Aytackydln committed Jul 2, 2024
1 parent 3b63c6f commit ec945c4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ public static class ChromaInstallationUtils
</devices>
""";

private const string RazerChromaSdkServer = "Razer Chroma SDK Server";
private const string RazerChromaStreamServer = "Razer Chroma Stream Server";

public static async Task<int> UninstallAsync() => await Task.Run(() =>
{
if (RzHelper.GetSdkVersion() == new RzSdkVersion())
Expand Down Expand Up @@ -172,13 +175,13 @@ public static void RestoreDeviceControl()
var chromaPath = GetChromaPath();
if (chromaPath != null)
{
File.Delete(chromaPath);
File.Delete(Path.Combine(chromaPath, DevicesXml));
}

var chromaPath64 = GetChromaPath64();
if (chromaPath64 != null)
{
File.Delete(chromaPath64);
File.Delete(Path.Combine(chromaPath64, DevicesXml));
}
RestartChromaService();
}
Expand Down Expand Up @@ -218,8 +221,8 @@ private static void ReplaceDevicesXml(List<Task> tasks, string? chromaPath)

public static void DisableChromaBloat()
{
DisableService("Razer Chroma SDK Server");
DisableService("Razer Chroma Stream Server");
DisableService(RazerChromaSdkServer);
DisableService(RazerChromaStreamServer);
}

private static void DisableService(string serviceName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,14 @@ private void UpdateChromaStatus(ChromaReader? chromaReader)
ChromaConnectionStatusLabel.Content = "Failure";
ChromaConnectionStatusLabel.Foreground = new SolidColorBrush(Colors.PaleVioletRed);
ChromaDisableDeviceControlButton.IsEnabled = false;
ChromaInstallButton.IsEnabled = true;
return;
}

ChromaConnectionStatusLabel.Content = "Success";
ChromaConnectionStatusLabel.Foreground = new SolidColorBrush(Colors.LightGreen);
ChromaDisableDeviceControlButton.IsEnabled = true;
ChromaInstallButton.IsEnabled = false;

var currentApp = RzHelper.CurrentAppExecutable;
var currentAppId = RzHelper.CurrentAppId;
Expand Down

0 comments on commit ec945c4

Please sign in to comment.