mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-06-20 23:54:26 +08:00
Refactor launcher startup, logging & host resolution
Improve launcher startup flow, logging, and host resolution. Key changes: add detailed startup logging and standardized preview messages; unify CLI vs GUI handling and error/result reporting (write result file when requested); refactor DeploymentLocator to a more robust host resolution (new HostResolutionResult, explicit/portable/published/debug resolution paths, legacy fallback); overhaul LauncherFlowCoordinator to better handle IPC stages, activation retries, window lifecycle, plugin/update flows and error reporting; add CommandContext helpers (IsGui/IsPreview/ExplicitAppRoot) and JSON context options; tighten async usage and ConfigureAwait calls; add better UI error handling and consistent exit codes. Several UX/debug conveniences and robustness fixes included.
This commit is contained in:
@@ -1,89 +1,38 @@
|
||||
namespace LanMountainDesktop.Shared.Contracts.Launcher;
|
||||
|
||||
/// <summary>
|
||||
/// 启动阶段枚举
|
||||
/// </summary>
|
||||
public enum StartupStage
|
||||
{
|
||||
/// <summary>
|
||||
/// 初始化中
|
||||
/// </summary>
|
||||
Initializing,
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置中
|
||||
/// </summary>
|
||||
LoadingSettings,
|
||||
|
||||
/// <summary>
|
||||
/// 加载插件中
|
||||
/// </summary>
|
||||
LoadingPlugins,
|
||||
|
||||
/// <summary>
|
||||
/// 初始化界面中
|
||||
/// </summary>
|
||||
InitializingUI,
|
||||
|
||||
/// <summary>
|
||||
/// 就绪
|
||||
/// </summary>
|
||||
ShellInitialized,
|
||||
DesktopVisible,
|
||||
ActivationRedirected,
|
||||
ActivationFailed,
|
||||
Ready
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 启动进度消息
|
||||
/// </summary>
|
||||
public record StartupProgressMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// 当前阶段
|
||||
/// </summary>
|
||||
public StartupStage Stage { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 进度百分比 (0-100)
|
||||
/// </summary>
|
||||
|
||||
public int ProgressPercent { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态消息
|
||||
/// </summary>
|
||||
|
||||
public string? Message { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 时间戳
|
||||
/// </summary>
|
||||
|
||||
public DateTimeOffset Timestamp { get; init; } = DateTimeOffset.UtcNow;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Launcher IPC 常量
|
||||
/// </summary>
|
||||
public static class LauncherIpcConstants
|
||||
{
|
||||
/// <summary>
|
||||
/// 命名管道名称
|
||||
/// </summary>
|
||||
public const string PipeName = "LanMountainDesktop_Launcher";
|
||||
|
||||
/// <summary>
|
||||
/// Launcher 进程 ID 环境变量
|
||||
/// </summary>
|
||||
|
||||
public const string LauncherPidEnvVar = "LMD_LAUNCHER_PID";
|
||||
|
||||
/// <summary>
|
||||
/// 包根目录环境变量
|
||||
/// </summary>
|
||||
|
||||
public const string PackageRootEnvVar = "LMD_PACKAGE_ROOT";
|
||||
|
||||
/// <summary>
|
||||
/// 版本环境变量
|
||||
/// </summary>
|
||||
|
||||
public const string VersionEnvVar = "LMD_VERSION";
|
||||
|
||||
/// <summary>
|
||||
/// 开发代号环境变量
|
||||
/// </summary>
|
||||
|
||||
public const string CodenameEnvVar = "LMD_CODENAME";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user