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 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)
|
||||||
|
|||||||
@@ -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(() =>
|
||||||
|
|||||||
Reference in New Issue
Block a user