merge: or5 parcel p1a

This commit is contained in:
Alby96 committed 2026-11-15 14:57:09 +01:00
commit 1f77f6b9d5
58 files changed
+1401 -233

No files matched your search

+94 -14
View File
@@ -1,10 +1,13 @@
# Installs, runs, upgrades and removes the packed installers on a clean Windows runner (BRIEF §18): silent mode,
# folder with a space, Add/Remove Programs entry, shortcuts, the .chronos file type, upgrade in place (files of the
# previous version removed), user data kept, the uninstaller removing itself, and the documented exit codes.
# previous version removed), user data kept, the uninstaller removing itself, and the documented exit codes. Then the
# single setup: a program added to and removed from an installation in place (a changed file is kept), the separate
# 1.0 Uploader replaced, and a 1.0 Server for Windows retained until the switches leave it out.
param(
[Parameter(Mandatory)] [string] $Setup1,
[Parameter(Mandatory)] [string] $Setup2,
[Parameter(Mandatory)] [string] $UploaderSetup,
[Parameter(Mandatory)] [string] $LegacyUploaderSetup,
[Parameter(Mandatory)] [string] $ServerSetup,
[Parameter(Mandatory)] [string] $Version1,
[Parameter(Mandatory)] [string] $Version2,
[Parameter(Mandatory)] [string] $Screenshots
@@ -17,7 +20,8 @@ Set-StrictMode -Version Latest
# Set-Location does not move, and the programs get the screenshot folder as an argument.
$Setup1 = (Resolve-Path -LiteralPath $Setup1).Path
$Setup2 = (Resolve-Path -LiteralPath $Setup2).Path
$UploaderSetup = (Resolve-Path -LiteralPath $UploaderSetup).Path
$LegacyUploaderSetup = (Resolve-Path -LiteralPath $LegacyUploaderSetup).Path
$ServerSetup = (Resolve-Path -LiteralPath $ServerSetup).Path
$Screenshots = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($Screenshots)
function Invoke-Program([string] $Exe, [string[]] $Arguments) {
@@ -48,6 +52,14 @@ function Get-DefaultValue([string] $Key) {
return (Get-Item -LiteralPath $Key).GetValue('')
}
function Get-LinkTarget([string] $Link) {
return (New-Object -ComObject WScript.Shell).CreateShortcut($Link).TargetPath
}
function Get-InstallLog([string] $Directory) {
return Get-Content -Raw -LiteralPath (Join-Path $Directory 'install-log.json') | ConvertFrom-Json
}
$dir = Join-Path $env:RUNNER_TEMP 'Chronos Test'
$entryKey = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\Chronos'
$programs = [Environment]::GetFolderPath('Programs')
@@ -63,9 +75,10 @@ Set-Content -LiteralPath $userFile -Value 'user data'
Write-Host '--- Arguments'
Assert-True ((Invoke-Program $Setup1 @('/BOGUS')) -eq 2) 'an unknown switch exits with 2 (invalid arguments)'
Assert-True ((Invoke-Program $Setup1 @('/S', '/uninstall')) -eq 6) 'removing a product that is not installed exits with 6'
Assert-True ((Invoke-Program $Setup2 @('/S', '/COMPONENTS=Server')) -eq 2) 'a component the setup does not ship and nothing retains exits with 2'
Write-Host "--- Install $Version1 into '$dir'"
Assert-True ((Invoke-Program $Setup1 @('/S', "/DIR=$dir")) -eq 0) 'silent install exits with 0'
Assert-True ((Invoke-Program $Setup1 @('/S', "/DIR=$dir", '/COMPONENTS=Desktop,Uploader')) -eq 0) 'silent install exits with 0'
foreach ($file in 'Chronos.exe', 'Chronos.Uploader.exe', 'Uninstall Chronos.exe', 'install-log.json', 'legacy.txt') {
Assert-True (Test-Path -LiteralPath (Join-Path $dir $file)) "$file installed"
}
@@ -76,6 +89,8 @@ Assert-True ($entry.QuietUninstallString -eq "`"$(Join-Path $dir 'Uninstall Chro
foreach ($link in $links) { Assert-True (Test-Path -LiteralPath $link) "shortcut '$link' created" }
Assert-True ((Get-DefaultValue 'HKCU:\Software\Classes\.chronos') -eq 'Chronos.Project') '.chronos opens with Chronos'
Assert-True ((Get-DefaultValue 'HKCU:\Software\Classes\Chronos.Project\shell\open\command') -eq "`"$(Join-Path $dir 'Chronos.exe')`" `"%1`"") 'Chronos.Project opens the installed Chronos.exe'
$log = Get-InstallLog $dir
Assert-True ($log.formatVersion -eq 2 -and $null -ne $log.hashes.'Chronos.exe') 'the install log records each file with its SHA-256 (format 2)'
Write-Host '--- Run the installed programs'
foreach ($program in 'Chronos.exe', 'Chronos.Uploader.exe') {
@@ -88,8 +103,9 @@ foreach ($program in 'Chronos.exe', 'Chronos.Uploader.exe') {
Write-Host "--- Upgrade in place to $Version2"
Assert-True ((Invoke-Program $Setup2 @('/S')) -eq 0) 'silent upgrade exits with 0'
Assert-True ((Get-ItemProperty -LiteralPath $entryKey).DisplayVersion -eq $Version2) "Add/Remove Programs lists version $Version2"
Assert-True ((Get-Content -Raw -LiteralPath (Join-Path $dir 'install-log.json') | ConvertFrom-Json).version -eq $Version2) "install log records version $Version2"
Assert-True ((Get-InstallLog $dir).version -eq $Version2) "install log records version $Version2"
Assert-True (Test-Path -LiteralPath (Join-Path $dir 'Chronos.exe')) 'Chronos.exe still installed'
Assert-True (Test-Path -LiteralPath (Join-Path $dir 'Chronos.Uploader.exe')) 'the Uploader installed before is kept by the upgrade'
Assert-True (-not (Test-Path -LiteralPath (Join-Path $dir 'legacy.txt'))) 'a file only the previous version had is removed'
foreach ($link in $links) { Assert-True (Test-Path -LiteralPath $link) "shortcut '$link' kept" }
Assert-True (Test-Path -LiteralPath $userFile) 'user data kept by the upgrade'
@@ -103,15 +119,79 @@ Assert-True (-not (Test-Path -LiteralPath 'HKCU:\Software\Classes\Chronos.Projec
Assert-True ($null -eq (Get-DefaultValue 'HKCU:\Software\Classes\.chronos')) '.chronos no longer opens with Chronos'
Assert-True (Test-Path -LiteralPath $userFile) 'user data kept by the uninstall'
Write-Host '--- Uploader installer: default folder, removal through the installer itself'
$uploaderDir = Join-Path $env:LOCALAPPDATA 'Programs\Chronos Uploader'
$uploaderKey = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\ChronosUploader'
Assert-True ((Invoke-Program $UploaderSetup @('/S')) -eq 0) 'silent Uploader install exits with 0'
Assert-True (Test-Path -LiteralPath (Join-Path $uploaderDir 'Chronos.Uploader.exe')) 'Uploader installed in %LOCALAPPDATA%\Programs\Chronos Uploader'
Assert-True (Test-Path -LiteralPath $uploaderKey) 'Uploader listed in Add/Remove Programs'
Assert-True ((Invoke-Program $UploaderSetup @('/uninstall', '/S')) -eq 0) 'silent Uploader removal exits with 0'
Assert-True (Wait-Removed $uploaderDir) 'Uploader folder removed'
Assert-True (-not (Test-Path -LiteralPath $uploaderKey)) 'Uploader entry removed'
$single = Join-Path $env:LOCALAPPDATA 'Programs\Chronos'
$uploaderLinks = @((Join-Path $programs 'Chronos Uploader.lnk'), (Join-Path $desktop 'Chronos Uploader.lnk'))
$desktopLinks = @((Join-Path $programs 'Chronos.lnk'), (Join-Path $desktop 'Chronos.lnk'))
Write-Host '--- One setup: the Uploader alone, then the desktop app added, then the Uploader removed'
Assert-True ((Invoke-Program $Setup2 @('/S', '/COMPONENTS=Uploader')) -eq 0) 'silent install of the Uploader alone exits with 0'
Assert-True (Test-Path -LiteralPath (Join-Path $single 'Chronos.Uploader.exe')) 'Uploader installed in %LOCALAPPDATA%\Programs\Chronos'
Assert-True (-not (Test-Path -LiteralPath (Join-Path $single 'Chronos.exe'))) 'the desktop app is not installed'
foreach ($link in $desktopLinks) { Assert-True (-not (Test-Path -LiteralPath $link)) "no shortcut '$link'" }
Assert-True ($null -eq (Get-DefaultValue 'HKCU:\Software\Classes\.chronos')) '.chronos is not registered without the desktop app'
Assert-True ((Invoke-Program $Setup2 @('/S', '/COMPONENTS=Desktop,Uploader')) -eq 0) 'adding the desktop app in place exits with 0'
Assert-True (Test-Path -LiteralPath (Join-Path $single 'Chronos.exe')) 'the desktop app is added in place'
foreach ($link in $desktopLinks) { Assert-True (Test-Path -LiteralPath $link) "shortcut '$link' created" }
Assert-True ((Get-DefaultValue 'HKCU:\Software\Classes\.chronos') -eq 'Chronos.Project') '.chronos opens with the added desktop app'
# A changed file of a removed program is never deleted: setup checks it against the SHA-256 it recorded.
$changed = Join-Path $single 'Chronos.Uploader.exe'
[System.IO.File]::AppendAllText($changed, 'changed after setup')
Assert-True ((Invoke-Program $Setup2 @('/S', '/COMPONENTS=Desktop')) -eq 0) 'removing the Uploader in place exits with 0'
Assert-True (Test-Path -LiteralPath $changed) 'the Uploader file changed since setup installed it is kept'
Assert-True (-not ((Get-InstallLog $single).components -contains 'Uploader')) 'the install log no longer lists the Uploader'
foreach ($link in $uploaderLinks) { Assert-True (-not (Test-Path -LiteralPath $link)) "shortcut '$link' removed with the Uploader" }
Remove-Item -LiteralPath $changed
Assert-True ((Invoke-Program (Join-Path $single 'Uninstall Chronos.exe') @('/uninstall', '/S')) -eq 0) 'silent uninstall exits with 0'
Assert-True (Wait-Removed $single) 'install folder removed'
Write-Host '--- One setup replaces the separate 1.0 Uploader'
$legacyDir = Join-Path $env:LOCALAPPDATA 'Programs\Chronos Uploader'
$legacyKey = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\ChronosUploader'
$runKey = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Run'
$approvedKey = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run'
Assert-True ((Invoke-Program $LegacyUploaderSetup @('/S')) -eq 0) 'the separate Uploader installs'
Assert-True (Test-Path -LiteralPath (Join-Path $legacyDir 'Chronos.Uploader.exe')) 'separate Uploader in %LOCALAPPDATA%\Programs\Chronos Uploader'
# Its sign-in entry, turned off in Task Manager, as the Uploader and Windows write them.
New-Item -Force -Path $runKey | Out-Null
New-Item -Force -Path $approvedKey | Out-Null
Set-ItemProperty -LiteralPath $runKey -Name 'Chronos Uploader' -Value "`"$(Join-Path $legacyDir 'Chronos.Uploader.exe')`" --tray"
Set-ItemProperty -LiteralPath $approvedKey -Name 'Chronos Uploader' -Type Binary -Value ([byte[]](3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
Assert-True ((Invoke-Program $Setup2 @('/S')) -eq 0) 'the single setup exits with 0'
Assert-True (Test-Path -LiteralPath (Join-Path $single 'Chronos.Uploader.exe')) 'the Uploader is now in %LOCALAPPDATA%\Programs\Chronos'
Assert-True (-not (Test-Path -LiteralPath (Join-Path $single 'Chronos.exe'))) 'only the Uploader is installed: it replaces the separate one'
Assert-True (-not (Test-Path -LiteralPath $legacyKey)) 'the separate Uploader entry is gone'
Assert-True (Wait-Removed $legacyDir) 'the separate Uploader folder is gone'
Assert-True ((Get-ItemProperty -LiteralPath $runKey).'Chronos Uploader' -eq "`"$(Join-Path $single 'Chronos.Uploader.exe')`" --tray") 'the sign-in entry starts the new copy with its option'
Assert-True ($null -ne (Get-ItemProperty -LiteralPath $approvedKey -Name 'Chronos Uploader' -ErrorAction SilentlyContinue)) 'the sign-in entry stays turned off'
$link = Join-Path $programs 'Chronos Uploader.lnk'
Assert-True ((Test-Path -LiteralPath $link) -and ((Get-LinkTarget $link) -eq (Join-Path $single 'Chronos.Uploader.exe'))) 'the Start menu shortcut starts the new copy'
Assert-True (Test-Path -LiteralPath $userFile) 'user data kept by the replacement'
Assert-True ((Invoke-Program (Join-Path $single 'Uninstall Chronos.exe') @('/uninstall', '/S')) -eq 0) 'silent uninstall exits with 0'
Assert-True (Wait-Removed $single) 'install folder removed'
Assert-True ($null -eq (Get-ItemProperty -LiteralPath $runKey -Name 'Chronos Uploader' -ErrorAction SilentlyContinue)) 'the sign-in entry goes with the uninstall'
Write-Host '--- One setup keeps a 1.0 Server for Windows until the switches leave it out'
Assert-True ((Invoke-Program $ServerSetup @('/S', '/COMPONENTS=Desktop,Server')) -eq 0) 'the 1.0 Server installs'
$serverLink = Join-Path $programs 'Chronos Server.lnk'
Assert-True (Test-Path -LiteralPath $serverLink) 'its Start menu shortcut is created'
# As Chronos 1.0 wrote it: format 1, no record of which component installed what, no hashes.
$log = Get-InstallLog $single
foreach ($name in 'componentFiles', 'componentShortcuts', 'componentVersions', 'hashes') { $log.PSObject.Properties.Remove($name) }
$log.formatVersion = 1
[System.IO.File]::WriteAllText((Join-Path $single 'install-log.json'), ($log | ConvertTo-Json -Depth 5))
Assert-True ((Invoke-Program $Setup2 @('/S')) -eq 0) 'the upgrade exits with 0'
Assert-True (Test-Path -LiteralPath (Join-Path $single 'Chronos.Server.exe')) 'Chronos.Server.exe is kept'
Assert-True (Test-Path -LiteralPath (Join-Path $single 'legacy.txt')) 'a file the 1.0 log lists and this setup does not ship is kept with it'
Assert-True (Test-Path -LiteralPath $serverLink) 'its shortcut is kept'
$log = Get-InstallLog $single
Assert-True (($log.components -contains 'Server') -and ($log.componentVersions.Server -eq $Version1)) 'the install log keeps the Server at its own version'
Assert-True ((Invoke-Program $Setup2 @('/S', '/COMPONENTS=Desktop')) -eq 0) 'switches that leave the Server out exit with 0'
Assert-True (-not (Test-Path -LiteralPath (Join-Path $single 'Chronos.Server.exe'))) 'Chronos.Server.exe is removed'
Assert-True (-not (Test-Path -LiteralPath (Join-Path $single 'legacy.txt'))) 'the files kept with it are removed'
Assert-True (-not (Test-Path -LiteralPath $serverLink)) 'its shortcut is removed'
Assert-True (-not ((Get-InstallLog $single).components -contains 'Server')) 'the install log no longer lists the Server'
Assert-True ((Invoke-Program (Join-Path $single 'Uninstall Chronos.exe') @('/uninstall', '/S')) -eq 0) 'silent uninstall exits with 0'
Assert-True (Wait-Removed $single) 'install folder removed'
Assert-True (Test-Path -LiteralPath $userFile) 'user data kept'
Write-Host 'Installer test passed.'
+10 -4
View File
@@ -307,20 +307,26 @@ jobs:
-p:IncludeNativeLibrariesForSelfExtract=true -p:PublishReadyToRun=false -o "out/publish/$p"
if ($LASTEXITCODE -ne 0) { throw "dotnet publish $p failed" }
}
Remove-Item -Recurse -Force out/app-v1, out/installers -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force out/app-v1, out/server-v1, out/installers -ErrorAction SilentlyContinue
Copy-Item -Recurse out/publish/Chronos.App out/app-v1
Set-Content -LiteralPath out/app-v1/legacy.txt -Value 'only in version 1'
# Stands in for Chronos Server 1.0 for Windows, which the single setup no longer ships (a program it retains).
New-Item -ItemType Directory -Force -Path out/server-v1 | Out-Null
Copy-Item -LiteralPath out/publish/Chronos.Uploader/Chronos.Uploader.exe -Destination out/server-v1/Chronos.Server.exe
$tools = 'src/Chronos.Tools/bin/Release/net10.0/Chronos.Tools.dll'
$installers = @(
@('--product', 'Chronos', '--version', '1.0.0', '--component', 'Chronos=out/app-v1',
'--component', 'Uploader=out/publish/Chronos.Uploader', '--out', 'out/installers/Chronos-Setup-1.0.0.exe'),
@('--product', 'Chronos', '--version', '1.0.1', '--component', 'Chronos=out/publish/Chronos.App',
'--component', 'Uploader=out/publish/Chronos.Uploader', '--out', 'out/installers/Chronos-Setup-1.0.1.exe'),
@('--product', 'Chronos Uploader', '--version', '1.0.1', '--component', 'Uploader=out/publish/Chronos.Uploader',
'--out', 'out/installers/Chronos-Uploader-Setup-1.0.1.exe'))
@('--product', 'Chronos Uploader', '--version', '1.0.0', '--component', 'Uploader=out/publish/Chronos.Uploader',
'--out', 'out/installers/Chronos-Uploader-Setup-1.0.0.exe'),
@('--product', 'Chronos', '--version', '1.0.0', '--component', 'Chronos=out/app-v1', '--component', 'Server=out/server-v1', '--legacy',
'--out', 'out/installers/Chronos-Server-Setup-1.0.0.exe'))
foreach ($installer in $installers) {
dotnet $tools pack-installer --setup out/publish/Chronos.Setup/Chronos.Setup.exe @installer
if ($LASTEXITCODE -ne 0) { throw "pack-installer $installer failed" }
}
./.gitea/scripts/installer-test.ps1 -Setup1 out/installers/Chronos-Setup-1.0.0.exe -Setup2 out/installers/Chronos-Setup-1.0.1.exe `
-UploaderSetup out/installers/Chronos-Uploader-Setup-1.0.1.exe -Version1 1.0.0 -Version2 1.0.1 -Screenshots out/installer-screenshots
-LegacyUploaderSetup out/installers/Chronos-Uploader-Setup-1.0.0.exe -ServerSetup out/installers/Chronos-Server-Setup-1.0.0.exe `
-Version1 1.0.0 -Version2 1.0.1 -Screenshots out/installer-screenshots
+22 -7
View File
@@ -1,7 +1,7 @@
name: Release
# A tag vMAJOR.MINOR.PATCH[-PRERELEASE] builds, tests and publishes everything (BRIEF §19.3, amended 2026-10-26, R1)
# on the Linux runner: the Windows programs cross-compiled (installers, portable and server zips), SHA256SUMS and
# on the Linux runner: the Windows programs cross-compiled (the one setup and the portable zip), SHA256SUMS and
# release notes on the Gitea release, then the server image in the Gitea container registry. The image's :latest
# follows the highest stable release, or the highest pre-release while no stable one exists; the public releases
# repository and the in-app update check follow stable releases only.
@@ -111,7 +111,6 @@ jobs:
common="-c Release -r win-x64 --self-contained -p:ChronosVersion=$VERSION -p:ChronosReleasesUrl=$CHRONOS_RELEASES_URL -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=none -m:$BUILD_CPUS"
dotnet publish src/Chronos.App/Chronos.App.csproj $common -p:PublishReadyToRun=true -o out/publish/app
dotnet publish src/Chronos.Uploader/Chronos.Uploader.csproj $common -p:PublishReadyToRun=true -o out/publish/uploader
dotnet publish src/Chronos.Server/Chronos.Server.csproj $common -o out/publish/server
dotnet publish src/Chronos.Setup/Chronos.Setup.csproj $common -p:PublishReadyToRun=true -o out/publish/setup
dotnet "$TOOLS" pe-check out/publish/app/Chronos.exe out/publish/uploader/Chronos.Uploader.exe out/publish/setup/Chronos.Setup.exe
@@ -131,15 +130,14 @@ jobs:
mv "$exe.signed" "$exe"
done
- name: Package installers and archives
# One setup installs, updates, adds and removes Chronos Desktop and Chronos Uploader; Chronos Server ships only as
# the Docker image. The portable zip stays beside it: portable copies update through it.
- name: Package the setup and the portable zip
run: |
mkdir -p out/release
dotnet "$TOOLS" pack-installer --setup out/publish/setup/Chronos.Setup.exe --product Chronos \
--component "Chronos=out/publish/app" --component "Uploader=out/publish/uploader" --component "Server=out/publish/server" \
--component "Chronos=out/publish/app" --component "Uploader=out/publish/uploader" \
--version "$VERSION" --out "out/release/Chronos-Setup-$VERSION.exe"
dotnet "$TOOLS" pack-installer --setup out/publish/setup/Chronos.Setup.exe --product "Chronos Uploader" \
--component "Uploader=out/publish/uploader" --version "$VERSION" --out "out/release/Chronos-Uploader-Setup-$VERSION.exe"
dotnet "$TOOLS" zip out/publish/server --out "out/release/Chronos-Server-win-x64-$VERSION.zip"
# The portable build keeps its data next to Chronos.exe because of portable.txt (never inside the installer).
cp -R out/publish/app out/portable
printf 'Chronos portable mode: settings, index and logs are kept in the data folder next to Chronos.exe.\r\n' > out/portable/portable.txt
@@ -147,6 +145,23 @@ jobs:
dotnet "$TOOLS" pe-check out/release/*.exe
ls -l out/release
# The release holds exactly the setup and the portable zip (SHA256SUMS follows): an Uploader-only setup or a
# Windows server package must never be published again.
- name: Check the release assets
working-directory: out/release
run: |
if ls | grep -E 'Uploader-Setup|Server-win' ; then
echo "::error title=Release assets::an Uploader-only setup or a Windows server package was produced"
exit 1
fi
expected="$(printf '%s\n' "Chronos-Setup-$VERSION.exe" "Chronos-win-x64-portable-$VERSION.zip" | sort)"
actual="$(ls -1 | sort)"
if [ "$actual" != "$expected" ]; then
echo "::error title=Release assets::expected:"; echo "$expected"; echo "found:"; echo "$actual"
exit 1
fi
echo "Release assets: $(echo "$actual" | tr '\n' ' ')"
- name: Sign installers
if: env.HAS_SIGNING == 'true'
env:
-1
View File
@@ -1005,7 +1005,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>طلب إغلاق البرامج قيد التشغيل · يتولى كل برنامج عمله غير المحفوظ</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>تثبيت هذا البرنامج</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>تطبيق سطح المكتب لاستيراد مقاطع الفاصل الزمني وأرشفتها وتصييرها</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>يشغّل خادم Chronos على هذا الكمبيوتر للأجهزة الأخرى وعقد التصيير</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>يرسل الصور من المجلدات المراقَبة إلى خادم Chronos</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>إضافة اختصارات إلى سطح المكتب</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>مكان تثبيت البرامج · تبقى بياناتك في مجلدها الخاص</value></data>
-1
View File
@@ -963,7 +963,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>Иска от работещите програми да се затворят · всяка от тях се грижи за незаписаната си работа</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>Инсталира тази програма</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>Настолното приложение за импортиране, архивиране и рендериране на таймлапси</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>Изпълнява Chronos Server на този компютър за други устройства и възли за рендериране</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>Изпраща снимки от наблюдавани папки към Chronos Server</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>Добавя преки пътища на работния плот</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>Къде се инсталират програмите · данните ви остават в собствена папка</value></data>
-1
View File
@@ -984,7 +984,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>Požádá spuštěné programy o zavření · každý si sám poradí s neuloženou prací</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>Nainstaluje tento program</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>Desktopová aplikace pro import, archivaci a renderování časosběrů</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>Spouští Chronos Server v tomto počítači pro další zařízení a renderovací uzly</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>Odesílá fotografie ze sledovaných složek na Chronos Server</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>Přidá zástupce na plochu</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>Kam se programy nainstalují · vaše data zůstanou ve vlastní složce</value></data>
-1
View File
@@ -963,7 +963,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>Bed de kørende programmer om at lukke · hvert program håndterer selv sit ikke-gemte arbejde</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>Installer dette program</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>Desktopappen til at importere, arkivere og rendere time-lapses</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>Kører Chronos Server på denne pc til andre enheder og renderingsnoder</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>Sender fotos fra overvågede mapper til en Chronos Server</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>Føj genveje til skrivebordet</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>Hvor programmerne installeres · dine data bliver i deres egen mappe</value></data>
-1
View File
@@ -963,7 +963,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>Die laufenden Programme zum Schließen auffordern · jedes kümmert sich selbst um seine ungespeicherte Arbeit</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>Dieses Programm installieren</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>Die Desktop-App zum Importieren, Archivieren und Rendern von Zeitraffern</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>Führt Chronos Server auf diesem PC für andere Geräte und Render-Knoten aus</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>Sendet Fotos aus überwachten Ordnern an einen Chronos Server</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>Verknüpfungen auf dem Desktop hinzufügen</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>Wo die Programme installiert werden · Ihre Daten bleiben in einem eigenen Ordner</value></data>
-1
View File
@@ -963,7 +963,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>Αίτημα κλεισίματος προς τα προγράμματα που εκτελούνται · το καθένα χειρίζεται τη μη αποθηκευμένη εργασία του</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>Εγκατάσταση αυτού του προγράμματος</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>Η εφαρμογή υπολογιστή για εισαγωγή, αρχειοθέτηση και απόδοση time-lapse</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>Εκτελεί το Chronos Server σε αυτόν τον υπολογιστή για άλλες συσκευές και κόμβους απόδοσης</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>Στέλνει φωτογραφίες από φακέλους παρακολούθησης σε ένα Chronos Server</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>Προσθήκη συντομεύσεων στην επιφάνεια εργασίας</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>Πού εγκαθίστανται τα προγράμματα · τα δεδομένα σας μένουν στον δικό τους φάκελο</value></data>
+13 -3
View File
@@ -12,10 +12,19 @@
<data name="Setup.Action.Retry" xml:space="preserve"><value>Retry</value></data>
<data name="Setup.Action.Uninstall" xml:space="preserve"><value>Uninstall</value></data>
<data name="Setup.Action.Update" xml:space="preserve"><value>Update</value></data>
<data name="Setup.Component.Server" xml:space="preserve"><value>Server for Windows</value></data>
<data name="Setup.Component.Chronos" xml:space="preserve"><value>Chronos</value></data>
<data name="Setup.Component.Uploader" xml:space="preserve"><value>Uploader</value></data>
<data name="Setup.Changes.Add" xml:space="preserve"><value>Adds {0}</value></data>
<data name="Setup.Changes.KeptSeparate" xml:space="preserve"><value>{0} stays</value></data>
<data name="Setup.Changes.Remove" xml:space="preserve"><value>Removes {0}</value></data>
<data name="Setup.Changes.Replace" xml:space="preserve"><value>Replaces {0} {1}</value></data>
<data name="Setup.Component.Server" xml:space="preserve"><value>Chronos Server</value></data>
<data name="Setup.Component.Chronos" xml:space="preserve"><value>Chronos Desktop</value></data>
<data name="Setup.Component.Installed" xml:space="preserve"><value>Installed · {0}</value></data>
<data name="Setup.Component.NoLongerOffered" xml:space="preserve"><value>No longer offered</value></data>
<data name="Setup.Component.Uploader" xml:space="preserve"><value>Chronos Uploader</value></data>
<data name="Setup.Component.Versioned" xml:space="preserve"><value>{0} {1}</value></data>
<data name="Setup.Done.Installed" xml:space="preserve"><value>{0} is installed.</value></data>
<data name="Setup.Done.Kept.one" xml:space="preserve"><value>{0:N0} changed file kept</value></data>
<data name="Setup.Done.Kept.other" xml:space="preserve"><value>{0:N0} changed files kept</value></data>
<data name="Setup.Done.Removed" xml:space="preserve"><value>{0} was removed.</value></data>
<data name="Setup.Error.Access" xml:space="preserve"><value>Windows denied access to the folder.</value><comment>long</comment></data>
<data name="Setup.Error.Arguments" xml:space="preserve"><value>The command line is not valid.</value><comment>long</comment></data>
@@ -26,6 +35,7 @@
<data name="Setup.Error.Payload" xml:space="preserve"><value>This installer is damaged; download it again.</value><comment>long</comment></data>
<data name="Setup.Error.Running" xml:space="preserve"><value>{0} did not close.</value><comment>long</comment></data>
<data name="Setup.Error.Uninstall" xml:space="preserve"><value>Some files could not be removed.</value><comment>long</comment></data>
<data name="Setup.Field.Changes" xml:space="preserve"><value>Changes</value></data>
<data name="Setup.Field.Components" xml:space="preserve"><value>Components</value></data>
<data name="Setup.Field.Folder" xml:space="preserve"><value>Folder</value></data>
<data name="Setup.Field.Language" xml:space="preserve"><value>Language</value></data>
+11 -3
View File
@@ -862,13 +862,20 @@
<data name="Tooltips.Setup.Back" xml:space="preserve"><value>Return to the options without changing anything</value></data>
<data name="Tooltips.Setup.Browse" xml:space="preserve"><value>Choose the installation folder</value></data>
<data name="Tooltips.Setup.Cancel" xml:space="preserve"><value>Close setup without changing anything</value></data>
<data name="Tooltips.Setup.Changes.Add" xml:space="preserve"><value>Installs this program in the same folder</value></data>
<data name="Tooltips.Setup.Changes.KeptSeparate" xml:space="preserve"><value>The separate copy in {0} is installed for all users, so it stays · remove it in Settings › Apps</value></data>
<data name="Tooltips.Setup.Changes.Remove" xml:space="preserve"><value>Removes its files and shortcuts · a file changed since setup installed it is kept · your data is kept</value></data>
<data name="Tooltips.Setup.Changes.RemoveRetained" xml:space="preserve"><value>Removes {0} and the Windows service that runs it · its data in %ProgramData%\Chronos Server is kept</value></data>
<data name="Tooltips.Setup.Changes.Replace" xml:space="preserve"><value>Moves the separate copy in {0} here with its sign-in entry and shortcuts, then removes it · your data is kept</value></data>
<data name="Tooltips.Setup.Close" xml:space="preserve"><value>Close setup</value></data>
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>Ask the running programs to close · each one handles its unsaved work</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>Install this program</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>Runs Chronos Server on this PC for other devices and render nodes</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>The desktop app to import, archive and render time-lapses</value></data>
<data name="Tooltips.Setup.Component.InstalledVersion" xml:space="preserve"><value>{0} · version {1} is installed · untick to remove it</value></data>
<data name="Tooltips.Setup.Component.Retained" xml:space="preserve"><value>Installed {0} · no longer updated: Chronos Server now ships as a Docker image · untick to remove it and its Windows service</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>Sends photos from watched folders to a Chronos Server</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>Add shortcuts to the desktop</value></data>
<data name="Tooltips.Setup.Done.Kept" xml:space="preserve"><value>Files changed since setup installed them are never deleted · they stay in the install folder</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>Where the programs are installed · your data stays in its own folder</value></data>
<data name="Tooltips.Setup.FolderInvalid" xml:space="preserve"><value>Enter a full folder path that is not a drive root or a system folder</value></data>
<data name="Tooltips.Setup.FolderProgramFiles" xml:space="preserve"><value>{0} runs as a Windows service, so choose a folder inside Program Files</value></data>
@@ -882,14 +889,15 @@
<data name="Tooltips.Setup.Locked" xml:space="preserve"><value>Already installed here · uninstall it first to change folder or scope</value></data>
<data name="Tooltips.Setup.NeedsAllUsers" xml:space="preserve"><value>Runs as a Windows service, so it installs for all users only · this copy is installed for you alone; uninstall it first to add it</value></data>
<data name="Tooltips.Setup.NeedsProgramFiles" xml:space="preserve"><value>Runs as a Windows service, so it installs inside Program Files only · this copy is installed elsewhere; uninstall it first to add it</value></data>
<data name="Tooltips.Setup.NoComponent" xml:space="preserve"><value>Select at least one program to install</value></data>
<data name="Tooltips.Setup.NoComponent" xml:space="preserve"><value>Select Chronos Desktop, Chronos Uploader or both</value></data>
<data name="Tooltips.Setup.RemoveData" xml:space="preserve"><value>Also delete %LOCALAPPDATA%\Chronos: database, backups, cache, settings, logs, the uploader queue and sign-in · photos in archives are kept</value></data>
<data name="Tooltips.Setup.RemoveDataChronos" xml:space="preserve"><value>Also delete Chronos’s database, backups, cache, settings and logs in %LOCALAPPDATA%\Chronos · the Uploader’s files and photos in archives are kept</value></data>
<data name="Tooltips.Setup.RemoveDataUploader" xml:space="preserve"><value>Also delete the Uploader’s queue, settings, sign-in and logs in %LOCALAPPDATA%\Chronos · Chronos’s files and photos in archives are kept</value></data>
<data name="Tooltips.Setup.Retry" xml:space="preserve"><value>Run the same step again</value></data>
<data name="Tooltips.Setup.StartMenu" xml:space="preserve"><value>Add the programs to the Start menu</value></data>
<data name="Tooltips.Setup.Uninstall" xml:space="preserve"><value>Remove programs, shortcuts and file types · your data is kept unless selected</value></data>
<data name="Tooltips.Setup.Update" xml:space="preserve"><value>Replace the installed version in place · your data is kept</value></data>
<data name="Tooltips.Setup.UninstallAll" xml:space="preserve"><value>No program is selected: remove the whole installation · the next step shows what goes</value></data>
<data name="Tooltips.Setup.Update" xml:space="preserve"><value>Update the installed programs in place and apply the changes listed · your data is kept</value></data>
<data name="Tooltips.Shell.CollapseRail" xml:space="preserve"><value>Collapse navigation to icons · Ctrl+B</value></data>
<data name="Tooltips.Shell.ExpandRail" xml:space="preserve"><value>Show navigation names · Ctrl+B</value></data>
<data name="Tooltips.Shell.PauseJob" xml:space="preserve"><value>Pause the job shown; it continues from its checkpoint when resumed</value></data>
-1
View File
@@ -963,7 +963,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>Pide a los programas en ejecución que se cierren · cada uno gestiona su trabajo sin guardar</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>Instala este programa</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>La aplicación de escritorio para importar, archivar y renderizar time-lapses</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>Ejecuta Chronos Server en este equipo para otros dispositivos y nodos de renderizado</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>Envía fotos de carpetas vigiladas a un Chronos Server</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>Añade accesos directos al escritorio</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>Dónde se instalan los programas · tus datos se quedan en su propia carpeta</value></data>
-1
View File
@@ -963,7 +963,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>Paluge töötavatel programmidel sulguda · igaüks käsitleb oma salvestamata tööd ise</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>Installib selle programmi</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>Töölauarakendus aegvõtete importimiseks, arhiveerimiseks ja renderdamiseks</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>Käitab selles arvutis Chronos Serverit teiste seadmete ja renderdussõlmede jaoks</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>Saadab jälgitavatest kaustadest fotod Chronos Serverisse</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>Lisab töölauale otseteed</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>Programmide installikoht · teie andmed jäävad oma kausta</value></data>
-1
View File
@@ -963,7 +963,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>Pyydä käynnissä olevia ohjelmia sulkeutumaan · kukin käsittelee tallentamattomat työnsä itse</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>Asenna tämä ohjelma</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>Työpöytäsovellus aikaviivevideoiden tuontiin, arkistointiin ja renderöintiin</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>Suorittaa Chronos-palvelinta tällä tietokoneella muille laitteille ja renderöintisolmuille</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>Lähettää kuvia valvotuista kansioista Chronos-palvelimelle</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>Lisää pikakuvakkeet työpöydälle</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>Kansio, johon ohjelmat asennetaan · tietosi pysyvät omassa kansiossaan</value></data>
-1
View File
@@ -963,7 +963,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>Demander aux programmes en cours de se fermer · chacun gère son travail non enregistré</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>Installer ce programme</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>L'application de bureau pour importer, archiver et rendre des time-lapses</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>Exécute Chronos Server sur ce PC pour d'autres appareils et des nœuds de rendu</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>Envoie les photos de dossiers surveillés vers un Chronos Server</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>Ajouter des raccourcis sur le bureau</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>Emplacement d'installation des programmes · vos données restent dans leur propre dossier</value></data>
-1
View File
@@ -984,7 +984,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>בקשה מהתוכניות הפועלות להיסגר · כל אחת מטפלת בעבודה שלא נשמרה בה</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>התקנת התוכנית הזו</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>יישום שולחן העבודה לייבוא, לאחסון בארכיון ולרינדור של טיים-לאפס</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>מפעיל את שרת Chronos במחשב הזה עבור מכשירים אחרים וצומתי רינדור</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>שולח תמונות מתיקיות במעקב לשרת Chronos</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>הוספת קיצורי דרך לשולחן העבודה</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>המקום שבו התוכניות מותקנות · הנתונים שלך נשארים בתיקייה משלהם</value></data>
-1
View File
@@ -963,7 +963,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>चल रहे प्रोग्राम को बंद होने के लिए कहें · हर प्रोग्राम अपना बिना सहेजा काम खुद संभालता है</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>यह प्रोग्राम इंस्टॉल करें</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>टाइम-लैप्स आयात, संग्रहीत और रेंडर करने के लिए डेस्कटॉप ऐप</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>अन्य डिवाइस और रेंडर नोड के लिए इस PC पर Chronos Server चलाता है</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>निगरानी वाले फ़ोल्डरों से फ़ोटो किसी Chronos Server को भेजता है</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>डेस्कटॉप पर शॉर्टकट जोड़ें</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>प्रोग्राम कहाँ इंस्टॉल होते हैं · आपका डेटा अपने अलग फ़ोल्डर में रहता है</value></data>
-1
View File
@@ -984,7 +984,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>Traži od pokrenutih programa da se zatvore · svaki sam rješava nespremljeni rad</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>Instalira ovaj program</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>Aplikacija za stolna računala za uvoz, arhiviranje i renderiranje time-lapse snimaka</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>Pokreće Chronos Server na ovom računalu za druge uređaje i čvorove za renderiranje</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>Šalje fotografije iz nadziranih mapa na Chronos Server</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>Dodaje prečace na radnu površinu</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>Mjesto na koje se instaliraju programi · vaši podaci ostaju u vlastitoj mapi</value></data>
-1
View File
@@ -963,7 +963,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>Bezárásra kéri a futó programokat · mindegyik maga kezeli a mentetlen munkáját</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>Ennek a programnak a telepítése</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>Az asztali alkalmazás time-lapse felvételek importálásához, archiválásához és rendereléséhez</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>A Chronos Server futtatása ezen a számítógépen más eszközök és renderelő csomópontok számára</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>Fotókat küld a figyelt mappákból egy Chronos Serverre</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>Parancsikonokat helyez az asztalra</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>A programok telepítési helye · az adatai a saját mappájukban maradnak</value></data>
-1
View File
@@ -963,7 +963,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>Minta program yang sedang berjalan untuk menutup · masing-masing menangani pekerjaannya yang belum disimpan</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>Instal program ini</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>Aplikasi desktop untuk mengimpor, mengarsipkan, dan merender time-lapse</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>Menjalankan Chronos Server di PC ini untuk perangkat lain dan node render</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>Mengirim foto dari folder pantauan ke Chronos Server</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>Tambahkan pintasan ke desktop</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>Tempat program diinstal · data Anda tetap di foldernya sendiri</value></data>
+13 -3
View File
@@ -12,10 +12,19 @@
<data name="Setup.Action.Retry" xml:space="preserve"><value>Riprova</value></data>
<data name="Setup.Action.Uninstall" xml:space="preserve"><value>Disinstalla</value></data>
<data name="Setup.Action.Update" xml:space="preserve"><value>Aggiorna</value></data>
<data name="Setup.Component.Server" xml:space="preserve"><value>Server per Windows</value></data>
<data name="Setup.Component.Chronos" xml:space="preserve"><value>Chronos</value></data>
<data name="Setup.Component.Uploader" xml:space="preserve"><value>Uploader</value></data>
<data name="Setup.Changes.Add" xml:space="preserve"><value>Aggiunge {0}</value></data>
<data name="Setup.Changes.KeptSeparate" xml:space="preserve"><value>{0} resta</value></data>
<data name="Setup.Changes.Remove" xml:space="preserve"><value>Rimuove {0}</value></data>
<data name="Setup.Changes.Replace" xml:space="preserve"><value>Sostituisce {0} {1}</value></data>
<data name="Setup.Component.Server" xml:space="preserve"><value>Chronos Server</value></data>
<data name="Setup.Component.Chronos" xml:space="preserve"><value>Chronos Desktop</value></data>
<data name="Setup.Component.Installed" xml:space="preserve"><value>Installato · {0}</value></data>
<data name="Setup.Component.NoLongerOffered" xml:space="preserve"><value>Non più offerto</value></data>
<data name="Setup.Component.Uploader" xml:space="preserve"><value>Chronos Uploader</value></data>
<data name="Setup.Component.Versioned" xml:space="preserve"><value>{0} {1}</value></data>
<data name="Setup.Done.Installed" xml:space="preserve"><value>{0} è installato.</value></data>
<data name="Setup.Done.Kept.one" xml:space="preserve"><value>{0:N0} file modificato tenuto</value></data>
<data name="Setup.Done.Kept.other" xml:space="preserve"><value>{0:N0} file modificati tenuti</value></data>
<data name="Setup.Done.Removed" xml:space="preserve"><value>{0} è stato rimosso.</value></data>
<data name="Setup.Error.Access" xml:space="preserve"><value>Windows ha negato l'accesso alla cartella.</value><comment>long</comment></data>
<data name="Setup.Error.Arguments" xml:space="preserve"><value>La riga di comando non è valida.</value><comment>long</comment></data>
@@ -26,6 +35,7 @@
<data name="Setup.Error.Payload" xml:space="preserve"><value>Il programma di installazione è danneggiato; scaricalo di nuovo.</value><comment>long</comment></data>
<data name="Setup.Error.Running" xml:space="preserve"><value>{0} non si è chiuso.</value><comment>long</comment></data>
<data name="Setup.Error.Uninstall" xml:space="preserve"><value>Alcuni file non sono stati rimossi.</value><comment>long</comment></data>
<data name="Setup.Field.Changes" xml:space="preserve"><value>Modifiche</value></data>
<data name="Setup.Field.Components" xml:space="preserve"><value>Componenti</value></data>
<data name="Setup.Field.Folder" xml:space="preserve"><value>Cartella</value></data>
<data name="Setup.Field.Language" xml:space="preserve"><value>Lingua</value></data>
+11 -3
View File
@@ -959,13 +959,20 @@
<data name="Tooltips.Setup.Back" xml:space="preserve"><value>Torna alle opzioni senza modificare nulla</value></data>
<data name="Tooltips.Setup.Browse" xml:space="preserve"><value>Scegli la cartella di installazione</value></data>
<data name="Tooltips.Setup.Cancel" xml:space="preserve"><value>Chiudi l'installazione senza modificare nulla</value></data>
<data name="Tooltips.Setup.Changes.Add" xml:space="preserve"><value>Installa questo programma nella stessa cartella</value></data>
<data name="Tooltips.Setup.Changes.KeptSeparate" xml:space="preserve"><value>La copia separata in {0} è installata per tutti gli utenti, quindi resta · rimuovila da Impostazioni › App</value></data>
<data name="Tooltips.Setup.Changes.Remove" xml:space="preserve"><value>Rimuove i suoi file e collegamenti · un file modificato dopo l'installazione resta · i tuoi dati restano</value></data>
<data name="Tooltips.Setup.Changes.RemoveRetained" xml:space="preserve"><value>Rimuove {0} e il servizio Windows che lo esegue · i suoi dati in %ProgramData%\Chronos Server restano</value></data>
<data name="Tooltips.Setup.Changes.Replace" xml:space="preserve"><value>Sposta qui la copia separata in {0} con la voce di avvio e i collegamenti, poi la rimuove · i tuoi dati restano</value></data>
<data name="Tooltips.Setup.Close" xml:space="preserve"><value>Chiudi l'installazione</value></data>
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>Chiedi ai programmi aperti di chiudersi · ognuno gestisce il lavoro non salvato</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>Installa questo programma</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>L'app desktop per importare, archiviare e renderizzare time-lapse</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>Esegue Chronos Server su questo PC per altri dispositivi e nodi di rendering</value></data>
<data name="Tooltips.Setup.Component.InstalledVersion" xml:space="preserve"><value>{0} · la versione {1} è installata · togli la spunta per rimuoverlo</value></data>
<data name="Tooltips.Setup.Component.Retained" xml:space="preserve"><value>Installato {0} · non più aggiornato: Chronos Server ora è un'immagine Docker · togli la spunta per rimuoverlo con il suo servizio Windows</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>Invia le foto dalle cartelle monitorate a un Chronos Server</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>Aggiungi collegamenti al desktop</value></data>
<data name="Tooltips.Setup.Done.Kept" xml:space="preserve"><value>I file modificati dopo l'installazione non vengono mai eliminati · restano nella cartella di installazione</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>Dove vengono installati i programmi · i tuoi dati restano nella loro cartella</value></data>
<data name="Tooltips.Setup.FolderInvalid" xml:space="preserve"><value>Inserisci il percorso completo di una cartella che non sia la radice di un'unità o una cartella di sistema</value></data>
<data name="Tooltips.Setup.FolderProgramFiles" xml:space="preserve"><value>{0} è un servizio di Windows, quindi scegli una cartella dentro Programmi</value></data>
@@ -979,14 +986,15 @@
<data name="Tooltips.Setup.Locked" xml:space="preserve"><value>Già installato qui · disinstallalo prima per cambiare cartella o ambito</value></data>
<data name="Tooltips.Setup.NeedsAllUsers" xml:space="preserve"><value>È un servizio di Windows, quindi si installa solo per tutti gli utenti · questa copia è installata solo per te; disinstallala prima per aggiungerlo</value></data>
<data name="Tooltips.Setup.NeedsProgramFiles" xml:space="preserve"><value>È un servizio di Windows, quindi si installa solo dentro Programmi · questa copia è installata altrove; disinstallala prima per aggiungerlo</value></data>
<data name="Tooltips.Setup.NoComponent" xml:space="preserve"><value>Seleziona almeno un programma da installare</value></data>
<data name="Tooltips.Setup.NoComponent" xml:space="preserve"><value>Seleziona Chronos Desktop, Chronos Uploader o entrambi</value></data>
<data name="Tooltips.Setup.RemoveData" xml:space="preserve"><value>Elimina anche %LOCALAPPDATA%\Chronos: database, backup, cache, impostazioni, log, coda e accesso dell'uploader · le foto negli archivi restano</value></data>
<data name="Tooltips.Setup.RemoveDataChronos" xml:space="preserve"><value>Elimina anche database, backup, cache, impostazioni e log di Chronos in %LOCALAPPDATA%\Chronos · i file dell'uploader e le foto negli archivi restano</value></data>
<data name="Tooltips.Setup.RemoveDataUploader" xml:space="preserve"><value>Elimina anche coda, impostazioni, accesso e log dell'uploader in %LOCALAPPDATA%\Chronos · i file di Chronos e le foto negli archivi restano</value></data>
<data name="Tooltips.Setup.Retry" xml:space="preserve"><value>Esegui di nuovo lo stesso passaggio</value></data>
<data name="Tooltips.Setup.StartMenu" xml:space="preserve"><value>Aggiungi i programmi al menu Start</value></data>
<data name="Tooltips.Setup.Uninstall" xml:space="preserve"><value>Rimuovi programmi, collegamenti e tipi di file · i dati restano salvo diversa scelta</value></data>
<data name="Tooltips.Setup.Update" xml:space="preserve"><value>Sostituisci la versione installata · i tuoi dati restano</value></data>
<data name="Tooltips.Setup.UninstallAll" xml:space="preserve"><value>Nessun programma selezionato: rimuovi l'intera installazione · il passo successivo mostra cosa viene rimosso</value></data>
<data name="Tooltips.Setup.Update" xml:space="preserve"><value>Aggiorna sul posto i programmi installati e applica le modifiche elencate · i tuoi dati restano</value></data>
<data name="Tooltips.Shell.CollapseRail" xml:space="preserve"><value>Riduci la navigazione alle icone · Ctrl+B</value></data>
<data name="Tooltips.Shell.ExpandRail" xml:space="preserve"><value>Mostra i nomi della navigazione · Ctrl+B</value></data>
<data name="Tooltips.Shell.PauseJob" xml:space="preserve"><value>Mette in pausa l'attività mostrata; quando la riprendi continua dal punto di ripresa</value></data>
-1
View File
@@ -963,7 +963,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>実行中のプログラムに終了を要求します · 未保存の作業は各プログラムが処理します</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>このプログラムをインストールします。</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>タイムラプスをインポート、アーカイブ、レンダリングするデスクトップアプリです。</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>他のデバイスとレンダリングノードのために、この PC で Chronos Server を実行します。</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>監視フォルダーの写真を Chronos Server に送信します。</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>デスクトップにショートカットを追加します。</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>プログラムのインストール先です · データは専用のフォルダーに保存されます</value></data>
-1
View File
@@ -963,7 +963,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>실행 중인 프로그램에 종료를 요청합니다 · 저장하지 않은 작업은 각 프로그램이 처리</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>이 프로그램을 설치합니다.</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>타임랩스를 가져오고, 보관하고, 렌더링하는 데스크톱 앱</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>다른 장치와 렌더링 노드를 위해 이 PC에서 Chronos Server를 실행합니다.</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>감시 폴더의 사진을 Chronos Server로 보냅니다.</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>바탕 화면에 바로 가기를 추가합니다.</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>프로그램이 설치되는 위치 · 데이터는 별도 폴더에 보관됨</value></data>
-1
View File
@@ -984,7 +984,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>Paprašyti veikiančių programų užsidaryti · kiekviena pati tvarko neįrašytus duomenis</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>Įdiegti šią programą</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>Darbalaukio programa time-lapse įrašams importuoti, archyvuoti ir atvaizduoti</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>Paleidžia Chronos serverį šiame kompiuteryje kitiems įrenginiams ir atvaizdavimo mazgams</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>Siunčia nuotraukas iš stebimų aplankų į Chronos serverį</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>Pridėti nuorodas darbalaukyje</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>Kur įdiegiamos programos · jūsų duomenys lieka savo aplanke</value></data>
-1
View File
@@ -984,7 +984,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>Lūgt aktīvajām programmām aizvērties · katra pati apstrādā savu nesaglabāto darbu</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>Instalēt šo programmu</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>Darbvirsmas lietotne timelapse importēšanai, arhivēšanai un renderēšanai</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>Palaiž Chronos Server šajā datorā citām ierīcēm un renderēšanas mezgliem</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>Sūta fotoattēlus no uzraudzītām mapēm uz Chronos Server</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>Pievienot saīsnes darbvirsmai</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>Kur tiek instalētas programmas · jūsu dati paliek savā mapē</value></data>
-1
View File
@@ -963,7 +963,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>Minta program yang sedang berjalan ditutup · setiap program mengendalikan kerjanya yang belum disimpan</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>Pasang program ini</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>Aplikasi desktop untuk mengimport, mengarkib dan merender time-lapse</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>Menjalankan Chronos Server pada PC ini untuk peranti lain dan nod render</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>Menghantar foto daripada folder pantauan ke Chronos Server</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>Tambah pintasan pada desktop</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>Lokasi program dipasang · data anda kekal dalam foldernya sendiri</value></data>
-1
View File
@@ -963,7 +963,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>Be programmene som kjører, om å lukkes · hvert program håndterer sitt eget ulagrede arbeid</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>Installer dette programmet</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>Skrivebordsappen for å importere, arkivere og rendre timelapser</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>Kjører Chronos Server på denne PC-en for andre enheter og renderingsnoder</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>Sender bilder fra overvåkede mapper til en Chronos Server</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>Legg til snarveier på skrivebordet</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>Hvor programmene installeres · dataene dine blir i sin egen mappe</value></data>
-1
View File
@@ -963,7 +963,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>Vraag de geopende programma's om af te sluiten · elk programma handelt zijn niet-opgeslagen werk zelf af</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>Installeer dit programma</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>De desktop-app om time-lapses te importeren, archiveren en renderen</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>Voert Chronos Server uit op deze pc voor andere apparaten en renderknooppunten</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>Stuurt foto's uit bewaakte mappen naar een Chronos Server</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>Voeg snelkoppelingen toe aan het bureaublad</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>Waar de programma's worden geïnstalleerd · je gegevens blijven in hun eigen map</value></data>
-1
View File
@@ -1005,7 +1005,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>Poproś uruchomione programy o zamknięcie · każdy sam zadba o niezapisaną pracę</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>Zainstaluj ten program</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>Aplikacja komputerowa do importowania, archiwizowania i renderowania timelapsów</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>Uruchamia Chronos Server na tym komputerze dla innych urządzeń i węzłów renderowania</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>Wysyła zdjęcia z obserwowanych folderów do Chronos Server</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>Dodaj skróty na pulpicie</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>Miejsce instalacji programów · Twoje dane pozostają we własnym folderze</value></data>
-1
View File
@@ -963,7 +963,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>Pede aos programas em execução que fechem · cada um cuida do próprio trabalho não salvo</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>Instala este programa</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>O aplicativo da área de trabalho para importar, arquivar e renderizar time-lapses</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>Executa o Chronos Server neste PC para outros dispositivos e nós de renderização</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>Envia fotos de pastas monitoradas para um Chronos Server</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>Adiciona atalhos à área de trabalho</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>Onde os programas são instalados · seus dados ficam na própria pasta</value></data>
-1
View File
@@ -963,7 +963,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>Pedir aos programas em execução que fechem · cada um trata do seu trabalho não guardado</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>Instalar este programa</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>A aplicação de ambiente de trabalho para importar, arquivar e renderizar time-lapses</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>Executa o Chronos Server neste PC para outros dispositivos e nós de renderização</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>Envia fotografias de pastas monitorizadas para um Chronos Server</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>Adicionar atalhos ao ambiente de trabalho</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>Onde os programas são instalados · os seus dados ficam na respetiva pasta</value></data>
-1
View File
@@ -984,7 +984,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>Cereți programelor deschise să se închidă · fiecare își gestionează lucrul nesalvat</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>Instalați acest program</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>Aplicația desktop pentru importul, arhivarea și randarea time-lapse-urilor</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>Rulează Chronos Server pe acest PC pentru alte dispozitive și noduri de randare</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>Trimite fotografii din folderele monitorizate către un Chronos Server</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>Adăugați comenzi rapide pe desktop</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>Locul în care sunt instalate programele · datele dumneavoastră rămân în folderul lor</value></data>
-1
View File
@@ -1005,7 +1005,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>Попросить запущенные программы закрыться · каждая сама позаботится о несохранённых данных</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>Установить эту программу</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>Настольное приложение для импорта, архивирования и рендеринга таймлапсов</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>Запускает Chronos Server на этом ПК для других устройств и узлов рендеринга</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>Отправляет фото из отслеживаемых папок на Chronos Server</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>Добавить ярлыки на рабочий стол</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>Куда устанавливаются программы · ваши данные хранятся в отдельной папке</value></data>
-1
View File
@@ -984,7 +984,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>Požiada spustené programy o zatvorenie · každý sa sám postará o svoju neuloženú prácu</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>Nainštaluje tento program</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>Desktopová aplikácia na import, archiváciu a renderovanie časozberných videí</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>Spúšťa Chronos Server na tomto počítači pre ďalšie zariadenia a renderovacie uzly</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>Odosiela fotografie zo sledovaných priečinkov na Chronos Server</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>Pridá odkazy na pracovnú plochu</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>Kam sa nainštalujú programy · vaše údaje zostanú vo vlastnom priečinku</value></data>
-1
View File
@@ -984,7 +984,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>Prosi programe, ki se izvajajo, naj se zaprejo · vsak sam poskrbi za neshranjeno delo</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>Namesti ta program</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>Namizni program za uvoz, arhiviranje in upodabljanje posnetkov s časovnim zamikom</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>Izvaja Chronos Server v tem računalniku za druge naprave in vozlišča za upodabljanje</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>Pošilja fotografije iz nadzorovanih map na Chronos Server</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>Dodaj bližnjice na namizje</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>Kam se namestijo programi · vaši podatki ostanejo v svoji mapi</value></data>
-1
View File
@@ -963,7 +963,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>Be de program som körs att stänga · vart och ett hanterar sitt osparade arbete</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>Installera det här programmet</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>Skrivbordsappen för att importera, arkivera och rendera timelapser</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>Kör Chronos Server på den här datorn för andra enheter och renderingsnoder</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>Skickar foton från bevakade mappar till en Chronos Server</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>Lägg till genvägar på skrivbordet</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>Var programmen installeras · dina data stannar i sin egen mapp</value></data>
-1
View File
@@ -963,7 +963,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>ขอให้โปรแกรมที่กำลังทำงานปิดลง · แต่ละโปรแกรมจะจัดการงานที่ยังไม่ได้บันทึกเอง</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>ติดตั้งโปรแกรมนี้</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>แอปเดสก์ท็อปสำหรับนำเข้า จัดเก็บในคลัง และเรนเดอร์ไทม์แลปส์</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>เรียกใช้ Chronos Server บนพีซีเครื่องนี้สำหรับอุปกรณ์อื่นและโหนดเรนเดอร์</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>ส่งภาพจากโฟลเดอร์ที่เฝ้าดูไปยัง Chronos Server</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>เพิ่มทางลัดบนเดสก์ท็อป</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>ตำแหน่งที่ติดตั้งโปรแกรม · ข้อมูลของคุณอยู่ในโฟลเดอร์ของตัวเอง</value></data>
-1
View File
@@ -963,7 +963,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>Çalışan programlardan kapanmalarını ister · her biri kaydedilmemiş işini kendisi yönetir</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>Bu programı kurar</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>Time-lapse'leri içe aktarmak, arşivlemek ve işlemek için masaüstü uygulaması</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>Diğer cihazlar ve işleme düğümleri için Chronos Server'ı bu bilgisayarda çalıştırır</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>İzlenen klasörlerdeki fotoğrafları bir Chronos Server'a gönderir</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>Masaüstüne kısayollar ekler</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>Programların kurulacağı yer · verileriniz kendi klasöründe kalır</value></data>
-1
View File
@@ -1005,7 +1005,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>Попросити запущені програми закритися · кожна сама подбає про незбережену роботу</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>Інсталювати цю програму</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>Настільний застосунок для імпорту, архівування й рендерингу таймлапсів</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>Запускає Chronos Server на цьому ПК для інших пристроїв і вузлів рендерингу</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>Надсилає фото з відстежуваних папок на Chronos Server</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>Додати ярлики на робочий стіл</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>Куди інсталюються програми · ваші дані зберігаються в окремій папці</value></data>
-1
View File
@@ -963,7 +963,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>Yêu cầu các chương trình đang chạy đóng lại · mỗi chương trình tự xử lý công việc chưa lưu</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>Cài đặt chương trình này</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>Ứng dụng máy tính để nhập, lưu trữ và kết xuất time-lapse</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>Chạy Chronos Server trên máy tính này cho các thiết bị khác và nút kết xuất</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>Gửi ảnh từ các thư mục được theo dõi đến một Chronos Server</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>Thêm lối tắt vào màn hình nền</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>Nơi cài đặt các chương trình · dữ liệu của bạn vẫn nằm trong thư mục riêng</value></data>
-1
View File
@@ -963,7 +963,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>请求正在运行的程序关闭 · 各程序会自行处理未保存的工作</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>安装此程序</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>用于导入、归档和渲染延时摄影的桌面应用</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>在此电脑上运行 Chronos 服务器,供其他设备和渲染节点使用</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>将受监视文件夹中的照片发送到 Chronos 服务器</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>在桌面上添加快捷方式</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>程序的安装位置 · 你的数据保存在其自己的文件夹中</value></data>
-1
View File
@@ -963,7 +963,6 @@
<data name="Tooltips.Setup.ClosePrograms" xml:space="preserve"><value>要求執行中的程式關閉 · 各程式會自行處理未儲存的工作</value></data>
<data name="Tooltips.Setup.Component" xml:space="preserve"><value>安裝此程式</value></data>
<data name="Tooltips.Setup.Component.Chronos" xml:space="preserve"><value>用於匯入、典藏與算圖縮時攝影的桌面應用程式</value></data>
<data name="Tooltips.Setup.Component.Server" xml:space="preserve"><value>在此電腦上執行 Chronos Server,供其他裝置與算圖節點使用</value></data>
<data name="Tooltips.Setup.Component.Uploader" xml:space="preserve"><value>將監看資料夾中的相片傳送到 Chronos Server</value></data>
<data name="Tooltips.Setup.Desktop" xml:space="preserve"><value>在桌面新增捷徑</value></data>
<data name="Tooltips.Setup.Folder" xml:space="preserve"><value>程式的安裝位置 · 您的資料會保留在其專屬資料夾中</value></data>
+3 -2
View File
@@ -5,8 +5,9 @@ namespace Chronos.Setup.Cli;
/// <summary>
/// Command-line switches, case-insensitive, with <c>/</c> or <c>-</c>:
/// <c>/S</c> silent · <c>/DIR=path</c> · <c>/COMPONENTS=Chronos,Uploader</c> · <c>/ALLUSERS</c> · <c>/NODESKTOP</c> ·
/// <c>/NOSTARTMENU</c> · <c>/LAUNCH</c> · <c>/LANG=it</c> · <c>/uninstall</c>.
/// <c>/S</c> silent · <c>/DIR=path</c> · <c>/COMPONENTS=Desktop,Uploader</c> (<c>Desktop</c> is the component
/// <c>Chronos</c>; the list is exact, so a retained component it leaves out, such as a 1.0 <c>Server</c>, is removed) ·
/// <c>/ALLUSERS</c> · <c>/NODESKTOP</c> · <c>/NOSTARTMENU</c> · <c>/LAUNCH</c> · <c>/LANG=it</c> · <c>/uninstall</c>.
/// Internal: <c>/ELEVATED</c> (relaunched for administrator rights), <c>/CLEANUP=path /WAITPID=n</c> (removes the
/// uninstaller after the uninstall process exits), <c>/SERVICES=stop,prune,start,remove /NAMES=a,b /DIR=path</c> (the
/// elevated step that stops, starts or deletes the named Windows services of an installation).
+96 -24
View File
@@ -1,6 +1,7 @@
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Security.Cryptography;
using Chronos.Core.Diagnostics;
using Chronos.Core.IO;
using Chronos.Core.Localization;
@@ -11,15 +12,24 @@ using Chronos.Setup.Interop;
namespace Chronos.Setup.Engine;
/// <summary>What to install, where and with which shortcuts.</summary>
internal sealed record InstallRequest(string Directory, InstallScope Scope, IReadOnlyList<string> Components, bool DesktopShortcuts, bool StartMenuShortcuts);
internal sealed record InstallRequest(string Directory, InstallScope Scope, IReadOnlyList<string> Components, bool DesktopShortcuts, bool StartMenuShortcuts)
{
/// <summary>Retained components of the previous installation to keep as they are (<see cref="InstallPlan.Kept"/>).</summary>
public IReadOnlyList<RetainedComponent> Keep { get; init; } = [];
}
/// <summary>The log written, and how many files of the previous version were kept because they changed since.</summary>
internal sealed record InstallResult(InstallLog Log, int KeptFiles);
/// <summary>Overall progress (0–1) and the file being written.</summary>
internal readonly record struct SetupProgress(double Fraction, string CurrentFile);
/// <summary>
/// Installs or upgrades in place from the payload: verified extraction into staging, an all-or-nothing move into
/// the folder, removal of files the previous version shipped and this one does not, then shortcuts, file types and
/// the Add/Remove Programs entry. The user data folder is never touched.
/// the folder, removal of files the previous version shipped and this one does not (or of a component the user
/// removed), then shortcuts, file types and the Add/Remove Programs entry. A removed file whose SHA-256 the log
/// recorded is deleted only while it still matches; a retained component's files, shortcuts and service stay as they
/// are. The user data folder is never touched.
/// </summary>
internal sealed class InstallEngine(PayloadReader payload)
{
@@ -41,7 +51,7 @@ internal sealed class InstallEngine(PayloadReader payload)
return Manifest.Shortcuts.FirstOrDefault(s => selected.Contains(s.Component))?.Target;
}
public InstallLog Install(InstallRequest request, IProgress<SetupProgress>? progress, CancellationToken cancellationToken)
public InstallResult Install(InstallRequest request, IProgress<SetupProgress>? progress, CancellationToken cancellationToken)
{
var directory = Path.TrimEndingDirectorySeparator(Path.GetFullPath(request.Directory));
var product = Manifest.Product;
@@ -65,21 +75,13 @@ internal sealed class InstallEngine(PayloadReader payload)
var shortcuts = PlanShortcuts(request, directory);
var fileTypes = PlanFileTypes(request);
var log = new InstallLog
{
Product = product,
Version = Manifest.Version,
Scope = request.Scope,
Components = [.. request.Components],
Files = [.. files.Select(f => f.Path)],
Shortcuts = [.. shortcuts.Select(s => s.Link)],
Associations = [.. fileTypes.Select(a => new InstalledAssociation(a.Extension, a.ProgId))],
};
if (previous is not null) RemoveLeftovers(directory, previous, log);
var log = NewLog(request, files, shortcuts.Select(s => (s.Component, s.Link)));
log.Associations = [.. fileTypes.Select(a => new InstalledAssociation(a.Extension, a.ProgId))];
var kept = previous is null ? 0 : RemoveLeftovers(directory, previous, log);
// Saved before registration so that an uninstall can always undo whatever follows.
log.Save(directory);
foreach (var (link, target, name, _) in shortcuts.Where(s => s.Create)) ShellLink.Create(link, target, name);
foreach (var (_, link, target, name, _) in shortcuts.Where(s => s.Create)) ShellLink.Create(link, target, name);
foreach (var a in fileTypes)
SetupRegistry.RegisterFileType(request.Scope, a.Extension, a.ProgId, FileTypeName(a), PayloadPath.Resolve(directory, a.Target));
if (fileTypes.Count > 0 || previous?.Associations.Count > 0) NativeMethods.NotifyAssociationsChanged();
@@ -89,7 +91,44 @@ internal sealed class InstallEngine(PayloadReader payload)
SetupRegistry.WriteUninstallEntry(request.Scope, SetupPaths.ProductKey(product), new UninstallEntry(
product, Manifest.Version, Publisher, directory, uninstallerPath, icon, RequiredBytes(request.Components), AboutUrl));
progress?.Report(new SetupProgress(1, string.Empty));
Log.Info("setup", $"Installed {files.Count} files");
Log.Info("setup", $"Installed {files.Count} files" + (kept > 0 ? $"; {kept} changed file(s) of the previous version kept" : string.Empty));
return new InstallResult(log, kept);
}
/// <summary>
/// The format 2 log of <paramref name="request"/>: the payload files and shortcuts of its components with their
/// hashes, plus the retained components it keeps, as the previous log recorded them.
/// </summary>
internal InstallLog NewLog(InstallRequest request, IReadOnlyList<PayloadFile> files, IEnumerable<(string Component, string Link)> shortcuts)
{
var links = shortcuts.ToList();
var log = new InstallLog
{
FormatVersion = InstallLog.CurrentFormat,
Product = Manifest.Product,
Version = Manifest.Version,
Scope = request.Scope,
Components = [.. request.Components],
Files = [.. files.Select(f => f.Path)],
Shortcuts = [.. links.Select(s => s.Link)],
};
foreach (var id in request.Components)
{
log.ComponentFiles[id] = [.. Manifest.Files.Where(f => f.Component.Equals(id, StringComparison.OrdinalIgnoreCase)).Select(f => f.Path)];
log.ComponentShortcuts[id] = [.. links.Where(s => s.Component.Equals(id, StringComparison.OrdinalIgnoreCase)).Select(s => s.Link)];
log.ComponentVersions[id] = Manifest.Version;
}
foreach (var f in files) log.Hashes[f.Path] = f.Sha256;
foreach (var r in request.Keep)
{
log.Components.Add(r.Id);
log.Files.AddRange(r.Files.Where(f => !log.Files.Contains(f, PayloadPath.Comparer)));
log.Shortcuts.AddRange(r.Shortcuts.Where(l => !log.Shortcuts.Contains(l, StringComparer.OrdinalIgnoreCase)));
log.ComponentFiles[r.Id] = [.. r.Files];
log.ComponentShortcuts[r.Id] = [.. r.Shortcuts];
log.ComponentVersions[r.Id] = r.Version;
foreach (var (path, hash) in r.Hashes) log.Hashes.TryAdd(path, hash);
}
return log;
}
@@ -116,19 +155,19 @@ internal sealed class InstallEngine(PayloadReader payload)
/// neither install retargets or removes the other's, and when the other product is uninstalled it hands the
/// shortcut over to this copy (<see cref="UninstallEngine.DeleteShortcut"/>).
/// </summary>
private List<(string Link, string Target, string Name, bool Create)> PlanShortcuts(InstallRequest request, string directory)
private List<(string Component, string Link, string Target, string Name, bool Create)> PlanShortcuts(InstallRequest request, string directory)
{
var selected = new HashSet<string>(request.Components, StringComparer.OrdinalIgnoreCase);
var result = new List<(string, string, string, bool)>();
var result = new List<(string, string, string, string, bool)>();
foreach (var s in Manifest.Shortcuts.Where(s => selected.Contains(s.Component)))
{
var target = PayloadPath.Resolve(directory, s.Target);
if (s.StartMenu && request.StartMenuShortcuts) Add(Path.Combine(SetupPaths.StartMenu(request.Scope), s.Name + ".lnk"), target, s.Name);
if (s.Desktop && request.DesktopShortcuts) Add(Path.Combine(SetupPaths.Desktop(request.Scope), s.Name + ".lnk"), target, s.Name);
if (s.StartMenu && request.StartMenuShortcuts) Add(s.Component, Path.Combine(SetupPaths.StartMenu(request.Scope), s.Name + ".lnk"), target, s.Name);
if (s.Desktop && request.DesktopShortcuts) Add(s.Component, Path.Combine(SetupPaths.Desktop(request.Scope), s.Name + ".lnk"), target, s.Name);
}
return result;
void Add(string link, string target, string name)
void Add(string component, string link, string target, string name)
{
var create = true;
if (ShellLink.TargetOf(link) is { } current && !CommandProgram.IsPathInside(current, directory) && File.Exists(current))
@@ -136,7 +175,7 @@ internal sealed class InstallEngine(PayloadReader payload)
Log.Info("setup", $"Shortcut '{link}' starts '{current}'; left as it is");
create = false;
}
result.Add((link, target, name, create));
result.Add((component, link, target, name, create));
}
}
@@ -167,10 +206,15 @@ internal sealed class InstallEngine(PayloadReader payload)
/// <summary>
/// Removes what the previous version installed and this one no longer does (files, shortcuts, file types). The
/// sign-in entries of the removed programs move to the program that replaces them, or go with a dropped component.
/// A file whose SHA-256 the previous log recorded and that changed since is kept (and left out of the new log);
/// returns how many were.
/// </summary>
private void RemoveLeftovers(string directory, InstallLog previous, InstallLog current)
private int RemoveLeftovers(string directory, InstallLog previous, InstallLog current)
{
var obsolete = previous.Files.Where(PayloadPath.IsValid).Except(current.Files, PayloadPath.Comparer).ToList();
var changed = Changed(directory, previous, obsolete);
foreach (var path in changed) Log.Info("setup", $"'{path}' changed since setup installed it; kept");
obsolete = [.. obsolete.Except(changed, PayloadPath.Comparer)];
if (obsolete.Count > 0)
{
InstalledFiles.Remove(directory, obsolete);
@@ -196,6 +240,34 @@ internal sealed class InstallEngine(PayloadReader payload)
{
if (SetupRegistry.IsValidFileType(a.Extension, a.ProgId)) SetupRegistry.UnregisterFileType(previous.Scope, a.Extension, a.ProgId);
}
return changed.Count;
}
/// <summary>
/// The files among <paramref name="paths"/> that exist and whose SHA-256 differs from the one <paramref name="log"/>
/// recorded: removing them would delete what someone changed since. A file the log has no hash for (a format 1 log)
/// is never among them; one that cannot be read is, as it cannot be shown to be unchanged.
/// </summary>
internal static IReadOnlyList<string> Changed(string directory, InstallLog log, IEnumerable<string> paths)
{
var changed = new List<string>();
foreach (var path in paths)
{
if (log.HashOf(path) is not { } expected) continue;
var full = PayloadPath.Resolve(directory, path);
try
{
if (!File.Exists(full)) continue;
using var stream = new FileStream(full, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete, 1 << 16);
if (!Convert.ToHexStringLower(SHA256.HashData(stream)).Equals(expected, StringComparison.OrdinalIgnoreCase)) changed.Add(path);
}
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
{
Log.Warning("setup", $"'{full}' not read", ex);
changed.Add(path);
}
}
return changed;
}
private static void EnsureFreeSpace(string directory, long required)
+48 -2
View File
@@ -2,18 +2,25 @@ using System.IO;
using System.Text.Json;
using System.Text.Json.Serialization;
using Chronos.Core.IO;
using Chronos.Core.Packaging;
namespace Chronos.Setup.Engine;
/// <summary>
/// Record of one installation, kept as <c>install-log.json</c> in the install folder. The uninstaller carries no
/// payload, so everything it removes comes from here: payload files, shortcuts and file types. User data is never
/// listed.
/// listed. Format 2 adds which component installed which file and shortcut, the version of each component and the
/// SHA-256 of each file, so that one component can be removed alone and a file changed since is never deleted; a
/// format 1 log (Chronos 1.0) is still read, and a 1.0 setup reads a format 2 log as format 1 (it ignores the rest).
/// </summary>
internal sealed class InstallLog
{
public const string FileName = "install-log.json";
/// <summary>The format this setup writes.</summary>
public const int CurrentFormat = 2;
/// <summary>1 unless set: a log that does not say otherwise records no components' files (setup writes <see cref="CurrentFormat"/>).</summary>
public int FormatVersion { get; set; } = 1;
public required string Product { get; set; }
public required string Version { get; set; }
@@ -30,12 +37,44 @@ internal sealed class InstallLog
public List<string> Shortcuts { get; set; } = [];
public List<InstalledAssociation> Associations { get; set; } = [];
/// <summary>Format 2: the payload paths of each component (a path two components ship is listed under both).</summary>
public Dictionary<string, List<string>> ComponentFiles { get; set; } = [];
/// <summary>Format 2: the shortcuts of each component.</summary>
public Dictionary<string, List<string>> ComponentShortcuts { get; set; } = [];
/// <summary>Format 2: the version of each component, which differs from <see cref="Version"/> for one this setup no longer ships.</summary>
public Dictionary<string, string> ComponentVersions { get; set; } = [];
/// <summary>Format 2: lower-case hex SHA-256 of each file as setup wrote it.</summary>
public Dictionary<string, string> Hashes { get; set; } = [];
[JsonIgnore]
public string ProductKey => SetupPaths.ProductKey(Product);
[JsonIgnore]
public string UninstallerName => SetupPaths.UninstallerName(Product);
/// <summary>True when the log records each component's files (format 2).</summary>
[JsonIgnore]
public bool HasComponentFiles => FormatVersion >= 2;
/// <summary>The files <paramref name="component"/> installed; null for a format 1 log, which does not record them.</summary>
public IReadOnlyList<string>? FilesOf(string component) =>
!HasComponentFiles ? null : Find(ComponentFiles, component) ?? [];
/// <summary>The shortcuts <paramref name="component"/> installed; null for a format 1 log.</summary>
public IReadOnlyList<string>? ShortcutsOf(string component) =>
!HasComponentFiles ? null : Find(ComponentShortcuts, component) ?? [];
/// <summary>The version of <paramref name="component"/>: its own when recorded, else the installation's.</summary>
public string VersionOf(string component) =>
ComponentVersions.FirstOrDefault(p => p.Key.Equals(component, StringComparison.OrdinalIgnoreCase)).Value is { Length: > 0 } version ? version : Version;
/// <summary>The SHA-256 recorded for <paramref name="path"/>; null when the log has none.</summary>
public string? HashOf(string path) =>
Hashes.TryGetValue(path, out var hash) ? hash : Hashes.FirstOrDefault(p => PayloadPath.Comparer.Equals(p.Key, path)).Value;
/// <summary>The log in <paramref name="directory"/>, or null when there is none or it is unreadable.</summary>
public static InstallLog? TryLoad(string directory)
{
@@ -52,7 +91,14 @@ internal sealed class InstallLog
}
public void Save(string directory) =>
AtomicFile.WriteAllBytes(Path.Combine(directory, FileName), JsonSerializer.SerializeToUtf8Bytes(this, InstallLogJson.Default.InstallLog));
AtomicFile.WriteAllBytes(Path.Combine(directory, FileName), ToJson());
public byte[] ToJson() => JsonSerializer.SerializeToUtf8Bytes(this, InstallLogJson.Default.InstallLog);
public static InstallLog? FromJson(ReadOnlySpan<byte> json) => JsonSerializer.Deserialize(json, InstallLogJson.Default.InstallLog);
private static List<string>? Find(Dictionary<string, List<string>> map, string component) =>
map.FirstOrDefault(p => p.Key.Equals(component, StringComparison.OrdinalIgnoreCase)).Value;
}
/// <summary>A file type registered by setup.</summary>
+80 -21
View File
@@ -7,53 +7,105 @@ namespace Chronos.Setup.Engine;
/// <summary>
/// Where and what to install before the user changes anything: an existing installation fixes folder and scope
/// (upgrade in place) and suggests its components; otherwise the switches, then the manifest defaults, apply. A
/// component that installs for all users only (<see cref="PayloadComponent.AllUsersOnly"/>, the Server) makes a new
/// installation an all-users one, in a folder inside Program Files; an installation upgraded in place elsewhere (for
/// the current user, or in another folder) cannot take it.
/// component of the previous installation that this payload no longer ships is retained (<see cref="Retained"/>, kept
/// unless the switches leave it out or the user unticks it); a separate 1.0 Uploader product (<see cref="Legacy"/>)
/// fixes the scope of a new installation and preselects the Uploader, which replaces it. A component that installs
/// for all users only (<see cref="PayloadComponent.AllUsersOnly"/>) makes a new installation an all-users one, in a
/// folder inside Program Files; an installation upgraded in place elsewhere cannot take it.
/// </summary>
internal sealed record InstallPlan(InstallScope Scope, string Directory, IReadOnlyList<string> Components, ExistingInstall? Existing)
{
/// <summary>The log of the installation upgraded in place.</summary>
public InstallLog? Previous { get; init; }
/// <summary>The components of the previous installation this payload no longer ships.</summary>
public IReadOnlyList<RetainedComponent> Retained { get; init; } = [];
/// <summary>The retained components to keep: all of them, unless explicit switches leave some out.</summary>
public IReadOnlyList<RetainedComponent> Kept { get; init; } = [];
/// <summary>The separate 1.0 Uploader product installed beside, which the Uploader of this payload replaces.</summary>
public LegacyInstall? Legacy { get; init; }
public static InstallPlan Resolve(PayloadManifest manifest, SetupArguments arguments)
{
var existing = SetupRegistry.FindInstall(SetupPaths.ProductKey(manifest.Product));
var scope = existing?.Scope ?? (arguments.AllUsers ? InstallScope.AllUsers : InstallScope.CurrentUser);
var previous = existing is null ? null : InstallLog.TryLoad(existing.Directory);
return Resolve(manifest, arguments, existing, previous, LegacyProducts.FindUploader(manifest));
}
/// <summary><see cref="Resolve(PayloadManifest, SetupArguments)"/> from what was found on this PC (no registry access).</summary>
public static InstallPlan Resolve(PayloadManifest manifest, SetupArguments arguments, ExistingInstall? existing, InstallLog? previous, LegacyInstall? legacy)
{
// Without an installation of its own, a legacy Uploader fixes the scope: its removal needs the same account.
var scope = existing?.Scope ?? legacy?.Scope ?? (arguments.AllUsers ? InstallScope.AllUsers : InstallScope.CurrentUser);
var retained = existing is null ? [] : LegacyProducts.Retained(manifest, previous);
IReadOnlyList<string> components;
IReadOnlyList<RetainedComponent> kept;
if (arguments.Components is { } requested)
{
var unknown = requested.FirstOrDefault(id => manifest.FindComponent(id) is null);
// Switches are exact: a retained component they leave out is removed.
var ids = requested.Select(LegacyProducts.Canonical).ToList();
var unknown = ids.FirstOrDefault(id => manifest.FindComponent(id) is null && !retained.Any(r => r.Id.Equals(id, StringComparison.OrdinalIgnoreCase)));
if (unknown is not null) throw new SetupException(SetupExitCode.InvalidArguments, $"Unknown component '{unknown}'.");
components = [.. requested.Select(id => manifest.FindComponent(id)!.Id).Distinct()];
components = [.. ids.Select(manifest.FindComponent).OfType<PayloadComponent>().Select(c => c.Id).Distinct(StringComparer.OrdinalIgnoreCase)];
kept = [.. retained.Where(r => ids.Contains(r.Id, StringComparer.OrdinalIgnoreCase))];
}
else
{
var previous = existing is null ? null : InstallLog.TryLoad(existing.Directory)?.Components;
var kept = previous?.Select(manifest.FindComponent).OfType<PayloadComponent>().Select(c => c.Id).ToList();
components = kept is { Count: > 0 } ? kept : [.. manifest.Components.Where(c => c.DefaultSelected).Select(c => c.Id)];
var suggested = previous?.Components.Select(manifest.FindComponent).OfType<PayloadComponent>().Select(c => c.Id).ToList() ?? [];
// The legacy Uploader is replaced by this payload's.
if (legacy is not null && manifest.FindComponent(LegacyProducts.UploaderComponent) is { } uploader && !suggested.Contains(uploader.Id, StringComparer.OrdinalIgnoreCase))
suggested.Add(uploader.Id);
components = suggested.Count > 0
? [.. suggested.Distinct(StringComparer.OrdinalIgnoreCase)]
: [.. manifest.Components.Where(c => c.DefaultSelected).Select(c => c.Id)];
kept = retained;
}
var allUsersOnly = components.Where(id => manifest.FindComponent(id)!.AllUsersOnly).ToList();
if (allUsersOnly.Count > 0 && existing is null) scope = InstallScope.AllUsers;
var directory = existing?.Directory ?? arguments.Directory ?? SetupPaths.DefaultDirectory(scope, manifest.Product);
if (allUsersOnly.Count > 0 && existing is not null && !IsServiceSafe(existing.Scope, existing.Directory))
var fixedLocation = existing is not null || legacy is not null;
if (allUsersOnly.Count > 0 && !fixedLocation) scope = InstallScope.AllUsers;
var directory = existing?.Directory ?? (legacy is null ? arguments.Directory : null) ?? SetupPaths.DefaultDirectory(scope, manifest.Product);
if (allUsersOnly.Count > 0 && fixedLocation && !IsServiceSafe(scope, directory))
{
if (arguments.Components is not null)
{
throw new SetupException(SetupExitCode.InvalidArguments,
$"{string.Join(", ", allUsersOnly)} installs for all users inside Program Files only; {manifest.Product} is installed in '{existing.Directory}' for {existing.Scope}.");
$"{string.Join(", ", allUsersOnly)} installs for all users inside Program Files only; {manifest.Product} is installed in '{directory}' for {scope}.");
}
// An earlier installation elsewhere carried it: the upgrade drops it, and its service with it (Prune).
Log.Warning("setup", $"{string.Join(", ", allUsersOnly)} not kept: it installs for all users inside Program Files only");
components = [.. components.Except(allUsersOnly, StringComparer.OrdinalIgnoreCase)];
}
return new InstallPlan(scope, directory, components, existing);
return new InstallPlan(scope, directory, components, existing) { Previous = previous, Retained = retained, Kept = kept, Legacy = legacy };
}
/// <summary>False while the folder and scope are fixed: an installation is upgraded in place, or a legacy Uploader sets the scope.</summary>
public bool CanChangeLocation => Existing is null && Legacy is null;
/// <summary>
/// False for a component that installs for all users only when the folder and scope are fixed and are not an
/// all-users folder inside Program Files.
/// </summary>
public bool CanInstall(PayloadComponent component) =>
!component.AllUsersOnly || CanChangeLocation || (Existing is { } existing ? IsServiceSafe(existing.Scope, existing.Directory) : IsServiceSafe(Scope, Directory));
/// <summary>The retained components that are not kept: removed, with their service.</summary>
public IReadOnlyList<RetainedComponent> Removed(IEnumerable<RetainedComponent> kept)
{
var ids = new HashSet<string>(kept.Select(k => k.Id), StringComparer.OrdinalIgnoreCase);
return [.. Retained.Where(r => !ids.Contains(r.Id))];
}
/// <summary>
/// False for a component that installs for all users only when an installation that is not an all-users one inside
/// Program Files is upgraded.
/// The legacy Uploader the installation of <paramref name="components"/> replaces: only when the Uploader is among them
/// and <see cref="LegacyProducts.CanMerge"/> allows it; null otherwise.
/// </summary>
public bool CanInstall(PayloadComponent component) => !component.AllUsersOnly || Existing is null || IsServiceSafe(Existing.Scope, Existing.Directory);
public LegacyInstall? LegacyToReplace(IEnumerable<string> components, InstallScope scope, string directory) =>
Legacy is { } legacy && components.Contains(LegacyProducts.UploaderComponent, StringComparer.OrdinalIgnoreCase) && LegacyProducts.CanMerge(legacy, scope, directory)
? legacy
: null;
/// <summary>
/// True when <paramref name="components"/> may be installed in <paramref name="directory"/> for
@@ -67,7 +119,14 @@ internal sealed record InstallPlan(InstallScope Scope, string Directory, IReadOn
/// <summary>True for an all-users installation inside Program Files: where a program a LocalSystem service starts may live.</summary>
public static bool IsServiceSafe(InstallScope scope, string directory) => scope == InstallScope.AllUsers && SetupPaths.IsInsideProgramFiles(directory);
/// <summary>Executables to look for among running processes: the new payload's and the previous install's.</summary>
public static IEnumerable<string> Programs(PayloadManifest manifest, string directory) =>
manifest.Files.Select(f => f.Path).Concat(InstallLog.TryLoad(directory)?.Files ?? []);
/// <summary>
/// Executables to look for among running processes, and whose services setup stops: the new payload's and the
/// previous install's, except the files of the retained components it keeps (their service keeps running).
/// </summary>
public static IEnumerable<string> Programs(PayloadManifest manifest, string directory, IEnumerable<RetainedComponent> kept)
{
var keep = new HashSet<string>(kept.SelectMany(k => k.Files), PayloadPath.Comparer);
var payload = manifest.Files.Select(f => f.Path).ToList();
return payload.Concat((InstallLog.TryLoad(directory)?.Files ?? []).Where(f => !keep.Contains(f) || payload.Contains(f, PayloadPath.Comparer)));
}
}
+134
View File
@@ -0,0 +1,134 @@
using System.IO;
using Chronos.Core.Diagnostics;
using Chronos.Core.Packaging;
using Chronos.Setup.Cli;
namespace Chronos.Setup.Engine;
/// <summary>
/// A component the previous installation has and this payload no longer ships (Chronos Server 1.0 for Windows): it is
/// kept as it is, its service untouched, until the user unticks it, and it is never updated again.
/// </summary>
/// <param name="Files">Its payload paths. For a format 1 log, which does not say which component installed what, every file
/// the log lists and this payload does not ship: nothing is removed by guess.</param>
/// <param name="Shortcuts">Its shortcuts (for a format 1 log, those whose name no shortcut of this payload has).</param>
/// <param name="Hashes">The SHA-256 the log recorded for its files (none for a format 1 log).</param>
internal sealed record RetainedComponent(string Id, string Version, IReadOnlyList<string> Files, IReadOnlyList<string> Shortcuts,
IReadOnlyDictionary<string, string> Hashes);
/// <summary>The separate Chronos Uploader product of 1.0 (its own folder and Add/Remove Programs entry), found beside this setup's.</summary>
internal sealed record LegacyInstall(InstalledProduct Product, InstallScope Scope)
{
public string Directory => Product.Directory;
public string Version => Product.Log.Version;
}
/// <summary>
/// What became of the 1.0 products in the single setup: the Uploader's own product is merged into Chronos, and a
/// component this setup no longer ships (the Windows Server) is retained.
/// </summary>
internal static class LegacyProducts
{
/// <summary>The product the single setup installs.</summary>
public const string Product = "Chronos";
/// <summary>The 1.0 Uploader-only product (key <c>ChronosUploader</c>, folder <c>…\Programs\Chronos Uploader</c>).</summary>
public const string UploaderProduct = "Chronos Uploader";
public const string DesktopComponent = "Chronos";
public const string UploaderComponent = "Uploader";
/// <summary><c>/COMPONENTS=Desktop</c> names the <see cref="DesktopComponent"/>.</summary>
public const string DesktopAlias = "Desktop";
/// <summary>The component id <paramref name="id"/> stands for: <see cref="DesktopAlias"/> is the desktop app.</summary>
public static string Canonical(string id) => id.Equals(DesktopAlias, StringComparison.OrdinalIgnoreCase) ? DesktopComponent : id;
/// <summary>The components of <paramref name="previous"/> that <paramref name="manifest"/> no longer ships, with their files.</summary>
public static IReadOnlyList<RetainedComponent> Retained(PayloadManifest manifest, InstallLog? previous)
{
if (previous is null) return [];
var ids = previous.Components.Where(id => manifest.FindComponent(id) is null).Distinct(StringComparer.OrdinalIgnoreCase).ToList();
if (ids.Count == 0) return [];
var result = new List<RetainedComponent>();
if (previous.HasComponentFiles)
{
foreach (var id in ids)
{
var files = previous.FilesOf(id)!.Where(PayloadPath.IsValid).ToList();
var hashes = new Dictionary<string, string>(PayloadPath.Comparer);
foreach (var file in files)
{
if (previous.HashOf(file) is { } hash) hashes[file] = hash;
}
result.Add(new RetainedComponent(id, previous.VersionOf(id), files, [.. previous.ShortcutsOf(id)!], hashes));
}
return result;
}
// Format 1: the files and shortcuts this payload does not know go with the retained component, so none is deleted
// by guess. The only cost: a file the previous desktop app had and this one dropped stays until it is unticked.
var payloadFiles = new HashSet<string>(manifest.Files.Select(f => f.Path), PayloadPath.Comparer);
var payloadShortcuts = new HashSet<string>(manifest.Shortcuts.Select(s => s.Name), StringComparer.OrdinalIgnoreCase);
var previousOnly = previous.Files.Where(PayloadPath.IsValid).Where(f => !payloadFiles.Contains(f)).ToList();
var links = previous.Shortcuts.Where(l => !payloadShortcuts.Contains(Path.GetFileNameWithoutExtension(l))).ToList();
var empty = new Dictionary<string, string>();
result.Add(new RetainedComponent(ids[0], previous.Version, previousOnly, links, empty));
result.AddRange(ids.Skip(1).Select(id => new RetainedComponent(id, previous.Version, [], [], empty)));
return result;
}
/// <summary>The 1.0 Uploader product beside the Chronos one this payload installs; null when there is none or this is another product.</summary>
public static LegacyInstall? FindUploader(PayloadManifest manifest)
{
if (!manifest.Product.Equals(Product, StringComparison.Ordinal) || manifest.FindComponent(UploaderComponent) is null) return null;
if (SetupRegistry.FindInstall(SetupPaths.ProductKey(UploaderProduct)) is not { } found) return null;
if (InstallLog.TryLoad(found.Directory) is not { } log) return null;
return new LegacyInstall(new InstalledProduct(Path.GetFullPath(found.Directory), log), found.Scope);
}
/// <summary>
/// True when the legacy copy can be replaced by an installation for <paramref name="scope"/> in
/// <paramref name="directory"/>: not an all-users copy under a per-user installation (that removal would need its own
/// administrator approval: the user removes it in Settings › Apps), and not the same folder.
/// </summary>
public static bool CanMerge(LegacyInstall legacy, InstallScope scope, string directory) =>
(legacy.Scope == InstallScope.CurrentUser || scope == InstallScope.AllUsers)
&& !SetupPaths.IsSameOrInside(directory, legacy.Directory) && !SetupPaths.IsSameOrInside(legacy.Directory, directory);
/// <summary>
/// After the new installation in <paramref name="directory"/> works: the legacy Uploader's sign-in entry starts the
/// new copy (its Task Manager state kept), then the legacy product is removed from its log (files, entry, uninstaller,
/// folder; its shortcut is handed over to the new copy). User data is shared and never touched.
/// </summary>
public static void Merge(LegacyInstall legacy, PayloadManifest manifest, string directory)
{
Log.Info("setup", $"Replacing {legacy.Product.Log.Product} {legacy.Version} in '{legacy.Directory}'");
try
{
SetupRegistry.MoveStartupEntries(CommandProgram.FullPaths(legacy.Directory, legacy.Product.Log.Files), StartupPrograms(manifest, directory));
}
catch (Exception ex) when (ex is System.Security.SecurityException or UnauthorizedAccessException or IOException)
{
Log.Warning("setup", "Sign-in entry of the legacy Uploader not moved", ex);
}
UninstallEngine.Uninstall(legacy.Product, userData: null, progress: null);
}
/// <summary><see cref="Merge"/> without failing the installation that already works: a failure is logged.</summary>
public static void TryMerge(LegacyInstall legacy, PayloadManifest manifest, string directory)
{
try
{
Merge(legacy, manifest, directory);
}
catch (Exception ex) when (ex is SetupException or IOException or UnauthorizedAccessException or System.Security.SecurityException)
{
Log.Warning("setup", $"The separate {legacy.Product.Log.Product} in '{legacy.Directory}' was not removed", ex);
}
}
/// <summary>The programs the legacy Uploader's sign-in entry moves to: the new copy's, when it is installed.</summary>
public static IReadOnlyDictionary<string, string> StartupPrograms(PayloadManifest manifest, string directory) =>
InstallEngine.StartupPrograms(manifest, directory, [UploaderComponent]).Where(p => File.Exists(p.Value)).ToDictionary(StringComparer.Ordinal);
}
@@ -11,6 +11,18 @@ namespace Chronos.Setup.Engine;
/// </summary>
internal static class RunningPrograms
{
/// <summary>
/// Processes of <paramref name="executables"/> (payload paths) started from inside <paramref name="directory"/>,
/// except the programs of <paramref name="services"/>, which ignore WM_CLOSE; plus the programs of
/// <paramref name="also"/> (the legacy Uploader the installation replaces).
/// </summary>
public static IReadOnlyList<Process> Find(string directory, IEnumerable<string> executables, IReadOnlyCollection<InstalledService>? services, InstalledProduct? also)
{
var found = Find(directory, executables, services).ToList();
if (also is not null) found.AddRange(Find(also.Directory, also.Log.Files, services));
return found;
}
/// <summary>
/// Processes of <paramref name="executables"/> (payload paths) started from inside <paramref name="directory"/>,
/// except the programs of <paramref name="services"/>, which ignore WM_CLOSE.
+28 -9
View File
@@ -9,8 +9,10 @@ namespace Chronos.Setup.Engine;
/// <c>/S</c>: install or uninstall without a window, reporting only through the exit code and the setup log.
/// Running programs are asked to close; if they do not, setup stops with <see cref="SetupExitCode.ProgramRunning"/>
/// before touching anything. Then the services of the installed programs are stopped (and started again after the
/// upgrade, or when it fails) or deleted with the uninstall, which asks for administrator approval when setup runs
/// without it. Silent uninstall never removes user data.
/// upgrade, or when it fails) or deleted with the uninstall or with a retained component the switches leave out,
/// which asks for administrator approval when setup runs without it. A separate 1.0 Uploader is replaced once the
/// installation works (a failure to remove it is logged and does not fail the run). Silent uninstall never removes
/// user data.
/// </summary>
internal static class SilentSetup
{
@@ -54,24 +56,37 @@ internal static class SilentSetup
if (plan.Components.Count == 0) return SetupExitCode.InvalidArguments;
var launch = arguments.Launch && engine.LaunchTarget(plan.Components) is { } target ? PayloadPath.Resolve(plan.Directory, target) : null;
var legacy = plan.LegacyToReplace(plan.Components, plan.Scope, plan.Directory);
if (plan.Scope == InstallScope.AllUsers && !Elevation.IsElevated)
return arguments.Elevated ? SetupExitCode.ElevationDeclined : await Elevation.RunElevatedAsync(arguments, launch).ConfigureAwait(false);
{
if (arguments.Elevated) return SetupExitCode.ElevationDeclined;
// The components as this account resolved them: the approving account may not see a per-user legacy Uploader.
var exact = arguments with { Components = [.. plan.Components, .. plan.Kept.Select(k => k.Id)] };
var elevated = await Elevation.RunElevatedAsync(exact, launch).ConfigureAwait(false);
// A per-user legacy Uploader belongs to this account, not to the one that approved the elevation.
if (elevated == SetupExitCode.Success && legacy is { Scope: InstallScope.CurrentUser }) LegacyProducts.TryMerge(legacy, engine.Manifest, plan.Directory);
return elevated;
}
// Read before the upgrade rewrites the log, so a program it drops still names its service.
var programs = InstallPlan.Programs(engine.Manifest, plan.Directory).ToList();
var programs = InstallPlan.Programs(engine.Manifest, plan.Directory, plan.Kept).ToList();
var owned = CommandProgram.FullPaths(plan.Directory, programs);
var closed = await CloseProgramsAsync(plan.Directory, programs, owned).ConfigureAwait(false);
var closed = await CloseProgramsAsync(plan.Directory, programs, owned, legacy?.Product).ConfigureAwait(false);
if (closed.Code != SetupExitCode.Success) return closed.Code;
var stopped = closed.Services;
// The services of a retained component left out (the 1.0 Server) are deleted; the others are stopped for the upgrade.
var removed = plan.Removed(plan.Kept);
var removing = InstalledServices.Find(CommandProgram.FullPaths(plan.Directory, removed.SelectMany(r => r.Files)));
var stopped = closed.Services.ExceptBy(removing.Select(s => s.Name), s => s.Name, StringComparer.OrdinalIgnoreCase).ToList();
try
{
var code = await InstalledServices.ApplyAsync(plan.Directory, stopped, ServiceActions.Stop, IntPtr.Zero).ConfigureAwait(false);
if (code == SetupExitCode.Success) code = await InstalledServices.ApplyAsync(plan.Directory, removing, ServiceActions.Remove, IntPtr.Zero).ConfigureAwait(false);
if (code != SetupExitCode.Success)
{
await StartAgainAsync(plan.Directory, stopped).ConfigureAwait(false);
return code;
}
var request = new InstallRequest(plan.Directory, plan.Scope, plan.Components, !arguments.NoDesktopShortcut, !arguments.NoStartMenu);
var request = new InstallRequest(plan.Directory, plan.Scope, plan.Components, !arguments.NoDesktopShortcut, !arguments.NoStartMenu) { Keep = plan.Kept };
engine.Install(request, null, CancellationToken.None);
}
catch
@@ -82,6 +97,9 @@ internal static class SilentSetup
// Services whose program the upgrade removed go; the ones stopped for it run again.
var after = InstalledServices.Find(owned).Where(s => !File.Exists(s.Program)).UnionBy(stopped, s => s.Name, StringComparer.OrdinalIgnoreCase).ToList();
var services = await InstalledServices.ApplyAsync(plan.Directory, after, ServiceActions.Prune | ServiceActions.Start, IntPtr.Zero).ConfigureAwait(false);
// Running setup is the explicit action: the legacy Uploader goes once this installation works. A per-user one is
// left to the unelevated parent when this is its elevated copy.
if (legacy is not null && !(arguments.Elevated && legacy.Scope == InstallScope.CurrentUser)) LegacyProducts.TryMerge(legacy, engine.Manifest, plan.Directory);
if (services != SetupExitCode.Success) return services;
if (launch is null) return SetupExitCode.Success;
@@ -130,10 +148,11 @@ internal static class SilentSetup
/// <paramref name="owned"/>, which the caller stops or deletes: a program that does not close stops setup before
/// any service is touched.
/// </summary>
private static async Task<(SetupExitCode Code, IReadOnlyList<InstalledService> Services)> CloseProgramsAsync(string directory, IEnumerable<string> programs, IReadOnlySet<string> owned)
private static async Task<(SetupExitCode Code, IReadOnlyList<InstalledService> Services)> CloseProgramsAsync(string directory, IEnumerable<string> programs,
IReadOnlySet<string> owned, InstalledProduct? alsoClose = null)
{
var services = InstalledServices.Find(owned).Where(InstalledServices.IsRunning).ToList();
var running = RunningPrograms.Find(directory, programs, services);
var running = RunningPrograms.Find(directory, programs, services, alsoClose);
try
{
if (running.Count == 0) return (SetupExitCode.Success, services);
+62 -15
View File
@@ -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();
}
}
}
+38 -10
View File
@@ -13,8 +13,9 @@ namespace Chronos.Setup.Views;
/// <summary>
/// <c>Chronos.Setup.exe --capture &lt;dir&gt;</c>: renders the setup window in every stage (install options, programs
/// running, installing, installed, failed, uninstall with its data plan) in the dark and light themes, then in
/// Arabic (right to left, dark), from a small sample installer built in a temporary folder. Nothing is installed,
/// running, installing, installed, failed, uninstall with its data plan), the update of an installed copy that
/// replaces a legacy Uploader, and a retained Chronos Server 1.0 kept and unticked, in the dark and light themes, then
/// in Arabic (right to left, dark), from a small sample installer built in a temporary folder. Nothing is installed,
/// removed or registered.
/// </summary>
internal static class SetupCapture
@@ -94,16 +95,41 @@ internal static class SetupCapture
{
Program.ApplyLanguage(language);
using var payload = PayloadReader.Open(installer);
using var install = SetupViewModel.ForInstall(new SetupArguments(), payload);
var manifest = payload.Manifest;
// Nothing installed, whatever this machine has, so every capture shows the same screen.
using var install = SetupViewModel.ForInstall(new SetupArguments(), payload, InstallPlan.Resolve(manifest, new SetupArguments(), null, null, null));
// The desktop app 1.0 installed for this user, the separate 1.0 Uploader beside it: Update replaces it.
var perUser = SetupPaths.DefaultDirectory(InstallScope.CurrentUser, Product);
var legacy = new LegacyInstall(new InstalledProduct(SetupPaths.DefaultDirectory(InstallScope.CurrentUser, LegacyProducts.UploaderProduct),
new InstallLog { Product = LegacyProducts.UploaderProduct, Version = "1.0.0", Components = ["Uploader"], Files = ["Chronos.Uploader.exe"] }), InstallScope.CurrentUser);
using var update = SetupViewModel.ForInstall(new SetupArguments(), payload, InstallPlan.Resolve(manifest, new SetupArguments(),
new ExistingInstall(InstallScope.CurrentUser, perUser, "1.0.0"), new InstallLog { Product = Product, Version = "1.0.0", Components = ["Chronos"], Files = ["Chronos.exe"] }, legacy));
// Chronos 1.0 for all users with Chronos Server for Windows, which this setup no longer ships: kept, then unticked.
var allUsers = SetupPaths.DefaultDirectory(InstallScope.AllUsers, Product);
var withServer = new InstallLog
{
Product = Product,
Version = "1.0.0",
Scope = InstallScope.AllUsers,
Components = ["Chronos", "Uploader", "Server"],
Files = ["Chronos.exe", "Chronos.Uploader.exe", "Chronos.Server.exe"],
};
InstallPlan Retained() => InstallPlan.Resolve(manifest, new SetupArguments(), new ExistingInstall(InstallScope.AllUsers, allUsers, "1.0.0"), withServer, null);
using var retained = SetupViewModel.ForInstall(new SetupArguments(), payload, Retained());
using var removeServer = SetupViewModel.ForInstall(new SetupArguments(), payload, Retained());
foreach (var c in removeServer.Components.Where(c => c.IsRetained)) c.IsSelected = false;
// Both programs' data, whatever this machine has installed, so every capture shows the same screen.
using var uninstall = SetupViewModel.ForUninstall(new SetupArguments(), new InstalledProduct(
SetupPaths.DefaultDirectory(InstallScope.CurrentUser, Product), new InstallLog { Product = Product, Version = "1.0.0", Components = ["Chronos", "Uploader"] }),
perUser, new InstallLog { Product = Product, Version = "1.0.0", Components = ["Chronos", "Uploader"] }),
UserDataOwners.All);
foreach (var theme in themes)
{
ThemeManager.Apply(theme);
var name = suffix + "-" + theme.ToString().ToLowerInvariant();
Capture(install, [.. InstallStages.Select(s => ("setup-" + s.Name + name, s.Stage, (UserDataPlan?)null))], directory);
Capture(update, [("setup-update" + name, SetupStage.Options, null)], directory);
Capture(retained, [("setup-retained" + name, SetupStage.Options, null)], directory);
Capture(removeServer, [("setup-retained-remove" + name, SetupStage.Options, null)], directory);
Capture(uninstall, [("setup-uninstall" + name, SetupStage.Options, SamplePlan)], directory);
}
}
@@ -134,15 +160,17 @@ internal static class SetupCapture
}
}
/// <summary>Three components of random (incompressible) bytes, with the shortcuts the real installer carries.</summary>
/// <summary>
/// The two components of the real installer (the desktop app preselected), of random (incompressible) bytes, with
/// its shortcuts.
/// </summary>
private static string WriteSampleInstaller(string work)
{
var random = new Random(1);
var components = new (string Id, string DisplayName, bool Selected, string Program, int Bytes)[]
{
("Chronos", "Chronos", true, "Chronos.exe", 2_400_000),
("Uploader", "Chronos Uploader", true, "Chronos.Uploader.exe", 900_000),
("Server", "Chronos Server", false, "Chronos.Server.exe", 1_600_000),
("Uploader", "Chronos Uploader", false, "Chronos.Uploader.exe", 900_000),
};
foreach (var c in components)
{
@@ -155,9 +183,9 @@ internal static class SetupCapture
PayloadWriter.Write(Environment.ProcessPath ?? throw new InvalidOperationException("No process path."), new PayloadSource
{
Product = Product,
Version = "1.0.0",
Components = [.. components.Select(c => new PayloadComponentSource(c.Id, c.DisplayName, c.Selected, Path.Combine(work, c.Id), AllUsersOnly: c.Id == "Server"))],
Shortcuts = [.. components.Select(c => new PayloadShortcut { Component = c.Id, Name = c.DisplayName, Target = c.Program, StartMenu = true, Desktop = c.Id != "Server" })],
Version = "1.1.0",
Components = [.. components.Select(c => new PayloadComponentSource(c.Id, c.DisplayName, c.Selected, Path.Combine(work, c.Id)))],
Shortcuts = [.. components.Select(c => new PayloadShortcut { Component = c.Id, Name = c.DisplayName, Target = c.Program, StartMenu = true, Desktop = true })],
}, installer);
return installer;
}
+193 -35
View File
@@ -14,6 +14,10 @@ namespace Chronos.Setup.Views;
/// <summary>A line of the "Remove my data" dry run: a file or folder name (or "3 more items") and its size.</summary>
internal sealed record DataPlanRow(string Name, string Size, bool IsFileName);
/// <summary>One change of the dry-run plan shown before Update: a program added, removed or replaced.</summary>
/// <param name="IsRemoval">Shown in the warning colour: something installed goes.</param>
internal sealed record ChangeRow(string Text, string ToolTip, bool IsRemoval);
/// <summary>What the setup screen currently shows.</summary>
internal enum SetupStage
{
@@ -26,7 +30,10 @@ internal enum SetupStage
/// <summary>
/// The single setup screen for install and uninstall: options, a prompt when installed programs must close,
/// progress, success and failure. Work runs on the thread pool and reports through <see cref="Progress{T}"/>.
/// progress, success and failure. One setup installs, updates, adds and removes programs: the component rows show
/// what is installed, the Changes line is the dry-run plan of what Update adds, removes or replaces, and with every
/// component unticked the primary action becomes Uninstall, which opens the uninstall options of the same window.
/// Work runs on the thread pool and reports through <see cref="Progress{T}"/>.
/// </summary>
internal sealed class SetupViewModel : LocalizedViewModel, INotifyDataErrorInfo
{
@@ -39,10 +46,11 @@ internal sealed class SetupViewModel : LocalizedViewModel, INotifyDataErrorInfo
private readonly PayloadReader? _payload;
private readonly InstallEngine? _engine;
private readonly InstallPlan? _plan;
private readonly InstalledProduct? _installed;
private readonly string _product;
private readonly string? _version;
private readonly IReadOnlySet<string> _dataOwners;
private InstalledProduct? _installed;
private IReadOnlySet<string> _dataOwners;
private int _keptFiles;
private SetupStage _stage;
private string _directory = string.Empty;
private bool _allUsers;
@@ -66,7 +74,7 @@ internal sealed class SetupViewModel : LocalizedViewModel, INotifyDataErrorInfo
private IReadOnlyList<InstalledService> _stopped = [];
private SetupViewModel(SetupArguments arguments, string product, string? version, PayloadReader? payload, InstalledProduct? installed,
IReadOnlySet<string>? dataOwners = null)
IReadOnlySet<string>? dataOwners = null, InstallPlan? plan = null)
{
_arguments = arguments;
_product = product;
@@ -79,7 +87,7 @@ internal sealed class SetupViewModel : LocalizedViewModel, INotifyDataErrorInfo
if (payload is not null)
{
_engine = new InstallEngine(payload);
_plan = InstallPlan.Resolve(_engine.Manifest, arguments);
_plan = plan ?? InstallPlan.Resolve(_engine.Manifest, arguments);
_directory = _plan.Directory;
_allUsers = _plan.Scope == InstallScope.AllUsers;
}
@@ -88,11 +96,20 @@ internal sealed class SetupViewModel : LocalizedViewModel, INotifyDataErrorInfo
_launchAfter = arguments.Launch;
Components = _engine is null
? []
: [.. _engine.Manifest.Components.Select(c => new ComponentOption(c, _plan!.Components.Contains(c.Id, StringComparer.OrdinalIgnoreCase), UnavailableReason(c),
OnComponentsChanged))];
:
[
.. _engine.Manifest.Components.Select(c => new ComponentOption(c, _plan!.Components.Contains(c.Id, StringComparer.OrdinalIgnoreCase),
InstalledVersionOf(c.Id), UnavailableReason(c), OnComponentsChanged)),
.. _plan!.Retained.Select(r => new ComponentOption(r, _plan.Kept.Any(k => k.Id.Equals(r.Id, StringComparison.OrdinalIgnoreCase)), OnComponentsChanged)),
];
Languages = [.. Core.Localization.Languages.Shipped.Select(c => new LanguageOption(c, Core.Localization.Languages.NativeName(c)))];
PrimaryCommand = new RelayCommand(() => Start(IsUninstall ? UninstallAsync : InstallAsync), () => CanStart);
PrimaryCommand = new RelayCommand(() =>
{
if (IsUninstall) Start(UninstallAsync);
else if (IsUninstallAll) SwitchToUninstall();
else Start(InstallAsync);
}, () => CanStart);
BrowseCommand = new RelayCommand(Browse, () => IsOptions && CanChangeLocation);
CloseProgramsCommand = new RelayCommand(() =>
{
@@ -105,8 +122,9 @@ internal sealed class SetupViewModel : LocalizedViewModel, INotifyDataErrorInfo
RetryCommand = new RelayCommand(() => Start(_operation!), () => CanRetry && _operation is not null);
}
public static SetupViewModel ForInstall(SetupArguments arguments, PayloadReader payload) =>
new(arguments, payload.Manifest.Product, payload.Manifest.Version, payload, null);
/// <param name="plan">What was found on this PC; null resolves it from the registry (tests and captures pass their own).</param>
public static SetupViewModel ForInstall(SetupArguments arguments, PayloadReader payload, InstallPlan? plan = null) =>
new(arguments, payload.Manifest.Product, payload.Manifest.Version, payload, null, plan: plan);
/// <param name="dataOwners">Whose user data "Remove my data" covers; null works it out from the installed products.</param>
public static SetupViewModel ForUninstall(SetupArguments arguments, InstalledProduct installed, IReadOnlySet<string>? dataOwners = null) =>
@@ -136,7 +154,8 @@ internal sealed class SetupViewModel : LocalizedViewModel, INotifyDataErrorInfo
public SetupExitCode ExitCode { get; private set; } = SetupExitCode.Cancelled;
public bool IsInstall => _engine is not null;
/// <summary>Installing from the payload; false once Uninstall (every component unticked) opened the uninstall options.</summary>
public bool IsInstall => _engine is not null && _installed is null;
public bool IsUninstall => _installed is not null;
public string WindowTitle => IsUninstall ? Loc.L("Setup.Window.Uninstall", _product) : Loc.L("Setup.Window.Title", _product);
@@ -182,12 +201,73 @@ internal sealed class SetupViewModel : LocalizedViewModel, INotifyDataErrorInfo
public IReadOnlyList<ComponentOption> Components { get; }
private List<string> SelectedComponents => [.. Components.Where(c => c.IsSelected).Select(c => c.Id)];
/// <summary>The components of the payload that are ticked (retained ones excluded).</summary>
private List<string> SelectedComponents => [.. Components.Where(c => c.IsSelected && !c.IsRetained).Select(c => c.Id)];
/// <summary>The retained components that are ticked: kept as they are.</summary>
private List<RetainedComponent> KeptComponents => [.. Components.Where(c => c.IsSelected && c.Retained is not null).Select(c => c.Retained!)];
public string RequiredSpaceText => _engine is null ? string.Empty : Loc.L("Setup.Space.Required", ByteSize.Format(_engine.RequiredBytes(SelectedComponents)));
/// <summary>False when upgrading: the existing folder and scope are kept.</summary>
public bool CanChangeLocation => _plan?.Existing is null;
/// <summary>False when upgrading (the existing folder and scope are kept) or replacing a legacy Uploader (its scope is).</summary>
public bool CanChangeLocation => _plan is null || _plan.CanChangeLocation;
/// <summary>An installation of this product exists: Update replaces it in place.</summary>
private bool IsUpgrade => _plan?.Existing is not null;
/// <summary>Installed, and every component unticked: the primary action is Uninstall, which opens the uninstall options.</summary>
public bool IsUninstallAll => IsInstall && IsUpgrade && !Components.Any(c => c.IsSelected);
/// <summary>The Install or Update button is shown.</summary>
public bool IsInstallPrimary => IsInstallOptions && !IsUninstallAll;
/// <summary>The destructive Uninstall button of the install options is shown.</summary>
public bool IsUninstallAllPrimary => IsInstallOptions && IsUninstallAll;
/// <summary>Cancel is the default when the primary action removes something.</summary>
public bool IsCancelDefault => IsUninstallOptions || IsUninstallAllPrimary;
/// <summary>
/// The dry-run plan of the run, shown before it can start: programs added next to the installed ones, programs and a
/// retained Server removed, a legacy Uploader replaced (or left where it is). Empty for a new installation and for an
/// update in place.
/// </summary>
public IReadOnlyList<ChangeRow> Changes
{
get
{
if (!IsInstall || _plan is null || IsUninstallAll) return [];
var rows = new List<ChangeRow>();
var replaces = _plan.Legacy is { } found && LegacyProducts.CanMerge(found, Scope, _directory);
if (IsUpgrade)
{
foreach (var c in Components)
{
if (c.Retained is { } retained && !c.IsSelected)
rows.Add(new ChangeRow(Loc.L("Setup.Changes.Remove", c.Name), Loc.L("Tooltips.Setup.Changes.RemoveRetained", FileList(retained.Files)), true));
else if (!c.IsRetained && c.IsInstalled && !c.IsSelected)
rows.Add(new ChangeRow(Loc.L("Setup.Changes.Remove", c.Name), Loc.L("Tooltips.Setup.Changes.Remove"), true));
// An Uploader that replaces the legacy one is said by "Replaces Chronos Uploader 1.0.0" below.
else if (!c.IsRetained && !c.IsInstalled && c.IsSelected && !(replaces && c.Id.Equals(LegacyProducts.UploaderComponent, StringComparison.OrdinalIgnoreCase)))
rows.Add(new ChangeRow(Loc.L("Setup.Changes.Add", c.Name), Loc.L("Tooltips.Setup.Changes.Add"), false));
}
}
if (_plan.Legacy is { } legacy && Components.FirstOrDefault(c => c.Id.Equals(LegacyProducts.UploaderComponent, StringComparison.OrdinalIgnoreCase)) is { IsSelected: true } uploader)
{
rows.Add(replaces
? new ChangeRow(Loc.L("Setup.Changes.Replace", uploader.Name, legacy.Version), Loc.L("Tooltips.Setup.Changes.Replace", legacy.Directory), false)
: new ChangeRow(Loc.L("Setup.Changes.KeptSeparate", uploader.Name), Loc.L("Tooltips.Setup.Changes.KeptSeparate", legacy.Directory), false));
}
return rows;
}
}
public bool HasChanges => Changes.Count > 0;
/// <summary>The changes in one line ("Adds Chronos Uploader · Removes Chronos Server 1.0.0").</summary>
public string ChangesText => string.Join(" · ", Changes.Select(c => c.Text));
private InstallScope Scope => _allUsers ? InstallScope.AllUsers : InstallScope.CurrentUser;
public bool IsAllUsers
{
@@ -270,17 +350,21 @@ internal sealed class SetupViewModel : LocalizedViewModel, INotifyDataErrorInfo
public bool HasStartMenuOption => SelectedShortcuts().Any(s => s.StartMenu);
public bool HasLaunchOption => _engine?.LaunchTarget(SelectedComponents) is not null;
public string InstallText => CanChangeLocation ? Loc.L("Setup.Action.Install") : Loc.L("Setup.Action.Update");
public string InstallText => IsUpgrade ? Loc.L("Setup.Action.Update") : Loc.L("Setup.Action.Install");
/// <summary>What Install does, or why it is disabled: no program selected, or a folder it cannot use.</summary>
public string InstallToolTip => !Components.Any(c => c.IsSelected) ? Loc.L("Tooltips.Setup.NoComponent")
public string InstallToolTip => SelectedComponents.Count == 0 ? Loc.L("Tooltips.Setup.NoComponent")
: !IsDirectoryValid ? FolderErrorText
: CanChangeLocation ? Loc.L("Tooltips.Setup.Install") : Loc.L("Tooltips.Setup.Update");
: IsUpgrade ? Loc.L("Tooltips.Setup.Update") : Loc.L("Tooltips.Setup.Install");
/// <summary>Removing user data waits for its plan, so the user has seen what goes before choosing Uninstall.</summary>
/// <summary>
/// Removing user data waits for its plan, so the user has seen what goes before choosing Uninstall. Installing needs
/// a program of the payload (a retained one alone is not an installation); with nothing ticked on an installed copy
/// the action is Uninstall.
/// </summary>
private bool CanStart => IsOptions && (IsUninstall
? !_removeUserData || _dataPlan is not null
: IsInstall && IsDirectoryValid && Components.Any(c => c.IsSelected));
: IsInstall && (IsUninstallAll || (IsDirectoryValid && SelectedComponents.Count > 0)));
// ---- Uninstall options ----
@@ -360,6 +444,11 @@ internal sealed class SetupViewModel : LocalizedViewModel, INotifyDataErrorInfo
public string DoneText => IsUninstall ? Loc.L("Setup.Done.Removed", _product) : Loc.L("Setup.Done.Installed", _product);
/// <summary>"3 files kept": files of the previous version that changed since setup installed them, left in place.</summary>
public string KeptText => _keptFiles > 0 ? Loc.Plural("Setup.Done.Kept", _keptFiles) : string.Empty;
public bool HasKeptFiles => IsDone && _keptFiles > 0;
public bool CanLaunch => IsDone && _launchProgram is not null;
public string ErrorText => _failure switch
@@ -439,37 +528,48 @@ internal sealed class SetupViewModel : LocalizedViewModel, INotifyDataErrorInfo
{
var request = new InstallRequest(
Path.TrimEndingDirectorySeparator(Path.GetFullPath(_directory)),
_allUsers ? InstallScope.AllUsers : InstallScope.CurrentUser,
Scope,
SelectedComponents,
HasDesktopOption && _desktop,
HasStartMenuOption && _startMenu);
HasStartMenuOption && _startMenu)
{ Keep = KeptComponents };
var target = engine.LaunchTarget(request.Components);
var program = target is null ? null : PayloadPath.Resolve(request.Directory, target);
var launch = _launchAfter ? program : null;
var legacy = _plan!.LegacyToReplace(request.Components, request.Scope, request.Directory);
if (request.Scope == InstallScope.AllUsers && !Elevation.IsElevated)
{
await InstallElevatedAsync(request, program);
await InstallElevatedAsync(request, program, legacy);
return;
}
directory = request.Directory;
// Read before the upgrade rewrites the log, so a program it drops still names its service.
var programs = InstallPlan.Programs(engine.Manifest, request.Directory).ToList();
var programs = InstallPlan.Programs(engine.Manifest, request.Directory, request.Keep).ToList();
var owned = CommandProgram.FullPaths(request.Directory, programs);
if (await CloseProgramsAsync(request.Directory, programs, owned) is not { } running) return;
if (await CloseProgramsAsync(request.Directory, programs, owned, legacy?.Product) is not { } running) return;
BeginWork(indeterminate: false);
if (running.Count > 0)
// The services of a retained component the user unticked (the 1.0 Server) are deleted; the others are
// stopped for the upgrade and run again after it.
var removing = InstalledServices.Find(CommandProgram.FullPaths(request.Directory, _plan.Removed(request.Keep).SelectMany(r => r.Files)));
var stopping = running.ExceptBy(removing.Select(s => s.Name), s => s.Name, StringComparer.OrdinalIgnoreCase).ToList();
if (stopping.Count > 0)
{
_stopped = running;
await ApplyToServicesAsync(request.Directory, running, ServiceActions.Stop);
_stopped = stopping;
await ApplyToServicesAsync(request.Directory, stopping, ServiceActions.Stop);
}
await ApplyToServicesAsync(request.Directory, removing, ServiceActions.Remove);
var progress = new Progress<SetupProgress>(ReportProgress);
await Task.Run(() => engine.Install(request, progress, CancellationToken.None));
var result = await Task.Run(() => engine.Install(request, progress, CancellationToken.None));
_keptFiles = result.KeptFiles;
// Services whose program the upgrade removed go; the ones stopped for it run again.
var after = InstalledServices.Find(owned).Where(s => !File.Exists(s.Program)).UnionBy(_stopped, s => s.Name, StringComparer.OrdinalIgnoreCase).ToList();
_stopped = [];
await ApplyToServicesAsync(request.Directory, after, ServiceActions.Prune | ServiceActions.Start);
// The legacy Uploader goes once this installation works; a per-user one is the unelevated parent's to remove.
if (legacy is not null && !(_arguments.Elevated && legacy.Scope == InstallScope.CurrentUser))
await Task.Run(() => LegacyProducts.TryMerge(legacy, engine.Manifest, request.Directory));
_launchProgram = program;
Complete();
if (launch is not null) Launch();
@@ -483,15 +583,16 @@ internal sealed class SetupViewModel : LocalizedViewModel, INotifyDataErrorInfo
/// <summary>
/// All users without administrator rights: an elevated copy installs with the chosen options. This process
/// stays behind, hidden, to start <paramref name="program"/> unelevated if the copy asks for it.
/// stays behind, hidden, to start <paramref name="program"/> unelevated if the copy asks for it, and to remove a
/// per-user <paramref name="legacy"/> Uploader afterwards: it belongs to this account, not to the approving one.
/// </summary>
private async Task InstallElevatedAsync(InstallRequest request, string? program)
private async Task InstallElevatedAsync(InstallRequest request, string? program, LegacyInstall? legacy)
{
if (_arguments.Elevated) throw new SetupException(SetupExitCode.ElevationDeclined, "Still not elevated after relaunch.");
var switches = new SetupArguments
{
Directory = request.Directory,
Components = request.Components,
Components = [.. request.Components, .. request.Keep.Select(k => k.Id)],
AllUsers = true,
NoDesktopShortcut = !request.DesktopShortcuts,
NoStartMenu = !request.StartMenuShortcuts,
@@ -500,7 +601,27 @@ internal sealed class SetupViewModel : LocalizedViewModel, INotifyDataErrorInfo
};
var child = Elevation.Start(switches, WindowHandle) ?? throw new SetupException(SetupExitCode.ElevationDeclined, "Administrator approval declined.");
VisibilityRequested?.Invoke(this, false);
Finish(await Elevation.WaitAsync(child, program));
var code = await Elevation.WaitAsync(child, program);
if (code == SetupExitCode.Success && legacy is { Scope: InstallScope.CurrentUser })
await Task.Run(() => LegacyProducts.TryMerge(legacy, _engine!.Manifest, request.Directory));
Finish(code);
}
/// <summary>
/// Every component unticked on an installed copy: the uninstall options of that copy (folder, Remove my data and
/// its plan), in the same window.
/// </summary>
private void SwitchToUninstall()
{
if (UninstallEngine.Locate(_plan!.Directory, null) is not { } installed)
{
Fail(new SetupException(SetupExitCode.NotInstalled, $"No installation log in '{_plan.Directory}'."));
return;
}
_installed = installed;
_dataOwners = UserDataOwners.RemovableBeside(installed.Log.Components, SetupRegistry.OtherInstalls(installed.Directory, InstallEngine.Publisher));
_directory = installed.Directory;
Stage = SetupStage.Options;
}
private async Task UninstallAsync()
@@ -510,6 +631,13 @@ internal sealed class SetupViewModel : LocalizedViewModel, INotifyDataErrorInfo
{
var owned = CommandProgram.FullPaths(installed.Directory, installed.Log.Files);
if (await CloseProgramsAsync(installed.Directory, installed.Log.Files, owned) is not { } running) return;
if (installed.Log.Scope == InstallScope.AllUsers && !Elevation.IsElevated)
{
// Reached from the install options (every component unticked): an elevated copy removes the programs and
// their services; the data of this account, when chosen, is removed here afterwards.
await UninstallElevatedAsync(installed);
return;
}
BeginWork(indeterminate: false);
// Only now that the programs are closed. A service that was not running is still registered: none may
// outlive its program. If one cannot be deleted, the ones stopped here run again.
@@ -528,19 +656,32 @@ internal sealed class SetupViewModel : LocalizedViewModel, INotifyDataErrorInfo
}
}
private async Task UninstallElevatedAsync(InstalledProduct installed)
{
if (_arguments.Elevated) throw new SetupException(SetupExitCode.ElevationDeclined, "Still not elevated after relaunch.");
var switches = new SetupArguments { Uninstall = true, Silent = true, Directory = installed.Directory, Language = Loc.Culture.Name };
var child = Elevation.Start(switches, WindowHandle) ?? throw new SetupException(SetupExitCode.ElevationDeclined, "Administrator approval declined.");
BeginWork(indeterminate: true);
var code = await Elevation.WaitAsync(child, null);
if (code != SetupExitCode.Success) throw new SetupException(code, $"The elevated uninstall exited with {code}.");
if (_removeUserData && _dataPlan is { Entries.Count: > 0 } plan) await Task.Run(plan.Remove);
Complete();
}
/// <summary>
/// Null when the user must first confirm (Confirm stage) that the programs and services running from
/// <paramref name="directory"/> may close. Otherwise the running programs have closed, and the result lists the
/// <paramref name="directory"/> (and from <paramref name="alsoClose"/>, the legacy Uploader being replaced) may close. Otherwise the running programs have closed, and the result lists the
/// running services of <paramref name="owned"/>, which the caller stops or deletes: a program that does not close
/// stops setup before any service is touched.
/// </summary>
private async Task<IReadOnlyList<InstalledService>?> CloseProgramsAsync(string directory, IEnumerable<string> programs, IReadOnlySet<string> owned)
private async Task<IReadOnlyList<InstalledService>?> CloseProgramsAsync(string directory, IEnumerable<string> programs, IReadOnlySet<string> owned,
InstalledProduct? alsoClose = null)
{
// A confirmation answers one prompt only; a later attempt asks again.
var confirmed = _closeConfirmed;
_closeConfirmed = false;
var services = InstalledServices.Find(owned).Where(InstalledServices.IsRunning).ToList();
var running = RunningPrograms.Find(directory, programs, services);
var running = RunningPrograms.Find(directory, programs, services, alsoClose);
try
{
if (running.Count == 0 && services.Count == 0) return services;
@@ -688,9 +829,26 @@ internal sealed class SetupViewModel : LocalizedViewModel, INotifyDataErrorInfo
OnPropertyChanged(nameof(HasDesktopOption));
OnPropertyChanged(nameof(HasStartMenuOption));
OnPropertyChanged(nameof(HasLaunchOption));
OnPropertyChanged(nameof(Changes));
OnPropertyChanged(nameof(HasChanges));
OnPropertyChanged(nameof(ChangesText));
OnPropertyChanged(nameof(IsUninstallAll));
OnPropertyChanged(nameof(IsInstallPrimary));
OnPropertyChanged(nameof(IsUninstallAllPrimary));
OnPropertyChanged(nameof(IsCancelDefault));
OnDirectoryRuleChanged();
}
/// <summary>The installed version of <paramref name="component"/> when the installation upgraded here has it; null otherwise.</summary>
private string? InstalledVersionOf(string component) =>
_plan is { Existing: not null, Previous: { } previous } && previous.Components.Contains(component, StringComparer.OrdinalIgnoreCase)
? previous.VersionOf(component)
: null;
/// <summary>The files a removal plan names: the first few, then "…".</summary>
private static string FileList(IReadOnlyList<string> files) =>
files.Count <= 3 ? string.Join(", ", files) : string.Join(", ", files.Take(3)) + ", …";
/// <summary>The folder, the scope or the components changed: whether the folder is valid, and why not, may have too.</summary>
private void OnDirectoryRuleChanged()
{
+43 -11
View File
@@ -32,18 +32,20 @@
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="44" />
<RowDefinition Height="44" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- Each row says whether it is installed; a program this setup no longer ships is kept until unticked. -->
<TextBlock Text="{l:Loc Setup.Field.Components}" Foreground="{DynamicResource Brush.TextMuted}" Margin="0,3,16,0" />
<ItemsControl Grid.Column="1" ItemsSource="{Binding Components}" Focusable="False" Margin="0,0,0,8">
<ItemsControl.ItemTemplate>
<DataTemplate>
<DockPanel Margin="0,0,0,6">
<TextBlock DockPanel.Dock="Right" Text="{Binding SizeText}" Style="{StaticResource Text.Secondary}" VerticalAlignment="Center" Typography.NumeralAlignment="Tabular" />
<TextBlock DockPanel.Dock="Right" Text="{Binding StateText}" Style="{StaticResource Text.Secondary}" VerticalAlignment="Center" Typography.NumeralAlignment="Tabular" />
<CheckBox Content="{Binding Name}" IsChecked="{Binding IsSelected}" IsEnabled="{Binding IsAvailable}" ToolTip="{Binding ToolTip}"
ToolTipService.ShowOnDisabled="True" />
</DockPanel>
@@ -51,8 +53,30 @@
</ItemsControl.ItemTemplate>
</ItemsControl>
<TextBlock Grid.Row="1" Text="{l:Loc Setup.Field.Scope}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" Margin="0,0,16,0" />
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
<!-- The dry-run plan: what Update adds, removes or replaces, before it can run. -->
<TextBlock Grid.Row="1" Text="{l:Loc Setup.Field.Changes}" Foreground="{DynamicResource Brush.TextMuted}" Margin="0,0,16,8"
Visibility="{Binding HasChanges, Converter={StaticResource BoolToVisibility}}" />
<ItemsControl Grid.Row="1" Grid.Column="1" ItemsSource="{Binding Changes}" Focusable="False" Margin="0,0,0,8"
Visibility="{Binding HasChanges, Converter={StaticResource BoolToVisibility}}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock x:Name="Change" Text="{Binding Text}" ToolTip="{Binding ToolTip}" Margin="0,0,16,0" />
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding IsRemoval}" Value="True">
<Setter TargetName="Change" Property="Foreground" Value="{DynamicResource Brush.Warning}" />
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<TextBlock Grid.Row="2" Text="{l:Loc Setup.Field.Scope}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" Margin="0,0,16,0" />
<StackPanel Grid.Row="2" Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
<RadioButton Content="{l:Loc Setup.Scope.JustMe}" IsChecked="{Binding IsJustMe}" IsEnabled="{Binding CanChooseJustMe}"
ToolTipService.ShowOnDisabled="True" ToolTip="{Binding JustMeToolTip}" Margin="0,0,20,0" />
<RadioButton Content="{l:Loc Setup.Scope.AllUsers}" IsChecked="{Binding IsAllUsers}" IsEnabled="{Binding CanChangeLocation}"
@@ -60,8 +84,8 @@
</StackPanel>
<!-- The field comes before Browse in the Tab order, as on screen; a path reads left to right in every language. -->
<TextBlock Grid.Row="2" Text="{l:Loc Setup.Field.Folder}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" Margin="0,0,16,0" />
<Grid Grid.Row="2" Grid.Column="1" VerticalAlignment="Center">
<TextBlock Grid.Row="3" Text="{l:Loc Setup.Field.Folder}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" Margin="0,0,16,0" />
<Grid Grid.Row="3" Grid.Column="1" VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
@@ -72,8 +96,8 @@
ToolTipService.ShowOnDisabled="True" ToolTip="{Binding BrowseToolTip}" />
</Grid>
<TextBlock Grid.Row="3" Text="{l:Loc Setup.Field.Options}" Foreground="{DynamicResource Brush.TextMuted}" Margin="0,12,16,0" />
<StackPanel Grid.Row="3" Grid.Column="1" Margin="0,12,0,0">
<TextBlock Grid.Row="4" Text="{l:Loc Setup.Field.Options}" Foreground="{DynamicResource Brush.TextMuted}" Margin="0,12,16,0" />
<StackPanel Grid.Row="4" Grid.Column="1" Margin="0,12,0,0">
<CheckBox Content="{l:Loc Setup.Options.Desktop}" IsChecked="{Binding DesktopShortcut}" ToolTip="{l:Loc Tooltips.Setup.Desktop}" Margin="0,0,0,6"
Visibility="{Binding HasDesktopOption, Converter={StaticResource BoolToVisibility}}" />
<CheckBox Content="{l:Loc Setup.Options.StartMenu}" IsChecked="{Binding StartMenuShortcuts}" ToolTip="{l:Loc Tooltips.Setup.StartMenu}" Margin="0,0,0,6"
@@ -154,8 +178,13 @@
<!-- Success -->
<DockPanel Grid.Row="1" VerticalAlignment="Center" Visibility="{Binding IsDone, Converter={StaticResource BoolToVisibility}}">
<ui:Icon Glyph="{StaticResource Icon.SuccessCircle}" Size="20" Foreground="{DynamicResource Brush.Success}" Margin="0,0,12,0" VerticalAlignment="Center" />
<TextBlock x:Name="DoneMessage" Text="{Binding DoneText}" Style="{StaticResource Text.Title}" TextWrapping="Wrap" VerticalAlignment="Center"
AutomationProperties.LiveSetting="Assertive" />
<StackPanel VerticalAlignment="Center">
<TextBlock x:Name="DoneMessage" Text="{Binding DoneText}" Style="{StaticResource Text.Title}" TextWrapping="Wrap"
AutomationProperties.LiveSetting="Assertive" />
<!-- Files of the previous version that changed since setup installed them were left in place. -->
<TextBlock Text="{Binding KeptText}" Style="{StaticResource Text.Secondary}" ToolTip="{l:Loc Tooltips.Setup.Done.Kept}" Margin="0,6,0,0"
Visibility="{Binding HasKeptFiles, Converter={StaticResource BoolToVisibility}}" />
</StackPanel>
</DockPanel>
<!-- Failure -->
@@ -174,9 +203,12 @@
Visibility="{Binding IsInstallOptions, Converter={StaticResource BoolToVisibility}}" />
<StackPanel x:Name="Footer" DockPanel.Dock="Right" Orientation="Horizontal">
<Button Content="{l:Loc Setup.Action.Cancel}" MinWidth="88" Margin="0,0,8,0" Command="{Binding CloseCommand}" ToolTip="{l:Loc Tooltips.Setup.Cancel}"
IsCancel="{Binding IsOptions}" IsDefault="{Binding IsUninstallOptions}" Visibility="{Binding IsOptions, Converter={StaticResource BoolToVisibility}}" />
IsCancel="{Binding IsOptions}" IsDefault="{Binding IsCancelDefault}" Visibility="{Binding IsOptions, Converter={StaticResource BoolToVisibility}}" />
<Button Style="{StaticResource Button.Primary}" MinWidth="104" Content="{Binding InstallText}" Command="{Binding PrimaryCommand}" ToolTip="{Binding InstallToolTip}"
ToolTipService.ShowOnDisabled="True" IsDefault="{Binding IsInstallOptions}" Visibility="{Binding IsInstallOptions, Converter={StaticResource BoolToVisibility}}" />
ToolTipService.ShowOnDisabled="True" IsDefault="{Binding IsInstallPrimary}" Visibility="{Binding IsInstallPrimary, Converter={StaticResource BoolToVisibility}}" />
<!-- Every component unticked on an installed copy: continue to the uninstall options. -->
<Button Style="{StaticResource Button.Destructive}" MinWidth="104" Content="{l:Loc Setup.Action.Uninstall}" Command="{Binding PrimaryCommand}"
ToolTip="{l:Loc Tooltips.Setup.UninstallAll}" Visibility="{Binding IsUninstallAllPrimary, Converter={StaticResource BoolToVisibility}}" />
<Button Style="{StaticResource Button.Destructive}" MinWidth="104" Content="{l:Loc Setup.Action.Uninstall}" Command="{Binding PrimaryCommand}" ToolTip="{l:Loc Tooltips.Setup.Uninstall}"
Visibility="{Binding IsUninstallOptions, Converter={StaticResource BoolToVisibility}}" />
+5 -1
View File
@@ -19,11 +19,13 @@ internal sealed partial class SetupWindow : ChronosWindow
{
private readonly SetupViewModel _model;
private SetupStage _shownStage;
private bool _shownUninstall;
public SetupWindow(SetupViewModel model)
{
_model = model;
_shownStage = model.Stage;
_shownUninstall = model.IsUninstall;
DataContext = model;
InitializeComponent();
// Ahead of the chrome's own Close binding, which is always enabled.
@@ -59,8 +61,10 @@ internal sealed partial class SetupWindow : ChronosWindow
{
if (e.PropertyName == nameof(SetupViewModel.IsDataPlanVisible) && _model.IsDataPlanVisible)
Dispatcher.BeginInvoke(DispatcherPriority.Loaded, () => Announce(DataPlanHeading));
if (_model.Stage == _shownStage) return;
// Uninstall from the install options keeps the Options stage but shows other buttons.
if (_model.Stage == _shownStage && _model.IsUninstall == _shownUninstall) return;
_shownStage = _model.Stage;
_shownUninstall = _model.IsUninstall;
Dispatcher.BeginInvoke(DispatcherPriority.Loaded, () =>
{
FocusDefault();
@@ -4,30 +4,43 @@ using Chronos.Core.Packaging;
namespace Chronos.Tools.Commands;
/// <summary>
/// <c>pack-installer --setup Chronos.Setup.exe --product Chronos --version 1.2.3 --component Id=folder … --out file</c>:
/// <c>pack-installer --setup Chronos.Setup.exe --product Chronos --version 1.2.3 --component Id=folder … --out file [--legacy]</c>:
/// appends a TPK1 payload (BRIEF §18) to the setup program. Known component ids carry their display name, default
/// selection, shortcuts and file types; unknown ids are packed as plain, preselected components. The Server
/// installs only for all users: it is registered as a LocalSystem service, which must run from Program Files.
/// selection, shortcuts and file types: <c>Chronos</c> (alias <c>Desktop</c>), the desktop app, preselected, and
/// <c>Uploader</c>, not preselected; unknown ids are packed as plain, preselected components. Chronos Server is no
/// longer packed (it ships as a Docker image): <c>Server</c> is refused unless <c>--legacy</c>, which packs it as 1.0
/// named it (not preselected, Start menu shortcut) for the CI test of a retained 1.0 Server, installable for the
/// current user so that the test needs no administrator rights.
/// </summary>
internal sealed class PackInstallerCommand : ICommand
{
private sealed record KnownComponent(string DisplayName, bool DefaultSelected, string Program, bool Desktop, PayloadAssociation? Association, bool AllUsersOnly = false);
/// <param name="DisplayName">The component's name when setup has no translation of it.</param>
/// <param name="ShortcutName">The shortcut's file name, which links, pins and the sign-in entries follow: never renamed.</param>
private sealed record KnownComponent(string DisplayName, string ShortcutName, bool DefaultSelected, string Program, bool Desktop, PayloadAssociation? Association);
/// <remarks>The file type's description is the English fallback; setup writes it in its own language (<c>Setup.FileType.*</c>).</remarks>
private static readonly Dictionary<string, KnownComponent> Known = new(StringComparer.OrdinalIgnoreCase)
{
["Chronos"] = new("Chronos", true, "Chronos.exe", Desktop: true,
["Chronos"] = new("Chronos Desktop", "Chronos", true, "Chronos.exe", Desktop: true,
new PayloadAssociation { Component = "Chronos", Extension = ".chronos", ProgId = "Chronos.Project", Description = "Chronos project", Target = "Chronos.exe" }),
["Uploader"] = new("Chronos Uploader", true, "Chronos.Uploader.exe", Desktop: true, null),
["Server"] = new("Chronos Server", false, "Chronos.Server.exe", Desktop: false, null, AllUsersOnly: true),
["Uploader"] = new("Chronos Uploader", "Chronos Uploader", false, "Chronos.Uploader.exe", Desktop: true, null),
};
/// <summary>The 1.0 Windows Server, packed only with <c>--legacy</c>.</summary>
private static readonly KnownComponent LegacyServer = new("Chronos Server", "Chronos Server", false, "Chronos.Server.exe", Desktop: false, null);
private const string ServerId = "Server";
/// <summary><c>--component Desktop=…</c> packs the component <c>Chronos</c>, as <c>/COMPONENTS=Desktop</c> selects it.</summary>
private const string DesktopAlias = "Desktop";
public string Name => "pack-installer";
public string Summary => "--setup <exe> --product <name> --version <v> --component Id=dir … --out <file>";
public string Summary => "--setup <exe> --product <name> --version <v> --component Id=dir … --out <file> [--legacy]";
public Task<int> RunAsync(string[] args)
{
var options = Parse(args);
var legacy = args.Contains("--legacy", StringComparer.Ordinal);
var options = Parse([.. args.Where(a => a != "--legacy")]);
var setup = Required(options, "setup");
var output = Required(options, "out");
if (!File.Exists(setup)) throw new ToolException($"Setup program '{setup}' not found.");
@@ -41,23 +54,31 @@ internal sealed class PackInstallerCommand : ICommand
var eq = spec.IndexOf('=', StringComparison.Ordinal);
if (eq <= 0 || eq == spec.Length - 1) throw new ToolException($"--component expects Id=folder, got '{spec}'.");
var id = spec[..eq];
if (id.Equals(DesktopAlias, StringComparison.OrdinalIgnoreCase)) id = "Chronos";
var folder = spec[(eq + 1)..];
if (!PayloadManifest.IdentifierRegex().IsMatch(id)) throw new ToolException($"Component id '{id}' must be letters and digits.");
if (components.Any(c => c.Id.Equals(id, StringComparison.OrdinalIgnoreCase))) throw new ToolException($"Component '{id}' given twice.");
if (!Directory.Exists(folder)) throw new ToolException($"Component folder '{folder}' not found.");
if (!Known.TryGetValue(id, out var known))
KnownComponent? known;
if (id.Equals(ServerId, StringComparison.OrdinalIgnoreCase))
{
if (!legacy) throw new ToolException("Chronos Server is no longer packed into the setup (it ships as a Docker image); --legacy packs a 1.0 Server for the migration test.");
known = LegacyServer;
id = ServerId;
}
else if (!Known.TryGetValue(id, out known))
{
components.Add(new PayloadComponentSource(id, id, true, folder));
continue;
}
components.Add(new PayloadComponentSource(id, known.DisplayName, known.DefaultSelected, folder, known.AllUsersOnly));
components.Add(new PayloadComponentSource(id, known.DisplayName, known.DefaultSelected, folder));
if (!File.Exists(Path.Combine(folder, known.Program)))
{
Console.Error.WriteLine($"warning: {id} has no {known.Program}; no shortcut or file type registered.");
continue;
}
shortcuts.Add(new PayloadShortcut { Component = id, Name = known.DisplayName, Target = known.Program, StartMenu = true, Desktop = known.Desktop });
shortcuts.Add(new PayloadShortcut { Component = id, Name = known.ShortcutName, Target = known.Program, StartMenu = true, Desktop = known.Desktop });
if (known.Association is { } association) associations.Add(association);
}
@@ -0,0 +1,398 @@
using System.Globalization;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using Microsoft.Win32;
using Chronos.Core.Localization;
using Chronos.Core.Packaging;
using Chronos.Setup.Cli;
using Chronos.Setup.Engine;
using Chronos.Setup.Views;
using Chronos.Testing;
namespace Chronos.App.Tests.Setup;
/// <summary>
/// One setup for Chronos Desktop and Chronos Uploader: what a run installs, keeps and removes. A 1.0 Server for Windows
/// is retained until the user unticks it or the switches leave it out, the separate 1.0 Uploader is replaced, a file
/// changed since setup installed it is never deleted, and the Changes line is the dry-run plan of all of it.
/// </summary>
public sealed class SingleSetupTests(TestContext context)
{
private const string TestsKey = @"Software\Chronos.Tests";
/// <summary>The StartupApproved state Task Manager writes for an entry it turned off.</summary>
private static readonly byte[] TurnedOff = [0x03, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
static SingleSetupTests() => Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
[Test]
public void ANewInstallationTakesTheDesktopAppAndDesktopNamesIt()
{
var manifest = Manifest();
var plan = InstallPlan.Resolve(manifest, new SetupArguments(), null, null, null);
Assert.SequenceEqual(["Chronos"], plan.Components);
Assert.Empty(plan.Retained);
Assert.True(plan.CanChangeLocation);
Assert.Equal(InstallScope.CurrentUser, plan.Scope);
var both = InstallPlan.Resolve(manifest, new SetupArguments { Components = ["Desktop", "Uploader"] }, null, null, null);
Assert.SequenceEqual(["Chronos", "Uploader"], both.Components);
Assert.SequenceEqual(["Uploader"], InstallPlan.Resolve(manifest, new SetupArguments { Components = ["uploader"] }, null, null, null).Components);
// The Server is no longer offered: asking for it without a 1.0 Server installed is a wrong switch.
var refused = Assert.Throws<SetupException>(() => InstallPlan.Resolve(manifest, new SetupArguments { Components = ["Server"] }, null, null, null));
Assert.Equal(SetupExitCode.InvalidArguments, refused.Code);
}
[Test]
public void A10ServerIsRetainedUntilTheSwitchesLeaveItOut()
{
var manifest = Manifest();
var directory = context.CreateTempDirectory("retained");
var previous = ServerLog(directory);
var existing = new ExistingInstall(InstallScope.AllUsers, directory, "1.0.0");
// Nothing said: the desktop app and the Uploader are updated, the Server is kept with every file this payload
// does not know (a format 1 log does not say which component installed what), and its own shortcut.
var plan = InstallPlan.Resolve(manifest, new SetupArguments(), existing, previous, null);
Assert.SequenceEqual(["Chronos", "Uploader"], plan.Components);
var server = Assert.Contains(plan.Retained, r => r.Id == "Server");
Assert.Count(1, plan.Retained);
Assert.Equal("1.0.0", server.Version);
Assert.SequenceEqual(["Chronos.Server.exe", "legacy.txt"], server.Files);
Assert.SequenceEqual([Path.Combine(directory, "Chronos Server.lnk")], server.Shortcuts);
Assert.SequenceEqual(["Server"], plan.Kept.Select(k => k.Id));
Assert.Empty(plan.Removed(plan.Kept));
Assert.False(plan.CanChangeLocation);
// Its program keeps running: it is not among those setup closes or whose service it stops.
previous.Save(directory);
var programs = InstallPlan.Programs(manifest, directory, plan.Kept).ToList();
Assert.Contains("Chronos.Uploader.exe", programs);
Assert.DoesNotContain("Chronos.Server.exe", programs);
Assert.DoesNotContain("legacy.txt", programs);
Assert.Contains("Chronos.Server.exe", InstallPlan.Programs(manifest, directory, []));
// Switches are exact: leaving the Server out removes it; naming it keeps it.
var desktop = InstallPlan.Resolve(manifest, new SetupArguments { Components = ["Desktop"] }, existing, previous, null);
Assert.SequenceEqual(["Chronos"], desktop.Components);
Assert.Empty(desktop.Kept);
Assert.SequenceEqual(["Server"], desktop.Removed(desktop.Kept).Select(r => r.Id));
var kept = InstallPlan.Resolve(manifest, new SetupArguments { Components = ["Desktop", "Server"] }, existing, previous, null);
Assert.SequenceEqual(["Chronos"], kept.Components);
Assert.SequenceEqual(["Server"], kept.Kept.Select(k => k.Id));
}
[Test]
public void AFormat2LogKeepsOnlyTheFilesOfTheRetainedComponent()
{
var manifest = Manifest();
var log = new InstallLog
{
FormatVersion = InstallLog.CurrentFormat,
Product = "Chronos",
Version = "1.1.0",
Scope = InstallScope.AllUsers,
Components = ["Chronos", "Server"],
Files = ["Chronos.exe", "old.dll", "Chronos.Server.exe"],
ComponentFiles = { ["Chronos"] = ["Chronos.exe", "old.dll"], ["Server"] = ["Chronos.Server.exe"] },
ComponentVersions = { ["Chronos"] = "1.1.0", ["Server"] = "1.0.0" },
Hashes = { ["Chronos.Server.exe"] = new string('a', 64) },
};
var server = Assert.Contains(LegacyProducts.Retained(manifest, log), r => r.Id == "Server");
Assert.Equal("1.0.0", server.Version);
Assert.SequenceEqual(["Chronos.Server.exe"], server.Files);
Assert.Equal(new string('a', 64), server.Hashes["chronos.server.exe"]);
Assert.Empty(LegacyProducts.Retained(manifest, null));
// Without an installation of its own (only a log), nothing is retained.
Assert.Empty(InstallPlan.Resolve(manifest, new SetupArguments(), null, log, null).Retained);
}
[Test]
public void TheInstallLogRecordsEachComponentAndStillReadsA10Log()
{
var log = new InstallLog
{
FormatVersion = InstallLog.CurrentFormat,
Product = "Chronos",
Version = "1.1.0",
Components = ["Chronos", "Server"],
Files = ["Chronos.exe", "Chronos.Server.exe"],
ComponentFiles = { ["Chronos"] = ["Chronos.exe"], ["Server"] = ["Chronos.Server.exe"] },
ComponentShortcuts = { ["Chronos"] = [@"C:\Links\Chronos.lnk"], ["Server"] = [] },
ComponentVersions = { ["Chronos"] = "1.1.0", ["Server"] = "1.0.0" },
Hashes = { ["Chronos.exe"] = new string('b', 64) },
};
var read = Assert.NotNull(InstallLog.FromJson(log.ToJson()));
Assert.Equal(2, read.FormatVersion);
Assert.True(read.HasComponentFiles);
Assert.SequenceEqual(["Chronos.Server.exe"], read.FilesOf("server")!);
Assert.SequenceEqual([@"C:\Links\Chronos.lnk"], read.ShortcutsOf("Chronos")!);
Assert.Equal("1.0.0", read.VersionOf("Server"));
Assert.Equal(new string('b', 64), read.HashOf("CHRONOS.EXE"));
Assert.Empty(read.FilesOf("Uploader")!);
// As Chronos 1.0 wrote it: no format, no record of which component installed what.
var old = Assert.NotNull(InstallLog.FromJson("""
{"product":"Chronos","version":"1.0.0","scope":"CurrentUser","components":["Chronos","Server"],
"files":["Chronos.exe","Chronos.Server.exe"],"shortcuts":[],"associations":[]}
"""u8));
Assert.Equal(1, old.FormatVersion);
Assert.False(old.HasComponentFiles);
Assert.Null(old.FilesOf("Server"));
Assert.Equal("1.0.0", old.VersionOf("Server"));
Assert.Null(old.HashOf("Chronos.exe"));
}
[Test]
public void AFileChangedSinceSetupInstalledItIsNeverDeleted()
{
var directory = context.CreateTempDirectory("changed");
var same = Encoding.UTF8.GetBytes("as installed");
File.WriteAllBytes(Path.Combine(directory, "same.exe"), same);
File.WriteAllText(Path.Combine(directory, "edited.exe"), "changed since");
File.WriteAllText(Path.Combine(directory, "unknown.exe"), "a 1.0 log has no hash");
var hash = Convert.ToHexStringLower(SHA256.HashData(same));
var log = new InstallLog
{
FormatVersion = InstallLog.CurrentFormat,
Product = "Chronos",
Version = "1.1.0",
Hashes = { ["same.exe"] = hash, ["edited.exe"] = hash, ["gone.exe"] = hash },
};
// Only the edited file is kept; a missing file or one without a recorded hash is removed as before.
Assert.SequenceEqual(["edited.exe"], InstallEngine.Changed(directory, log, ["same.exe", "edited.exe", "unknown.exe", "gone.exe"]));
}
[Test]
public void ALegacyUploaderPreselectsTheUploaderAndFixesTheScope()
{
var manifest = Manifest();
var root = context.CreateTempDirectory("legacy");
var legacy = Legacy(Path.Combine(root, "Chronos Uploader"), InstallScope.CurrentUser);
// Its removal needs the same account, so the scope is the legacy copy's whatever the switches say.
var plan = InstallPlan.Resolve(manifest, new SetupArguments { AllUsers = true, Directory = Path.Combine(root, "Elsewhere") }, null, null, legacy);
Assert.Equal(InstallScope.CurrentUser, plan.Scope);
Assert.Equal(SetupPaths.DefaultDirectory(InstallScope.CurrentUser, manifest.Product), plan.Directory);
Assert.SequenceEqual(["Uploader"], plan.Components);
Assert.False(plan.CanChangeLocation);
Assert.Same(legacy, plan.LegacyToReplace(plan.Components, plan.Scope, plan.Directory));
Assert.Null(plan.LegacyToReplace(["Chronos"], plan.Scope, plan.Directory));
// An all-users copy stays under a per-user installation (its removal needs administrator approval), and a
// copy is never replaced by an installation in its own folder.
var allUsers = Legacy(Path.Combine(root, "Program Files", "Chronos Uploader"), InstallScope.AllUsers);
Assert.False(LegacyProducts.CanMerge(allUsers, InstallScope.CurrentUser, Path.Combine(root, "Chronos")));
Assert.True(LegacyProducts.CanMerge(allUsers, InstallScope.AllUsers, Path.Combine(root, "Program Files", "Chronos")));
Assert.False(LegacyProducts.CanMerge(legacy, InstallScope.CurrentUser, legacy.Directory));
Assert.False(LegacyProducts.CanMerge(legacy, InstallScope.CurrentUser, Path.Combine(legacy.Directory, "Chronos")));
// Another product's setup leaves the 1.0 Uploader alone.
Assert.Null(LegacyProducts.FindUploader(Manifest("ChronosTest" + Guid.NewGuid().ToString("N")[..12])));
}
[Test]
[WindowsOnly]
public void ReplacingTheLegacyUploaderMovesItsSignInEntryAndKeepsItTurnedOff()
{
var root = context.CreateTempDirectory("merge");
var legacyDir = Path.Combine(root, "Chronos Uploader");
var directory = Path.Combine(root, "Chronos");
Directory.CreateDirectory(directory);
File.WriteAllBytes(Path.Combine(directory, "Chronos.Uploader.exe"), [0x4D, 0x5A]);
var programs = LegacyProducts.StartupPrograms(Manifest(), directory);
Assert.SequenceEqual(["Chronos Uploader"], programs.Keys);
var keyPath = TestsKey + @"\" + Guid.NewGuid().ToString("N");
try
{
using var run = Registry.CurrentUser.CreateSubKey(keyPath + @"\Run", writable: true);
using var approval = Registry.CurrentUser.CreateSubKey(keyPath + @"\Approved", writable: true);
run.SetValue("Chronos Uploader", $"\"{Path.Combine(legacyDir, "Chronos.Uploader.exe")}\" --tray");
approval.SetValue("Chronos Uploader", TurnedOff, RegistryValueKind.Binary);
var dropped = CommandProgram.FullPaths(legacyDir, ["Chronos.Uploader.exe", "Uninstall Chronos Uploader.exe"]);
Assert.SequenceEqual(["Chronos Uploader"], SetupRegistry.MoveStartupEntries(run, approval, dropped, programs));
Assert.Equal($"\"{Path.Combine(directory, "Chronos.Uploader.exe")}\" --tray", run.GetValue("Chronos Uploader"));
Assert.SequenceEqual(["Chronos Uploader"], approval.GetValueNames());
}
finally
{
Registry.CurrentUser.DeleteSubKeyTree(keyPath, throwOnMissingSubKey: false);
bool empty;
using (var tests = Registry.CurrentUser.OpenSubKey(TestsKey)) empty = tests is { SubKeyCount: 0, ValueCount: 0 };
if (empty) Registry.CurrentUser.DeleteSubKey(TestsKey, throwOnMissingSubKey: false);
}
}
[Test]
[WindowsOnly]
public void ReplacingTheLegacyUploaderRemovesItsEntryAndFolder()
{
var root = context.CreateTempDirectory("merge");
// A product name no machine has, so the entry written and removed is the test's own.
var product = "ChronosTest" + Guid.NewGuid().ToString("N")[..12];
var legacyDir = Path.Combine(root, product);
Directory.CreateDirectory(legacyDir);
File.WriteAllBytes(Path.Combine(legacyDir, "Chronos.Uploader.exe"), [0x4D, 0x5A]);
var log = new InstallLog { Product = product, Version = "1.0.0", Scope = InstallScope.CurrentUser, Components = ["Uploader"], Files = ["Chronos.Uploader.exe"] };
log.Save(legacyDir);
File.WriteAllBytes(Path.Combine(legacyDir, log.UninstallerName), [0x4D, 0x5A]);
var key = SetupPaths.ProductKey(product);
try
{
SetupRegistry.WriteUninstallEntry(InstallScope.CurrentUser, key, new UninstallEntry(product, "1.0.0", "Chronos", legacyDir,
Path.Combine(legacyDir, log.UninstallerName), Path.Combine(legacyDir, "Chronos.Uploader.exe"), 2, null));
Assert.NotNull(SetupRegistry.FindInstall(key));
var directory = Path.Combine(root, "Chronos");
Directory.CreateDirectory(directory);
LegacyProducts.Merge(new LegacyInstall(new InstalledProduct(legacyDir, log), InstallScope.CurrentUser), Manifest(), directory);
Assert.Null(SetupRegistry.FindInstall(key));
Assert.False(Directory.Exists(legacyDir), "the legacy folder is removed");
Assert.True(Directory.Exists(directory));
}
finally
{
SetupRegistry.DeleteUninstallEntry(InstallScope.CurrentUser, key);
}
}
[Test]
[WindowsOnly]
public void TheChangesLineIsTheDryRunPlanAndNothingTickedUninstalls()
{
var root = context.CreateTempDirectory("changes");
using var payload = PayloadReader.Open(WritePayload(root));
var manifest = payload.Manifest;
var directory = Path.Combine(root, "Installed");
var existing = new ExistingInstall(InstallScope.AllUsers, directory, "1.0.0");
var previous = ServerLog(directory);
previous.Components = ["Chronos", "Server"];
// Updating keeps the Server and adds nothing: nothing to say.
using (var update = SetupViewModel.ForInstall(new SetupArguments(), payload, InstallPlan.Resolve(manifest, new SetupArguments(), existing, previous, null)))
{
Assert.Equal("Update", update.InstallText);
Assert.False(update.HasChanges);
var server = Assert.Contains(update.Components, c => c.IsRetained);
Assert.Equal("Chronos Server 1.0.0", server.Name);
Assert.Equal("No longer offered", server.StateText);
Assert.Contains(update.Components, c => c.Id == "Uploader").IsSelected = true;
Assert.Equal("Adds Chronos Uploader", update.ChangesText);
server.IsSelected = false;
Assert.Equal("Adds Chronos Uploader · Removes Chronos Server 1.0.0", update.ChangesText);
Assert.True(update.Changes[1].IsRemoval);
Assert.Contains("Chronos.Server.exe", update.Changes[1].ToolTip);
// Every program unticked: the primary action removes the installation, and Cancel is the default.
foreach (var c in update.Components) c.IsSelected = false;
Assert.True(update.IsUninstallAll);
Assert.True(update.IsUninstallAllPrimary);
Assert.False(update.IsInstallPrimary);
Assert.True(update.IsCancelDefault);
Assert.False(update.HasChanges);
}
// A new installation beside the separate 1.0 Uploader replaces it, and says so.
var legacy = Legacy(Path.Combine(root, "Chronos Uploader"), InstallScope.CurrentUser);
using (var replace = SetupViewModel.ForInstall(new SetupArguments(), payload, InstallPlan.Resolve(manifest, new SetupArguments(), null, null, legacy)))
{
Assert.Equal("Install", replace.InstallText);
Assert.False(replace.CanChangeLocation);
Assert.Equal("Replaces Chronos Uploader 1.0.0", replace.ChangesText);
Assert.False(replace.IsUninstallAll);
}
// A new installation with nothing ticked cannot start, and is no uninstall.
using var fresh = SetupViewModel.ForInstall(new SetupArguments(), payload, InstallPlan.Resolve(manifest, new SetupArguments(), null, null, null));
Assert.Equal("Install", fresh.InstallText);
foreach (var c in fresh.Components) c.IsSelected = false;
Assert.False(fresh.IsUninstallAll);
Assert.False(fresh.PrimaryCommand.CanExecute(null));
}
/// <summary>The single setup's payload as pack-installer writes it, its programs one byte each.</summary>
private static PayloadManifest Manifest(string product = "Chronos") => new()
{
Product = product,
Version = "1.1.0",
Components =
[
new PayloadComponent { Id = "Chronos", DisplayName = "Chronos Desktop", DefaultSelected = true },
new PayloadComponent { Id = "Uploader", DisplayName = "Chronos Uploader" },
],
Files =
[
new PayloadFile { Path = "Chronos.exe", Component = "Chronos", Sha256 = new string('1', 64) },
new PayloadFile { Path = "Chronos.Uploader.exe", Component = "Uploader", Sha256 = new string('2', 64) },
],
Shortcuts =
[
new PayloadShortcut { Component = "Chronos", Name = "Chronos", Target = "Chronos.exe", StartMenu = true, Desktop = true },
new PayloadShortcut { Component = "Uploader", Name = "Chronos Uploader", Target = "Chronos.Uploader.exe", StartMenu = true, Desktop = true },
],
};
/// <summary>The log Chronos 1.0 wrote for the desktop app, the Uploader and the Server for Windows (format 1).</summary>
private static InstallLog ServerLog(string directory) => new()
{
Product = "Chronos",
Version = "1.0.0",
Scope = InstallScope.AllUsers,
Components = ["Chronos", "Uploader", "Server"],
Files = ["Chronos.exe", "Chronos.Uploader.exe", "Chronos.Server.exe", "legacy.txt"],
Shortcuts =
[
Path.Combine(directory, "Chronos.lnk"),
Path.Combine(directory, "Chronos Uploader.lnk"),
Path.Combine(directory, "Chronos Server.lnk"),
],
};
private static LegacyInstall Legacy(string directory, InstallScope scope) =>
new(new InstalledProduct(directory, new InstallLog
{
Product = LegacyProducts.UploaderProduct,
Version = "1.0.0",
Scope = scope,
Components = ["Uploader"],
Files = ["Chronos.Uploader.exe"],
}), scope);
/// <summary>Writes the single setup's payload (the two programs, the desktop app preselected) to a scratch installer.</summary>
private static string WritePayload(string root)
{
var stub = Path.Combine(root, "stub.exe");
var bytes = new byte[4096];
new Random(7).NextBytes(bytes);
"MZ"u8.CopyTo(bytes);
File.WriteAllBytes(stub, bytes);
foreach (var (id, program) in (ReadOnlySpan<(string, string)>)[("Chronos", "Chronos.exe"), ("Uploader", "Chronos.Uploader.exe")])
{
var folder = Directory.CreateDirectory(Path.Combine(root, "payload", id)).FullName;
File.WriteAllText(Path.Combine(folder, program), "MZ " + program);
}
var installer = Path.Combine(root, "setup.exe");
PayloadWriter.Write(stub, new PayloadSource
{
Product = "Chronos",
Version = "1.1.0",
Components =
[
new PayloadComponentSource("Chronos", "Chronos Desktop", true, Path.Combine(root, "payload", "Chronos")),
new PayloadComponentSource("Uploader", "Chronos Uploader", false, Path.Combine(root, "payload", "Uploader")),
],
Shortcuts =
[
new PayloadShortcut { Component = "Chronos", Name = "Chronos", Target = "Chronos.exe", StartMenu = true, Desktop = true },
new PayloadShortcut { Component = "Uploader", Name = "Chronos Uploader", Target = "Chronos.Uploader.exe", StartMenu = true, Desktop = true },
],
}, installer);
return installer;
}
}
@@ -8,31 +8,67 @@ namespace Chronos.Tools.Tests;
public sealed class PackInstallerCommandTests(TestContext context)
{
[Test]
public async Task TheServerInstallsOnlyForAllUsersAndChronosOwnsTheProjectFileType()
public async Task TheSetupCarriesTheDesktopAppPreselectedAndTheUploaderToChoose()
{
var root = context.CreateTempDirectory("pack");
var stub = await Stub(root);
var app = Program(root, "app", "Chronos.exe");
var uploader = Program(root, "uploader", "Chronos.Uploader.exe");
var output = Path.Combine(root, "out", "Chronos-Setup.exe");
// "Desktop" names the desktop app, as /COMPONENTS=Desktop does.
Assert.Equal(0, await new PackInstallerCommand().RunAsync(
["--setup", stub, "--product", "Chronos", "--version", "1.2.3", "--component", "Desktop=" + app, "--component", "Uploader=" + uploader, "--out", output]));
using var reader = PayloadReader.Open(output);
var manifest = reader.Manifest;
Assert.SequenceEqual(["Chronos", "Uploader"], manifest.Components.Select(c => c.Id));
var desktop = manifest.FindComponent("Chronos")!;
Assert.True(desktop.DefaultSelected);
Assert.Equal("Chronos Desktop", desktop.DisplayName);
Assert.False(desktop.AllUsersOnly);
Assert.False(manifest.FindComponent("Uploader")!.DefaultSelected);
// The shortcut names that links, pins and the installer test follow stay as in 1.0.
Assert.SequenceEqual(["Chronos", "Chronos Uploader"], manifest.Shortcuts.Select(s => s.Name));
var association = Assert.Contains(manifest.Associations, a => a.Extension == ".chronos");
Assert.Equal("Chronos.Project", association.ProgId);
Assert.Equal("Chronos.exe", association.Target);
Assert.Equal("Chronos", association.Component);
}
[Test]
public async Task TheServerIsPackedOnlyForTheMigrationTest()
{
var root = context.CreateTempDirectory("pack");
var stub = await Stub(root);
var app = Program(root, "app", "Chronos.exe");
var server = Program(root, "server", "Chronos.Server.exe");
var output = Path.Combine(root, "out", "Chronos-Setup.exe");
string[] args = ["--setup", stub, "--product", "Chronos", "--version", "1.0.0", "--component", "Chronos=" + app, "--component", "Server=" + server, "--out", output];
var refused = await Assert.ThrowsAsync<ToolException>(() => new PackInstallerCommand().RunAsync(args));
Assert.Contains("Docker", refused.Message);
Assert.FileMissing(output);
Assert.Equal(0, await new PackInstallerCommand().RunAsync([.. args, "--legacy"]));
using var reader = PayloadReader.Open(output);
var serverComponent = reader.Manifest.FindComponent("Server")!;
Assert.False(serverComponent.DefaultSelected);
// Installable for the current user, so that the test needs no administrator rights.
Assert.False(serverComponent.AllUsersOnly);
var shortcut = Assert.Contains(reader.Manifest.Shortcuts, s => s.Component == "Server");
Assert.Equal("Chronos Server", shortcut.Name);
Assert.False(shortcut.Desktop);
}
private static async Task<string> Stub(string root)
{
var stub = Path.Combine(root, "Chronos.Setup.exe");
var bytes = new byte[4096];
new Random(5).NextBytes(bytes);
"MZ"u8.CopyTo(bytes);
await File.WriteAllBytesAsync(stub, bytes);
var app = Program(root, "app", "Chronos.exe");
var server = Program(root, "server", "Chronos.Server.exe");
var output = Path.Combine(root, "out", "Chronos-Setup.exe");
Assert.Equal(0, await new PackInstallerCommand().RunAsync(
["--setup", stub, "--product", "Chronos", "--version", "1.2.3", "--component", "Chronos=" + app, "--component", "Server=" + server, "--out", output]));
using var reader = PayloadReader.Open(output);
var manifest = reader.Manifest;
Assert.False(manifest.FindComponent("Chronos")!.AllUsersOnly);
var serverComponent = manifest.FindComponent("Server")!;
Assert.True(serverComponent.AllUsersOnly);
Assert.False(serverComponent.DefaultSelected);
var association = Assert.Contains(manifest.Associations, a => a.Extension == ".chronos");
Assert.Equal("Chronos.Project", association.ProgId);
Assert.Equal("Chronos.exe", association.Target);
Assert.Equal("Chronos", association.Component);
return stub;
}
private static string Program(string root, string folder, string name)