Files
LanMountainDesktop/LanMountainDesktop.Shared.Contracts/Update/UpdateState.cs
lincube 458494d131 Add update contracts, IPC progress & providers
Introduce a new update subsystem: shared contracts for manifests, messages, paths and state (LanMountainDesktop.Shared.Contracts.Update). Add IPC and reporting infrastructure for installer progress (IUpdateProgressReporter, LauncherUpdateProgressIpcServer, NullUpdateProgressReporter) and integrate progress/complete reporting into UpdateEngineService. Add multiple update service components and providers (CompositeManifestProvider, GithubReleaseManifestProvider, PlondsApiManifestProvider, UpdateDownloadEngine, UpdateOrchestrator, UpdateInstallGateway, CLI launcher bridge, launcher bridge interfaces, observable helper, state store, progress subject, JSON context). Update settings and models to support UseGhProxyMirror and PLONDS/GitHub fallback logic, plus localization strings and UI/viewmodel files for update settings and progress. Misc: installer script tweak and a small change in Plonds generator. This adds end-to-end support for checking, downloading and reporting update progress and results.
2026-05-03 19:31:04 +08:00

84 lines
1.7 KiB
C#

namespace LanMountainDesktop.Shared.Contracts.Update;
public enum UpdatePhase
{
Idle,
Checking,
Checked,
Downloading,
Downloaded,
Installing,
Installed,
Verifying,
Completed,
Failed,
Recovering,
RollingBack,
RolledBack
}
public enum UpdatePayloadKind
{
DeltaPlonds,
DeltaLegacy,
FullInstaller
}
public enum InstallStage
{
None,
VerifySignature,
CreateTarget,
ApplyFiles,
VerifyHashes,
ActivateDeployment,
Cleanup,
Completed,
Failed,
RollingBack
}
public enum UpdateChannel
{
Stable,
Preview
}
public enum UpdateMode
{
Manual,
DownloadThenConfirm,
SilentOnExit
}
public enum UpdateDownloadSource
{
PlondsApi,
GitHub,
GhProxy
}
public static class UpdatePhaseExtensions
{
public static bool IsTerminal(this UpdatePhase phase) =>
phase is UpdatePhase.Completed or UpdatePhase.Failed or UpdatePhase.RolledBack;
public static bool IsBusy(this UpdatePhase phase) =>
phase is not (UpdatePhase.Idle or UpdatePhase.Checked or UpdatePhase.Downloaded
or UpdatePhase.Installed or UpdatePhase.Completed or UpdatePhase.Failed
or UpdatePhase.RolledBack);
public static bool CanCheck(this UpdatePhase phase) =>
phase is UpdatePhase.Idle or UpdatePhase.Checked or UpdatePhase.Downloaded
or UpdatePhase.Completed or UpdatePhase.Failed or UpdatePhase.RolledBack;
public static bool CanDownload(this UpdatePhase phase) =>
phase is UpdatePhase.Checked;
public static bool CanInstall(this UpdatePhase phase) =>
phase is UpdatePhase.Downloaded;
public static bool CanRollback(this UpdatePhase phase) =>
phase is UpdatePhase.Failed;
}