Files
LanMountainDesktop/LanMountainDesktop.Shared.Contracts/Update/UpdateMessages.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

67 lines
1.7 KiB
C#

namespace LanMountainDesktop.Shared.Contracts.Update;
public sealed record InstallProgressReport(
InstallStage Stage,
string Message,
int ProgressPercent,
string? CurrentFile,
int FilesCompleted,
int FilesTotal)
{
public DateTimeOffset Timestamp { get; init; } = DateTimeOffset.UtcNow;
}
public sealed record InstallCompleteReport(
bool Success,
string? FromVersion,
string? ToVersion,
string? ErrorMessage,
bool WasRolledBack)
{
public DateTimeOffset Timestamp { get; init; } = DateTimeOffset.UtcNow;
}
public sealed record DownloadProgressReport(
string CurrentFile,
long BytesDownloaded,
long BytesTotal,
double BytesPerSecond,
int FilesCompleted,
int FilesTotal,
double OverallFraction)
{
public int OverallPercent => (int)Math.Clamp(OverallFraction * 100, 0, 100);
}
public sealed record UpdateProgressReport(
UpdatePhase Phase,
string Message,
double ProgressFraction,
DownloadProgressReport? DownloadDetail,
InstallProgressReport? InstallDetail)
{
public int ProgressPercent => (int)Math.Clamp(ProgressFraction * 100, 0, 100);
}
public sealed record UpdateCheckReport(
bool IsUpdateAvailable,
string? LatestVersion,
string? CurrentVersion,
UpdatePayloadKind? PayloadKind,
string? DistributionId,
string? Channel,
DateTimeOffset? PublishedAt,
long? TotalDownloadBytes,
long? FullInstallerBytes,
string? ErrorMessage);
public sealed record InstallRequest(
UpdatePayloadKind PayloadKind,
string LauncherRoot,
string? LaunchSource = null);
public sealed record LaunchResult(
bool Success,
string? ErrorMessage,
int? ProcessId);