Fix updater static init order; clear staged updates on startup

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Exterrata
2026-10-25 02:49:07 -04:00
parent 9bb4f85802
commit 49fb3ca253
2 changed files with 3 additions and 2 deletions
+2 -2
View File
@@ -15,6 +15,8 @@ public static class UpdateService
public static string Repo { get; } = Environment.GetEnvironmentVariable("CVRMANAGER_UPDATE_REPO") is { Length: > 0 } r ? r : "Koneko/CVRManager"; public static string Repo { get; } = Environment.GetEnvironmentVariable("CVRMANAGER_UPDATE_REPO") is { Length: > 0 } r ? r : "Koneko/CVRManager";
public const string AssetName = "CVRManager-win-x64.zip"; public const string AssetName = "CVRManager-win-x64.zip";
public static Version Current { get; } = Normalize(Assembly.GetEntryAssembly()?.GetName().Version ?? new Version(1, 0, 0));
static readonly HttpClient Http = CreateClient(); static readonly HttpClient Http = CreateClient();
static HttpClient CreateClient() static HttpClient CreateClient()
@@ -24,8 +26,6 @@ public static class UpdateService
return http; return http;
} }
public static Version Current { get; } = Normalize(Assembly.GetEntryAssembly()?.GetName().Version ?? new Version(1, 0, 0));
static Version Normalize(Version v) => new(v.Major, Math.Max(v.Minor, 0), Math.Max(v.Build, 0)); static Version Normalize(Version v) => new(v.Major, Math.Max(v.Minor, 0), Math.Max(v.Build, 0));
public static bool TryParseTag(string tag, out Version version) public static bool TryParseTag(string tag, out Version version)
+1
View File
@@ -841,6 +841,7 @@ public class MainViewModel : ObservableObject
RebuildChoices(); RebuildChoices();
} }
_ = RefreshBranchesQuietAsync(CancellationToken.None); _ = RefreshBranchesQuietAsync(CancellationToken.None);
_ = Task.Run(() => { try { Directory.Delete(Path.Combine(Paths.Root, "update"), true); } catch (Exception e) when (e is IOException or UnauthorizedAccessException) { } });
if (cfg.CheckUpdates) _ = CheckForUpdateAsync(false); if (cfg.CheckUpdates) _ = CheckForUpdateAsync(false);
if (!IsBusy) await RefreshModCoreAsync(MelonLoader, quiet: true); if (!IsBusy) await RefreshModCoreAsync(MelonLoader, quiet: true);
_ = Task.Run(() => _ = Task.Run(() =>