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:
@@ -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 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 HttpClient CreateClient()
|
||||
@@ -24,8 +26,6 @@ public static class UpdateService
|
||||
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));
|
||||
|
||||
public static bool TryParseTag(string tag, out Version version)
|
||||
|
||||
@@ -841,6 +841,7 @@ public class MainViewModel : ObservableObject
|
||||
RebuildChoices();
|
||||
}
|
||||
_ = 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 (!IsBusy) await RefreshModCoreAsync(MelonLoader, quiet: true);
|
||||
_ = Task.Run(() =>
|
||||
|
||||
Reference in New Issue
Block a user