mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-06-20 23:54:26 +08:00
Add launcher debug settings, recovery & version fixes
Introduce a persistent LauncherDebugSettingsStore and wire it into ErrorWindow and SplashWindow so dev-mode and custom host path can be saved/loaded. Harden DeploymentLocator/FlexibleHostLocator to safely normalize and validate saved debug paths and log warnings for malformed values. Add a WaitingForShell startup state and recoverable-activation logic across App and LauncherFlowCoordinator (with registry updates) so Launcher can attach to an in-progress desktop shell rather than failing. Clean up ErrorDebugWindow UI/flow (WasAccepted flag, localization fixes, event wiring) and improve splash version population. Improve AppVersionProvider to trim surrounding quotes, robustly parse version.json via JsonDocument and read string properties; add unit tests for AppVersionProvider, DeploymentLocator and LauncherDebugSettingsStore. Also quote Exec commands in the csproj and harden scripts/Generate-VersionFile.ps1 (argument normalization, LiteralPath, error handling).
This commit is contained in:
@@ -1,15 +1,47 @@
|
||||
# 生成版本信息文件
|
||||
param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$OutputPath,
|
||||
|
||||
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$Version,
|
||||
|
||||
|
||||
[Parameter(Mandatory=$false)]
|
||||
[string]$Codename = "Administrate"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
function Normalize-ArgumentValue {
|
||||
param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[AllowEmptyString()]
|
||||
[string]$Value
|
||||
)
|
||||
|
||||
$trimmed = $Value.Trim()
|
||||
if ($trimmed.Length -ge 2) {
|
||||
$first = $trimmed[0]
|
||||
$last = $trimmed[$trimmed.Length - 1]
|
||||
if (($first -eq "'" -and $last -eq "'") -or ($first -eq '"' -and $last -eq '"')) {
|
||||
return $trimmed.Substring(1, $trimmed.Length - 2).Trim()
|
||||
}
|
||||
}
|
||||
|
||||
return $trimmed
|
||||
}
|
||||
|
||||
$OutputPath = Normalize-ArgumentValue -Value $OutputPath
|
||||
$Version = Normalize-ArgumentValue -Value $Version
|
||||
$Codename = Normalize-ArgumentValue -Value $Codename
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($OutputPath)) {
|
||||
throw "OutputPath is required."
|
||||
}
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($Version)) {
|
||||
throw "Version is required."
|
||||
}
|
||||
|
||||
$versionInfo = @{
|
||||
Version = $Version
|
||||
Codename = $Codename
|
||||
@@ -18,11 +50,15 @@ $versionInfo = @{
|
||||
$json = $versionInfo | ConvertTo-Json -Compress
|
||||
$dir = Split-Path -Parent $OutputPath
|
||||
|
||||
if (!(Test-Path $dir)) {
|
||||
if ([string]::IsNullOrWhiteSpace($dir)) {
|
||||
throw "OutputPath must include a directory: $OutputPath"
|
||||
}
|
||||
|
||||
if (!(Test-Path -LiteralPath $dir)) {
|
||||
New-Item -ItemType Directory -Path $dir -Force | Out-Null
|
||||
}
|
||||
|
||||
Set-Content -Path $OutputPath -Value $json -Encoding UTF8
|
||||
Set-Content -LiteralPath $OutputPath -Value $json -Encoding UTF8
|
||||
Write-Host "Generated version file: $OutputPath" -ForegroundColor Green
|
||||
Write-Host " Version: $Version" -ForegroundColor Gray
|
||||
Write-Host " Codename: $Codename" -ForegroundColor Gray
|
||||
|
||||
Reference in New Issue
Block a user