feat(setup): one setup for Chronos Desktop and Chronos Uploader
Chronos Server now ships as a Docker image only, so the Windows setup no longer offers it and the separate Uploader setup goes: one setup installs, updates, adds and removes Chronos Desktop and Chronos Uploader in place. - Install log format 2 records each component's files, shortcuts, version and SHA-256; format 1 logs (1.0) are still read. A file of a removed program that changed since setup installed it is kept, never deleted. - A Chronos Server 1.0 for Windows installed by 1.0 is retained as "no longer offered": its files and service are untouched until the user unticks it or explicit /COMPONENTS leave it out; then it is removed with its service. A format 1 log keeps every file the payload does not know. - The separate 1.0 Chronos Uploader product is replaced: the Uploader is preselected, its sign-in entry moves to the new copy (Task Manager state kept), its shortcut is handed over and the old product is uninstalled. An all-users copy under a per-user install stays and is said so. - The setup window shows the dry-run plan (Changes: adds, removes, replaces) before Update; with every program unticked the primary action becomes Uninstall. /COMPONENTS=Desktop names the desktop app. - pack-installer refuses Server (--legacy packs a 1.0 one for the CI test); release.yml publishes only Chronos-Setup-<v>.exe and the portable zip; the installer test covers add/remove in place, the Uploader replacement and the retained Server. Refs #64 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
58ed737310
commit
7d0c6554a4
58 files changed
+1401
-233
No files matched your search
@@ -1,43 +1,90 @@
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Core.Packaging;
|
||||
using Chronos.Setup.Engine;
|
||||
using Chronos.Ui.Mvvm;
|
||||
|
||||
namespace Chronos.Setup.Views;
|
||||
|
||||
/// <summary>
|
||||
/// A component checkbox: localized name and tooltip (falling back to the manifest), size and selection. A component
|
||||
/// that installs for all users only says so in its tooltip, and is unavailable when an installation that is not an
|
||||
/// all-users one inside Program Files is upgraded.
|
||||
/// A component checkbox: localized name and tooltip (falling back to the manifest), its state (size, "Installed ·
|
||||
/// size", or "No longer offered" for a retained one) and selection. Unticking an installed component removes it;
|
||||
/// unticking a retained one (Chronos Server 1.0 for Windows) removes it with its service. A component that installs for
|
||||
/// all users only says so in its tooltip, and is unavailable when an installation that is not an all-users one inside
|
||||
/// Program Files is upgraded.
|
||||
/// </summary>
|
||||
/// <param name="unavailableToolTip">The tooltip key saying why it cannot be added here; null when it can.</param>
|
||||
internal sealed class ComponentOption(PayloadComponent component, bool selected, string? unavailableToolTip, Action changed) : LocalizedViewModel
|
||||
internal sealed class ComponentOption : LocalizedViewModel
|
||||
{
|
||||
private bool _selected = selected;
|
||||
private readonly PayloadComponent? _component;
|
||||
private readonly string? _unavailableToolTip;
|
||||
private readonly Action _changed;
|
||||
private bool _selected;
|
||||
|
||||
public string Id => component.Id;
|
||||
/// <param name="installedVersion">The version installed now; null when it is not installed.</param>
|
||||
/// <param name="unavailableToolTip">The tooltip key saying why it cannot be added here; null when it can.</param>
|
||||
public ComponentOption(PayloadComponent component, bool selected, string? installedVersion, string? unavailableToolTip, Action changed)
|
||||
{
|
||||
_component = component;
|
||||
_selected = selected;
|
||||
InstalledVersion = installedVersion;
|
||||
_unavailableToolTip = unavailableToolTip;
|
||||
_changed = changed;
|
||||
Id = component.Id;
|
||||
}
|
||||
|
||||
public string Name => Loc.Get("Setup.Component." + component.Id, Loc.Culture) ?? component.DisplayName;
|
||||
/// <summary>A retained component: ticked keeps it as it is, unticked removes it with its service.</summary>
|
||||
public ComponentOption(RetainedComponent retained, bool selected, Action changed)
|
||||
{
|
||||
Retained = retained;
|
||||
_selected = selected;
|
||||
InstalledVersion = retained.Version;
|
||||
_changed = changed;
|
||||
Id = retained.Id;
|
||||
}
|
||||
|
||||
/// <summary>Installs for all users only (the Server runs as a LocalSystem service from Program Files).</summary>
|
||||
public bool AllUsersOnly => component.AllUsersOnly;
|
||||
public string Id { get; }
|
||||
|
||||
/// <summary>The retained component this row keeps or removes; null for a component of the payload.</summary>
|
||||
public RetainedComponent? Retained { get; }
|
||||
|
||||
public bool IsRetained => Retained is not null;
|
||||
|
||||
/// <summary>The version installed now; null when it is not installed.</summary>
|
||||
public string? InstalledVersion { get; }
|
||||
|
||||
public bool IsInstalled => InstalledVersion is not null;
|
||||
|
||||
/// <summary>The component's name; a retained one carries its version ("Chronos Server 1.0.0").</summary>
|
||||
public string Name => Retained is { } retained ? Loc.L("Setup.Component.Versioned", BaseName, retained.Version) : BaseName;
|
||||
|
||||
private string BaseName => Loc.Get("Setup.Component." + Id, Loc.Culture) ?? _component?.DisplayName ?? Id;
|
||||
|
||||
/// <summary>Installs for all users only (a program a LocalSystem service runs from Program Files).</summary>
|
||||
public bool AllUsersOnly => _component?.AllUsersOnly == true;
|
||||
|
||||
/// <summary>False when it cannot be installed here: it needs all users in Program Files and this installation is not.</summary>
|
||||
public bool IsAvailable => unavailableToolTip is null;
|
||||
public bool IsAvailable => _unavailableToolTip is null;
|
||||
|
||||
public string ToolTip => unavailableToolTip is { } reason ? Loc.L(reason)
|
||||
public string ToolTip => _unavailableToolTip is { } reason ? Loc.L(reason)
|
||||
: Retained is { } retained ? Loc.L("Tooltips.Setup.Component.Retained", retained.Version)
|
||||
: AllUsersOnly ? Loc.L("Tooltips.Setup.AllUsersOnly", Description)
|
||||
: InstalledVersion is { } version ? Loc.L("Tooltips.Setup.Component.InstalledVersion", Description, version)
|
||||
: Description;
|
||||
|
||||
private string Description => Loc.Get("Tooltips.Setup.Component." + component.Id, Loc.Culture) ?? Loc.L("Tooltips.Setup.Component");
|
||||
private string Description => Loc.Get("Tooltips.Setup.Component." + Id, Loc.Culture) ?? Loc.L("Tooltips.Setup.Component");
|
||||
|
||||
public string SizeText => ByteSize.Format(component.EstimatedSize);
|
||||
/// <summary>The right-hand text of the row: the size, "Installed · size", or "No longer offered".</summary>
|
||||
public string StateText => IsRetained ? Loc.L("Setup.Component.NoLongerOffered")
|
||||
: IsInstalled ? Loc.L("Setup.Component.Installed", SizeText)
|
||||
: SizeText;
|
||||
|
||||
public string SizeText => ByteSize.Format(_component?.EstimatedSize ?? 0);
|
||||
|
||||
public bool IsSelected
|
||||
{
|
||||
get => _selected;
|
||||
set
|
||||
{
|
||||
if (Set(ref _selected, value)) changed();
|
||||
if (Set(ref _selected, value)) _changed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user