Move environment variable logic to static bool in OsuGameDesktop

This commit is contained in:
smallketchup82 2024-09-09 03:28:50 -04:00
parent bf3597f711
commit d451415d5c
No known key found for this signature in database
GPG Key ID: 7345B7C561243F1E
2 changed files with 4 additions and 6 deletions

View File

@ -95,11 +95,11 @@ public OsuGameDesktop(string[]? args = null)
return key?.OpenSubKey(WindowsAssociationManager.SHELL_OPEN_COMMAND)?.GetValue(string.Empty)?.ToString()?.Split('"')[1].Replace("osu!.exe", ""); return key?.OpenSubKey(WindowsAssociationManager.SHELL_OPEN_COMMAND)?.GetValue(string.Empty)?.ToString()?.Split('"')[1].Replace("osu!.exe", "");
} }
public static bool IsPackageManaged => !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("OSU_EXTERNAL_UPDATE_PROVIDER"));
protected override UpdateManager CreateUpdateManager() protected override UpdateManager CreateUpdateManager()
{ {
string? packageManaged = Environment.GetEnvironmentVariable("OSU_EXTERNAL_UPDATE_PROVIDER"); if (IsPackageManaged)
if (!string.IsNullOrEmpty(packageManaged))
return new NoActionUpdateManager(); return new NoActionUpdateManager();
return new VelopackUpdateManager(); return new VelopackUpdateManager();

View File

@ -169,9 +169,7 @@ private static bool trySendIPCMessage(IIpcHost host, string cwd, string[] args)
private static void setupVelopack() private static void setupVelopack()
{ {
string? packageManaged = Environment.GetEnvironmentVariable("OSU_EXTERNAL_UPDATE_PROVIDER"); if (OsuGameDesktop.IsPackageManaged)
if (!string.IsNullOrEmpty(packageManaged))
{ {
Logger.Log("Updates are being managed by an external provider. Skipping Velopack setup"); Logger.Log("Updates are being managed by an external provider. Skipping Velopack setup");
return; return;