mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-06-20 23:54:26 +08:00
Compare commits
105 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a1cc0ee2bf | ||
|
|
313d093257 | ||
|
|
1ef47c780b | ||
|
|
a26b6faace | ||
|
|
b219f109ec | ||
|
|
1ee6e68f33 | ||
|
|
545dee85a7 | ||
|
|
ebe35d6f91 | ||
|
|
63f08987a7 | ||
|
|
ce41fd676c | ||
|
|
c1f148f7d6 | ||
|
|
a75ed0ced1 | ||
|
|
2dc40c53e2 | ||
|
|
a99ed9fef2 | ||
|
|
553cee54f9 | ||
|
|
1d7a878d55 | ||
|
|
0361b83ea2 | ||
|
|
cc85638a37 | ||
|
|
791e38d55e | ||
|
|
75aed3f6ad | ||
|
|
01cf32a610 | ||
|
|
69bcf2c6eb | ||
|
|
12f0caafc7 | ||
|
|
fd3a193e68 | ||
|
|
edf3d82cc9 | ||
|
|
e1adba3771 | ||
|
|
ac8ee8dc54 | ||
|
|
7a70476ce8 | ||
|
|
cc1c040203 | ||
|
|
68dc17f863 | ||
|
|
b6d820a320 | ||
|
|
93758fc083 | ||
|
|
9404a0b347 | ||
|
|
a5abda62dc | ||
|
|
ada0cd4a3a | ||
|
|
b48056391a | ||
|
|
33c264f6dd | ||
|
|
563f12caa1 | ||
|
|
f0319b7deb | ||
|
|
d8f75e86be | ||
|
|
84caca02bf | ||
|
|
aa7e15d967 | ||
|
|
6b1c738d8c | ||
|
|
f8a4bb888c | ||
|
|
b71687cecd | ||
|
|
68ca532dc0 | ||
|
|
60e7f31ba7 | ||
|
|
574b798092 | ||
|
|
49bbae29af | ||
|
|
1d7df5a105 | ||
|
|
6a30bc6fce | ||
|
|
3a8516334a | ||
|
|
458494d131 | ||
|
|
01670147f6 | ||
|
|
0348324fa3 | ||
|
|
fc4d0c4cd8 | ||
|
|
eb066b53f1 | ||
|
|
5ea242af9a | ||
|
|
abfa64b3d7 | ||
|
|
cbaf2a0c38 | ||
|
|
0e45c836c9 | ||
|
|
0b603384b4 | ||
|
|
0085c66514 | ||
|
|
d4901e436f | ||
|
|
2d9391f930 | ||
|
|
927dc8d1fd | ||
|
|
33591a0a63 | ||
|
|
001d77968f | ||
|
|
e20462ac2b | ||
|
|
aa7c118d13 | ||
|
|
f51ec309a6 | ||
|
|
9224c9a33a | ||
|
|
703ed7b48a | ||
|
|
5af7ac8b56 | ||
|
|
4cb52e56c7 | ||
|
|
03e32ee6cb | ||
|
|
c2cc62b58b | ||
|
|
9c529f2992 | ||
|
|
1e9ead8bee | ||
|
|
5f7b3a1e7d | ||
|
|
b12dd68ba7 | ||
|
|
1b22e9df4a | ||
|
|
ce5acf5bd7 | ||
|
|
b933f3badf | ||
|
|
76d13ac024 | ||
|
|
99a82d64e3 | ||
|
|
692ca3de3d | ||
|
|
d62226ffa0 | ||
|
|
91ab52ce8b | ||
|
|
4a89c2388b | ||
|
|
cb96180118 | ||
|
|
cf4b8e2132 | ||
|
|
e8ba847328 | ||
|
|
2156922039 | ||
|
|
e795e9964e | ||
|
|
11130cfdb3 | ||
|
|
66ae0b0270 | ||
|
|
a671db8b69 | ||
|
|
8c94253f92 | ||
|
|
6849a467d6 | ||
|
|
e69bbf8b19 | ||
|
|
d30af21317 | ||
|
|
8583465a67 | ||
|
|
e1d5a0c6de | ||
|
|
5fa2031ad6 |
@@ -1,3 +1,5 @@
|
||||
{
|
||||
"diffEditor.renderSideBySide": false
|
||||
"diffEditor.renderSideBySide": false,
|
||||
"clawMode.mode": "editor",
|
||||
"workbench.activityBar.location": "default"
|
||||
}
|
||||
13
.claude/settings.local.json
Normal file
13
.claude/settings.local.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"permissions": {
|
||||
"allow": [
|
||||
"Bash(ls -la \"/d/github/LanMountainDesktop/.claude/worktrees/agent-a4c5412322421ab67\" && ls -la \"/d/github/LanMountainDesktop\" && ls -la \"/d/github\")",
|
||||
"Read(//d/github/**)",
|
||||
"Bash(dotnet build *)",
|
||||
"Bash(dotnet test *)",
|
||||
"Bash(python -)",
|
||||
"Bash(py -3 -c \"from pathlib import Path; p=Path\\(r'd:/github/LanMountainDesktop/LanMountainDesktop/ViewModels/SettingsViewModels.cs'\\); t=p.read_text\\(encoding='utf-8'\\); s=t.find\\('public sealed partial class UpdateSettingsPageViewModel : ViewModelBase'\\); e=t.find\\('public sealed partial class StudySettingsPageViewModel : ViewModelBase', s\\); assert s!=-1 and e!=-1; p.write_text\\(t[:s]+t[e:], encoding='utf-8'\\); print\\('ok'\\)\")",
|
||||
"Bash(perl -0777 -i -pe \"s/public sealed partial class UpdateSettingsPageViewModel : ViewModelBase\\\\R\\\\{.*?\\\\R\\\\}\\\\R\\\\Rpublic sealed partial class StudySettingsPageViewModel : ViewModelBase/public sealed partial class StudySettingsPageViewModel : ViewModelBase/s\" \"d:/github/LanMountainDesktop/LanMountainDesktop/ViewModels/SettingsViewModels.cs\")"
|
||||
]
|
||||
}
|
||||
}
|
||||
291
.comate/specs/standby-digital-clock/doc.md
Normal file
291
.comate/specs/standby-digital-clock/doc.md
Normal file
@@ -0,0 +1,291 @@
|
||||
# StandBy Digital Clock - iPhone 待机风格大数字时钟组件
|
||||
|
||||
## 1. 需求场景与处理逻辑
|
||||
|
||||
### 1.1 需求描述
|
||||
新增一个 4×2 尺寸的数字时钟桌面组件,视觉风格参考 iPhone 横屏充电时的 StandBy 待机显示——大面积、粗体、圆润的数字显示当前时间(HH:MM),数字采用不规则的自由排版(有微妙的垂直偏移,不在一条直线上),颜色使用 Monet 主题色而非纯黑/白,伴随数字切换时的流畅垂直滚动/翻转动画,下方显示日期信息。
|
||||
|
||||
### 1.2 用户体验目标
|
||||
- 大字号、圆润粗体的数字时间,远距离一目了然
|
||||
- 数字采用不规则自由排版(微妙垂直偏移),营造 iPhone StandBy 那种有机、散漫的视觉节奏
|
||||
- 数字使用 Monet 主题色(跟随壁纸/用户选色的强调色),而非死板的纯黑/白
|
||||
- 数字变化时执行垂直滑动动画(旧数字向上滑出,新数字从下方滑入),类似翻页时钟效果
|
||||
- 冒号(:)有呼吸闪烁效果
|
||||
- 支持夜间/日间模式自动切换
|
||||
- 点击组件可打开世界时钟 AirApp
|
||||
- 支持时区配置(与现有桌面时钟共享设置体系)
|
||||
|
||||
### 1.3 处理逻辑
|
||||
1. 组件加载时读取时区设置和秒针模式设置
|
||||
2. `DispatcherTimer` 每秒触发一次更新
|
||||
3. 当检测到分钟数变化时,触发分钟数字的垂直滑动动画
|
||||
4. 当检测到小时数变化时,触发小时数字的垂直滑动动画
|
||||
5. 冒号以 1 秒周期做透明度脉冲动画
|
||||
6. 每 tick 检查是否需要切换日间/夜间视觉模式
|
||||
|
||||
## 2. 架构与技术方案
|
||||
|
||||
### 2.1 组件架构
|
||||
遵循现有桌面组件架构模式:
|
||||
- 继承 `UserControl`,实现 `IDesktopComponentWidget`, `ITimeZoneAwareComponentWidget`, `IComponentPlacementContextAware`, `IComponentRuntimeContextAware`
|
||||
- AXAML 定义根布局结构,代码后置处理动画逻辑
|
||||
- 通过 `DesktopComponentDefinition` 注册到组件系统
|
||||
|
||||
### 2.2 数字滚动动画技术方案
|
||||
采用 Avalonia `RenderTransform` + `DoubleTransition` 实现数字滚动:
|
||||
|
||||
**核心思路**:每个数位(共 4 位:H1, H2, M1, M2)使用 `ClipToBounds` 的容器,内含一个垂直排列的 `StackPanel`,包含当前数字和下一个数字。切换时通过 `TranslateTransform.Y` 的 `DoubleTransition` 实现平滑滚动。
|
||||
|
||||
```
|
||||
每位数字的结构:
|
||||
┌─ DigitClip (ClipToBounds=true) ──────────┐
|
||||
│ ┌─ DigitStack (TranslateTransform.Y) ──┐ │
|
||||
│ │ [当前数字 TextBlock] │ │
|
||||
│ │ [新数字 TextBlock] │ │
|
||||
│ └───────────────────────────────────────┘ │
|
||||
└───────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
当数字变化时:
|
||||
1. 在 StackPanel 底部添加新数字的 TextBlock
|
||||
2. 将 `TranslateTransform.Y` 从 0 动画过渡到 `-digitHeight`
|
||||
3. 动画完成后移除旧数字,重置 Y 为 0
|
||||
|
||||
### 2.3 动画参数
|
||||
- 使用项目 `FluttermotionToken` 体系:滚动动画时长 `FluttermotionToken.Standard`(200ms)
|
||||
- 缓动函数:`CubicEaseOut`(与项目现有动画风格一致)
|
||||
- 冒号呼吸动画:透明度 1.0 → 0.3 → 1.0,周期 2 秒,使用 `DoubleTransition`
|
||||
|
||||
### 2.4 尺寸与布局
|
||||
- 组件定义:`MinWidthCells = 4, MinHeightCells = 2`
|
||||
- 缩放规则:2:1 比例(与 WorldClock 一致)
|
||||
- 内部布局采用 `Viewbox` 包裹,确保在不同 cellSize 下自适应缩放
|
||||
- 数字字体大小:基准设计为 130px(在 Viewbox 内),实际显示由 Viewbox 缩放
|
||||
|
||||
### 2.5 布局风格——不规则自由排版(iPhone StandBy 风格)
|
||||
iPhone StandBy 的数字不是规矩地排成一条直线,而是有微妙的垂直偏移和大小差异,营造出自由散漫、有机的视觉节奏:
|
||||
|
||||
```
|
||||
H1 H2 : M1 M2
|
||||
↗↘ ↘↗ ↗↘ ↘↗
|
||||
↕+6 ↕+2 : ↕+4 ↕+2
|
||||
↖ -3° ↗ +4° : ↖ -1° ↗ +5°
|
||||
←+6,↑-10 ←-2,↓+10 →+4,↑-3 ←-2,↓+12
|
||||
```
|
||||
|
||||
每个数字有三个自由度:
|
||||
- **垂直偏移 (Y)**:H1=-10, H2=+10, 冒号=+8, M1=-3, M2=+12
|
||||
- **水平偏移 (X)**:H1=+6, H2=-2, 冒号=0, M1=+4, M2=-2
|
||||
- **旋转角度 (Z)**:H1=-4°, H2=+3°, 冒号=-1°, M1=-2°, M2=+5°
|
||||
|
||||
### 2.6 视觉风格——圆润粗体 + Monet 主题色
|
||||
- **字体**:`FontWeight.Bold`,配合较大的字号,视觉上圆润饱满
|
||||
- **颜色**:使用项目 Monet 主题色系统,数字颜色跟随 `AdaptiveAccentBrush` / `SystemAccentColor`,而非纯黑/白
|
||||
- 数字颜色通过 `ComponentColorSchemeHelper.ShouldUseMonetColor()` 判断:
|
||||
- 跟随系统:使用 `AdaptiveAccentBrush`(Monet 提取的强调色)
|
||||
- 原生模式:使用组件自带的特色色彩
|
||||
- 夜间模式:深色渐变背景 + 主题色数字(亮色调)
|
||||
- 日间模式:浅色渐变背景 + 主题色数字(深色调)
|
||||
- 夜间暗光环境:数字过渡到柔和的红色调(`#FF6B4A`),模拟 iPhone StandBy 夜间红色调
|
||||
- **冒号颜色**:与数字同色,但有呼吸动画
|
||||
- **日期行**:使用 `AdaptiveTextMutedBrush`(跟随主题的弱化文字色),字号约 14-16px 基准
|
||||
- **根容器圆角**:`DesignCornerRadiusComponent`(遵循圆角规范)
|
||||
|
||||
## 3. 受影响文件
|
||||
|
||||
### 3.1 新增文件
|
||||
| 文件 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| `LanMountainDesktop/Views/Components/StandbyDigitalClockWidget.axaml` | 新增 | 组件 AXAML 布局 |
|
||||
| `LanMountainDesktop/Views/Components/StandbyDigitalClockWidget.axaml.cs` | 新增 | 组件代码后置(动画逻辑、时间更新、模式切换) |
|
||||
|
||||
### 3.2 修改文件
|
||||
| 文件 | 修改类型 | 受影响函数/区域 |
|
||||
|------|----------|-----------------|
|
||||
| `LanMountainDesktop/ComponentSystem/BuiltInComponentIds.cs` | 新增常量 | 新增 `DesktopStandbyDigitalClock` 常量 |
|
||||
| `LanMountainDesktop/ComponentSystem/ComponentRegistry.cs` | 新增定义 | `CreateDefault()` 中新增组件定义 |
|
||||
| `LanMountainDesktop/Views/Components/DesktopComponentRuntimeRegistry.cs` | 新增运行时注册 | `GetDefaultRegistrations()` 中新增运行时注册项 |
|
||||
| `LanMountainDesktop/Views/MainWindow.ComponentSystem.cs` | 新增缩放规则 | `NormalizeAspectRatioForComponent()` 中为 StandbyDigitalClock 添加 2:1 缩放规则 |
|
||||
|
||||
## 4. 实现细节
|
||||
|
||||
### 4.1 BuiltInComponentIds 新增常量
|
||||
```csharp
|
||||
public const string DesktopStandbyDigitalClock = "DesktopStandbyDigitalClock";
|
||||
```
|
||||
|
||||
### 4.2 ComponentRegistry 新增定义
|
||||
```csharp
|
||||
new DesktopComponentDefinition(
|
||||
BuiltInComponentIds.DesktopStandbyDigitalClock,
|
||||
"StandBy Clock",
|
||||
"Clock",
|
||||
"Clock",
|
||||
MinWidthCells: 4,
|
||||
MinHeightCells: 2,
|
||||
AllowStatusBarPlacement: false,
|
||||
AllowDesktopPlacement: true),
|
||||
```
|
||||
|
||||
### 4.3 DesktopComponentRuntimeRegistry 新增注册
|
||||
```csharp
|
||||
new DesktopComponentRuntimeRegistration(
|
||||
BuiltInComponentIds.DesktopStandbyDigitalClock,
|
||||
"component.standby_digital_clock",
|
||||
() => new StandbyDigitalClockWidget()),
|
||||
```
|
||||
|
||||
### 4.4 NormalizeAspectRatioForComponent 缩放规则
|
||||
在 `case BuiltInComponentIds.DesktopWorldClock:` 的同一分支中添加 `BuiltInComponentIds.DesktopStandbyDigitalClock`,使用 2:1 比例规则。
|
||||
|
||||
### 4.5 AXAML 布局结构
|
||||
```xml
|
||||
<UserControl x:Class="LanMountainDesktop.Views.Components.StandbyDigitalClockWidget">
|
||||
<Border x:Name="RootBorder"
|
||||
CornerRadius="{DynamicResource DesignCornerRadiusComponent}"
|
||||
ClipToBounds="True"
|
||||
Padding="14">
|
||||
<!-- 背景在代码后置中设置(渐变,与AnalogClockWidget一致) -->
|
||||
<Viewbox Stretch="Uniform">
|
||||
<Grid Width="400" Height="200">
|
||||
<StackPanel VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<!-- H1 数位 -->
|
||||
<Border x:Name="H1Clip" ClipToBounds="True" ...>
|
||||
<Panel x:Name="H1Stack" ...>
|
||||
<TextBlock x:Name="H1Text" Text="0" ... />
|
||||
</Panel>
|
||||
</Border>
|
||||
<!-- H2 数位 -->
|
||||
<Border x:Name="H2Clip" ClipToBounds="True" ...>
|
||||
<Panel x:Name="H2Stack" ...>
|
||||
<TextBlock x:Name="H2Text" Text="0" ... />
|
||||
</Panel>
|
||||
</Border>
|
||||
<!-- 冒号 -->
|
||||
<TextBlock x:Name="ColonText" Text=":" ... />
|
||||
<!-- M1 数位 -->
|
||||
<Border x:Name="M1Clip" ClipToBounds="True" ...>
|
||||
<Panel x:Name="M1Stack" ...>
|
||||
<TextBlock x:Name="M1Text" Text="0" ... />
|
||||
</Panel>
|
||||
</Border>
|
||||
<!-- M2 数位 -->
|
||||
<Border x:Name="M2Clip" ClipToBounds="True" ...>
|
||||
<Panel x:Name="M2Stack" ...>
|
||||
<TextBlock x:Name="M2Text" Text="0" ... />
|
||||
</Panel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- 日期行 -->
|
||||
<TextBlock x:Name="DateTextBlock"
|
||||
VerticalAlignment="Bottom"
|
||||
HorizontalAlignment="Center" ... />
|
||||
</Grid>
|
||||
</Viewbox>
|
||||
</Border>
|
||||
</UserControl>
|
||||
```
|
||||
|
||||
### 4.6 数字滚动动画核心代码(伪代码)
|
||||
```csharp
|
||||
private void AnimateDigit(Border clip, Panel stack, TextBlock currentText, char newDigit, double digitHeight)
|
||||
{
|
||||
var oldText = currentText;
|
||||
var newTextBlock = new TextBlock
|
||||
{
|
||||
Text = newDigit.ToString(),
|
||||
FontSize = oldText.FontSize,
|
||||
FontWeight = oldText.FontWeight,
|
||||
Foreground = oldText.Foreground,
|
||||
Width = oldText.Width,
|
||||
Height = digitHeight,
|
||||
// 复制旧文本的所有样式属性
|
||||
};
|
||||
stack.Children.Add(newTextBlock);
|
||||
|
||||
// 应用 TranslateTransform 过渡动画
|
||||
var transform = new TranslateTransform { Y = 0 };
|
||||
stack.RenderTransform = transform;
|
||||
stack.Transitions = new Transitions
|
||||
{
|
||||
new DoubleTransition(TranslateTransform.YProperty, FluttermotionToken.Standard, new CubicEaseOut())
|
||||
};
|
||||
|
||||
// 触发动画:从当前位置滑到 -digitHeight
|
||||
transform.Y = -digitHeight;
|
||||
|
||||
// 动画完成后清理
|
||||
_ = DispatcherTimer.RunOnce(() =>
|
||||
{
|
||||
stack.Children.Remove(oldText);
|
||||
transform.Y = 0;
|
||||
stack.Transitions = null; // 移除过渡,避免重置时再次动画
|
||||
// 更新引用
|
||||
UpdateCurrentTextReference(newTextBlock);
|
||||
}, FluttermotionToken.Standard);
|
||||
}
|
||||
```
|
||||
|
||||
### 4.7 冒号呼吸动画
|
||||
使用 `DispatcherTimer` 每秒切换冒号透明度:
|
||||
```csharp
|
||||
private void ToggleColonOpacity()
|
||||
{
|
||||
_colonVisible = !_colonVisible;
|
||||
ColonText.Opacity = _colonVisible ? 1.0 : 0.3;
|
||||
}
|
||||
```
|
||||
配合 `DoubleTransition` 使透明度变化平滑过渡。
|
||||
|
||||
### 4.8 日间/夜间模式
|
||||
与 `AnalogClockWidget` 使用完全相同的判断逻辑:
|
||||
- 检查 `ActualThemeVariant`
|
||||
- 回退到 `AdaptiveSurfaceBaseBrush` 亮度计算
|
||||
- 夜间模式:深色渐变背景 + 浅色数字
|
||||
- 日间模式:浅色渐变背景 + 深色数字
|
||||
|
||||
### 4.9 时区与设置
|
||||
- 复用 `AnalogClockWidget` 的时区解析和设置加载逻辑
|
||||
- 使用 `ComponentSettingsSnapshot.DesktopClockTimeZoneId` 读取时区配置
|
||||
- 点击打开世界时钟 AirApp
|
||||
|
||||
## 5. 边界条件与异常处理
|
||||
|
||||
| 场景 | 处理方式 |
|
||||
|------|----------|
|
||||
| 组件首次加载时数字尚未初始化 | 在构造函数中初始化所有数字为当前时间,不触发动画 |
|
||||
| 快速连续触发数字变化(如时间同步导致跳变) | 在动画完成前忽略新的变化请求,或中断当前动画立即跳转到目标值 |
|
||||
| cellSize 极小或极大 | `ApplyCellSize` 中 clamp 缩放因子(0.58-1.95,与 AnalogClockWidget 一致) |
|
||||
| 时区切换 | 重新加载设置并更新所有数字(无动画,直接设置) |
|
||||
| 主题切换 | 通过 `ApplyModeVisualIfNeeded()` 在下一个 tick 自动检测并切换 |
|
||||
| 组件被销毁 | `DetachedFromVisualTree` 停止 timer,清理资源 |
|
||||
| 冒号动画在组件不可见时 | timer 仍在运行但 Opacity 变化无性能开销;若需要可结合 `IDesktopPageVisibilityAwareComponentWidget` |
|
||||
|
||||
## 6. 数据流路径
|
||||
|
||||
```
|
||||
DispatcherTimer (1s interval)
|
||||
→ OnTimerTick
|
||||
→ 计算当前时间 (TimeZoneInfo.ConvertTimeFromUtc)
|
||||
→ 比较新旧时间数字
|
||||
→ 若有变化: AnimateDigit() 执行滚动动画
|
||||
→ ToggleColonOpacity() 切换冒号
|
||||
→ ApplyModeVisualIfNeeded() 检查日/夜间切换
|
||||
→ UpdateDateText() 更新日期文本
|
||||
|
||||
用户点击 → OnPointerReleased → AirAppLauncherServiceProvider.OpenWorldClock()
|
||||
|
||||
时区变更 → TimeZoneChanged event → RefreshFromSettings() → 无动画更新所有数字
|
||||
```
|
||||
|
||||
## 7. 预期成果
|
||||
|
||||
- 在桌面组件选择器中新增 "StandBy Clock" 组件,位于 Clock 分类
|
||||
- 拖放到桌面后显示 4×2 大数字时钟
|
||||
- 数字切换时有流畅的垂直滑动动画
|
||||
- 冒号有呼吸闪烁效果
|
||||
- 支持日间/夜间自动切换
|
||||
- 支持时区配置
|
||||
- 支持组件缩放(2:1 比例规则)
|
||||
52
.comate/specs/standby-digital-clock/summary.md
Normal file
52
.comate/specs/standby-digital-clock/summary.md
Normal file
@@ -0,0 +1,52 @@
|
||||
# StandBy Digital Clock 实现总结
|
||||
|
||||
## 完成状态
|
||||
全部任务已完成,构建通过(0 错误)。
|
||||
|
||||
## 变更清单
|
||||
|
||||
### 新增文件
|
||||
| 文件 | 说明 |
|
||||
|------|------|
|
||||
| `LanMountainDesktop/Views/Components/StandbyDigitalClockWidget.axaml` | AXAML 布局:不规则自由排版数字 + 冒号 + 日期,Monet 主题色绑定 |
|
||||
| `LanMountainDesktop/Views/Components/StandbyDigitalClockWidget.axaml.cs` | 代码后置:数字滚动动画、冒号呼吸、Monet 主题色、日/夜模式、时区支持 |
|
||||
|
||||
### 修改文件
|
||||
| 文件 | 改动 |
|
||||
|------|------|
|
||||
| `LanMountainDesktop/ComponentSystem/BuiltInComponentIds.cs` | 新增 `DesktopStandbyDigitalClock` 常量 |
|
||||
| `LanMountainDesktop/ComponentSystem/ComponentRegistry.cs` | 在 `CreateDefault()` 中新增 4×2 Clock 分类组件定义 |
|
||||
| `LanMountainDesktop/Views/Components/DesktopComponentRuntimeRegistry.cs` | 新增 `StandbyDigitalClockWidget` 运行时注册 |
|
||||
| `LanMountainDesktop/Views/MainWindow.ComponentSystem.cs` | `NormalizeAspectRatioForComponent` 将 StandbyDigitalClock 加入 2:1 缩放规则 |
|
||||
|
||||
## 核心设计要点
|
||||
|
||||
### 不规则自由排版(iPhone StandBy 风格)
|
||||
- 每个数字有独立的垂直 Margin 偏移(H1 上移10, H2 下移8, M1 上移5, M2 下移10)
|
||||
- 冒号比数字中心略低(下移6)
|
||||
- 数字间距不等,营造自由散漫的视觉节奏
|
||||
|
||||
### Monet 主题色
|
||||
- 数字和冒号使用 `AdaptiveAccentBrush` / `SystemAccentColor`,跟随壁纸/用户选色的强调色
|
||||
- 通过 `ComponentColorSchemeHelper.ShouldUseMonetColor()` 判断:
|
||||
- 跟随系统:使用 Monet 提取的强调色
|
||||
- 原生模式:使用暖橙红色(`#E84530` 日间 / `#FF8A65` 夜间),灵感来自 iPhone StandBy
|
||||
- 日期文本使用 `AdaptiveTextMutedBrush`
|
||||
|
||||
### 数字滚动动画
|
||||
- `TranslateTransform.Y` + `DoubleTransition`(200ms CubicEaseOut)
|
||||
- 动画完成后清理旧 TextBlock 并重置 transform
|
||||
|
||||
### 冒号呼吸
|
||||
- 每秒切换 Opacity(1.0 ↔ 0.25),配合 400ms CubicEaseInOut 平滑过渡
|
||||
|
||||
### 日/夜模式
|
||||
- 检测 `ActualThemeVariant` + `AdaptiveSurfaceBaseBrush` 亮度计算
|
||||
- 夜间:深色渐变背景 + 亮调强调色数字
|
||||
- 日间:浅色渐变背景 + 深调强调色数字
|
||||
|
||||
### 组件规格
|
||||
- 尺寸:4×2 (MinWidthCells=4, MinHeightCells=2)
|
||||
- 分类:Clock
|
||||
- 缩放:2:1 比例 (Proportional)
|
||||
- 字体:FontWeight.Bold, 120px 基准
|
||||
25
.comate/specs/standby-digital-clock/tasks.md
Normal file
25
.comate/specs/standby-digital-clock/tasks.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# StandBy Digital Clock 任务计划
|
||||
|
||||
- [x] Task 1: 注册组件定义与运行时
|
||||
- 1.1: 在 `BuiltInComponentIds.cs` 中新增 `DesktopStandbyDigitalClock` 常量
|
||||
- 1.2: 在 `ComponentRegistry.cs` 的 `CreateDefault()` 中新增 `DesktopComponentDefinition`(4×2, Clock 分类, Proportional)
|
||||
- 1.3: 在 `DesktopComponentRuntimeRegistry.cs` 的 `GetDefaultRegistrations()` 中新增运行时注册项
|
||||
- 1.4: 在 `MainWindow.ComponentSystem.cs` 的 `NormalizeAspectRatioForComponent()` 中为 StandbyDigitalClock 添加 2:1 缩放规则
|
||||
|
||||
- [x] Task 2: 创建 StandbyDigitalClockWidget AXAML 布局
|
||||
- 2.1: 创建 `StandbyDigitalClockWidget.axaml`,定义 RootBorder(DesignCornerRadiusComponent)、Viewbox、时间数字区域(4 个 ClipToBounds 数位容器 + 冒号)、日期文本
|
||||
- 2.2: 确保 Viewbox 内基准设计尺寸为 400×200,数字使用 FontWeight.Bold,冒号和日期布局合理
|
||||
|
||||
- [x] Task 3: 实现组件代码后置(核心逻辑与动画)
|
||||
- 3.1: 创建 `StandbyDigitalClockWidget.axaml.cs`,实现 `IDesktopComponentWidget`, `ITimeZoneAwareComponentWidget`, `IComponentPlacementContextAware`, `IComponentRuntimeContextAware` 接口
|
||||
- 3.2: 实现 DispatcherTimer 每秒更新逻辑,比较新旧时间数字,触发数位滚动动画
|
||||
- 3.3: 实现数字垂直滚动动画:每位数字使用 TranslateTransform.Y + DoubleTransition,旧数字上滑出新数字滑入,动画完成后清理
|
||||
- 3.4: 实现冒号呼吸动画:每秒切换透明度,配合 DoubleTransition 平滑过渡
|
||||
- 3.5: 实现日间/夜间模式切换:检测 ActualThemeVariant 和亮度,切换背景渐变和数字颜色;夜间暗光环境过渡到红色调
|
||||
- 3.6: 实现 ApplyCellSize 缩放逻辑,clamp 缩放因子,更新圆角和间距
|
||||
- 3.7: 实现时区设置加载(复用 AnalogClockWidget 逻辑),点击打开世界时钟 AirApp
|
||||
- 3.8: 实现日期文本更新逻辑,显示完整日期和星期
|
||||
|
||||
- [x] Task 4: 构建验证与调试
|
||||
- 4.1: 执行 `dotnet build` 确保编译通过,修复所有错误
|
||||
- 4.2: 检查圆角规范合规性(根容器使用 DesignCornerRadiusComponent)
|
||||
432
.cursor/plans/launcher_单项目解耦_302f1ec6.plan.md
Normal file
432
.cursor/plans/launcher_单项目解耦_302f1ec6.plan.md
Normal file
@@ -0,0 +1,432 @@
|
||||
---
|
||||
name: Launcher 单项目解耦
|
||||
overview: 在保持单一 LanMountainDesktop.Launcher 项目、单一 exe、零部署风险的前提下,按职责域增量重构:目录分层、RunAsync→Pipeline+Phase、UpdateEngine→策略类、App→纯 Avalonia+LauncherOrchestrator;执行过程中由 Agent 自主 Git 提交,每域可编译可测。
|
||||
todos:
|
||||
- id: phase-a-diagnostics
|
||||
content: Phase A:Startup 诊断 + HostStartupMonitor 独立类 + AOT 启动检测竞态修复 + 测试
|
||||
status: completed
|
||||
- id: phase-b-directory
|
||||
content: Phase B1:职责域目录迁移(Deployment/Update/Startup/Oobe/Plugins/Infrastructure),零逻辑变更,提交
|
||||
status: completed
|
||||
- id: phase-b-pipeline
|
||||
content: Phase B2:RunAsync→LaunchPipeline+ILaunchPhase,引入 LauncherOrchestrator,删除 LauncherFlowCoordinator,提交
|
||||
status: completed
|
||||
- id: phase-b-app-slim
|
||||
content: Phase B3:App.axaml.cs 精简为纯 Avalonia 初始化 + 委托 LauncherOrchestrator,提交
|
||||
status: completed
|
||||
- id: phase-c-di
|
||||
content: Phase C:LauncherServiceRegistration + 轻量 MS DI,统一 CLI/GUI 装配,提交
|
||||
status: completed
|
||||
- id: phase-d-update-split
|
||||
content: Phase D:UpdateEngineService→门面+策略类(Verifier/Activator/Rollback 等),提交
|
||||
status: completed
|
||||
- id: phase-e-guardrails
|
||||
content: Phase E:LauncherArchitectureTests + 文档 + AOT 回归,提交
|
||||
status: completed
|
||||
isProject: false
|
||||
---
|
||||
|
||||
# Launcher 单项目内部解耦改造计划(执行版)
|
||||
|
||||
## 0. 硬性约束
|
||||
|
||||
|
||||
| 约束 | 说明 |
|
||||
| ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| **单项目** | 仅 `[LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj](LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj)`,不新建 Launcher.* 独立程序集 |
|
||||
| **单 exe** | 仍只发布 `LanMountainDesktop.Launcher.exe`(AOT 单文件) |
|
||||
| **零部署风险** | 不改变安装包目录结构、不引入新进程、不改变 Public IPC / Coordinator IPC 拓扑与契约 |
|
||||
| **增量重构** | 一个职责域一域推进,每步 `dotnet build` + 相关 `dotnet test` 通过后再进下一步 |
|
||||
| **单进程性能** | 模块间仅 in-process 接口调用,不为解耦新增 IPC |
|
||||
| **未来可拆** | 各域暴露 `I`* 接口,将来若需多进程可直接复用契约 |
|
||||
| **Git 自主提交** | Agent 在每个职责域完成且验证通过后 **自动 commit**,无需用户手动提交(见 §8) |
|
||||
|
||||
|
||||
外部共享库 `[LanMountainDesktop.PluginPackaging](LanMountainDesktop.PluginPackaging/)` 保留(Host + Launcher CLI 共用),不属于 Launcher 拆分。
|
||||
|
||||
---
|
||||
|
||||
## 1. 验收标准(必须全部满足)
|
||||
|
||||
### 1.1 零部署风险
|
||||
|
||||
- Inno Setup / CI 产物仍只有:`LanMountainDesktop.Launcher.exe` + `app-{version}/` + `.launcher/`
|
||||
- Host 调用 Launcher 的 CLI 参数、`launch-source`、`apply-update` 路径不变
|
||||
- Public IPC routes(`lanmountain.launcher.startup-progress`、`loading-state`)与 Coordinator pipe 不变
|
||||
- VeloPack / 更新 apply 状态机(`.current/.partial/.destroy`)行为不变
|
||||
|
||||
### 1.2 增量可验证
|
||||
|
||||
- 每个 Phase 结束:编译绿 + 该域新增/既有测试绿
|
||||
- 允许「纯移动文件」的 PR 单独提交,行为 diff 为零
|
||||
|
||||
### 1.3 测试友好
|
||||
|
||||
- `Startup/`、`Update/`、`Deployment/` 内类型 **无 Avalonia 依赖**,可独立单元测试
|
||||
- 每个 `ILaunchPhase`、每个 Update 策略类各有对应测试类
|
||||
- 保留并扩展现有 `[LauncherStartupTimeoutPolicyTests](LanMountainDesktop.Tests/LauncherStartupTimeoutPolicyTests.cs)`、`[LauncherMultiInstancePolicyTests](LanMountainDesktop.Tests/LauncherMultiInstancePolicyTests.cs)`
|
||||
|
||||
### 1.4 启动性能
|
||||
|
||||
- Pipeline 阶段为同步/异步方法调用链,不引入额外进程或网络
|
||||
- DI 容器仅在进程入口构建一次;Stage/Phase 实例可复用 Singleton
|
||||
|
||||
### 1.5 代码结构目标
|
||||
|
||||
|
||||
| 对象 | 当前(实测) | 目标 |
|
||||
| ----------------------------------- | -------------------------------------------- | --------------------------------------------------- |
|
||||
| `LauncherFlowCoordinator` 全 partial | ~1880 行(859+568+279+…) | **删除**;逻辑迁入 Pipeline + Phases |
|
||||
| `RunAsync()` 等价逻辑 | 跨 partial ~800+ 行 while/阶段混杂 | **≤80 行** 编排入口,细节在各 Phase |
|
||||
| `UpdateEngineService` | ~1622 行 | 门面 **≤200 行** + 6 个策略类各 **≤300 行** |
|
||||
| `App.axaml.cs` | ~258 行(已部分瘦身) | **≤120 行**:纯 Avalonia + 一行委托 `LauncherOrchestrator` |
|
||||
| `LauncherOrchestrator` | 不存在(逻辑在 Coordinator + CompositionRoot 546 行) | **≤250 行**:GUI 入口编排 |
|
||||
| `LauncherCompositionRoot` | ~546 行 | **≤150 行**:仅 DI 构建 + 入口分发 |
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 2. 目标架构
|
||||
|
||||
### 2.1 核心类型关系
|
||||
|
||||
```mermaid
|
||||
flowchart TB
|
||||
Program --> EntryRouter
|
||||
App --> LauncherOrchestrator
|
||||
EntryRouter --> LauncherOrchestrator
|
||||
LauncherOrchestrator --> LaunchPipeline
|
||||
LaunchPipeline --> Phase1[CleanupPhase]
|
||||
LaunchPipeline --> Phase2[OobeGatePhase]
|
||||
LaunchPipeline --> Phase3[ApplyUpdatePhase]
|
||||
LaunchPipeline --> Phase4[LaunchHostPhase]
|
||||
LaunchPipeline --> Phase5[MonitorStartupPhase]
|
||||
Phase3 --> IUpdateEngine
|
||||
Phase4 --> IDeploymentLocator
|
||||
Phase5 --> IHostStartupMonitor
|
||||
LauncherCompositionRoot --> ServiceProvider
|
||||
ServiceProvider --> LaunchPipeline
|
||||
```
|
||||
|
||||
|
||||
|
||||
**命名约定:**
|
||||
|
||||
- `**LauncherOrchestrator`**:GUI 生命周期内的唯一编排入口(取代 `LauncherFlowCoordinator` 对外角色)
|
||||
- `**LaunchPipeline**`:按序执行 `ILaunchPhase` 列表
|
||||
- `**ILaunchPhase**`:原 `ILaunchPipelineStage`;每个 Phase 对应原 `RunAsync` 中一个职责段
|
||||
|
||||
### 2.2 职责域目录(单项目内)
|
||||
|
||||
```
|
||||
LanMountainDesktop.Launcher/
|
||||
├── Program.cs # CLI / GUI 路由
|
||||
├── App.axaml.cs # 纯 Avalonia(≤120 行)
|
||||
├── Shell/
|
||||
│ ├── LauncherOrchestrator.cs # GUI 编排入口
|
||||
│ ├── LauncherCompositionRoot.cs # DI + Entry 分发
|
||||
│ ├── LaunchPipeline.cs
|
||||
│ ├── Phases/ # ILaunchPhase 实现
|
||||
│ │ ├── CleanupDeploymentsPhase.cs
|
||||
│ │ ├── OobeGatePhase.cs
|
||||
│ │ ├── ApplyPendingUpdatePhase.cs
|
||||
│ │ ├── LaunchHostPhase.cs
|
||||
│ │ └── MonitorStartupPhase.cs
|
||||
│ └── EntryHandlers/ # apply-update / air-app-broker / attach
|
||||
├── Deployment/
|
||||
├── Update/
|
||||
│ ├── IUpdateEngine.cs
|
||||
│ ├── UpdateEngineFacade.cs # 原 UpdateEngineService 门面
|
||||
│ └── Strategies/
|
||||
│ ├── PendingUpdateDetector.cs
|
||||
│ ├── UpdatePackageVerifier.cs
|
||||
│ ├── DeploymentActivator.cs
|
||||
│ ├── UpdateSnapshotStore.cs
|
||||
│ ├── RollbackStrategy.cs
|
||||
│ └── IncomingArtifactsCleaner.cs
|
||||
├── Startup/
|
||||
├── Oobe/
|
||||
├── Ipc/
|
||||
├── AirApp/
|
||||
├── Plugins/
|
||||
├── Infrastructure/
|
||||
├── Models/
|
||||
└── Views/
|
||||
```
|
||||
|
||||
### 2.3 模块依赖规则
|
||||
|
||||
- `Deployment/`、`Update/`、`Startup/`:**禁止** `using Avalonia`
|
||||
- `Views/`:**禁止** 引用具体 `UpdateEngineFacade` / `DeploymentLocator`(仅接口或 Orchestrator)
|
||||
- 跨域:**仅通过 `I`* 接口**;Orchestrator/Pipeline 负责装配
|
||||
|
||||
### 2.4 与 Host 边界(不变)
|
||||
|
||||
|
||||
| 能力 | Owner |
|
||||
| -------------------------- | ------------------------------ |
|
||||
| OOBE / Splash / 多实例 / 启动检测 | Launcher `Startup/` + `Shell/` |
|
||||
| 更新 apply / rollback | Launcher `Update/` |
|
||||
| 插件市场 / pending | Host + PluginPackaging |
|
||||
| 更新 download | Host → spawn Launcher apply |
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 3. 三大核心拆分(用户指定)
|
||||
|
||||
### 3.1 拆分 `LauncherFlowCoordinator`:`RunAsync` → Pipeline + Phase
|
||||
|
||||
**现状:** 逻辑分散在 4 个 partial,等效一个 1800+ 行 God Class;`RunAsync` 内含清理、OOBE、更新、启动、IPC 监听、超时 while-loop、多实例分支。
|
||||
|
||||
**目标 API(单项目 `Shell/` 内):**
|
||||
|
||||
```csharp
|
||||
internal interface ILaunchPhase
|
||||
{
|
||||
string PhaseId { get; }
|
||||
/// <returns>null = 继续下一阶段;非 null = 管道终止并返回结果</returns>
|
||||
Task<LauncherResult?> ExecuteAsync(LaunchContext context, CancellationToken cancellationToken);
|
||||
}
|
||||
|
||||
internal sealed class LaunchPipeline
|
||||
{
|
||||
public LaunchPipeline(IEnumerable<ILaunchPhase> phases) { ... }
|
||||
public Task<LauncherResult> RunAsync(LaunchContext context, CancellationToken ct);
|
||||
}
|
||||
```
|
||||
|
||||
**Phase 映射(与原 RunAsync 步骤一一对应):**
|
||||
|
||||
|
||||
| Phase | 原 RunAsync 段 | 产出 |
|
||||
| ------------------------- | --------------------------------------- | ----------------------------- |
|
||||
| `CleanupDeploymentsPhase` | `CleanupOldDeployments` | 无 UI |
|
||||
| `ExistingHostProbePhase` | 多实例 / Public IPC 探测 | 可短路成功 |
|
||||
| `ApplyPendingUpdatePhase` | `_updateEngine.ApplyPendingUpdateAsync` | 失败仍继续 |
|
||||
| `OobeGatePhase` | migration + OOBE steps | UI via `ILauncherUiPresenter` |
|
||||
| `LaunchHostPhase` | `LaunchHostWithIpcAsync` | Process + plan |
|
||||
| `MonitorStartupPhase` | while-loop + IPC + timeout | 调用 `IHostStartupMonitor` |
|
||||
|
||||
|
||||
`**LauncherOrchestrator` 职责:**
|
||||
|
||||
- 接收 `SplashWindow`、构建 `LaunchContext`(含 reporter、attempt registry、coordinator server)
|
||||
- 调用 `LaunchPipeline.RunAsync`
|
||||
- 管理 Splash/Error 窗口生命周期(委托 `ILauncherUiPresenter`)
|
||||
- **不含** 更新/部署/IPC 细节
|
||||
|
||||
**删除清单:** `LauncherFlowCoordinator.cs` 及全部 partial 文件。
|
||||
|
||||
---
|
||||
|
||||
### 3.2 拆分 `UpdateEngineService` → 门面 + 策略类
|
||||
|
||||
**现状:** ~1622 行单文件,混合检测、验签、解压、激活、快照、回滚、清理。
|
||||
|
||||
**目标结构:**
|
||||
|
||||
```
|
||||
Update/
|
||||
├── IUpdateEngine.cs # 对外契约(未来多进程可原样抽出)
|
||||
├── UpdateEngineFacade.cs # 门面,编排策略,≤200 行
|
||||
└── Strategies/
|
||||
├── IUpdateStrategy.cs # 可选:各策略统一接口
|
||||
├── PendingUpdateDetector.cs # CheckPendingUpdate
|
||||
├── UpdatePackageVerifier.cs # manifest + RSA 签名
|
||||
├── UpdatePackageExtractor.cs # 解压 / 增量复用
|
||||
├── DeploymentActivator.cs # .current / .partial / .destroy
|
||||
├── UpdateSnapshotStore.cs # snapshots 读写
|
||||
├── RollbackStrategy.cs # rollback CLI/GUI
|
||||
└── IncomingArtifactsCleaner.cs # CleanupIncomingArtifacts
|
||||
```
|
||||
|
||||
**门面方法映射:**
|
||||
|
||||
|
||||
| 原 `UpdateEngineService` 公开方法 | 委托策略 |
|
||||
| ---------------------------- | ------------------------------------------------------ |
|
||||
| `CheckPendingUpdate()` | `PendingUpdateDetector` |
|
||||
| `ApplyPendingUpdateAsync()` | Detector → Verifier → Extractor → Activator → Snapshot |
|
||||
| `RollbackLatest()` | `RollbackStrategy` |
|
||||
| `CleanupIncomingArtifacts()` | `IncomingArtifactsCleaner` |
|
||||
| `DownloadAsync()`(若有) | 保持或拆 `UpdateDownloader` |
|
||||
|
||||
|
||||
**测试:** 每个 Strategy 独立 mock `IDeploymentLocator` / 文件系统,不启 Avalonia。
|
||||
|
||||
---
|
||||
|
||||
### 3.3 精简 `App.axaml.cs` → 纯 Avalonia + `LauncherOrchestrator`
|
||||
|
||||
**现状:** ~258 行,仍含 apply-update、air-app-broker、preview、coordinator attach 等分支。
|
||||
|
||||
**目标结构:**
|
||||
|
||||
```csharp
|
||||
// App.axaml.cs 目标形态(概念)
|
||||
public override void OnFrameworkInitializationCompleted()
|
||||
{
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
var context = LauncherRuntimeContext.Current;
|
||||
var mode = LauncherEntryModeResolver.Resolve(context);
|
||||
_ = LauncherOrchestrator.RunAsync(desktop, context, mode);
|
||||
}
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
}
|
||||
```
|
||||
|
||||
**从 App 迁出的逻辑 → `Shell/EntryHandlers/`:**
|
||||
|
||||
|
||||
| 现 App 分支 | 新 Handler |
|
||||
| ----------------- | -------------------------------------- |
|
||||
| `launch` + splash | `GuiLaunchEntryHandler` → Orchestrator |
|
||||
| `apply-update` | `ApplyUpdateEntryHandler` |
|
||||
| `air-app-broker` | `AirAppBrokerEntryHandler` |
|
||||
| debug preview | `PreviewEntryHandler` |
|
||||
|
||||
|
||||
**验收:** `App.axaml.cs` ≤120 行;不含 `new UpdateEngineService` / `new DeploymentLocator` / while-loop。
|
||||
|
||||
---
|
||||
|
||||
## 4. 分阶段执行顺序与 Git 提交点
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
A[Phase A Startup] --> B1[Phase B1 目录迁移]
|
||||
B1 --> B2[Phase B2 Pipeline+Orchestrator]
|
||||
B2 --> B3[Phase B3 App 精简]
|
||||
B3 --> C[Phase C DI]
|
||||
B1 --> D[Phase D Update 策略拆分]
|
||||
C --> E[Phase E 守卫+文档+AOT回归]
|
||||
D --> E
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Phase A:Startup 子系统 + AOT 生产 bug(优先)
|
||||
|
||||
- 抽出 `Startup/HostStartupMonitor.cs`(从 partial 独立)
|
||||
- 修复 IPC 连接退避、成功判定统一走 `StartupSuccessTracker`
|
||||
- Host 侧 `DesktopVisible` 上报对齐(仅日志/时序,不改 IPC 契约)
|
||||
- 测试 + `**git commit**`: `fix(launcher): extract HostStartupMonitor and harden startup detection`
|
||||
|
||||
### Phase B1:目录迁移(零逻辑变更)
|
||||
|
||||
- 物理移动文件到 `Deployment/`、`Update/`、`Startup/` 等,更新 namespace
|
||||
- `dotnet build` + test
|
||||
- `**git commit**`: `refactor(launcher): reorganize into responsibility folders`
|
||||
|
||||
### Phase B2:Pipeline + Phase + LauncherOrchestrator
|
||||
|
||||
- 实现 `ILaunchPhase`、`LaunchPipeline`、`LauncherOrchestrator`
|
||||
- 逐 Phase 从 Coordinator 迁移逻辑(可先并行运行对照测试)
|
||||
- 删除 `LauncherFlowCoordinator*`
|
||||
- `**git commit**`: `refactor(launcher): replace LauncherFlowCoordinator with LaunchPipeline`
|
||||
|
||||
### Phase B3:App.axaml.cs 精简
|
||||
|
||||
- EntryHandlers 提取;App 仅 Avalonia + Orchestrator 委托
|
||||
- `**git commit**`: `refactor(launcher): slim App.axaml.cs to Avalonia shell only`
|
||||
|
||||
### Phase C:轻量 DI
|
||||
|
||||
- `LauncherServiceRegistration.cs` + `Microsoft.Extensions.DependencyInjection`
|
||||
- Program / CliHost / CompositionRoot 统一 `ServiceProvider`
|
||||
- `**git commit**`: `refactor(launcher): add composition-root DI wiring`
|
||||
|
||||
### Phase D:UpdateEngine 策略拆分(可与 B2 并行,依赖 B1)
|
||||
|
||||
- 策略类提取 + `UpdateEngineFacade`
|
||||
- 删除原巨型 `UpdateEngineService.cs`
|
||||
- 每策略测试
|
||||
- `**git commit**`: `refactor(launcher): split UpdateEngine into strategy classes`
|
||||
|
||||
### Phase E:守卫 + 文档 + AOT 回归
|
||||
|
||||
- `LauncherArchitectureTests`(命名空间依赖规则)
|
||||
- 更新 `[docs/LAUNCHER.md](docs/LAUNCHER.md)`、`[.trae/specs/launcher-shell-hardening/spec.md](.trae/specs/launcher-shell-hardening/spec.md)`
|
||||
- AOT publish 本地 smoke:launch / apply-update / 多实例 / 启动检测
|
||||
- `**git commit**`: `docs(launcher): document module boundaries and add architecture tests`
|
||||
|
||||
---
|
||||
|
||||
## 5. Phase / Service 测试矩阵
|
||||
|
||||
|
||||
| 组件 | 测试文件 | 覆盖点 |
|
||||
| ----------------------- | ---------------------------- | --------------------------------- |
|
||||
| `StartupSuccessTracker` | `StartupSuccessTrackerTests` | Foreground/Tray/Background policy |
|
||||
| `HostStartupMonitor` | `HostStartupMonitorTests` | 超时、IPC 延迟、ShellStatus 轮询 |
|
||||
| `LaunchPipeline` | `LaunchPipelineTests` | Phase 短路、失败传播 |
|
||||
| 各 `ILaunchPhase` | `*PhaseTests` | 单阶段 mock |
|
||||
| `PendingUpdateDetector` | `PendingUpdateDetectorTests` | 无 pending / corrupt |
|
||||
| `DeploymentActivator` | `DeploymentActivatorTests` | 标记文件状态机 |
|
||||
| `RollbackStrategy` | `RollbackStrategyTests` | 快照回退 |
|
||||
| 命名空间规则 | `LauncherArchitectureTests` | 无 Avalonia 泄漏 |
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 6. 明确不做
|
||||
|
||||
- 不新建 csproj(Launcher.Deployment 等)
|
||||
- 不新建 exe / Windows Service
|
||||
- 不改变 Public IPC / Coordinator IPC 协议
|
||||
- 不把插件市场安装迁回 Launcher
|
||||
- 不为模块间通信引入新 IPC(仅保留现有 Host↔Launcher 契约)
|
||||
|
||||
---
|
||||
|
||||
## 7. 风险与缓解
|
||||
|
||||
|
||||
| 风险 | 缓解 |
|
||||
| --------------- | ------------------------------------------------------------------ |
|
||||
| 大规模移动 merge 冲突 | B1 独立 commit,零逻辑变更 |
|
||||
| Pipeline 迁移行为回归 | 先写 Phase 级测试再迁代码;保留 `LMD_LAUNCHER_LEGACY_COORDINATOR=1` 开关一个版本(可选) |
|
||||
| AOT + DI | 显式注册,禁止反射扫描;`PublishAot` CI 步骤验证 |
|
||||
| Update 拆分遗漏路径 | CLI `update *` 与 GUI apply-update 同一 `IUpdateEngine` 门面 |
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 8. Git 工作流(Agent 自主提交)
|
||||
|
||||
**原则:** 每个 Phase 验证通过后立即提交;不累积巨型 uncommitted diff。
|
||||
|
||||
**Commit 前检查(每个 commit 必做):**
|
||||
|
||||
```bash
|
||||
dotnet build LanMountainDesktop.slnx -c Debug
|
||||
dotnet test LanMountainDesktop.slnx -c Debug --filter "FullyQualifiedName~Launcher"
|
||||
```
|
||||
|
||||
**Commit message 风格(与仓库一致):**
|
||||
|
||||
```
|
||||
refactor(launcher): replace LauncherFlowCoordinator with LaunchPipeline
|
||||
|
||||
Pipeline + Phase pattern; LauncherOrchestrator becomes GUI entry.
|
||||
No deployment or IPC contract changes.
|
||||
```
|
||||
|
||||
**禁止:** `git push --force`、修改 git config、跳过 hooks(除非 hook 失败需修复后新 commit)。
|
||||
|
||||
**建议分支:** `refactor/launcher-internal-modularization`(单 long-lived 分支,按 Phase 连续 commit;或每 Phase 一个 PR 由用户决定 merge 时机)。
|
||||
|
||||
---
|
||||
|
||||
## 9. 整体完成定义(Definition of Done)
|
||||
|
||||
- 无 `LauncherFlowCoordinator` 源文件
|
||||
- `App.axaml.cs` ≤120 行,仅 Avalonia + Orchestrator 委托
|
||||
- `UpdateEngineService` 巨型文件已替换为 Facade + Strategies
|
||||
- 职责域目录就位,架构测试通过
|
||||
- 全量 Launcher 相关测试 + AOT publish smoke 通过
|
||||
- 安装包结构与 IPC 拓扑与重构前一致
|
||||
- 每个 Phase 有对应 Git commit,工作区 clean
|
||||
|
||||
1
.cursor/skills/.gitkeep
Normal file
1
.cursor/skills/.gitkeep
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
152
.github/VERSION_SYNC_INFO.md
vendored
152
.github/VERSION_SYNC_INFO.md
vendored
@@ -1,127 +1,65 @@
|
||||
# 版本号自动同步说明
|
||||
# 版本同步说明
|
||||
|
||||
## 📋 概述
|
||||
## 目标
|
||||
|
||||
从本次更新开始,Release 工作流已配置为**自动同步版本号**,确保应用的每个版本号来源都保持一致。
|
||||
发布版的用户可见版本必须统一指向“应用版本”,不能再出现:
|
||||
|
||||
## 🔄 版本号流转链路
|
||||
- Launcher UI 显示 `1.0.0`
|
||||
- 应用设置页显示 `0.8.x`
|
||||
- `version.json`、安装包、Release 资产名称各写各的
|
||||
|
||||
```
|
||||
Git Tag (v1.0.1)
|
||||
↓
|
||||
[Release 工作流 prepare 任务]
|
||||
↓
|
||||
提取版本号: 1.0.1
|
||||
↓
|
||||
[Update version in .csproj] ✨ 新增步骤
|
||||
↓
|
||||
自动更新 .csproj 文件版本号
|
||||
↓
|
||||
dotnet restore/build
|
||||
↓
|
||||
构建时读取更新后的版本号
|
||||
↓
|
||||
应用内显示版本号 (MainWindow.Localization.cs 动态读取)
|
||||
```
|
||||
## 默认仓库状态
|
||||
|
||||
## 🎯 工作原理
|
||||
仓库内的静态版本现在故意保留为开发占位值:
|
||||
|
||||
### 1. 版本号提取
|
||||
当推送 Git Tag 时(如 `git tag v1.0.1`),Release 工作流的 `prepare` 任务自动提取版本号:
|
||||
- TAG: `v1.0.1` → VERSION: `1.0.1`
|
||||
- `Directory.Build.props`
|
||||
- `LanMountainDesktop/LanMountainDesktop.csproj`
|
||||
- `LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj`
|
||||
- `LanMountainDesktop.Shared.Contracts/LanMountainDesktop.Shared.Contracts.csproj`
|
||||
- `LanMountainDesktop/app.manifest`
|
||||
- `LanMountainDesktop.Launcher/app.manifest`
|
||||
|
||||
### 2. 自动更新 .csproj
|
||||
在三个平台的构建任务中,新增了 **"Update version in .csproj"** 步骤:
|
||||
这些值只是提醒“当前不是正式注入构建”,不能代表发布版本。
|
||||
|
||||
**Windows (PowerShell)**:
|
||||
```powershell
|
||||
$VERSION = "1.0.1"
|
||||
(Get-Content file.csproj) -replace '<Version>.*?</Version>', "<Version>$VERSION</Version>" | Set-Content file.csproj
|
||||
```
|
||||
## Release 工作流怎么做
|
||||
|
||||
**Linux/macOS (Bash)**:
|
||||
```bash
|
||||
VERSION="1.0.1"
|
||||
sed -i "s/<Version>.*<\/Version>/<Version>$VERSION<\/Version>/" file.csproj
|
||||
```
|
||||
Release 工作流会先从 tag 提取版本:
|
||||
|
||||
### 3. 构建和发布
|
||||
更新后的版本号被用于:
|
||||
- 程序集版本 (`AssemblyVersion`)
|
||||
- 包文件名 (`LanMountainDesktop-1.0.1-win-x64.zip`)
|
||||
- 应用内显示 (About 页面)
|
||||
- GitHub Release 标题
|
||||
- `v0.8.5.2` -> `0.8.5.2`
|
||||
- 程序集四段版本 -> `0.8.5.2`
|
||||
|
||||
## 📍 涉及的文件
|
||||
随后显式执行:
|
||||
|
||||
自动更新的文件:
|
||||
1. `LanMountainDesktop/LanMountainDesktop.csproj`
|
||||
- `scripts/Set-ReleaseVersion.ps1`
|
||||
|
||||
## ✅ 使用流程
|
||||
这个步骤会同步更新:
|
||||
|
||||
### 发布新版本
|
||||
- 主程序 `.csproj` 的 `Version`
|
||||
- Launcher `.csproj` 的 `Version`
|
||||
- Shared.Contracts `.csproj` 的 `Version`
|
||||
- `Directory.Build.props`
|
||||
- 主程序 `app.manifest`
|
||||
- Launcher `app.manifest`
|
||||
|
||||
```bash
|
||||
# 1. 更新代码(可选:代码中的版本号现在会自动更新)
|
||||
git add .
|
||||
git commit -m "feat: Add new features"
|
||||
之后构建和发布阶段继续通过 MSBuild 属性注入:
|
||||
|
||||
# 2. 创建版本标签
|
||||
git tag v1.0.1
|
||||
# 或带注释的标签
|
||||
git tag -a v1.0.1 -m "Release v1.0.1"
|
||||
- `Version`
|
||||
- `AssemblyVersion`
|
||||
- `FileVersion`
|
||||
- `InformationalVersion`
|
||||
|
||||
# 3. 推送标签到 GitHub
|
||||
git push origin v1.0.1
|
||||
因此最终会统一落到:
|
||||
|
||||
# 4. Release 工作流自动运行:
|
||||
# - 自动更新 .csproj 文件
|
||||
# - 构建所有平台
|
||||
# - 创建 GitHub Release
|
||||
# - 附带所有平台的发布包
|
||||
```
|
||||
- Launcher UI 读取到的应用版本
|
||||
- 应用设置页显示的版本
|
||||
- `version.json`
|
||||
- 程序集文件版本
|
||||
- Windows manifest
|
||||
- 安装包版本
|
||||
- GitHub Release 资产名称
|
||||
|
||||
## 🔒 版本号一致性保证
|
||||
## 维护规则
|
||||
|
||||
现在应用的三个版本号来源完全同步:
|
||||
|
||||
| 来源 | 说明 | 自动更新 |
|
||||
|------|------|--------|
|
||||
| `.csproj` <Version> | 项目文件版本 | ✅ 是 |
|
||||
| 程序集版本 | 编译时读取 | ✅ 是 |
|
||||
| 应用内显示 | About 页面 | ✅ 是 |
|
||||
| 发布包文件名 | Release 工作流 | ✅ 是 |
|
||||
| GitHub Release | Release 工作流 | ✅ 是 |
|
||||
|
||||
## ⚠️ 注意事项
|
||||
|
||||
### 不需要手动更新
|
||||
- ❌ 不需要在 `.csproj` 中手动修改 Version
|
||||
- ❌ 不需要修改多个地方的版本号
|
||||
|
||||
### 只需执行
|
||||
- ✅ 创建 Git Tag: `git tag v1.0.1`
|
||||
- ✅ 推送 Tag: `git push origin v1.0.1`
|
||||
- ✅ 其他由工作流自动处理
|
||||
|
||||
## 📊 版本号格式
|
||||
|
||||
支持的格式:
|
||||
- ✅ `v1.0.0` (builds -> 1.0.0)
|
||||
- ✅ `v1.2.3` (builds -> 1.2.3)
|
||||
- ✅ `v2.0.0-rc1` (builds -> 2.0.0-rc1, 如果需要)
|
||||
|
||||
## 🛠️ 工作流文件
|
||||
|
||||
更新的工作流文件:
|
||||
- `.github/workflows/release.yml` - Release 工作流
|
||||
|
||||
## 📝 相关文件
|
||||
|
||||
- [MULTIPLATFORM_RELEASE_GUIDE.md](./MULTIPLATFORM_RELEASE_GUIDE.md) - 多平台发布指南
|
||||
- [WORKFLOWS_GUIDE.md](./WORKFLOWS_GUIDE.md) - 工作流使用指南
|
||||
|
||||
---
|
||||
|
||||
**最后更新**: 2026-03-04
|
||||
**工作流版本**: 2.0 (自动版本同步)
|
||||
- 日常开发不要手动把仓库默认版本改成正式版本号。
|
||||
- 正式发版只需要打 tag,版本同步交给工作流。
|
||||
- 如果新增新的版本承载点,必须同时补到 `Set-ReleaseVersion.ps1` 和 Release 工作流里。
|
||||
|
||||
21
.github/workflows/build.yml
vendored
21
.github/workflows/build.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: Build
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -10,6 +10,7 @@ on:
|
||||
env:
|
||||
DOTNET_VERSION: '10.0.x'
|
||||
Solution_Name: LanMountainDesktop.slnx
|
||||
DOTNET_gcServer: 1
|
||||
|
||||
jobs:
|
||||
build-windows:
|
||||
@@ -31,6 +32,7 @@ jobs:
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
||||
dotnet-quality: 'preview'
|
||||
|
||||
- name: Restore
|
||||
run: dotnet restore ${{ env.Solution_Name }}
|
||||
@@ -63,12 +65,22 @@ jobs:
|
||||
sudo apt-get install -y \
|
||||
libfontconfig1 libfreetype6 \
|
||||
libx11-6 libxrandr2 libxinerama1 \
|
||||
libxi6 libxcursor1 libxext6
|
||||
libxi6 libxcursor1 libxext6 \
|
||||
libxrender1 libxkbcommon-x11-0 \
|
||||
clang zlib1g-dev
|
||||
|
||||
# Ubuntu 24.04+ moved several packages to t64 names.
|
||||
sudo apt-get install -y libasound2t64 || sudo apt-get install -y libasound2
|
||||
sudo apt-get install -y libportaudio2t64 || sudo apt-get install -y libportaudio2
|
||||
|
||||
# Prefer modern WebKit package, fallback for older images.
|
||||
sudo apt-get install -y libwebkit2gtk-4.1-dev || sudo apt-get install -y libwebkit2gtk-4.0-dev
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
||||
dotnet-quality: 'preview'
|
||||
|
||||
- name: Restore
|
||||
run: dotnet restore ${{ env.Solution_Name }}
|
||||
@@ -95,10 +107,14 @@ jobs:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: Install dependencies
|
||||
run: brew install portaudio
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
||||
dotnet-quality: 'preview'
|
||||
|
||||
- name: Restore
|
||||
run: dotnet restore ${{ env.Solution_Name }}
|
||||
@@ -129,6 +145,7 @@ jobs:
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
||||
dotnet-quality: 'preview'
|
||||
|
||||
- name: Pack SDK and template packages
|
||||
shell: pwsh
|
||||
|
||||
6
.github/workflows/code-quality.yml
vendored
6
.github/workflows/code-quality.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: Quality Check
|
||||
name: Quality Check
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
@@ -9,6 +9,7 @@ on:
|
||||
env:
|
||||
DOTNET_VERSION: '10.0.x'
|
||||
Solution_Name: LanMountainDesktop.slnx
|
||||
DOTNET_gcServer: 1
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
@@ -24,12 +25,13 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
||||
dotnet-quality: 'preview'
|
||||
|
||||
- name: Restore
|
||||
run: dotnet restore ${{ env.Solution_Name }}
|
||||
|
||||
276
.github/workflows/plonds-comparator.yml
vendored
Normal file
276
.github/workflows/plonds-comparator.yml
vendored
Normal file
@@ -0,0 +1,276 @@
|
||||
name: PLONDS Comparator
|
||||
|
||||
concurrency:
|
||||
group: plonds-${{ github.event_name }}-${{ github.event.release.tag_name || github.event.inputs.tag || github.run_id }}
|
||||
cancel-in-progress: false
|
||||
|
||||
on:
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
- prereleased
|
||||
- edited
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'Release tag'
|
||||
required: true
|
||||
type: string
|
||||
baseline_tag:
|
||||
description: 'Optional baseline tag'
|
||||
required: false
|
||||
type: string
|
||||
channel:
|
||||
description: 'Update channel'
|
||||
required: false
|
||||
type: choice
|
||||
default: stable
|
||||
options:
|
||||
- stable
|
||||
- preview
|
||||
|
||||
env:
|
||||
DOTNET_VERSION: '10.0.x'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: Resolve release context
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == "release" ]]; then
|
||||
TAG="${{ github.event.release.tag_name }}"
|
||||
if [[ "${{ github.event.release.prerelease }}" == "true" ]]; then
|
||||
CHANNEL="preview"
|
||||
else
|
||||
CHANNEL="stable"
|
||||
fi
|
||||
BASELINE_TAG=""
|
||||
else
|
||||
RAW_TAG="${{ github.event.inputs.tag }}"
|
||||
if [[ "${RAW_TAG}" == v* ]]; then
|
||||
TAG="${RAW_TAG}"
|
||||
else
|
||||
TAG="v${RAW_TAG}"
|
||||
fi
|
||||
CHANNEL="${{ github.event.inputs.channel }}"
|
||||
BASELINE_TAG="${{ github.event.inputs.baseline_tag }}"
|
||||
fi
|
||||
|
||||
echo "RELEASE_TAG=${TAG}" >> "$GITHUB_ENV"
|
||||
echo "RELEASE_VERSION=${TAG#v}" >> "$GITHUB_ENV"
|
||||
echo "RELEASE_CHANNEL=${CHANNEL}" >> "$GITHUB_ENV"
|
||||
echo "BASELINE_TAG_INPUT=${BASELINE_TAG}" >> "$GITHUB_ENV"
|
||||
PUBLIC_BASE="${{ vars.S3_PUBLIC_BASE_URL }}"
|
||||
if [[ -z "$PUBLIC_BASE" ]]; then
|
||||
PUBLIC_BASE="https://cn-nb1.rains3.com/lmdesktop/lanmountain/update"
|
||||
fi
|
||||
echo "S3_PUBLIC_BASE_URL=${PUBLIC_BASE%/}" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
||||
dotnet-quality: preview
|
||||
|
||||
- name: Prepare signing key
|
||||
env:
|
||||
UPDATE_PRIVATE_KEY_PEM: ${{ secrets.UPDATE_PRIVATE_KEY_PEM }}
|
||||
PLONDS_SIGNING_KEY: ${{ secrets.PLONDS_SIGNING_KEY }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
KEY="${PLONDS_SIGNING_KEY:-}"
|
||||
if [[ -z "$KEY" ]]; then KEY="${UPDATE_PRIVATE_KEY_PEM:-}"; fi
|
||||
if [[ -z "$KEY" ]]; then
|
||||
echo "No signing key is configured."
|
||||
exit 1
|
||||
fi
|
||||
printf '%s' "$KEY" > update-private-key.pem
|
||||
echo "UPDATE_PRIVATE_KEY_PATH=$PWD/update-private-key.pem" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Build PLONDS tool
|
||||
run: dotnet build PenguinLogisticsOnlineNetworkDistributionSystem/src/Plonds.Tool/Plonds.Tool.csproj -c Release
|
||||
|
||||
- name: Resolve baseline plan
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
shell: pwsh
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$repo = '${{ github.repository }}'
|
||||
$tag = $env:RELEASE_TAG
|
||||
$baselineInput = $env:BASELINE_TAG_INPUT
|
||||
$currentRelease = gh release view $tag --repo $repo --json tagName,isPrerelease,assets,publishedAt | ConvertFrom-Json
|
||||
$allReleases = gh api "repos/$repo/releases?per_page=100" | ConvertFrom-Json
|
||||
$platforms = @('windows-x64', 'windows-x86', 'linux-x64')
|
||||
|
||||
$entries = foreach ($platform in $platforms) {
|
||||
$assetName = "files-$platform.zip"
|
||||
$currentAsset = $currentRelease.assets | Where-Object { $_.name -eq $assetName } | Select-Object -First 1
|
||||
if (-not $currentAsset) {
|
||||
throw "Current release $tag does not contain required asset $assetName"
|
||||
}
|
||||
|
||||
$baselineRelease = $null
|
||||
if (-not [string]::IsNullOrWhiteSpace($baselineInput)) {
|
||||
$normalizedBaseline = if ($baselineInput.StartsWith('v')) { $baselineInput } else { "v$baselineInput" }
|
||||
$baselineRelease = $allReleases | Where-Object { $_.tag_name -eq $normalizedBaseline } | Select-Object -First 1
|
||||
if (-not $baselineRelease) {
|
||||
throw "Specified baseline tag not found: $normalizedBaseline"
|
||||
}
|
||||
}
|
||||
else {
|
||||
$baselineRelease = $allReleases |
|
||||
Where-Object {
|
||||
$_.tag_name -ne $tag -and
|
||||
-not $_.draft -and
|
||||
[bool]$_.prerelease -eq [bool]$currentRelease.isPrerelease -and
|
||||
($_.assets | Where-Object { $_.name -eq $assetName } | Measure-Object).Count -gt 0
|
||||
} |
|
||||
Select-Object -First 1
|
||||
}
|
||||
|
||||
[pscustomobject]@{
|
||||
platform = $platform
|
||||
assetName = $assetName
|
||||
baselineTag = if ($baselineRelease) { $baselineRelease.tag_name } else { $null }
|
||||
baselineVersion = if ($baselineRelease) { ($baselineRelease.tag_name -replace '^v', '') } else { $null }
|
||||
isFullPayload = -not $baselineRelease
|
||||
}
|
||||
}
|
||||
|
||||
$plan = [pscustomobject]@{
|
||||
tag = $tag
|
||||
version = $env:RELEASE_VERSION
|
||||
channel = $env:RELEASE_CHANNEL
|
||||
platforms = $entries
|
||||
}
|
||||
|
||||
$plan | ConvertTo-Json -Depth 8 | Set-Content plonds-plan.json -Encoding utf8
|
||||
Get-Content plonds-plan.json
|
||||
|
||||
- name: Download payload zips
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
shell: pwsh
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$repo = '${{ github.repository }}'
|
||||
$plan = Get-Content plonds-plan.json | ConvertFrom-Json
|
||||
|
||||
foreach ($entry in $plan.platforms) {
|
||||
$currentDir = Join-Path $PWD "plonds-input/current/$($entry.platform)"
|
||||
New-Item -ItemType Directory -Path $currentDir -Force | Out-Null
|
||||
gh release download $plan.tag --repo $repo -p $entry.assetName -D $currentDir
|
||||
|
||||
if (-not [string]::IsNullOrWhiteSpace($entry.baselineTag)) {
|
||||
$baselineDir = Join-Path $PWD "plonds-input/baseline/$($entry.platform)"
|
||||
New-Item -ItemType Directory -Path $baselineDir -Force | Out-Null
|
||||
gh release download $entry.baselineTag --repo $repo -p $entry.assetName -D $baselineDir
|
||||
}
|
||||
}
|
||||
|
||||
- name: Build delta assets
|
||||
shell: pwsh
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$plan = Get-Content plonds-plan.json | ConvertFrom-Json
|
||||
foreach ($entry in $plan.platforms) {
|
||||
$currentZip = Join-Path $PWD "plonds-input/current/$($entry.platform)/$($entry.assetName)"
|
||||
$args = @(
|
||||
'run', '--project', 'PenguinLogisticsOnlineNetworkDistributionSystem/src/Plonds.Tool/Plonds.Tool.csproj', '--configuration', 'Release', '--',
|
||||
'build-delta',
|
||||
'--platform', $entry.platform,
|
||||
'--current-version', $plan.version,
|
||||
'--current-tag', $plan.tag,
|
||||
'--current-zip', $currentZip,
|
||||
'--output-dir', 'plonds-output',
|
||||
'--private-key', $env:UPDATE_PRIVATE_KEY_PATH,
|
||||
'--channel', $plan.channel,
|
||||
'--static-output-dir', 'plonds-output/static',
|
||||
'--update-base-url', $env:S3_PUBLIC_BASE_URL
|
||||
)
|
||||
|
||||
if ([bool]$entry.isFullPayload) {
|
||||
$args += @('--is-full-payload', 'true')
|
||||
}
|
||||
else {
|
||||
$baselineZip = Join-Path $PWD "plonds-input/baseline/$($entry.platform)/$($entry.assetName)"
|
||||
$args += @('--baseline-tag', $entry.baselineTag, '--baseline-version', $entry.baselineVersion, '--baseline-zip', $baselineZip)
|
||||
}
|
||||
|
||||
dotnet @args
|
||||
}
|
||||
|
||||
dotnet run --project PenguinLogisticsOnlineNetworkDistributionSystem/src/Plonds.Tool/Plonds.Tool.csproj --configuration Release -- `
|
||||
build-index `
|
||||
--release-tag $plan.tag `
|
||||
--version $plan.version `
|
||||
--channel $plan.channel `
|
||||
--platform-summaries-dir plonds-output/platform-summaries `
|
||||
--output-dir plonds-output `
|
||||
--private-key $env:UPDATE_PRIVATE_KEY_PATH
|
||||
|
||||
foreach ($entry in $plan.platforms) {
|
||||
$summary = Get-Content "plonds-output/platform-summaries/platform-summary-$($entry.platform).json" | ConvertFrom-Json
|
||||
$required = @(
|
||||
"plonds-output/static/meta/channels/$($plan.channel)/$($entry.platform)/latest.json",
|
||||
"plonds-output/static/meta/distributions/$($summary.distributionId).json",
|
||||
"plonds-output/static/manifests/$($summary.distributionId)/plonds-filemap.json",
|
||||
"plonds-output/static/manifests/$($summary.distributionId)/plonds-filemap.json.sig"
|
||||
)
|
||||
|
||||
foreach ($path in $required) {
|
||||
if (-not (Test-Path $path)) {
|
||||
throw "Missing PLONDS static output: $path"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$objects = Get-ChildItem -Path "plonds-output/static/repo/sha256" -File -Recurse -ErrorAction SilentlyContinue
|
||||
if (-not $objects -or $objects.Count -eq 0) {
|
||||
throw "PLONDS static object repository is empty."
|
||||
}
|
||||
|
||||
Compress-Archive -Path "plonds-output/static/*" -DestinationPath "plonds-output/release-assets/plonds-static.zip" -Force
|
||||
|
||||
- name: Upload PLONDS assets to release
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
gh release upload "$RELEASE_TAG" plonds-output/release-assets/* --clobber
|
||||
|
||||
- name: Persist run metadata
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p plonds-run-metadata
|
||||
printf '%s' "$RELEASE_TAG" > plonds-run-metadata/tag.txt
|
||||
|
||||
- name: Upload run metadata artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: plonds-run-metadata
|
||||
path: plonds-run-metadata/tag.txt
|
||||
if-no-files-found: error
|
||||
retention-days: 7
|
||||
|
||||
- name: Upload PLONDS static artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: plonds-static
|
||||
path: plonds-output/static/**
|
||||
if-no-files-found: error
|
||||
retention-days: 7
|
||||
146
.github/workflows/plonds-rollback.yml
vendored
Normal file
146
.github/workflows/plonds-rollback.yml
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
name: PLONDS Rollback
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
channel:
|
||||
description: 'Target channel to rollback'
|
||||
required: true
|
||||
type: choice
|
||||
default: stable
|
||||
options:
|
||||
- stable
|
||||
- preview
|
||||
target_tag:
|
||||
description: 'Release tag to rollback to (e.g. v1.2.3)'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
env:
|
||||
DOTNET_VERSION: '10.0.x'
|
||||
|
||||
jobs:
|
||||
rollback:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: plonds-rollback-${{ github.event.inputs.channel }}
|
||||
cancel-in-progress: false
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Resolve rollback context
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
RAW_TAG="${{ github.event.inputs.target_tag }}"
|
||||
if [[ "$RAW_TAG" == v* ]]; then
|
||||
TAG="$RAW_TAG"
|
||||
else
|
||||
TAG="v$RAW_TAG"
|
||||
fi
|
||||
|
||||
CHANNEL="${{ github.event.inputs.channel }}"
|
||||
|
||||
gh release view "$TAG" --repo "${{ github.repository }}" --json tagName >/dev/null
|
||||
|
||||
PUBLIC_BASE="${{ vars.S3_PUBLIC_BASE_URL }}"
|
||||
if [[ -z "$PUBLIC_BASE" ]]; then
|
||||
PUBLIC_BASE="https://cn-nb1.rains3.com/lmdesktop/lanmountain/update"
|
||||
fi
|
||||
PUBLIC_BASE="${PUBLIC_BASE%/}"
|
||||
|
||||
echo "RELEASE_TAG=${TAG}" >> "$GITHUB_ENV"
|
||||
echo "RELEASE_CHANNEL=${CHANNEL}" >> "$GITHUB_ENV"
|
||||
echo "S3_PUBLIC_BASE_URL=${PUBLIC_BASE}" >> "$GITHUB_ENV"
|
||||
echo "S3_BASE_URL=${PUBLIC_BASE}/releases/${TAG}/assets" >> "$GITHUB_ENV"
|
||||
echo "PLONDS_CHANNEL_POINTER_KEY=lanmountain/update/meta/channels/${CHANNEL}/plonds-latest.json" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Validate rollback target assets
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_KEY }}
|
||||
AWS_DEFAULT_REGION: ${{ vars.S3_REGION }}
|
||||
AWS_REGION: ${{ vars.S3_REGION }}
|
||||
S3_ENDPOINT: ${{ vars.S3_ENDPOINT }}
|
||||
S3_BUCKET: ${{ vars.S3_BUCKET }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
for name in plonds.json plonds.json.sig; do
|
||||
key="lanmountain/update/releases/${RELEASE_TAG}/assets/${name}"
|
||||
aws --endpoint-url "$S3_ENDPOINT" --region "$AWS_REGION" s3api head-object \
|
||||
--bucket "$S3_BUCKET" \
|
||||
--key "$key" >/dev/null
|
||||
done
|
||||
|
||||
- name: Build rollback pointer
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
mkdir -p rollback-output
|
||||
pointer_file="rollback-output/plonds-latest.json"
|
||||
|
||||
manifest_url="${S3_BASE_URL}/plonds.json"
|
||||
sig_url="${S3_BASE_URL}/plonds.json.sig"
|
||||
version="${RELEASE_TAG#v}"
|
||||
updated_at="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
||||
|
||||
cat > "$pointer_file" <<EOF
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"channel": "${RELEASE_CHANNEL}",
|
||||
"releaseTag": "${RELEASE_TAG}",
|
||||
"version": "${version}",
|
||||
"updatedAt": "${updated_at}",
|
||||
"manifest": {
|
||||
"url": "${manifest_url}",
|
||||
"signatureUrl": "${sig_url}"
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
jq -e . "$pointer_file" >/dev/null
|
||||
|
||||
- name: Publish rollback pointer
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_KEY }}
|
||||
AWS_DEFAULT_REGION: ${{ vars.S3_REGION }}
|
||||
AWS_REGION: ${{ vars.S3_REGION }}
|
||||
S3_ENDPOINT: ${{ vars.S3_ENDPOINT }}
|
||||
S3_BUCKET: ${{ vars.S3_BUCKET }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
pointer_file="rollback-output/plonds-latest.json"
|
||||
|
||||
aws --endpoint-url "$S3_ENDPOINT" --region "$AWS_REGION" s3api put-object \
|
||||
--bucket "$S3_BUCKET" \
|
||||
--key "$PLONDS_CHANNEL_POINTER_KEY" \
|
||||
--body "$pointer_file"
|
||||
|
||||
aws --endpoint-url "$S3_ENDPOINT" --region "$AWS_REGION" s3api head-object \
|
||||
--bucket "$S3_BUCKET" \
|
||||
--key "$PLONDS_CHANNEL_POINTER_KEY" >/dev/null
|
||||
|
||||
curl -fsSI "$S3_PUBLIC_BASE_URL/meta/channels/${RELEASE_CHANNEL}/plonds-latest.json" >/dev/null
|
||||
|
||||
- name: Print rollback summary
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
echo "Rolled back channel '${RELEASE_CHANNEL}' to '${RELEASE_TAG}'."
|
||||
echo "Pointer: ${S3_PUBLIC_BASE_URL}/meta/channels/${RELEASE_CHANNEL}/plonds-latest.json"
|
||||
379
.github/workflows/plonds-uploader.yml
vendored
Normal file
379
.github/workflows/plonds-uploader.yml
vendored
Normal file
@@ -0,0 +1,379 @@
|
||||
name: PLONDS Publisher
|
||||
|
||||
concurrency:
|
||||
group: plonds-${{ github.event_name }}-${{ github.event.workflow_run.id || github.event.inputs.tag || github.run_id }}
|
||||
cancel-in-progress: false
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows:
|
||||
- PLONDS Comparator
|
||||
types:
|
||||
- completed
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'Release tag'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
env:
|
||||
DOTNET_VERSION: '10.0.x'
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
actions: read
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: Resolve release tag and channel
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
||||
RAW_TAG="${{ github.event.inputs.tag }}"
|
||||
if [[ "$RAW_TAG" == v* ]]; then
|
||||
TAG="$RAW_TAG"
|
||||
else
|
||||
TAG="v$RAW_TAG"
|
||||
fi
|
||||
else
|
||||
gh run download "${{ github.event.workflow_run.id }}" -n plonds-run-metadata -D plonds-run-metadata
|
||||
TAG="$(tr -d '\r\n' < plonds-run-metadata/tag.txt)"
|
||||
fi
|
||||
|
||||
echo "RELEASE_TAG=${TAG}" >> "$GITHUB_ENV"
|
||||
IS_PRERELEASE="$(gh release view "$TAG" --repo "${{ github.repository }}" --json isPrerelease --jq '.isPrerelease')"
|
||||
if [[ "$IS_PRERELEASE" == "true" ]]; then
|
||||
CHANNEL="preview"
|
||||
else
|
||||
CHANNEL="stable"
|
||||
fi
|
||||
echo "RELEASE_CHANNEL=${CHANNEL}" >> "$GITHUB_ENV"
|
||||
echo "PLONDS_CHANNEL_POINTER_KEY=lanmountain/update/meta/channels/${CHANNEL}/plonds-latest.json" >> "$GITHUB_ENV"
|
||||
PUBLIC_BASE="${{ vars.S3_PUBLIC_BASE_URL }}"
|
||||
if [[ -z "$PUBLIC_BASE" ]]; then
|
||||
PUBLIC_BASE="https://cn-nb1.rains3.com/lmdesktop/lanmountain/update"
|
||||
fi
|
||||
PUBLIC_BASE="${PUBLIC_BASE%/}"
|
||||
echo "S3_PUBLIC_BASE_URL=${PUBLIC_BASE}" >> "$GITHUB_ENV"
|
||||
echo "S3_BASE_URL=${PUBLIC_BASE}/releases/${TAG}/assets" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
||||
dotnet-quality: preview
|
||||
|
||||
- name: Prepare signing key
|
||||
env:
|
||||
UPDATE_PRIVATE_KEY_PEM: ${{ secrets.UPDATE_PRIVATE_KEY_PEM }}
|
||||
PLONDS_SIGNING_KEY: ${{ secrets.PLONDS_SIGNING_KEY }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
KEY="${PLONDS_SIGNING_KEY:-}"
|
||||
if [[ -z "$KEY" ]]; then KEY="${UPDATE_PRIVATE_KEY_PEM:-}"; fi
|
||||
if [[ -z "$KEY" ]]; then
|
||||
echo "No signing key is configured."
|
||||
exit 1
|
||||
fi
|
||||
printf '%s' "$KEY" > update-private-key.pem
|
||||
echo "UPDATE_PRIVATE_KEY_PATH=$PWD/update-private-key.pem" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Build PLONDS tool
|
||||
run: dotnet build PenguinLogisticsOnlineNetworkDistributionSystem/src/Plonds.Tool/Plonds.Tool.csproj -c Release
|
||||
|
||||
- name: Download release assets
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir -p release-assets
|
||||
gh release download "$RELEASE_TAG" -D release-assets
|
||||
find release-assets -maxdepth 1 -type f | sort
|
||||
|
||||
- name: Prepare PLONDS static output
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
rm -rf plonds-static
|
||||
mkdir -p plonds-static
|
||||
if [[ "${{ github.event_name }}" == "workflow_run" ]]; then
|
||||
gh run download "${{ github.event.workflow_run.id }}" -n plonds-static -D plonds-static || true
|
||||
fi
|
||||
if [[ ! -d plonds-static/repo/sha256 && -f release-assets/plonds-static.zip ]]; then
|
||||
unzip -q release-assets/plonds-static.zip -d plonds-static
|
||||
fi
|
||||
if [[ ! -d plonds-static/repo/sha256 || ! -d plonds-static/meta/channels || ! -d plonds-static/manifests ]]; then
|
||||
echo "PLONDS static output is missing. Run the PLONDS workflow for this release first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Upload release assets to Rainyun S3
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_KEY }}
|
||||
AWS_DEFAULT_REGION: ${{ vars.S3_REGION }}
|
||||
AWS_REGION: ${{ vars.S3_REGION }}
|
||||
S3_ENDPOINT: ${{ vars.S3_ENDPOINT }}
|
||||
S3_BUCKET: ${{ vars.S3_BUCKET }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
aws --version
|
||||
for file in release-assets/*; do
|
||||
[[ -f "$file" ]] || continue
|
||||
name="$(basename "$file")"
|
||||
if [[ "$name" == "plonds.json" || "$name" == "plonds.json.sig" ]]; then
|
||||
continue
|
||||
fi
|
||||
key="lanmountain/update/releases/${RELEASE_TAG}/assets/${name}"
|
||||
sha256="$(sha256sum "$file" | awk '{print $1}')"
|
||||
existing_sha="$(aws --endpoint-url "$S3_ENDPOINT" --region "$AWS_REGION" s3api head-object --bucket "$S3_BUCKET" --key "$key" --query 'Metadata.sha256' --output text 2>/dev/null || true)"
|
||||
if [[ "$existing_sha" == "$sha256" ]]; then
|
||||
echo "Skip existing asset: $name"
|
||||
continue
|
||||
fi
|
||||
aws --endpoint-url "$S3_ENDPOINT" --region "$AWS_REGION" s3api put-object \
|
||||
--bucket "$S3_BUCKET" \
|
||||
--key "$key" \
|
||||
--body "$file" \
|
||||
--metadata "sha256=$sha256"
|
||||
done
|
||||
|
||||
- name: Upload PLONDS static output to Rainyun S3
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_KEY }}
|
||||
AWS_DEFAULT_REGION: ${{ vars.S3_REGION }}
|
||||
AWS_REGION: ${{ vars.S3_REGION }}
|
||||
S3_ENDPOINT: ${{ vars.S3_ENDPOINT }}
|
||||
S3_BUCKET: ${{ vars.S3_BUCKET }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
aws --endpoint-url "$S3_ENDPOINT" --region "$AWS_REGION" s3 sync \
|
||||
plonds-static/ \
|
||||
"s3://$S3_BUCKET/lanmountain/update/" \
|
||||
--only-show-errors
|
||||
|
||||
- name: Mirror installers to Rainyun S3
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_KEY }}
|
||||
AWS_DEFAULT_REGION: ${{ vars.S3_REGION }}
|
||||
AWS_REGION: ${{ vars.S3_REGION }}
|
||||
S3_ENDPOINT: ${{ vars.S3_ENDPOINT }}
|
||||
S3_BUCKET: ${{ vars.S3_BUCKET }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
version="${RELEASE_TAG#v}"
|
||||
for file in release-assets/*; do
|
||||
[[ -f "$file" ]] || continue
|
||||
name="$(basename "$file")"
|
||||
platform=""
|
||||
case "$name" in
|
||||
*.exe)
|
||||
if [[ "$name" == *x86* ]]; then platform="windows-x86"; else platform="windows-x64"; fi
|
||||
;;
|
||||
*.deb)
|
||||
platform="linux-x64"
|
||||
;;
|
||||
*.dmg)
|
||||
if [[ "$name" == *arm64* ]]; then platform="macos-arm64"; else platform="macos-x64"; fi
|
||||
;;
|
||||
esac
|
||||
[[ -n "$platform" ]] || continue
|
||||
key="lanmountain/update/installers/${platform}/${version}/${name}"
|
||||
sha256="$(sha256sum "$file" | awk '{print $1}')"
|
||||
aws --endpoint-url "$S3_ENDPOINT" --region "$AWS_REGION" s3api put-object \
|
||||
--bucket "$S3_BUCKET" \
|
||||
--key "$key" \
|
||||
--body "$file" \
|
||||
--metadata "sha256=$sha256"
|
||||
done
|
||||
|
||||
- name: Build PLONDS manifest
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir -p plonds-output
|
||||
dotnet run --project PenguinLogisticsOnlineNetworkDistributionSystem/src/Plonds.Tool/Plonds.Tool.csproj --configuration Release -- \
|
||||
build-plonds \
|
||||
--release-tag "$RELEASE_TAG" \
|
||||
--assets-dir release-assets \
|
||||
--output-dir plonds-output \
|
||||
--private-key "$UPDATE_PRIVATE_KEY_PATH" \
|
||||
--repository "${{ github.repository }}" \
|
||||
--s3-base-url "$S3_BASE_URL"
|
||||
|
||||
- name: Validate PLONDS asset references in Rainyun S3
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_KEY }}
|
||||
AWS_DEFAULT_REGION: ${{ vars.S3_REGION }}
|
||||
AWS_REGION: ${{ vars.S3_REGION }}
|
||||
S3_ENDPOINT: ${{ vars.S3_ENDPOINT }}
|
||||
S3_BUCKET: ${{ vars.S3_BUCKET }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
keys=$(jq -r '.assets[]?.mirrors[]?.url // empty' plonds-output/plonds.json \
|
||||
| sed -n 's#^.*/lanmountain/update/\(.*\)$#lanmountain/update/\1#p' \
|
||||
| sort -u)
|
||||
|
||||
if [[ -z "$keys" ]]; then
|
||||
echo "No S3-backed asset URLs found in plonds.json"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while IFS= read -r key; do
|
||||
[[ -n "$key" ]] || continue
|
||||
aws --endpoint-url "$S3_ENDPOINT" --region "$AWS_REGION" s3api head-object \
|
||||
--bucket "$S3_BUCKET" \
|
||||
--key "$key" >/dev/null
|
||||
done <<< "$keys"
|
||||
|
||||
- name: Upload PLONDS manifest to release
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
gh release upload "$RELEASE_TAG" plonds-output/plonds.json plonds-output/plonds.json.sig --clobber
|
||||
|
||||
- name: Upload PLONDS manifest to Rainyun S3 staging
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_KEY }}
|
||||
AWS_DEFAULT_REGION: ${{ vars.S3_REGION }}
|
||||
AWS_REGION: ${{ vars.S3_REGION }}
|
||||
S3_ENDPOINT: ${{ vars.S3_ENDPOINT }}
|
||||
S3_BUCKET: ${{ vars.S3_BUCKET }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
for file in plonds-output/plonds.json plonds-output/plonds.json.sig; do
|
||||
name="$(basename "$file")"
|
||||
key="lanmountain/update/releases/${RELEASE_TAG}/assets/${name}"
|
||||
sha256="$(sha256sum "$file" | awk '{print $1}')"
|
||||
aws --endpoint-url "$S3_ENDPOINT" --region "$AWS_REGION" s3api put-object \
|
||||
--bucket "$S3_BUCKET" \
|
||||
--key "$key" \
|
||||
--body "$file" \
|
||||
--metadata "sha256=$sha256"
|
||||
done
|
||||
|
||||
- name: Prepare PLONDS channel pointer
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
pointer_file="plonds-output/plonds-latest.json"
|
||||
cat > "$pointer_file" <<'JSON'
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"channel": "__CHANNEL__",
|
||||
"releaseTag": "__TAG__",
|
||||
"version": "__VERSION__",
|
||||
"updatedAt": "__UPDATED_AT__",
|
||||
"manifest": {
|
||||
"url": "__MANIFEST_URL__",
|
||||
"signatureUrl": "__SIG_URL__"
|
||||
}
|
||||
}
|
||||
JSON
|
||||
|
||||
manifest_url="${S3_BASE_URL}/plonds.json"
|
||||
sig_url="${S3_BASE_URL}/plonds.json.sig"
|
||||
version="${RELEASE_TAG#v}"
|
||||
updated_at="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
||||
|
||||
sed -i "s|__CHANNEL__|${RELEASE_CHANNEL}|g" "$pointer_file"
|
||||
sed -i "s|__TAG__|${RELEASE_TAG}|g" "$pointer_file"
|
||||
sed -i "s|__VERSION__|${version}|g" "$pointer_file"
|
||||
sed -i "s|__UPDATED_AT__|${updated_at}|g" "$pointer_file"
|
||||
sed -i "s|__MANIFEST_URL__|${manifest_url}|g" "$pointer_file"
|
||||
sed -i "s|__SIG_URL__|${sig_url}|g" "$pointer_file"
|
||||
|
||||
jq -e . "$pointer_file" >/dev/null
|
||||
|
||||
- name: Atomically publish PLONDS channel pointer
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_KEY }}
|
||||
AWS_DEFAULT_REGION: ${{ vars.S3_REGION }}
|
||||
AWS_REGION: ${{ vars.S3_REGION }}
|
||||
S3_ENDPOINT: ${{ vars.S3_ENDPOINT }}
|
||||
S3_BUCKET: ${{ vars.S3_BUCKET }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
pointer_file="plonds-output/plonds-latest.json"
|
||||
staging_key="lanmountain/update/releases/${RELEASE_TAG}/assets/plonds-latest.json"
|
||||
|
||||
aws --endpoint-url "$S3_ENDPOINT" --region "$AWS_REGION" s3api put-object \
|
||||
--bucket "$S3_BUCKET" \
|
||||
--key "$staging_key" \
|
||||
--body "$pointer_file"
|
||||
|
||||
aws --endpoint-url "$S3_ENDPOINT" --region "$AWS_REGION" s3api put-object \
|
||||
--bucket "$S3_BUCKET" \
|
||||
--key "$PLONDS_CHANNEL_POINTER_KEY" \
|
||||
--body "$pointer_file"
|
||||
|
||||
aws --endpoint-url "$S3_ENDPOINT" --region "$AWS_REGION" s3api head-object \
|
||||
--bucket "$S3_BUCKET" \
|
||||
--key "$PLONDS_CHANNEL_POINTER_KEY" >/dev/null
|
||||
|
||||
curl -fsSI "$S3_PUBLIC_BASE_URL/meta/channels/${RELEASE_CHANNEL}/plonds-latest.json" >/dev/null
|
||||
|
||||
- name: Verify Rainyun S3 PLONDS output
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_KEY }}
|
||||
AWS_DEFAULT_REGION: ${{ vars.S3_REGION }}
|
||||
AWS_REGION: ${{ vars.S3_REGION }}
|
||||
S3_ENDPOINT: ${{ vars.S3_ENDPOINT }}
|
||||
S3_BUCKET: ${{ vars.S3_BUCKET }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mapfile -t required < <(
|
||||
{
|
||||
find plonds-static/meta/channels -path '*/latest.json' -type f | sort | head -n 1
|
||||
find plonds-static/meta/distributions -name '*.json' -type f | sort | head -n 1
|
||||
find plonds-static/manifests -name 'plonds-filemap.json' -type f | sort | head -n 1
|
||||
find plonds-static/manifests -name 'plonds-filemap.json.sig' -type f | sort | head -n 1
|
||||
find plonds-static/repo/sha256 -type f | sort | head -n 1
|
||||
} | sed '/^$/d'
|
||||
)
|
||||
|
||||
if [[ "${#required[@]}" -lt 5 ]]; then
|
||||
echo "Not enough PLONDS static files to verify."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for path in "${required[@]}"; do
|
||||
rel="${path#plonds-static/}"
|
||||
key="lanmountain/update/${rel}"
|
||||
aws --endpoint-url "$S3_ENDPOINT" --region "$AWS_REGION" s3api head-object \
|
||||
--bucket "$S3_BUCKET" \
|
||||
--key "$key" >/dev/null
|
||||
curl -fsSI "$S3_PUBLIC_BASE_URL/$rel" >/dev/null
|
||||
done
|
||||
672
.github/workflows/release.yml
vendored
672
.github/workflows/release.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: Release
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -19,6 +19,7 @@ on:
|
||||
env:
|
||||
DOTNET_VERSION: '10.0.x'
|
||||
Solution_Name: LanMountainDesktop.slnx
|
||||
DOTNET_gcServer: 1
|
||||
|
||||
jobs:
|
||||
prepare:
|
||||
@@ -29,14 +30,22 @@ jobs:
|
||||
informational_version: ${{ steps.version.outputs.informational_version }}
|
||||
tag: ${{ steps.version.outputs.tag }}
|
||||
checkout_ref: ${{ steps.version.outputs.checkout_ref }}
|
||||
|
||||
is_prerelease: ${{ steps.version.outputs.is_prerelease }}
|
||||
release_channel: ${{ steps.version.outputs.release_channel }}
|
||||
|
||||
steps:
|
||||
- name: Checkout repository metadata
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get release info
|
||||
id: version
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == "push" ]]; then
|
||||
TAG="${GITHUB_REF#refs/tags/}"
|
||||
CHECKOUT_REF="${GITHUB_REF}"
|
||||
IS_PRERELEASE="false"
|
||||
else
|
||||
RAW_TAG="${{ github.event.inputs.tag }}"
|
||||
if [[ "${RAW_TAG}" == refs/tags/* ]]; then
|
||||
@@ -46,19 +55,40 @@ jobs:
|
||||
else
|
||||
TAG="v${RAW_TAG}"
|
||||
fi
|
||||
CHECKOUT_REF="${GITHUB_SHA}"
|
||||
|
||||
if git rev-parse -q --verify "refs/tags/${TAG}" >/dev/null; then
|
||||
CHECKOUT_REF="refs/tags/${TAG}"
|
||||
else
|
||||
CHECKOUT_REF="${GITHUB_SHA}"
|
||||
fi
|
||||
|
||||
if [[ "${{ github.event.inputs.is_prerelease }}" == "true" ]]; then
|
||||
IS_PRERELEASE="true"
|
||||
else
|
||||
IS_PRERELEASE="false"
|
||||
fi
|
||||
fi
|
||||
|
||||
VERSION="${TAG#v}"
|
||||
IFS='.' read -r -a VERSION_PARTS <<< "${VERSION}"
|
||||
while [ "${#VERSION_PARTS[@]}" -lt 4 ]; do
|
||||
VERSION_PARTS+=("0")
|
||||
done
|
||||
ASSEMBLY_VERSION="${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.${VERSION_PARTS[2]}.${VERSION_PARTS[3]}"
|
||||
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
||||
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
||||
echo "assembly_version=${ASSEMBLY_VERSION}" >> $GITHUB_OUTPUT
|
||||
echo "informational_version=${VERSION}" >> $GITHUB_OUTPUT
|
||||
echo "checkout_ref=${CHECKOUT_REF}" >> $GITHUB_OUTPUT
|
||||
|
||||
if [[ "${IS_PRERELEASE}" == "true" ]]; then
|
||||
RELEASE_CHANNEL="preview"
|
||||
else
|
||||
RELEASE_CHANNEL="stable"
|
||||
fi
|
||||
|
||||
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
|
||||
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||
echo "assembly_version=${ASSEMBLY_VERSION}" >> "$GITHUB_OUTPUT"
|
||||
echo "informational_version=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||
echo "checkout_ref=${CHECKOUT_REF}" >> "$GITHUB_OUTPUT"
|
||||
echo "is_prerelease=${IS_PRERELEASE}" >> "$GITHUB_OUTPUT"
|
||||
echo "release_channel=${RELEASE_CHANNEL}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
build-windows:
|
||||
needs: prepare
|
||||
@@ -66,9 +96,13 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
arch: [x64, x86]
|
||||
name: Build_Windows_${{ matrix.arch }}
|
||||
|
||||
include:
|
||||
- arch: x64
|
||||
suffix: ''
|
||||
- arch: x86
|
||||
suffix: ''
|
||||
name: Build_Windows_${{ matrix.arch }}${{ matrix.suffix }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
@@ -81,6 +115,14 @@ jobs:
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
||||
dotnet-quality: 'preview'
|
||||
|
||||
- name: Stamp release version metadata
|
||||
shell: pwsh
|
||||
run: |
|
||||
./scripts/Set-ReleaseVersion.ps1 `
|
||||
-Version "${{ needs.prepare.outputs.version }}" `
|
||||
-AssemblyVersion "${{ needs.prepare.outputs.assembly_version }}"
|
||||
|
||||
- name: Restore
|
||||
run: dotnet restore ${{ env.Solution_Name }}
|
||||
@@ -93,17 +135,48 @@ jobs:
|
||||
-p:FileVersion=${{ needs.prepare.outputs.assembly_version }}
|
||||
-p:InformationalVersion=${{ needs.prepare.outputs.informational_version }}
|
||||
|
||||
- name: Publish
|
||||
- name: Publish Launcher (AOT)
|
||||
run: |
|
||||
dotnet publish LanMountainDesktop/LanMountainDesktop.csproj `
|
||||
$version = "${{ needs.prepare.outputs.version }}"
|
||||
$arch = "${{ matrix.arch }}"
|
||||
$launcherPublishDir = "publish/launcher-win-$arch"
|
||||
|
||||
dotnet publish LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj `
|
||||
-c Release `
|
||||
-o ./publish/windows-${{ matrix.arch }} `
|
||||
-o ./$launcherPublishDir `
|
||||
--self-contained `
|
||||
-r win-${{ matrix.arch }} `
|
||||
-p:PublishSingleFile=false `
|
||||
-p:SelfContained=true `
|
||||
-r win-$arch `
|
||||
-p:PublishAot=true `
|
||||
-p:PublishSingleFile=true `
|
||||
-p:IncludeNativeLibrariesForSelfExtract=true `
|
||||
-p:EnableCompressionInSingleFile=true `
|
||||
-p:DebugType=none `
|
||||
-p:DebugSymbols=false `
|
||||
-p:Version=${{ needs.prepare.outputs.version }} `
|
||||
-p:AssemblyVersion=${{ needs.prepare.outputs.assembly_version }} `
|
||||
-p:FileVersion=${{ needs.prepare.outputs.assembly_version }} `
|
||||
-p:InformationalVersion=${{ needs.prepare.outputs.informational_version }}
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Error "Launcher AOT publish failed"
|
||||
exit 1
|
||||
}
|
||||
shell: pwsh
|
||||
|
||||
- name: Publish Main App
|
||||
run: |
|
||||
$publishDir = "publish/windows-${{ matrix.arch }}"
|
||||
|
||||
dotnet publish LanMountainDesktop/LanMountainDesktop.csproj `
|
||||
-c Release `
|
||||
-o ./$publishDir `
|
||||
--self-contained:false `
|
||||
-r win-${{ matrix.arch }} `
|
||||
-p:SelfContained=false `
|
||||
-p:PublishSingleFile=false `
|
||||
-p:DebugType=none `
|
||||
-p:DebugSymbols=false `
|
||||
-p:SkipAirAppHostBuild=true `
|
||||
-p:PublishTrimmed=false `
|
||||
-p:PublishReadyToRun=false `
|
||||
-p:Version=${{ needs.prepare.outputs.version }} `
|
||||
@@ -112,72 +185,121 @@ jobs:
|
||||
-p:InformationalVersion=${{ needs.prepare.outputs.informational_version }}
|
||||
shell: pwsh
|
||||
|
||||
- name: Install Inno Setup
|
||||
run: choco install innosetup -y --no-progress
|
||||
- name: Publish AirAppHost
|
||||
run: |
|
||||
$arch = "${{ matrix.arch }}"
|
||||
$publishDir = "publish/windows-$arch"
|
||||
|
||||
dotnet publish LanMountainDesktop.AirAppHost/LanMountainDesktop.AirAppHost.csproj `
|
||||
-c Release `
|
||||
-o ./$publishDir `
|
||||
--self-contained:false `
|
||||
-r win-$arch `
|
||||
-p:SelfContained=false `
|
||||
-p:PublishSingleFile=false `
|
||||
-p:DebugType=none `
|
||||
-p:DebugSymbols=false `
|
||||
-p:PublishTrimmed=false `
|
||||
-p:PublishReadyToRun=false `
|
||||
-p:BuildingAirAppHost=true `
|
||||
-p:SkipAirAppHostBuild=true `
|
||||
-p:Version=${{ needs.prepare.outputs.version }} `
|
||||
-p:AssemblyVersion=${{ needs.prepare.outputs.assembly_version }} `
|
||||
-p:FileVersion=${{ needs.prepare.outputs.assembly_version }} `
|
||||
-p:InformationalVersion=${{ needs.prepare.outputs.informational_version }}
|
||||
shell: pwsh
|
||||
|
||||
- name: Restructure for Launcher
|
||||
run: |
|
||||
$version = "${{ needs.prepare.outputs.version }}"
|
||||
$arch = "${{ matrix.arch }}"
|
||||
$publishDir = "publish/windows-$arch"
|
||||
$launcherPublishDir = "publish/launcher-win-$arch"
|
||||
$appDir = "app-$version"
|
||||
$newStructure = "publish-launcher/windows-$arch"
|
||||
|
||||
New-Item -ItemType Directory -Path $newStructure -Force | Out-Null
|
||||
$appPath = Join-Path $newStructure $appDir
|
||||
Move-Item -Path $publishDir -Destination $appPath -Force
|
||||
|
||||
if (Test-Path $launcherPublishDir) {
|
||||
Copy-Item -Path "$launcherPublishDir\*" -Destination $newStructure -Recurse -Force
|
||||
}
|
||||
|
||||
New-Item -ItemType File -Path (Join-Path $appPath ".current") -Force | Out-Null
|
||||
|
||||
Remove-Item -Path $publishDir -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item -Path $launcherPublishDir -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Move-Item -Path $newStructure -Destination $publishDir -Force
|
||||
shell: pwsh
|
||||
|
||||
- name: Optimize and Guard Windows Payload
|
||||
run: |
|
||||
$arch = "${{ matrix.arch }}"
|
||||
$publishDir = "publish/windows-$arch"
|
||||
|
||||
./LanMountainDesktop/scripts/Optimize-PublishPayload.ps1 `
|
||||
-PublishDir $publishDir `
|
||||
-RuntimeIdentifier "win-$arch" `
|
||||
-AssertClean
|
||||
shell: pwsh
|
||||
|
||||
- name: Verify Windows app host payload
|
||||
run: |
|
||||
$version = "${{ needs.prepare.outputs.version }}"
|
||||
$arch = "${{ matrix.arch }}"
|
||||
$publishDir = "publish/windows-$arch"
|
||||
$appDir = Join-Path $publishDir "app-$version"
|
||||
|
||||
$requiredFiles = @(
|
||||
(Join-Path $publishDir "LanMountainDesktop.Launcher.exe"),
|
||||
(Join-Path $appDir "LanMountainDesktop.exe"),
|
||||
(Join-Path $appDir "LanMountainDesktop.AirAppHost.exe")
|
||||
)
|
||||
|
||||
foreach ($path in $requiredFiles) {
|
||||
if (-not (Test-Path -LiteralPath $path -PathType Leaf)) {
|
||||
Write-Error "Required release payload file is missing: $path"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
shell: pwsh
|
||||
|
||||
- name: Install Inno Setup and 7z
|
||||
run: |
|
||||
choco install innosetup -y --no-progress
|
||||
choco install 7zip -y --no-progress
|
||||
shell: pwsh
|
||||
|
||||
- name: Build Installer
|
||||
run: |
|
||||
$version = "${{ needs.prepare.outputs.version }}"
|
||||
$arch = "${{ matrix.arch }}"
|
||||
$publishDir = "publish\windows-$arch"
|
||||
$installerScript = "LanMountainDesktop\installer\LanMountainDesktop.iss"
|
||||
$suffix = "${{ matrix.suffix }}"
|
||||
$publishDir = "publish/windows-$arch"
|
||||
$outputDir = "build-installer"
|
||||
|
||||
# Verify source directory exists
|
||||
if (-not (Test-Path -Path $publishDir)) {
|
||||
Write-Error "Publish directory not found: $publishDir"
|
||||
Get-ChildItem -Path "publish" -Directory -ErrorAction SilentlyContinue | Select-Object Name
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Create output directory
|
||||
$installerScript = "LanMountainDesktop/installer/LanMountainDesktop.iss"
|
||||
|
||||
New-Item -ItemType Directory -Path $outputDir -Force | Out-Null
|
||||
|
||||
# Verify installer script exists
|
||||
if (-not (Test-Path -Path $installerScript)) {
|
||||
Write-Error "Installer script not found: $installerScript"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Find Inno Setup compiler (choco may install a shim in PATH)
|
||||
$isccPath = $null
|
||||
$isccCommand = Get-Command ISCC.exe -ErrorAction SilentlyContinue
|
||||
if ($isccCommand) {
|
||||
$isccPath = $isccCommand.Source
|
||||
}
|
||||
|
||||
$candidatePaths = @(
|
||||
"C:\Program Files (x86)\Inno Setup 6\ISCC.exe",
|
||||
"C:\Program Files\Inno Setup 6\ISCC.exe",
|
||||
"$env:ChocolateyInstall\bin\ISCC.exe",
|
||||
(Get-Command iscc.exe -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Source -ErrorAction SilentlyContinue),
|
||||
"$env:ProgramFiles(x86)\Inno Setup 6\ISCC.exe",
|
||||
"$env:ProgramFiles\Inno Setup 6\ISCC.exe",
|
||||
"$env:ChocolateyInstall\lib\innosetup\tools\ISCC.exe"
|
||||
)
|
||||
) | Where-Object { $_ -and (Test-Path $_) }
|
||||
|
||||
$isccPath = $candidatePaths | Select-Object -First 1
|
||||
if (-not $isccPath) {
|
||||
foreach ($candidate in $candidatePaths) {
|
||||
if ($candidate -and (Test-Path -Path $candidate)) {
|
||||
$isccPath = $candidate
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $isccPath) {
|
||||
Write-Host "ISCC.exe was not found in PATH or known locations."
|
||||
Write-Host "Checked locations:"
|
||||
$candidatePaths | ForEach-Object { Write-Host " - $_" }
|
||||
Write-Host "Chocolatey bin listing (if exists):"
|
||||
Get-ChildItem "$env:ChocolateyInstall\bin" -Filter "*iscc*" -ErrorAction SilentlyContinue | Select-Object FullName
|
||||
Write-Error "Inno Setup compiler not found."
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "Found Inno Setup at: $isccPath"
|
||||
|
||||
# Build installer with iscc.exe
|
||||
Write-Host "Building installer for Windows $arch with version $version..."
|
||||
|
||||
|
||||
if (-not (Test-Path $installerScript)) {
|
||||
Write-Error "Installer script not found: $(Join-Path $PWD $installerScript)"
|
||||
exit 1
|
||||
}
|
||||
|
||||
$publishDir = (Resolve-Path $publishDir).Path
|
||||
$outputDir = (Resolve-Path $outputDir).Path
|
||||
$installerScript = (Resolve-Path $installerScript).Path
|
||||
@@ -187,34 +309,68 @@ jobs:
|
||||
"/DPublishDir=$publishDir",
|
||||
"/DMyOutputDir=$outputDir",
|
||||
"/DMyAppArch=$arch",
|
||||
"/DMyAppSuffix=$suffix",
|
||||
$installerScript
|
||||
)
|
||||
|
||||
Write-Host "Compile command: `"$isccPath`" $($compileArgs -join ' ')"
|
||||
|
||||
# Execute the compiler
|
||||
|
||||
& $isccPath @compileArgs
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Error "Inno Setup compiler exited with code $LASTEXITCODE"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Check if build was successful
|
||||
|
||||
$installerFile = Get-ChildItem -Path $outputDir -Filter "*.exe" -ErrorAction SilentlyContinue | Select-Object -First 1
|
||||
if (-not $installerFile) {
|
||||
Write-Error "Failed to create installer"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "✅ Successfully created: $($installerFile.Name)"
|
||||
Write-Host "Installer size: $([Math]::Round($installerFile.Length / 1MB, 2)) MB"
|
||||
shell: pwsh
|
||||
|
||||
- name: Upload Installer
|
||||
- name: Package Payload Zip
|
||||
run: |
|
||||
$version = "${{ needs.prepare.outputs.version }}"
|
||||
$arch = "${{ matrix.arch }}"
|
||||
$payloadRoot = Join-Path (Join-Path $PWD "publish/windows-$arch") "app-$version"
|
||||
if (-not (Test-Path $payloadRoot)) {
|
||||
Write-Error "Payload root not found: $payloadRoot"
|
||||
exit 1
|
||||
}
|
||||
|
||||
$stageDir = Join-Path $PWD "payload-stage/windows-$arch"
|
||||
$releaseDir = Join-Path $PWD "release-assets"
|
||||
Remove-Item -Path $stageDir -Recurse -Force -ErrorAction SilentlyContinue
|
||||
New-Item -ItemType Directory -Path $stageDir -Force | Out-Null
|
||||
New-Item -ItemType Directory -Path $releaseDir -Force | Out-Null
|
||||
|
||||
Get-ChildItem -Path $payloadRoot -Recurse -File | ForEach-Object {
|
||||
$relative = [System.IO.Path]::GetRelativePath($payloadRoot, $_.FullName).Replace('\', '/')
|
||||
if ($relative -eq '.current' -or $relative -eq '.partial' -or $relative -eq '.destroy' -or $relative.StartsWith('.current/') -or $relative.StartsWith('.partial/') -or $relative.StartsWith('.destroy/')) {
|
||||
return
|
||||
}
|
||||
|
||||
$destination = Join-Path $stageDir ($relative -replace '/', [System.IO.Path]::DirectorySeparatorChar)
|
||||
$destinationDir = Split-Path -Path $destination -Parent
|
||||
if (-not [string]::IsNullOrWhiteSpace($destinationDir)) {
|
||||
New-Item -ItemType Directory -Path $destinationDir -Force | Out-Null
|
||||
}
|
||||
|
||||
Copy-Item -Path $_.FullName -Destination $destination -Force
|
||||
}
|
||||
|
||||
$payloadZip = Join-Path $releaseDir "files-windows-$arch.zip"
|
||||
if (Test-Path $payloadZip) {
|
||||
Remove-Item $payloadZip -Force
|
||||
}
|
||||
Compress-Archive -Path (Join-Path $stageDir '*') -DestinationPath $payloadZip -Force
|
||||
shell: pwsh
|
||||
|
||||
- name: Upload Release Assets
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-windows-${{ matrix.arch }}
|
||||
path: build-installer/*.exe
|
||||
path: |
|
||||
release-assets/files-windows-${{ matrix.arch }}.zip
|
||||
build-installer/*.exe
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
|
||||
@@ -222,7 +378,7 @@ jobs:
|
||||
needs: prepare
|
||||
runs-on: ubuntu-latest
|
||||
name: Build_Linux
|
||||
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
@@ -238,12 +394,25 @@ jobs:
|
||||
libfontconfig1 libfreetype6 \
|
||||
libx11-6 libxrandr2 libxinerama1 \
|
||||
libxi6 libxcursor1 libxext6 \
|
||||
libxrender1 libxkbcommon-x11-0
|
||||
libxrender1 libxkbcommon-x11-0 \
|
||||
clang zlib1g-dev zip rsync
|
||||
|
||||
sudo apt-get install -y libasound2t64 || sudo apt-get install -y libasound2
|
||||
sudo apt-get install -y libportaudio2t64 || sudo apt-get install -y libportaudio2
|
||||
sudo apt-get install -y libwebkit2gtk-4.1-dev || sudo apt-get install -y libwebkit2gtk-4.0-dev
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
||||
dotnet-quality: 'preview'
|
||||
|
||||
- name: Stamp release version metadata
|
||||
shell: pwsh
|
||||
run: |
|
||||
./scripts/Set-ReleaseVersion.ps1 `
|
||||
-Version "${{ needs.prepare.outputs.version }}" `
|
||||
-AssemblyVersion "${{ needs.prepare.outputs.assembly_version }}"
|
||||
|
||||
- name: Restore
|
||||
run: dotnet restore ${{ env.Solution_Name }}
|
||||
@@ -256,17 +425,36 @@ jobs:
|
||||
-p:FileVersion=${{ needs.prepare.outputs.assembly_version }}
|
||||
-p:InformationalVersion=${{ needs.prepare.outputs.informational_version }}
|
||||
|
||||
- name: Publish
|
||||
- name: Publish Launcher (AOT)
|
||||
run: |
|
||||
dotnet publish LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj \
|
||||
-c Release \
|
||||
-o ./publish/launcher-linux-x64 \
|
||||
--self-contained \
|
||||
-r linux-x64 \
|
||||
-p:PublishAot=true \
|
||||
-p:PublishSingleFile=true \
|
||||
-p:IncludeNativeLibrariesForSelfExtract=true \
|
||||
-p:EnableCompressionInSingleFile=true \
|
||||
-p:DebugType=none \
|
||||
-p:DebugSymbols=false \
|
||||
-p:Version=${{ needs.prepare.outputs.version }} \
|
||||
-p:AssemblyVersion=${{ needs.prepare.outputs.assembly_version }} \
|
||||
-p:FileVersion=${{ needs.prepare.outputs.assembly_version }} \
|
||||
-p:InformationalVersion=${{ needs.prepare.outputs.informational_version }}
|
||||
|
||||
- name: Publish Main App
|
||||
run: |
|
||||
dotnet publish LanMountainDesktop/LanMountainDesktop.csproj \
|
||||
-c Release \
|
||||
-o ./publish/linux-x64 \
|
||||
-o ./publish/linux-x64-app \
|
||||
--self-contained \
|
||||
-r linux-x64 \
|
||||
-p:PublishSingleFile=false \
|
||||
-p:SelfContained=true \
|
||||
-p:DebugType=none \
|
||||
-p:DebugSymbols=false \
|
||||
-p:SkipAirAppHostBuild=true \
|
||||
-p:PublishTrimmed=false \
|
||||
-p:PublishReadyToRun=false \
|
||||
-p:Version=${{ needs.prepare.outputs.version }} \
|
||||
@@ -274,6 +462,24 @@ jobs:
|
||||
-p:FileVersion=${{ needs.prepare.outputs.assembly_version }} \
|
||||
-p:InformationalVersion=${{ needs.prepare.outputs.informational_version }}
|
||||
|
||||
- name: Restructure for Launcher
|
||||
run: |
|
||||
version="${{ needs.prepare.outputs.version }}"
|
||||
publishDir="publish/linux-x64"
|
||||
appDir="app-$version"
|
||||
launcherDir="publish/launcher-linux-x64"
|
||||
|
||||
mkdir -p "$publishDir"
|
||||
mv "publish/linux-x64-app" "$publishDir/$appDir"
|
||||
|
||||
if [ -d "$launcherDir" ]; then
|
||||
cp -r "$launcherDir"/* "$publishDir/"
|
||||
chmod +x "$publishDir/LanMountainDesktop.Launcher" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
touch "$publishDir/$appDir/.current"
|
||||
rm -rf "$launcherDir"
|
||||
|
||||
- name: Package as DEB
|
||||
run: |
|
||||
version="${{ needs.prepare.outputs.version }}"
|
||||
@@ -283,41 +489,17 @@ jobs:
|
||||
arch="amd64"
|
||||
desktop_template="LanMountainDesktop/packaging/linux/LanMountainDesktop.desktop"
|
||||
icon_source="LanMountainDesktop/packaging/linux/lanmountaindesktop.png"
|
||||
|
||||
# Verify source directory exists
|
||||
if [ ! -d "$source" ]; then
|
||||
echo "Error: Source directory not found: $source"
|
||||
ls -la publish/ || echo "publish directory not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create DEB package structure
|
||||
|
||||
mkdir -p "build-deb/DEBIAN"
|
||||
mkdir -p "build-deb/usr/local/bin"
|
||||
mkdir -p "build-deb/usr/share/applications"
|
||||
mkdir -p "build-deb/usr/share/pixmaps"
|
||||
mkdir -p "build-deb/usr/share/icons/hicolor/256x256/apps"
|
||||
|
||||
# Copy application files
|
||||
cp -r "$source"/* "build-deb/usr/local/bin/"
|
||||
|
||||
# Verify copy was successful
|
||||
item_count=$(find build-deb/usr/local/bin -type f 2>/dev/null | wc -l)
|
||||
echo "DEB package contains $item_count files"
|
||||
|
||||
if [ "$item_count" -eq 0 ]; then
|
||||
echo "Error: DEB package is empty after copy"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "$desktop_template" ] || [ ! -f "$icon_source" ]; then
|
||||
echo "Error: Linux desktop resources are missing"
|
||||
ls -la "LanMountainDesktop/packaging/linux" || true
|
||||
exit 1
|
||||
fi
|
||||
cp -r "$source"/* "build-deb/usr/local/bin/"
|
||||
|
||||
sed \
|
||||
-e "s|@@EXEC@@|/usr/local/bin/LanMountainDesktop|g" \
|
||||
-e "s|@@EXEC@@|/usr/local/bin/LanMountainDesktop.Launcher|g" \
|
||||
-e "s|@@ICON@@|lanmountaindesktop|g" \
|
||||
"$desktop_template" > "build-deb/usr/share/applications/LanMountainDesktop.desktop"
|
||||
|
||||
@@ -334,49 +516,69 @@ jobs:
|
||||
printf '%s\n' ' gtk-update-icon-cache /usr/share/icons/hicolor >/dev/null 2>&1 || true'
|
||||
printf '%s\n' 'fi'
|
||||
} > "build-deb/DEBIAN/postinst"
|
||||
|
||||
# Create control file (NOTE: No leading spaces in control file)
|
||||
|
||||
{
|
||||
printf '%s\n' "Package: $package_name"
|
||||
printf '%s\n' "Version: $package_version"
|
||||
printf '%s\n' "Architecture: $arch"
|
||||
printf '%s\n' "Maintainer: LanMountain Team <dev@example.com>"
|
||||
printf '%s\n' "Description: LanMountain Desktop Application"
|
||||
printf '%s\n' " A desktop application for LanMountain."
|
||||
printf '%s\n' 'Maintainer: LanMountain Team <dev@example.com>'
|
||||
printf '%s\n' 'Description: LanMountain Desktop Application'
|
||||
printf '%s\n' ' A desktop application for LanMountain.'
|
||||
} > "build-deb/DEBIAN/control"
|
||||
|
||||
# Set proper permissions
|
||||
chmod 755 "build-deb/usr/local/bin/LanMountainDesktop" || chmod 755 "build-deb/usr/local/bin"/*
|
||||
|
||||
chmod 755 "build-deb/usr/local/bin/LanMountainDesktop.Launcher" 2>/dev/null || chmod 755 "build-deb/usr/local/bin"/*
|
||||
chmod 644 "build-deb/usr/share/applications/LanMountainDesktop.desktop"
|
||||
chmod 644 "build-deb/usr/share/pixmaps/lanmountaindesktop.png"
|
||||
chmod 644 "build-deb/usr/share/icons/hicolor/256x256/apps/lanmountaindesktop.png"
|
||||
chmod 755 "build-deb/DEBIAN/postinst"
|
||||
|
||||
# Create DEB file
|
||||
if dpkg-deb --build "build-deb" "${package_name}_${package_version}_${arch}.deb"; then
|
||||
echo "Successfully created: ${package_name}_${package_version}_${arch}.deb"
|
||||
ls -lh "${package_name}_${package_version}_${arch}.deb"
|
||||
else
|
||||
echo "Error: Failed to build DEB package"
|
||||
|
||||
dpkg-deb --build "build-deb" "${package_name}_${package_version}_${arch}.deb"
|
||||
|
||||
- name: Package Payload Zip
|
||||
run: |
|
||||
version="${{ needs.prepare.outputs.version }}"
|
||||
payload_root="publish/linux-x64/app-$version"
|
||||
release_dir="$PWD/release-assets"
|
||||
stage_dir="$PWD/payload-stage/linux-x64"
|
||||
|
||||
if [ ! -d "$payload_root" ]; then
|
||||
echo "Payload root not found: $payload_root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Upload
|
||||
rm -rf "$stage_dir"
|
||||
mkdir -p "$stage_dir" "$release_dir"
|
||||
rsync -a \
|
||||
--exclude '.current' \
|
||||
--exclude '.partial' \
|
||||
--exclude '.destroy' \
|
||||
"$payload_root/" "$stage_dir/"
|
||||
|
||||
(
|
||||
cd "$stage_dir"
|
||||
zip -qr "$release_dir/files-linux-x64.zip" .
|
||||
)
|
||||
|
||||
- name: Upload Release Assets
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-linux
|
||||
path: "*.deb"
|
||||
name: release-linux-x64
|
||||
path: |
|
||||
release-assets/files-linux-x64.zip
|
||||
*.deb
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
|
||||
build-macos:
|
||||
needs: prepare
|
||||
runs-on: macos-latest
|
||||
continue-on-error: true
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
arch: [x64, arm64]
|
||||
name: Build_macOS_${{ matrix.arch }}
|
||||
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
@@ -385,10 +587,21 @@ jobs:
|
||||
submodules: recursive
|
||||
ref: ${{ needs.prepare.outputs.checkout_ref }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: brew install portaudio
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
||||
dotnet-quality: 'preview'
|
||||
|
||||
- name: Stamp release version metadata
|
||||
shell: pwsh
|
||||
run: |
|
||||
./scripts/Set-ReleaseVersion.ps1 `
|
||||
-Version "${{ needs.prepare.outputs.version }}" `
|
||||
-AssemblyVersion "${{ needs.prepare.outputs.assembly_version }}"
|
||||
|
||||
- name: Restore
|
||||
run: dotnet restore ${{ env.Solution_Name }}
|
||||
@@ -401,17 +614,36 @@ jobs:
|
||||
-p:FileVersion=${{ needs.prepare.outputs.assembly_version }}
|
||||
-p:InformationalVersion=${{ needs.prepare.outputs.informational_version }}
|
||||
|
||||
- name: Publish
|
||||
- name: Publish Launcher (AOT)
|
||||
run: |
|
||||
dotnet publish LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj \
|
||||
-c Release \
|
||||
-o ./publish/launcher-macos-${{ matrix.arch }} \
|
||||
--self-contained \
|
||||
-r osx-${{ matrix.arch }} \
|
||||
-p:PublishAot=true \
|
||||
-p:PublishSingleFile=true \
|
||||
-p:IncludeNativeLibrariesForSelfExtract=true \
|
||||
-p:EnableCompressionInSingleFile=true \
|
||||
-p:DebugType=none \
|
||||
-p:DebugSymbols=false \
|
||||
-p:Version=${{ needs.prepare.outputs.version }} \
|
||||
-p:AssemblyVersion=${{ needs.prepare.outputs.assembly_version }} \
|
||||
-p:FileVersion=${{ needs.prepare.outputs.assembly_version }} \
|
||||
-p:InformationalVersion=${{ needs.prepare.outputs.informational_version }}
|
||||
|
||||
- name: Publish Main App
|
||||
run: |
|
||||
dotnet publish LanMountainDesktop/LanMountainDesktop.csproj \
|
||||
-c Release \
|
||||
-o ./publish/macos-${{ matrix.arch }} \
|
||||
-o ./publish/macos-${{ matrix.arch }}-app \
|
||||
--self-contained \
|
||||
-r osx-${{ matrix.arch }} \
|
||||
-p:PublishSingleFile=false \
|
||||
-p:SelfContained=true \
|
||||
-p:DebugType=none \
|
||||
-p:DebugSymbols=false \
|
||||
-p:SkipAirAppHostBuild=true \
|
||||
-p:PublishTrimmed=false \
|
||||
-p:PublishReadyToRun=false \
|
||||
-p:Version=${{ needs.prepare.outputs.version }} \
|
||||
@@ -419,45 +651,50 @@ jobs:
|
||||
-p:FileVersion=${{ needs.prepare.outputs.assembly_version }} \
|
||||
-p:InformationalVersion=${{ needs.prepare.outputs.informational_version }}
|
||||
|
||||
- name: Package as DMG
|
||||
- name: Package Payload Zip
|
||||
run: |
|
||||
release_dir="$PWD/release-assets"
|
||||
stage_dir="$PWD/payload-stage/macos-${{ matrix.arch }}"
|
||||
payload_root="publish/macos-${{ matrix.arch }}-app"
|
||||
|
||||
rm -rf "$stage_dir"
|
||||
mkdir -p "$stage_dir" "$release_dir"
|
||||
rsync -a "$payload_root/" "$stage_dir/"
|
||||
(
|
||||
cd "$stage_dir"
|
||||
zip -qr "$release_dir/files-macos-${{ matrix.arch }}.zip" .
|
||||
)
|
||||
|
||||
- name: Restructure and Package as DMG
|
||||
continue-on-error: true
|
||||
run: |
|
||||
version="${{ needs.prepare.outputs.version }}"
|
||||
arch="${{ matrix.arch }}"
|
||||
source="publish/macos-$arch"
|
||||
app_name="LanMountainDesktop"
|
||||
package_name="${app_name}-${version}-macos-${arch}"
|
||||
|
||||
# Verify source directory exists
|
||||
if [ ! -d "$source" ]; then
|
||||
echo "Error: Source directory not found: $source"
|
||||
ls -la publish/ || echo "publish directory not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create app bundle structure
|
||||
launcherDir="publish/launcher-macos-$arch"
|
||||
appSourceDir="publish/macos-$arch-app"
|
||||
|
||||
mkdir -p "${app_name}.app/Contents/MacOS"
|
||||
mkdir -p "${app_name}.app/Contents/Resources"
|
||||
|
||||
# Copy application files
|
||||
cp -r "$source"/* "${app_name}.app/Contents/MacOS/"
|
||||
|
||||
# Verify copy was successful
|
||||
item_count=$(find "${app_name}.app/Contents/MacOS" -type f | wc -l)
|
||||
echo "App bundle contains $item_count files"
|
||||
|
||||
if [ "$item_count" -eq 0 ]; then
|
||||
echo "Error: App bundle is empty after copy"
|
||||
exit 1
|
||||
appDir="app-$version"
|
||||
mkdir -p "${app_name}.app/Contents/MacOS/$appDir"
|
||||
|
||||
cp -r "$appSourceDir"/* "${app_name}.app/Contents/MacOS/$appDir/"
|
||||
if [ -d "$launcherDir" ]; then
|
||||
cp -r "$launcherDir"/* "${app_name}.app/Contents/MacOS/"
|
||||
chmod +x "${app_name}.app/Contents/MacOS/LanMountainDesktop.Launcher" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# Create Info.plist
|
||||
touch "${app_name}.app/Contents/MacOS/$appDir/.current"
|
||||
mkdir -p "${app_name}.app/Contents/Resources"
|
||||
|
||||
{
|
||||
printf '%s\n' '<?xml version="1.0" encoding="UTF-8"?>'
|
||||
printf '%s\n' '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">'
|
||||
printf '%s\n' '<plist version="1.0">'
|
||||
printf '%s\n' '<dict>'
|
||||
printf '%s\n' ' <key>CFBundleExecutable</key>'
|
||||
printf '%s\n' ' <string>LanMountainDesktop</string>'
|
||||
printf '%s\n' ' <string>LanMountainDesktop.Launcher</string>'
|
||||
printf '%s\n' ' <key>CFBundleName</key>'
|
||||
printf '%s\n' ' <string>LanMountain Desktop</string>'
|
||||
printf '%s\n' ' <key>CFBundleVersion</key>'
|
||||
@@ -471,96 +708,99 @@ jobs:
|
||||
printf '%s\n' '</dict>'
|
||||
printf '%s\n' '</plist>'
|
||||
} > "${app_name}.app/Contents/Info.plist"
|
||||
|
||||
# Create DMG
|
||||
|
||||
mkdir -p dmg-temp
|
||||
cp -r "${app_name}.app" dmg-temp/
|
||||
|
||||
if hdiutil create -volname "${app_name}" -srcfolder dmg-temp -ov -format UDZO "${package_name}.dmg" 2>&1; then
|
||||
echo "Successfully created: ${package_name}.dmg"
|
||||
ls -lh "${package_name}.dmg"
|
||||
else
|
||||
echo "Error: Failed to create DMG"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Cleanup
|
||||
rm -rf dmg-temp "${app_name}.app"
|
||||
hdiutil create -volname "${app_name}" -srcfolder dmg-temp -ov -format UDZO "${package_name}.dmg"
|
||||
|
||||
- name: Upload
|
||||
- name: Upload Release Assets
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-macos-${{ matrix.arch }}
|
||||
path: "*.dmg"
|
||||
if-no-files-found: error
|
||||
path: |
|
||||
release-assets/files-macos-${{ matrix.arch }}.zip
|
||||
*.dmg
|
||||
if-no-files-found: ignore
|
||||
retention-days: 30
|
||||
|
||||
github-release:
|
||||
needs: [ prepare, build-windows, build-linux, build-macos ]
|
||||
needs: [prepare, build-windows, build-linux]
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
|
||||
steps:
|
||||
- name: Download artifacts
|
||||
- name: Download release artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: artifacts
|
||||
path: release-files
|
||||
pattern: release-*
|
||||
merge-multiple: true
|
||||
|
||||
- name: List artifacts structure
|
||||
- name: Normalize release files
|
||||
run: |
|
||||
echo "🔍 Artifact directory structure:"
|
||||
find artifacts -type f -o -type d | sort
|
||||
echo ""
|
||||
echo "📊 Files found:"
|
||||
find artifacts -type f -exec ls -lh {} \;
|
||||
echo ""
|
||||
echo "📁 Full tree:"
|
||||
tree artifacts || find artifacts -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
|
||||
mkdir -p release-bundle
|
||||
|
||||
- name: Flatten artifacts for release
|
||||
run: |
|
||||
echo "📦 Organizing artifacts..."
|
||||
mkdir -p release-files
|
||||
find artifacts -type f \( -name "*.exe" -o -name "*.deb" -o -name "*.dmg" \) -exec cp -v {} release-files/ \;
|
||||
echo ""
|
||||
echo "✅ Files ready for release:"
|
||||
ls -lh release-files/ || echo "⚠️ No files found in release-files"
|
||||
echo ""
|
||||
echo "📋 Total files:"
|
||||
file_count=$(find release-files -type f | wc -l)
|
||||
echo "$file_count"
|
||||
if [ "$file_count" -eq 0 ]; then
|
||||
echo "Error: No installer/package files found for release"
|
||||
mapfile -t downloaded_files < <(find release-files -type f)
|
||||
if [ "${#downloaded_files[@]}" -eq 0 ]; then
|
||||
echo "No downloaded release artifacts were found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Create Release
|
||||
for file in "${downloaded_files[@]}"; do
|
||||
base_name="$(basename "$file")"
|
||||
target_path="release-bundle/$base_name"
|
||||
|
||||
if [ -e "$target_path" ]; then
|
||||
echo "Duplicate release asset name detected: $base_name"
|
||||
echo "Conflicting file: $file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cp "$file" "$target_path"
|
||||
done
|
||||
|
||||
- name: Validate release files
|
||||
run: |
|
||||
echo "Release files:"
|
||||
find release-bundle -maxdepth 1 -type f -exec ls -lh {} \;
|
||||
|
||||
if [ ! -f release-bundle/files-windows-x64.zip ] || [ ! -f release-bundle/files-windows-x86.zip ] || [ ! -f release-bundle/files-linux-x64.zip ]; then
|
||||
echo "Required payload zips are missing."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
file_count=$(find release-bundle -maxdepth 1 -type f | wc -l)
|
||||
if [ "$file_count" -eq 0 ]; then
|
||||
echo "No release files were produced."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Create or Update Release
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
tag: ${{ needs.prepare.outputs.tag }}
|
||||
name: ${{ needs.prepare.outputs.tag }}
|
||||
commit: ${{ github.sha }}
|
||||
allowUpdates: true
|
||||
draft: false
|
||||
prerelease: ${{ github.event.inputs.is_prerelease == 'true' }}
|
||||
artifacts: "release-files/**"
|
||||
prerelease: ${{ needs.prepare.outputs.is_prerelease == 'true' }}
|
||||
artifacts: 'release-bundle/*'
|
||||
body: |
|
||||
## Release ${{ needs.prepare.outputs.version }}
|
||||
|
||||
### Windows
|
||||
- **LanMountainDesktop-Setup-{version}-x64.exe** - 64-bit installer
|
||||
- **LanMountainDesktop-Setup-{version}-x86.exe** - 32-bit installer
|
||||
|
||||
Installation: Double-click the .exe file and follow the wizard.
|
||||
|
||||
### Linux
|
||||
- **LanMountainDesktop-{version}-linux-x64.deb** - Debian package (x64)
|
||||
|
||||
|
||||
### Installers
|
||||
- `LanMountainDesktop-Setup-${{ needs.prepare.outputs.version }}-x64.exe`
|
||||
- `LanMountainDesktop-Setup-${{ needs.prepare.outputs.version }}-x86.exe`
|
||||
- `LanMountainDesktop_${{ needs.prepare.outputs.version }}_amd64.deb`
|
||||
|
||||
### Payload Archives
|
||||
- `files-windows-x64.zip`
|
||||
- `files-windows-x86.zip`
|
||||
- `files-linux-x64.zip`
|
||||
|
||||
### macOS
|
||||
- **LanMountainDesktop-{version}-macos-x64.dmg** - Intel processor
|
||||
- **LanMountainDesktop-{version}-macos-arm64.dmg** - Apple Silicon (M1/M2/M3)
|
||||
|
||||
See commits for changes.
|
||||
- macOS assets are best-effort and will not block the release.
|
||||
|
||||
Release keeps only the stable installer and payload outputs. PLONDS delta assets and external mirror metadata are generated by follow-up workflows.
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
7
.gitignore
vendored
7
.gitignore
vendored
@@ -6,6 +6,9 @@
|
||||
# dotenv files
|
||||
.env
|
||||
|
||||
# Local NuGet global packages (NuGet.Config globalPackagesFolder)
|
||||
.nuget/packages/
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
@@ -512,3 +515,7 @@ nul
|
||||
/*.deb
|
||||
/*.dmg
|
||||
/*.AppImage
|
||||
/velopack-output-local-verify
|
||||
/velopack-output-local
|
||||
/test-aot-publish
|
||||
/.claude/worktrees
|
||||
|
||||
376
.kilo/package-lock.json
generated
Normal file
376
.kilo/package-lock.json
generated
Normal file
@@ -0,0 +1,376 @@
|
||||
{
|
||||
"name": ".kilo",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"dependencies": {
|
||||
"@kilocode/plugin": "7.2.20"
|
||||
}
|
||||
},
|
||||
"node_modules/@kilocode/plugin": {
|
||||
"version": "7.2.20",
|
||||
"resolved": "https://registry.npmjs.org/@kilocode/plugin/-/plugin-7.2.20.tgz",
|
||||
"integrity": "sha512-M5lMc58Mu9j1zveH+E3ZUKRHefzh+acNAqHGSG3TuF6K2l16KrZlCl38CZlgj2R5Qgaig6Jec/F2p9Rbn3BhCQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@kilocode/sdk": "7.2.20",
|
||||
"effect": "4.0.0-beta.48",
|
||||
"zod": "4.1.8"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@opentui/core": ">=0.1.99",
|
||||
"@opentui/solid": ">=0.1.99"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@opentui/core": {
|
||||
"optional": true
|
||||
},
|
||||
"@opentui/solid": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@kilocode/sdk": {
|
||||
"version": "7.2.20",
|
||||
"resolved": "https://registry.npmjs.org/@kilocode/sdk/-/sdk-7.2.20.tgz",
|
||||
"integrity": "sha512-KUpu1fyzcAyZWpiv//834zGLN+PYzIH65crs15VTtUJ9CDvGqcj08EM0XlkF9jMuGQAjHjfRbvCfml3+YO31+Q==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cross-spawn": "7.0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/@msgpackr-extract/msgpackr-extract-darwin-arm64": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-darwin-arm64/-/msgpackr-extract-darwin-arm64-3.0.3.tgz",
|
||||
"integrity": "sha512-QZHtlVgbAdy2zAqNA9Gu1UpIuI8Xvsd1v8ic6B2pZmeFnFcMWiPLfWXh7TVw4eGEZ/C9TH281KwhVoeQUKbyjw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
]
|
||||
},
|
||||
"node_modules/@msgpackr-extract/msgpackr-extract-darwin-x64": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-darwin-x64/-/msgpackr-extract-darwin-x64-3.0.3.tgz",
|
||||
"integrity": "sha512-mdzd3AVzYKuUmiWOQ8GNhl64/IoFGol569zNRdkLReh6LRLHOXxU4U8eq0JwaD8iFHdVGqSy4IjFL4reoWCDFw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
]
|
||||
},
|
||||
"node_modules/@msgpackr-extract/msgpackr-extract-linux-arm": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-linux-arm/-/msgpackr-extract-linux-arm-3.0.3.tgz",
|
||||
"integrity": "sha512-fg0uy/dG/nZEXfYilKoRe7yALaNmHoYeIoJuJ7KJ+YyU2bvY8vPv27f7UKhGRpY6euFYqEVhxCFZgAUNQBM3nw==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
"node_modules/@msgpackr-extract/msgpackr-extract-linux-arm64": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-linux-arm64/-/msgpackr-extract-linux-arm64-3.0.3.tgz",
|
||||
"integrity": "sha512-YxQL+ax0XqBJDZiKimS2XQaf+2wDGVa1enVRGzEvLLVFeqa5kx2bWbtcSXgsxjQB7nRqqIGFIcLteF/sHeVtQg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
"node_modules/@msgpackr-extract/msgpackr-extract-linux-x64": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-linux-x64/-/msgpackr-extract-linux-x64-3.0.3.tgz",
|
||||
"integrity": "sha512-cvwNfbP07pKUfq1uH+S6KJ7dT9K8WOE4ZiAcsrSes+UY55E/0jLYc+vq+DO7jlmqRb5zAggExKm0H7O/CBaesg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
"node_modules/@msgpackr-extract/msgpackr-extract-win32-x64": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-win32-x64/-/msgpackr-extract-win32-x64-3.0.3.tgz",
|
||||
"integrity": "sha512-x0fWaQtYp4E6sktbsdAqnehxDgEc/VwM7uLsRCYWaiGu0ykYdZPiS8zCWdnjHwyiumousxfBm4SO31eXqwEZhQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
]
|
||||
},
|
||||
"node_modules/@standard-schema/spec": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz",
|
||||
"integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/cross-spawn": {
|
||||
"version": "7.0.6",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
|
||||
"integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"path-key": "^3.1.0",
|
||||
"shebang-command": "^2.0.0",
|
||||
"which": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/detect-libc": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
|
||||
"integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
|
||||
"license": "Apache-2.0",
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/effect": {
|
||||
"version": "4.0.0-beta.48",
|
||||
"resolved": "https://registry.npmjs.org/effect/-/effect-4.0.0-beta.48.tgz",
|
||||
"integrity": "sha512-MMAM/ZabuNdNmgXiin+BAanQXK7qM8mlt7nfXDoJ/Gn9V8i89JlCq+2N0AiWmqFLXjGLA0u3FjiOjSOYQk5uMw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@standard-schema/spec": "^1.1.0",
|
||||
"fast-check": "^4.6.0",
|
||||
"find-my-way-ts": "^0.1.6",
|
||||
"ini": "^6.0.0",
|
||||
"kubernetes-types": "^1.30.0",
|
||||
"msgpackr": "^1.11.9",
|
||||
"multipasta": "^0.2.7",
|
||||
"toml": "^4.1.1",
|
||||
"uuid": "^13.0.0",
|
||||
"yaml": "^2.8.3"
|
||||
}
|
||||
},
|
||||
"node_modules/fast-check": {
|
||||
"version": "4.7.0",
|
||||
"resolved": "https://registry.npmjs.org/fast-check/-/fast-check-4.7.0.tgz",
|
||||
"integrity": "sha512-NsZRtqvSSoCP0HbNjUD+r1JH8zqZalyp6gLY9e7OYs7NK9b6AHOs2baBFeBG7bVNsuoukh89x2Yg3rPsul8ziQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://github.com/sponsors/dubzzz"
|
||||
},
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/fast-check"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"pure-rand": "^8.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.17.0"
|
||||
}
|
||||
},
|
||||
"node_modules/find-my-way-ts": {
|
||||
"version": "0.1.6",
|
||||
"resolved": "https://registry.npmjs.org/find-my-way-ts/-/find-my-way-ts-0.1.6.tgz",
|
||||
"integrity": "sha512-a85L9ZoXtNAey3Y6Z+eBWW658kO/MwR7zIafkIUPUMf3isZG0NCs2pjW2wtjxAKuJPxMAsHUIP4ZPGv0o5gyTA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/ini": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ini/-/ini-6.0.0.tgz",
|
||||
"integrity": "sha512-IBTdIkzZNOpqm7q3dRqJvMaldXjDHWkEDfrwGEQTs5eaQMWV+djAhR+wahyNNMAa+qpbDUhBMVt4ZKNwpPm7xQ==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": "^20.17.0 || >=22.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/isexe": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
||||
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/kubernetes-types": {
|
||||
"version": "1.30.0",
|
||||
"resolved": "https://registry.npmjs.org/kubernetes-types/-/kubernetes-types-1.30.0.tgz",
|
||||
"integrity": "sha512-Dew1okvhM/SQcIa2rcgujNndZwU8VnSapDgdxlYoB84ZlpAD43U6KLAFqYo17ykSFGHNPrg0qry0bP+GJd9v7Q==",
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
"node_modules/msgpackr": {
|
||||
"version": "1.11.10",
|
||||
"resolved": "https://registry.npmjs.org/msgpackr/-/msgpackr-1.11.10.tgz",
|
||||
"integrity": "sha512-iCZNq+HszvF+fC3anCm4nBmWEnbeIAfpDs6IStAEKhQ2YSgkjzVG2FF9XJqwwQh5bH3N9OUTUt4QwVN6MLMLtA==",
|
||||
"license": "MIT",
|
||||
"optionalDependencies": {
|
||||
"msgpackr-extract": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/msgpackr-extract": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/msgpackr-extract/-/msgpackr-extract-3.0.3.tgz",
|
||||
"integrity": "sha512-P0efT1C9jIdVRefqjzOQ9Xml57zpOXnIuS+csaB4MdZbTdmGDLo8XhzBG1N7aO11gKDDkJvBLULeFTo46wwreA==",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"node-gyp-build-optional-packages": "5.2.2"
|
||||
},
|
||||
"bin": {
|
||||
"download-msgpackr-prebuilds": "bin/download-prebuilds.js"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@msgpackr-extract/msgpackr-extract-darwin-arm64": "3.0.3",
|
||||
"@msgpackr-extract/msgpackr-extract-darwin-x64": "3.0.3",
|
||||
"@msgpackr-extract/msgpackr-extract-linux-arm": "3.0.3",
|
||||
"@msgpackr-extract/msgpackr-extract-linux-arm64": "3.0.3",
|
||||
"@msgpackr-extract/msgpackr-extract-linux-x64": "3.0.3",
|
||||
"@msgpackr-extract/msgpackr-extract-win32-x64": "3.0.3"
|
||||
}
|
||||
},
|
||||
"node_modules/multipasta": {
|
||||
"version": "0.2.7",
|
||||
"resolved": "https://registry.npmjs.org/multipasta/-/multipasta-0.2.7.tgz",
|
||||
"integrity": "sha512-KPA58d68KgGil15oDqXjkUBEBYc00XvbPj5/X+dyzeo/lWm9Nc25pQRlf1D+gv4OpK7NM0J1odrbu9JNNGvynA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/node-gyp-build-optional-packages": {
|
||||
"version": "5.2.2",
|
||||
"resolved": "https://registry.npmjs.org/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.2.2.tgz",
|
||||
"integrity": "sha512-s+w+rBWnpTMwSFbaE0UXsRlg7hU4FjekKU4eyAih5T8nJuNZT1nNsskXpxmeqSK9UzkBl6UgRlnKc8hz8IEqOw==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"detect-libc": "^2.0.1"
|
||||
},
|
||||
"bin": {
|
||||
"node-gyp-build-optional-packages": "bin.js",
|
||||
"node-gyp-build-optional-packages-optional": "optional.js",
|
||||
"node-gyp-build-optional-packages-test": "build-test.js"
|
||||
}
|
||||
},
|
||||
"node_modules/path-key": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
|
||||
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/pure-rand": {
|
||||
"version": "8.4.0",
|
||||
"resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-8.4.0.tgz",
|
||||
"integrity": "sha512-IoM8YF/jY0hiugFo/wOWqfmarlE6J0wc6fDK1PhftMk7MGhVZl88sZimmqBBFomLOCSmcCCpsfj7wXASCpvK9A==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://github.com/sponsors/dubzzz"
|
||||
},
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/fast-check"
|
||||
}
|
||||
],
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/shebang-command": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
||||
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"shebang-regex": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/shebang-regex": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
|
||||
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/toml": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/toml/-/toml-4.1.1.tgz",
|
||||
"integrity": "sha512-EBJnVBr3dTXdA89WVFoAIPUqkBjxPMwRqsfuo1r240tKFHXv3zgca4+NJib/h6TyvGF7vOawz0jGuryJCdNHrw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
}
|
||||
},
|
||||
"node_modules/uuid": {
|
||||
"version": "13.0.0",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-13.0.0.tgz",
|
||||
"integrity": "sha512-XQegIaBTVUjSHliKqcnFqYypAd4S+WCYt5NIeRs6w/UAry7z8Y9j5ZwRRL4kzq9U3sD6v+85er9FvkEaBpji2w==",
|
||||
"funding": [
|
||||
"https://github.com/sponsors/broofa",
|
||||
"https://github.com/sponsors/ctavan"
|
||||
],
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"uuid": "dist-node/bin/uuid"
|
||||
}
|
||||
},
|
||||
"node_modules/which": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"isexe": "^2.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"node-which": "bin/node-which"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/yaml": {
|
||||
"version": "2.8.3",
|
||||
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.3.tgz",
|
||||
"integrity": "sha512-AvbaCLOO2Otw/lW5bmh9d/WEdcDFdQp2Z2ZUH3pX9U2ihyUY0nvLv7J6TrWowklRGPYbB/IuIMfYgxaCPg5Bpg==",
|
||||
"license": "ISC",
|
||||
"bin": {
|
||||
"yaml": "bin.mjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14.6"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/eemeli"
|
||||
}
|
||||
},
|
||||
"node_modules/zod": {
|
||||
"version": "4.1.8",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/colinhacks"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
171
.kilo/plans/1776989126427-witty-island.md
Normal file
171
.kilo/plans/1776989126427-witty-island.md
Normal file
@@ -0,0 +1,171 @@
|
||||
# LanMountainDesktop 启动器无法启动应用 - 问题分析与修复计划
|
||||
|
||||
## 1. 项目架构概述
|
||||
|
||||
LanMountainDesktop 采用**双进程架构**:
|
||||
- **Launcher** (`LanMountainDesktop.Launcher`) - 启动器,负责版本管理、更新、启动主程序
|
||||
- **Host** (`LanMountainDesktop`) - 主应用宿主
|
||||
|
||||
### 启动流程
|
||||
1. 用户启动 `LanMountainDesktop.Launcher.exe`
|
||||
2. Launcher 扫描 `app-*` 目录,选择最佳版本
|
||||
3. 检查并应用待处理的更新
|
||||
4. 处理插件升级队列
|
||||
5. 启动主程序 `app-{version}/LanMountainDesktop.exe`
|
||||
6. 通过 IPC 监控主程序启动进度
|
||||
|
||||
## 2. 问题分析
|
||||
|
||||
### 2.1 核心问题:主机可执行文件找不到
|
||||
|
||||
根据代码分析(`DeploymentLocator.cs`),启动器通过以下顺序查找主机可执行文件:
|
||||
|
||||
1. **显式 app-root**(如果通过命令行指定)
|
||||
2. **已发布部署**(查找 `app-*` 目录)
|
||||
3. **可移植主机**(直接在应用根目录)
|
||||
4. **调试主机**(开发模式,查找构建输出路径)
|
||||
5. **旧版回退路径**
|
||||
|
||||
**当前状态检查**:
|
||||
- ❌ 未找到 `app-*` 目录(生产部署结构不存在)
|
||||
- ❌ 未找到 `bin/Debug/**/*.exe`(项目未构建或构建输出不存在)
|
||||
|
||||
### 2.2 可能的启动失败原因
|
||||
|
||||
| 问题 | 描述 | 优先级 |
|
||||
|------|------|--------|
|
||||
| **项目未构建** | LanMountainDesktop 主程序未编译,没有可执行文件 | P0 |
|
||||
| **部署结构缺失** | 生产模式下缺少 `app-*` 目录结构 | P0 |
|
||||
| **开发模式路径问题** | 调试模式下路径计算错误或构建输出不在预期位置 | P1 |
|
||||
| **.NET 版本问题** | 项目使用 .NET 10.0,运行环境可能缺少对应运行时 | P1 |
|
||||
| **更新应用失败** | `ApplyPendingUpdateAsync` 失败导致无法完成部署 | P2 |
|
||||
| **IPC 连接超时** | 主程序启动后未及时建立 IPC 连接,导致启动器超时 | P2 |
|
||||
|
||||
### 2.3 关键代码位置
|
||||
|
||||
- **主机查找逻辑**: `LanMountainDesktop.Launcher/Services/DeploymentLocator.cs`
|
||||
- `FindCurrentDeploymentDirectory()` - 查找 app-* 目录
|
||||
- `ResolveHostExecutable()` - 解析主机路径
|
||||
|
||||
- **启动协调逻辑**: `LanMountainDesktop.Launcher/Services/LauncherFlowCoordinator.cs`
|
||||
- `RunAsync()` - 主启动流程
|
||||
- `LaunchHostWithIpcAsync()` - 启动主机进程
|
||||
|
||||
- **更新引擎**: `LanMountainDesktop.Launcher/Services/UpdateEngineService.cs`
|
||||
- `ApplyPendingUpdateAsync()` - 应用待处理的更新
|
||||
|
||||
## 3. 诊断步骤
|
||||
|
||||
### 步骤 1:检查构建状态
|
||||
```bash
|
||||
dotnet --info
|
||||
dotnet build LanMountainDesktop.slnx -c Debug
|
||||
```
|
||||
|
||||
### 步骤 2:验证主机可执行文件是否存在
|
||||
检查以下路径是否存在 `LanMountainDesktop.exe`:
|
||||
- `LanMountainDesktop/bin/Debug/net10.0/`
|
||||
- `LanMountainDesktop/bin/Release/net10.0/`
|
||||
|
||||
### 步骤 3:测试直接运行主程序(跳过 Launcher)
|
||||
```bash
|
||||
dotnet run --project LanMountainDesktop/LanMountainDesktop.csproj
|
||||
```
|
||||
|
||||
### 步骤 4:检查 Launcher 启动日志
|
||||
在开发模式下运行 Launcher 并查看控制台输出:
|
||||
```bash
|
||||
dotnet run --project LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj -- launch
|
||||
```
|
||||
|
||||
## 4. 修复计划
|
||||
|
||||
### 方案 A:构建并配置开发环境(推荐)
|
||||
|
||||
**适用场景**:开发或调试环境
|
||||
|
||||
1. **构建整个解决方案**
|
||||
```bash
|
||||
dotnet restore
|
||||
dotnet build LanMountainDesktop.slnx -c Debug
|
||||
```
|
||||
|
||||
2. **验证构建输出**
|
||||
- 确认 `LanMountainDesktop/bin/Debug/net10.0/LanMountainDesktop.exe` 存在
|
||||
- 确认 `LanMountainDesktop.Launcher/bin/Debug/net10.0/LanMountainDesktop.Launcher.exe` 存在
|
||||
|
||||
3. **测试 Launcher 启动**
|
||||
```bash
|
||||
dotnet run --project LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj -- launch
|
||||
```
|
||||
|
||||
4. **如果路径查找失败,检查 `DeploymentLocator.cs` 中的开发路径**
|
||||
- 当前逻辑(第 366-375 行)查找:
|
||||
- `../LanMountainDesktop/bin/Debug/net10.0/LanMountainDesktop.exe`
|
||||
- `../LanMountainDesktop/bin/Release/net10.0/LanMountainDesktop.exe`
|
||||
- 确认这些路径与实际的构建输出路径匹配
|
||||
|
||||
### 方案 B:创建生产部署结构
|
||||
|
||||
**适用场景**:生产环境或模拟生产环境
|
||||
|
||||
1. **发布主程序**
|
||||
```bash
|
||||
dotnet publish LanMountainDesktop/LanMountainDesktop.csproj -c Release -o app-1.0.0
|
||||
```
|
||||
|
||||
2. **创建 .current 标记文件**
|
||||
```bash
|
||||
echo. > app-1.0.0/.current
|
||||
```
|
||||
|
||||
3. **从 Launcher 启动**
|
||||
- Launcher 应该能找到 `app-1.0.0/LanMountainDesktop.exe`
|
||||
|
||||
### 方案 C:修复潜在的代码问题
|
||||
|
||||
如果上述方案无法解决问题,可能需要修复代码:
|
||||
|
||||
#### C1. 增强错误处理和日志
|
||||
在 `DeploymentLocator.cs` 中添加更详细的日志输出,帮助诊断路径查找失败的原因。
|
||||
|
||||
#### C2. 检查更新逻辑
|
||||
如果 `ApplyPendingUpdateAsync` 失败,可能导致启动中止。检查 `.launcher/update/incoming/` 目录是否有残留的更新文件。
|
||||
|
||||
#### C3. 调整超时设置
|
||||
如果主程序启动较慢,可以适当增加 `LauncherFlowCoordinator.cs` 中的超时时间:
|
||||
- `StartupSoftTimeout` (当前 10 秒)
|
||||
- `StartupHardTimeout` (当前 30 秒)
|
||||
|
||||
## 5. 建议执行顺序
|
||||
|
||||
1. ✅ **首先执行方案 A 的步骤 1-2**(构建项目)
|
||||
2. ✅ **执行诊断步骤 3**(测试直接运行主程序)
|
||||
3. ✅ **执行诊断步骤 4**(查看 Launcher 启动日志)
|
||||
4. 根据日志输出决定后续操作:
|
||||
- 如果显示 "host executable was not found" → 检查路径配置
|
||||
- 如果显示 "update apply failed" → 清理更新缓存
|
||||
- 如果主程序启动后超时 → 检查 IPC 连接或增加超时
|
||||
|
||||
## 6. 验证方法
|
||||
|
||||
修复后,通过以下方式验证:
|
||||
|
||||
```bash
|
||||
# 开发模式启动
|
||||
dotnet run --project LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj -- launch
|
||||
|
||||
# 或直接运行 Launcher 可执行文件
|
||||
# (需要先构建 Launcher)
|
||||
```
|
||||
|
||||
启动后应该看到:
|
||||
1. Splash 窗口显示
|
||||
2. 主程序桌面窗口出现
|
||||
3. Launcher 自动退出(或最小化到托盘)
|
||||
|
||||
## 7. 注意事项
|
||||
|
||||
- 项目使用 .NET 10.0(`global.json` 指定版本 10.0.103)
|
||||
- 确保开发环境已安装对应的 .NET SDK
|
||||
- 如果修改了 `DeploymentLocator.cs` 的路径查找逻辑,需要同步更新文档 `docs/DEVELOPMENT.md`
|
||||
106
.trae/documents/avalonia12-migration-plan.md
Normal file
106
.trae/documents/avalonia12-migration-plan.md
Normal file
@@ -0,0 +1,106 @@
|
||||
# Avalonia 12 迁移计划
|
||||
|
||||
## 当前状态
|
||||
|
||||
项目已完成以下迁移准备:
|
||||
|
||||
* `Directory.Packages.props` 中 Avalonia 包已升级到 `12.0.1`
|
||||
|
||||
* `FluentAvaloniaUI` 已升级到 `3.0.0-preview1`
|
||||
|
||||
* `Avalonia.Diagnostics` 已替换为 `AvaloniaUI.DiagnosticsSupport`
|
||||
|
||||
* `Avalonia.Controls.WebView` 已升级到 `12.0.0`
|
||||
|
||||
* `ClassIsland.Markdown.Avalonia` 已升级到 `12.0.0`
|
||||
|
||||
## 构建错误清单(26 errors)
|
||||
|
||||
### 1. 窗口装饰 API 移除(8 errors)
|
||||
|
||||
**文件**:`LanMountainDesktop/Views/SettingsWindow.axaml.cs`(4 errors)
|
||||
|
||||
* `ExtendClientAreaChromeHints` 不存在(line 166, 179)
|
||||
|
||||
* `SystemDecorations` 已过时,需改用 `WindowDecorations`(line 168, 177)
|
||||
|
||||
**文件**:`LanMountainDesktop/Views/ComponentEditorWindow.axaml.cs`(4 errors)
|
||||
|
||||
* `ExtendClientAreaChromeHints` 不存在(line 63, 72)
|
||||
|
||||
* `SystemDecorations` 已过时,需改用 `WindowDecorations`(line 65, 70)
|
||||
|
||||
**AXAML 文件**:13 个文件使用 `SystemDecorations` 属性(编译警告)
|
||||
|
||||
### 2. 变量/字段未找到(8 errors)
|
||||
|
||||
**文件**:`LanMountainDesktop/Views/MainWindow.ComponentSystem.cs`
|
||||
|
||||
* `centerLeft` 不存在(line 759, 766, 778)
|
||||
|
||||
* `positions` 不存在(line 1266)
|
||||
|
||||
**文件**:`LanMountainDesktop/Views/MainWindow.DesktopPaging.cs`
|
||||
|
||||
* `child` 不存在(line 312)
|
||||
|
||||
* `_isThreeFingerOrRightDragSwipeActive` 不存在(line 517, 828, 847, 850)
|
||||
|
||||
### 3. API 变更(3 errors)
|
||||
|
||||
**文件**:`LanMountainDesktop/App.axaml.cs`
|
||||
|
||||
* `BindingPlugins` 不可访问(line 532, 537)
|
||||
|
||||
**文件**:`LanMountainDesktop/Views/Components/DesktopComponentFailureView.cs`
|
||||
|
||||
* `IClipboard.SetTextAsync` 不存在(line 187)
|
||||
|
||||
**文件**:`LanMountainDesktop/Services/MonetColorService.cs`
|
||||
|
||||
* `Bitmap.CopyPixels` 参数不匹配(line 91)
|
||||
|
||||
### 4. 第三方库变更(1 error)
|
||||
|
||||
**文件**:`LanMountainDesktop/Views/SettingsWindow.axaml.cs`
|
||||
|
||||
* `FluentIcons.Avalonia.SymbolIconSource` 不存在(line 215)
|
||||
|
||||
### 5. 过时属性警告(需同步修复)
|
||||
|
||||
* `TextBox.Watermark` → `PlaceholderText`(7 处 .cs + 7 处 .axaml)
|
||||
|
||||
## 迁移步骤
|
||||
|
||||
### Phase 1: 修复窗口装饰 API(高优先级)
|
||||
|
||||
1. 重写 `SettingsWindow.ApplyChromeMode()` 使用 Avalonia 12 新 API
|
||||
2. 重写 `ComponentEditorWindow.ApplyChromeMode()` 使用 Avalonia 12 新 API
|
||||
3. 批量替换所有 `.axaml` 中的 `SystemDecorations` → `WindowDecorations`
|
||||
|
||||
### Phase 2: 修复 MainWindow 编译错误(高优先级)
|
||||
|
||||
1. 检查 `MainWindow.ComponentSystem.cs` 中 `centerLeft` 和 `positions` 的作用域问题
|
||||
2. 检查 `MainWindow.DesktopPaging.cs` 中 `child` 和 `_isThreeFingerOrRightDragSwipeActive` 的作用域问题
|
||||
3. 确认这些变量是否被意外删除或重命名
|
||||
|
||||
### Phase 3: 修复 Avalonia 12 API 变更(中优先级)
|
||||
|
||||
1. `App.axaml.cs`: 替换 `BindingPlugins.DataValidators` 的访问方式
|
||||
2. `DesktopComponentFailureView.cs`: 使用新的剪贴板 API
|
||||
3. `MonetColorService.cs`: 更新 `Bitmap.CopyPixels` 调用签名
|
||||
|
||||
### Phase 4: 修复第三方库变更(中优先级)
|
||||
|
||||
1. `SettingsWindow.axaml.cs`: 替换 `FluentIcons.Avalonia.SymbolIconSource` 为 v3 等效 API
|
||||
|
||||
### Phase 5: 清理过时属性(低优先级)
|
||||
|
||||
1. 批量替换 `Watermark` → `PlaceholderText`(所有 .cs 和 .axaml)
|
||||
|
||||
## 验证步骤
|
||||
|
||||
* 每阶段修复后运行 `dotnet build LanMountainDesktop.slnx -c Debug`
|
||||
|
||||
* 最终运行 `dotnet test LanMountainDesktop.slnx -c Debug`
|
||||
|
||||
403
.trae/documents/class-schedule-widget-redesign.md
Normal file
403
.trae/documents/class-schedule-widget-redesign.md
Normal file
@@ -0,0 +1,403 @@
|
||||
# 课程表组件视觉重构 Implementation Plan
|
||||
|
||||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||
|
||||
**Goal:** 彻底重构阑山桌面的课程表(ClassScheduleWidget)组件视觉设计,参考小爱课程表的桌面小部件风格,实现时间轴+色块卡片布局、科目自动配色、当前课程进度高亮等现代化视觉效果。
|
||||
|
||||
**Architecture:** 保留现有数据层(ClassIslandScheduleDataService、Models)和组件注册机制不变,仅重构 Widget 的 UI 渲染层(XAML + code-behind 中的渲染逻辑)。新增科目配色服务,为每门课程分配稳定的区分色。先创建 HTML Mock 验证视觉效果,再移植到 Avalonia XAML。
|
||||
|
||||
**Tech Stack:** Avalonia UI (XAML + C# code-behind)、HTML/CSS (Mock 预览)
|
||||
|
||||
---
|
||||
|
||||
## 当前状态分析
|
||||
|
||||
### 现有组件结构
|
||||
- **XAML**: `ClassScheduleWidget.axaml` — 仅定义了 RootBorder、HeaderGrid(日期+星期+课数)、ScrollViewer+CourseListPanel、StatusTextBlock
|
||||
- **Code-behind**: `ClassScheduleWidget.axaml.cs` — 所有课程项 UI 在 `CreateSingleItemControl()` 中手动构建:圆点(Bullet) + 文字栈(课程名/时间/详情)
|
||||
- **数据层**: `ClassIslandScheduleDataService` + `ClassIslandScheduleModels` — 不变
|
||||
- **编辑器**: `ClassScheduleComponentEditor.axaml(.cs)` — 不变
|
||||
|
||||
### 现有设计问题
|
||||
1. **视觉单调**: 仅用小圆点区分课程,所有课程外观一致,缺乏层次感
|
||||
2. **信息密度低**: 课程名、时间、教师名挤在一行,可读性差
|
||||
3. **当前课不突出**: 仅通过圆点颜色变化标识当前课程,几乎无法一眼识别
|
||||
4. **色彩硬编码**: 颜色值直接写在 C# 中,不使用语义资源键,不遵循 VISUAL_SPEC
|
||||
5. **无时间轴感**: 列表式排列无法体现课程的时间先后和持续长度
|
||||
|
||||
### 小爱课程表参考设计特征
|
||||
1. **时间轴布局**: 左侧显示时间刻度,右侧是课程色块卡片
|
||||
2. **科目配色**: 每门课程自动分配一种柔和区分色,卡片使用对应色块背景
|
||||
3. **当前课高亮**: 正在进行的课程有明显的视觉强调(放大/进度条/发光)
|
||||
4. **进度指示**: 当前课程显示上课进度(已过时间/总时长)
|
||||
5. **紧凑信息**: 课程名+教室/教师信息在色块内清晰排列
|
||||
6. **课间分隔**: 课间休息区域有视觉分隔(虚线/淡色区域)
|
||||
|
||||
---
|
||||
|
||||
## 设计方案
|
||||
|
||||
### 视觉论文 (Visual Thesis)
|
||||
时间轴驱动的色块卡片布局,柔和科目配色,当前课程进度高亮——在桌面小组件有限空间内实现信息密度与美感的平衡。
|
||||
|
||||
### 布局结构
|
||||
```
|
||||
┌─────────────────────────────────────┐
|
||||
│ 7/24 周一 今天3节课 │ ← 头部:日期 + 星期 + 课数
|
||||
├─────────────────────────────────────┤
|
||||
│ 08:00 ┌──────────────────────┐ │
|
||||
│ │ 语文 │ │ ← 科目色块卡片
|
||||
│ │ 王老师 · 教室301 │ │
|
||||
│ 08:45 └──────────────────────┘ │
|
||||
│ ┌──────────────────────┐ │
|
||||
│ │ 数学 ████████░░ 75% │ │ ← 当前课:进度条 + 高亮
|
||||
│ │ 李老师 · 教室205 │ │
|
||||
│ 09:30 └──────────────────────┘ │
|
||||
│ ... │
|
||||
└─────────────────────────────────────┘
|
||||
```
|
||||
|
||||
### 科目配色方案
|
||||
使用一组预定义的柔和色彩,按科目名哈希值稳定分配:
|
||||
- 语文: #5B8FF9 (蓝)
|
||||
- 数学: #F6903D (橙)
|
||||
- 英语: #5AD8A6 (绿)
|
||||
- 物理: #E8684A (红)
|
||||
- 化学: #9270CA (紫)
|
||||
- 生物: #FF9845 (琥珀)
|
||||
- 历史: #1E9493 (青)
|
||||
- 地理: #FF99C3 (粉)
|
||||
- 政治: #7262FD (靛)
|
||||
- 体育: #78D3F8 (天蓝)
|
||||
- 默认: #8B95A5 (灰)
|
||||
|
||||
### 当前课程高亮
|
||||
- 卡片左侧显示 3px 宽的强调色竖条
|
||||
- 卡片底部显示细进度条(已过时间/总时长)
|
||||
- 卡片背景使用科目色的 15% 透明度版本
|
||||
- 非当前课程使用科目色的 8% 透明度版本
|
||||
|
||||
---
|
||||
|
||||
## 文件变更清单
|
||||
|
||||
| 文件 | 操作 | 说明 |
|
||||
|------|------|------|
|
||||
| `LanMountainDesktop/Views/Components/ClassScheduleWidget.axaml` | 修改 | 重构 XAML 布局:时间轴+卡片区域 |
|
||||
| `LanMountainDesktop/Views/Components/ClassScheduleWidget.axaml.cs` | 修改 | 重构渲染逻辑:色块卡片、科目配色、进度条 |
|
||||
| `LanMountainDesktop/Views/Components/SubjectColorService.cs` | 新建 | 科目配色服务:稳定哈希分配颜色 |
|
||||
| `mocks/class-schedule-mock.html` | 新建 | HTML Mock 预览(亮色+暗色) |
|
||||
|
||||
---
|
||||
|
||||
## Task 分解
|
||||
|
||||
### Task 1: 创建 HTML Mock 预览
|
||||
|
||||
**Files:**
|
||||
- Create: `mocks/class-schedule-mock.html`
|
||||
|
||||
- [ ] **Step 1: 创建 HTML Mock 文件**
|
||||
|
||||
创建完整的 HTML Mock,包含:
|
||||
- 亮色/暗色主题切换
|
||||
- 时间轴+色块卡片布局
|
||||
- 科目自动配色
|
||||
- 当前课程进度条高亮
|
||||
- 课间分隔区域
|
||||
- 响应式尺寸(模拟桌面组件 2x4 / 4x4 等尺寸)
|
||||
|
||||
Mock 中应包含示例数据:
|
||||
```
|
||||
08:00-08:45 语文 王老师
|
||||
08:55-09:40 数学 李老师 (当前课,进度 60%)
|
||||
09:50-10:35 英语 张老师
|
||||
10:45-11:30 物理 赵老师
|
||||
14:00-14:45 化学 陈老师
|
||||
14:55-15:40 生物 刘老师
|
||||
```
|
||||
|
||||
- [ ] **Step 2: 在浏览器中打开 Mock 验证效果**
|
||||
|
||||
Run: `start mocks/class-schedule-mock.html`
|
||||
|
||||
- [ ] **Step 3: 根据视觉效果调整 Mock 细节**
|
||||
|
||||
调整间距、色值、字体大小、进度条样式等直到满意。
|
||||
|
||||
---
|
||||
|
||||
### Task 2: 创建科目配色服务
|
||||
|
||||
**Files:**
|
||||
- Create: `LanMountainDesktop/Views/Components/SubjectColorService.cs`
|
||||
|
||||
- [ ] **Step 1: 实现 SubjectColorService**
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace LanMountainDesktop.Views.Components;
|
||||
|
||||
internal static class SubjectColorService
|
||||
{
|
||||
private static readonly (string Name, string Hex)[] Palette = [
|
||||
("语文", "#5B8FF9"),
|
||||
("数学", "#F6903D"),
|
||||
("英语", "#5AD8A6"),
|
||||
("物理", "#E8684A"),
|
||||
("化学", "#9270CA"),
|
||||
("生物", "#FF9845"),
|
||||
("历史", "#1E9493"),
|
||||
("地理", "#FF99C3"),
|
||||
("政治", "#7262FD"),
|
||||
("体育", "#78D3F8"),
|
||||
("音乐", "#F25E7E"),
|
||||
("美术", "#C2A1FD"),
|
||||
];
|
||||
|
||||
private static readonly string DefaultHex = "#8B95A5";
|
||||
|
||||
public static Color ResolveColor(string subjectName)
|
||||
{
|
||||
foreach (var (name, hex) in Palette)
|
||||
{
|
||||
if (subjectName.Contains(name, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return Color.Parse(hex);
|
||||
}
|
||||
}
|
||||
|
||||
var hash = StableHash(subjectName);
|
||||
var index = (int)(hash % (uint)Palette.Length);
|
||||
return Color.Parse(Palette[index].Hex);
|
||||
}
|
||||
|
||||
public static Color ResolveBackgroundColor(string subjectName, bool isCurrent, bool isNight)
|
||||
{
|
||||
var baseColor = ResolveColor(subjectName);
|
||||
var alpha = isCurrent ? 0.18 : 0.08;
|
||||
return new Color(
|
||||
(byte)(alpha * 255),
|
||||
baseColor.R,
|
||||
baseColor.G,
|
||||
baseColor.B);
|
||||
}
|
||||
|
||||
public static Color ResolveForegroundColor(string subjectName, bool isNight)
|
||||
{
|
||||
var baseColor = ResolveColor(subjectName);
|
||||
return isNight
|
||||
? new Color(0xFF, (byte)Math.Min(255, baseColor.R + 60), (byte)Math.Min(255, baseColor.G + 60), (byte)Math.Min(255, baseColor.B + 60))
|
||||
: baseColor;
|
||||
}
|
||||
|
||||
private static uint StableHash(string input)
|
||||
{
|
||||
uint hash = 5381;
|
||||
foreach (var c in input)
|
||||
{
|
||||
hash = ((hash << 5) + hash) ^ (uint)c;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- [ ] **Step 2: 验证编译通过**
|
||||
|
||||
Run: `dotnet build LanMountainDesktop/LanMountainDesktop.csproj -c Debug --no-restore`
|
||||
|
||||
---
|
||||
|
||||
### Task 3: 重构 ClassScheduleWidget XAML 布局
|
||||
|
||||
**Files:**
|
||||
- Modify: `LanMountainDesktop/Views/Components/ClassScheduleWidget.axaml`
|
||||
|
||||
- [ ] **Step 1: 重写 XAML 布局**
|
||||
|
||||
新的 XAML 结构:
|
||||
- RootBorder 保持 `DesignCornerRadiusComponent`
|
||||
- 头部区域:日期(大号)+ 星期 + 课数 + 进度摘要
|
||||
- 课程列表区域:ScrollViewer 包裹 StackPanel
|
||||
- 每个 CourseItem 将在 code-behind 中构建为:Grid(时间列 + 卡片列)
|
||||
- 时间列:StartTime / EndTime 垂直排列
|
||||
- 卡片列:Border(科目色背景) > StackPanel(课程名 + 教师信息 + 进度条)
|
||||
|
||||
XAML 只定义骨架,课程项仍由 code-behind 动态构建(因为需要科目配色和进度计算)。
|
||||
|
||||
```xml
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="LanMountainDesktop.Views.Components.ClassScheduleWidget">
|
||||
<Border x:Name="RootBorder"
|
||||
Background="{DynamicResource AdaptiveSurfaceRaisedBrush}"
|
||||
BorderBrush="{DynamicResource AdaptiveButtonBorderBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="{DynamicResource DesignCornerRadiusComponent}"
|
||||
Padding="0">
|
||||
<Grid x:Name="LayoutGrid"
|
||||
RowDefinitions="Auto,*">
|
||||
<Grid x:Name="HeaderGrid"
|
||||
ColumnDefinitions="Auto,*,Auto"
|
||||
Padding="16,12,16,8">
|
||||
<StackPanel x:Name="DateGroup"
|
||||
Orientation="Horizontal"
|
||||
VerticalAlignment="Center">
|
||||
<TextBlock x:Name="MonthTextBlock"
|
||||
FontWeight="Bold"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock x:Name="SlashTextBlock"
|
||||
Text="/"
|
||||
FontWeight="Bold" />
|
||||
<TextBlock x:Name="DayTextBlock"
|
||||
FontWeight="Bold"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
</StackPanel>
|
||||
<TextBlock x:Name="WeekdayTextBlock"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="SemiBold"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
<Border x:Name="ClassCountBadge"
|
||||
Grid.Column="2"
|
||||
VerticalAlignment="Center"
|
||||
Padding="8,3"
|
||||
CornerRadius="{DynamicResource DesignCornerRadiusMicro}">
|
||||
<TextBlock x:Name="ClassCountTextBlock"
|
||||
FontWeight="SemiBold"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
</Border>
|
||||
</Grid>
|
||||
<ScrollViewer x:Name="ContentScrollViewer"
|
||||
Grid.Row="1"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel x:Name="CourseListPanel"
|
||||
Spacing="4" />
|
||||
</ScrollViewer>
|
||||
<TextBlock x:Name="StatusTextBlock"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
TextAlignment="Center"
|
||||
IsVisible="False"
|
||||
TextWrapping="Wrap" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</UserControl>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 4: 重构 ClassScheduleWidget 渲染逻辑
|
||||
|
||||
**Files:**
|
||||
- Modify: `LanMountainDesktop/Views/Components/ClassScheduleWidget.axaml.cs`
|
||||
|
||||
- [ ] **Step 1: 扩展 CourseItemViewModel**
|
||||
|
||||
在现有 record 中增加字段:
|
||||
|
||||
```csharp
|
||||
private sealed record CourseItemViewModel(
|
||||
string Name,
|
||||
string TimeRange,
|
||||
string Detail,
|
||||
bool IsCurrent,
|
||||
TimeSpan StartTime,
|
||||
TimeSpan EndTime,
|
||||
double Progress);
|
||||
```
|
||||
|
||||
- [ ] **Step 2: 修改 BuildCourseItemViewModels 计算进度**
|
||||
|
||||
在构建 ViewModel 时,对当前课程计算 Progress = (now - startTime) / (endTime - startTime)。
|
||||
|
||||
- [ ] **Step 3: 重写 CreateSingleItemControl**
|
||||
|
||||
新的课程项 UI 结构:
|
||||
|
||||
```
|
||||
Grid (2列: 时间列 Auto + 卡片列 *)
|
||||
├── StackPanel (时间列)
|
||||
│ ├── TextBlock (开始时间, 如 "08:00")
|
||||
│ └── TextBlock (结束时间, 如 "08:45", 较淡)
|
||||
└── Border (卡片列, 科目色背景, 圆角 DesignCornerRadiusSm)
|
||||
├── 左侧强调竖条 (当前课显示, 3px宽, 科目色)
|
||||
└── StackPanel
|
||||
├── TextBlock (课程名, 科目色前景, 加粗)
|
||||
├── TextBlock (教师/教室, 次要色)
|
||||
└── ProgressBar (当前课显示, 科目色)
|
||||
```
|
||||
|
||||
关键改动点:
|
||||
1. 移除圆点(Bullet),改用时间轴左侧时间标签
|
||||
2. 课程卡片使用 `SubjectColorService` 配色
|
||||
3. 当前课程卡片左侧显示强调竖条 + 底部进度条
|
||||
4. 课间区域用淡色分隔线标识
|
||||
5. 颜色使用语义资源键(`AdaptiveTextPrimaryBrush` 等),科目色通过 `SubjectColorService` 获取
|
||||
|
||||
- [ ] **Step 4: 重写 ApplyAdaptiveLayout**
|
||||
|
||||
更新自适应布局逻辑:
|
||||
- 头部日期/星期/课数徽章的字号和间距
|
||||
- 移除旧的圆点、文字栈相关计算
|
||||
- 新增时间列宽度、卡片圆角、进度条高度等计算
|
||||
- 使用 `ComponentChromeCornerRadiusHelper` 获取圆角 Token
|
||||
|
||||
- [ ] **Step 5: 更新 IncrementalUpdateItems 和 IncrementalUpdateCurrentCourseHighlight**
|
||||
|
||||
适配新的 UI 结构:
|
||||
- 更新进度条值
|
||||
- 更新科目色背景
|
||||
- 更新强调竖条可见性
|
||||
|
||||
- [ ] **Step 6: 更新 RefreshSchedule 中的时间计算**
|
||||
|
||||
在 `BuildCourseItemViewModels` 中传入 `StartTime`/`EndTime`/`Progress`。
|
||||
|
||||
- [ ] **Step 7: 验证编译通过**
|
||||
|
||||
Run: `dotnet build LanMountainDesktop/LanMountainDesktop.csproj -c Debug`
|
||||
|
||||
---
|
||||
|
||||
### Task 5: 验证与测试
|
||||
|
||||
- [ ] **Step 1: 运行项目查看效果**
|
||||
|
||||
Run: `dotnet run --project LanMountainDesktop/LanMountainDesktop.csproj`
|
||||
|
||||
- [ ] **Step 2: 运行相关测试**
|
||||
|
||||
Run: `dotnet test LanMountainDesktop.slnx -c Debug`
|
||||
|
||||
- [ ] **Step 3: 检查圆角规范合规**
|
||||
|
||||
确认 RootBorder 使用 `DesignCornerRadiusComponent`,内部卡片使用 `DesignCornerRadiusSm`/`DesignCornerRadiusMd`,无硬编码圆角值。
|
||||
|
||||
---
|
||||
|
||||
## 假设与决策
|
||||
|
||||
1. **科目配色**: 使用预定义调色板 + 哈希回退,不依赖 ClassIsland 数据中的科目颜色(因为 ClassIsland 不提供科目颜色字段)
|
||||
2. **进度条**: 仅当前课程显示进度条,非当前课程不显示
|
||||
3. **课间分隔**: 用 4px 间距 + 可选的淡色虚线分隔,不做复杂的课间休息区域
|
||||
4. **Mock 优先**: 先完成 HTML Mock 确认视觉效果,再实现 Avalonia 代码
|
||||
5. **编辑器不变**: ClassScheduleComponentEditor 不需要修改
|
||||
6. **数据层不变**: ClassIslandScheduleDataService 和 Models 不需要修改
|
||||
7. **接口兼容**: IDesktopComponentWidget、ITimeZoneAwareComponentWidget、IComponentPlacementContextAware 接口实现不变
|
||||
|
||||
## 验证步骤
|
||||
|
||||
1. HTML Mock 在浏览器中展示效果满意
|
||||
2. Avalonia 项目编译通过
|
||||
3. 运行项目,课程表组件显示新布局
|
||||
4. 亮色/暗色主题切换正常
|
||||
5. 当前课程高亮和进度条正常
|
||||
6. 科目配色稳定(同一科目每次显示颜色一致)
|
||||
7. 测试通过
|
||||
850
.trae/documents/launcher-resx-i18n-plan.md
Normal file
850
.trae/documents/launcher-resx-i18n-plan.md
Normal file
@@ -0,0 +1,850 @@
|
||||
# 启动器 RESX 多语言适配实施计划
|
||||
|
||||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||
|
||||
**Goal:** 为 LanMountainDesktop.Launcher 引入 RESX 资源文件,实现启动器 UI 的多语言适配,消除所有硬编码中英文字符串。
|
||||
|
||||
**Architecture:** 在 Launcher 项目中创建 RESX 资源文件体系(默认 zh-CN + en-US/ja-JP/ko-KR),通过 .NET 内置 `ResourceManager` 机制实现本地化。启动时从主应用 `settings.json` 读取 `LanguageCode` 字段设置 `CultureInfo.CurrentUICulture`,AXAML 中使用 `x:Static` 引用资源,C# 代码中通过 `Strings.ResourceName` 强类型访问。
|
||||
|
||||
**Tech Stack:** .NET RESX 资源文件、Avalonia `x:Static` 标记扩展、`System.Globalization.CultureInfo`
|
||||
|
||||
---
|
||||
|
||||
## 现状分析
|
||||
|
||||
### 问题概述
|
||||
|
||||
1. **启动器完全没有本地化支持**:所有 UI 字符串硬编码,中英文混杂严重
|
||||
2. **纯英文窗口**:SplashWindow、ErrorWindow、MultiInstancePromptWindow、DataLocationPromptWindow、LoadingDetailsWindow
|
||||
3. **纯中文窗口**:OobeWindow、MigrationPromptWindow、UpdateWindow、ErrorDebugWindow、DevDebugWindow、PrivacyPolicyWindow
|
||||
4. **启动器不读取主应用语言设置**:没有 `LanguageCode` 相关代码
|
||||
5. **硬编码字符串总量约 180+ 条**,分布在 11 个 AXAML 视图和 11 个 C# code-behind 文件中
|
||||
|
||||
### 方案选择:RESX vs JSON
|
||||
|
||||
| 维度 | RESX(本方案) | JSON(主项目模式) |
|
||||
|------|---------------|-------------------|
|
||||
| 编译时安全 | ✅ 强类型 `Strings.KeyName` | ❌ 字符串键值 `L("key", "fallback")` |
|
||||
| AXAML 集成 | ✅ `x:Static` 直接引用 | ❌ 需 code-behind 赋值 |
|
||||
| 回退机制 | ✅ 内置(默认资源 → 特定文化) | ✅ 自定义 `fallback` 参数 |
|
||||
| 新增语言 | 需添加 RESX 文件并重新编译 | 仅添加 JSON 文件 |
|
||||
| AOT 兼容性 | ⚠️ 需额外配置 | ✅ 已验证 |
|
||||
| 与主项目一致性 | ❌ 不同模式 | ✅ 一致 |
|
||||
|
||||
**选择 RESX 的理由**:启动器是独立轻量进程,不需要运行时语言切换;强类型访问减少拼写错误;`x:Static` 比 code-behind 赋值更清晰;RESX 的内置回退机制足够满足启动器需求。
|
||||
|
||||
### AOT 兼容性说明
|
||||
|
||||
Launcher 项目支持 Native AOT 发布。RESX 的 `ResourceManager` 依赖反射,需要:
|
||||
1. 在 `.csproj` 中添加 `<EmbeddedResource>` 确保资源不被修剪
|
||||
2. 在 AOT props 中添加 `TrimmerRootAssembly` 保留资源程序集
|
||||
3. 发布后进行 AOT 冒烟测试验证
|
||||
|
||||
---
|
||||
|
||||
## 文件结构规划
|
||||
|
||||
### 新增文件
|
||||
|
||||
| 文件 | 职责 |
|
||||
|------|------|
|
||||
| `Resources/Strings.resx` | 默认资源文件(zh-CN,回退资源) |
|
||||
| `Resources/Strings.en-US.resx` | 英语资源 |
|
||||
| `Resources/Strings.ja-JP.resx` | 日语资源 |
|
||||
| `Resources/Strings.ko-KR.resx` | 韩语资源 |
|
||||
| `Services/LanguagePreferenceService.cs` | 从 settings.json 读取 LanguageCode 并设置 CultureInfo |
|
||||
|
||||
### 修改文件
|
||||
|
||||
| 文件 | 改动内容 |
|
||||
|------|---------|
|
||||
| `LanMountainDesktop.Launcher.csproj` | 添加 RESX 嵌入资源配置 |
|
||||
| `LanMountainDesktop.Launcher.AOT.props` | 添加资源程序集修剪保留 |
|
||||
| `Program.cs` | 启动时调用语言偏好初始化 |
|
||||
| `Views/SplashWindow.axaml` | 替换硬编码字符串为 `x:Static` |
|
||||
| `Views/SplashWindow.axaml.cs` | 替换 C# 硬编码字符串为 `Strings.XXX` |
|
||||
| `Views/ErrorWindow.axaml` | 同上 |
|
||||
| `Views/ErrorWindow.axaml.cs` | 同上 |
|
||||
| `Views/MultiInstancePromptWindow.axaml` | 同上 |
|
||||
| `Views/MultiInstancePromptWindow.axaml.cs` | 同上 |
|
||||
| `Views/DataLocationPromptWindow.axaml` | 同上 |
|
||||
| `Views/DataLocationPromptWindow.axaml.cs` | 同上 |
|
||||
| `Views/LoadingDetailsWindow.axaml` | 同上 |
|
||||
| `Views/LoadingDetailsWindow.axaml.cs` | 同上 |
|
||||
| `Views/UpdateWindow.axaml` | 同上 |
|
||||
| `Views/UpdateWindow.axaml.cs` | 同上 |
|
||||
| `Views/ErrorDebugWindow.axaml` | 同上 |
|
||||
| `Views/ErrorDebugWindow.axaml.cs` | 同上 |
|
||||
| `Views/OobeWindow.axaml` | 同上 |
|
||||
| `Views/OobeWindow.axaml.cs` | 同上 |
|
||||
| `Views/MigrationPromptWindow.axaml` | 同上 |
|
||||
| `Views/MigrationPromptWindow.axaml.cs` | 同上 |
|
||||
| `Views/PrivacyPolicyWindow.axaml` | 同上 |
|
||||
| `Views/PrivacyPolicyWindow.axaml.cs` | 同上 |
|
||||
| `Views/DevDebugWindow.axaml` | 同上 |
|
||||
| `Views/DevDebugWindow.axaml.cs` | 同上 |
|
||||
| `Services/LauncherFlowCoordinator.cs` | 替换硬编码字符串 |
|
||||
| `App.axaml.cs` | 替换预览模式硬编码字符串 |
|
||||
|
||||
---
|
||||
|
||||
## RESX 键命名规范
|
||||
|
||||
采用 `ViewName_ElementDescription` 模式,PascalCase 分隔:
|
||||
|
||||
- 窗口标题:`Splash_Title`、`Error_Title`、`MultiInstance_Title`
|
||||
- 按钮文本:`Error_ButtonOpenLogs`、`Error_ButtonCopy`、`Error_ButtonRetry`
|
||||
- 状态文本:`Splash_StatusInitializing`、`Loading_StatusPreparing`
|
||||
- 描述文本:`DataLocation_DescSystemProfile`、`DataLocation_DescPortable`
|
||||
- OOBE 步骤:`Oobe_StepWelcomeTitle`、`Oobe_StepAppearanceTitle`
|
||||
|
||||
---
|
||||
|
||||
## 实施任务
|
||||
|
||||
### Task 1: 创建 RESX 基础设施
|
||||
|
||||
**Files:**
|
||||
- Create: `LanMountainDesktop.Launcher/Resources/Strings.resx`
|
||||
- Create: `LanMountainDesktop.Launcher/Resources/Strings.en-US.resx`
|
||||
- Create: `LanMountainDesktop.Launcher/Resources/Strings.ja-JP.resx`
|
||||
- Create: `LanMountainDesktop.Launcher/Resources/Strings.ko-KR.resx`
|
||||
- Modify: `LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj`
|
||||
- Modify: `LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.AOT.props`
|
||||
|
||||
- [ ] **Step 1: 创建默认 RESX 文件(zh-CN 回退资源)**
|
||||
|
||||
创建 `Resources/Strings.resx`,包含所有 180+ 条字符串的中文翻译。此文件同时作为回退资源和中文资源。
|
||||
|
||||
```xml
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
<xsd:attribute name="type" type="xsd:string" use="optional" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" use="optional" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype"><value>text/microsoft-resx</value></resheader>
|
||||
<resheader name="version"><value>2.0</value></resheader>
|
||||
<resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms</value></resheader>
|
||||
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms</value></resheader>
|
||||
|
||||
<!-- SplashWindow -->
|
||||
<data name="Splash_Title" xml:space="preserve"><value>阑山桌面</value></data>
|
||||
<data name="Splash_AppName" xml:space="preserve"><value>阑山桌面</value></data>
|
||||
<data name="Splash_StatusInitializing" xml:space="preserve"><value>正在初始化...</value></data>
|
||||
<data name="Splash_DebugPreview" xml:space="preserve"><value>[调试模式] 启动画面预览</value></data>
|
||||
|
||||
<!-- ErrorWindow -->
|
||||
<data name="Error_Title" xml:space="preserve"><value>阑山桌面</value></data>
|
||||
<data name="Error_TitleCannotConfirm" xml:space="preserve"><value>启动器无法确认启动状态</value></data>
|
||||
<data name="Error_MessageNotReached" xml:space="preserve"><value>阑山桌面未达到预期的启动状态。</value></data>
|
||||
<data name="Error_SuggestionTitle" xml:space="preserve"><value>启动恢复</value></data>
|
||||
<data name="Error_SuggestionMessage" xml:space="preserve"><value>您可以检查日志、等待当前进程或激活正在运行的桌面实例。</value></data>
|
||||
<data name="Error_DiagnosticHeader" xml:space="preserve"><value>诊断详情</value></data>
|
||||
<data name="Error_ButtonOpenLogs" xml:space="preserve"><value>打开日志</value></data>
|
||||
<data name="Error_ButtonCopy" xml:space="preserve"><value>复制</value></data>
|
||||
<data name="Error_ButtonWait" xml:space="preserve"><value>等待</value></data>
|
||||
<data name="Error_ButtonExit" xml:space="preserve"><value>退出</value></data>
|
||||
<data name="Error_ButtonRetry" xml:space="preserve"><value>重试</value></data>
|
||||
<data name="Error_ButtonActivate" xml:space="preserve"><value>激活</value></data>
|
||||
<data name="Error_DebugTitle" xml:space="preserve"><value>[调试] 启动器错误</value></data>
|
||||
<data name="Error_HostNotFoundTitle" xml:space="preserve"><value>启动器找不到桌面可执行文件</value></data>
|
||||
<data name="Error_HostNotFoundMessage" xml:space="preserve"><value>在调试模式下选择另一个可执行文件、检查日志,或在修复部署路径后重试。</value></data>
|
||||
<data name="Error_GenericMessage" xml:space="preserve"><value>检查日志后重试,等待上一次启动尝试完全结束。</value></data>
|
||||
<data name="Error_RunningHostMessage" xml:space="preserve"><value>检查日志或退出。旧进程仍在运行时,启动器不会创建新的桌面进程。</value></data>
|
||||
<data name="Error_PendingTitle" xml:space="preserve"><value>启动仍在进行中</value></data>
|
||||
<data name="Error_PendingMessage" xml:space="preserve"><value>桌面进程仍在运行,启动器不会启动第二个实例。</value></data>
|
||||
|
||||
<!-- MultiInstancePromptWindow -->
|
||||
<data name="MultiInstance_Title" xml:space="preserve"><value>阑山桌面</value></data>
|
||||
<data name="MultiInstance_AlreadyRunning" xml:space="preserve"><value>阑山桌面已在运行</value></data>
|
||||
<data name="MultiInstance_AlreadyRunningMessage" xml:space="preserve"><value>启动器检测到已存在的桌面实例,未启动新进程。</value></data>
|
||||
<data name="MultiInstance_RepeatedLaunchTitle" xml:space="preserve"><value>重复启动</value></data>
|
||||
<data name="MultiInstance_RepeatedLaunchMessage" xml:space="preserve"><value>您当前的设置为显示此提示而不自动打开桌面。</value></data>
|
||||
<data name="MultiInstance_NoSecondProcess" xml:space="preserve"><value>未创建第二个主进程。</value></data>
|
||||
<data name="MultiInstance_ButtonCopy" xml:space="preserve"><value>复制</value></data>
|
||||
<data name="MultiInstance_ButtonClose" xml:space="preserve"><value>关闭</value></data>
|
||||
<data name="MultiInstance_ButtonOpenDesktop" xml:space="preserve"><value>打开桌面</value></data>
|
||||
<data name="MultiInstance_DetailsFormat" xml:space="preserve"><value>现有主进程 PID: {0}\nShell 状态: {1}\n未创建第二个主进程。</value></data>
|
||||
|
||||
<!-- DataLocationPromptWindow -->
|
||||
<data name="DataLocation_Title" xml:space="preserve"><value>选择数据保存位置</value></data>
|
||||
<data name="DataLocation_ChooseLocation" xml:space="preserve"><value>选择数据保存位置</value></data>
|
||||
<data name="DataLocation_ChooseLocationDesc" xml:space="preserve"><value>选择启动器和桌面数据的存储位置。您可以稍后在设置中更改。</value></data>
|
||||
<data name="DataLocation_NotWritable" xml:space="preserve"><value>应用目录不可写入</value></data>
|
||||
<data name="DataLocation_NotWritableDesc" xml:space="preserve"><value>当前安装目录需要管理员权限才能写入。数据将存储在系统用户目录中。</value></data>
|
||||
<data name="DataLocation_SystemProfile" xml:space="preserve"><value>保存在系统用户目录(推荐)</value></data>
|
||||
<data name="DataLocation_SystemProfileDesc" xml:space="preserve"><value>数据与当前 Windows 用户绑定,在应用重新安装和更新后保持完整。</value></data>
|
||||
<data name="DataLocation_Portable" xml:space="preserve"><value>保存在应用安装目录(便携模式)</value></data>
|
||||
<data name="DataLocation_PortableDesc" xml:space="preserve"><value>适用于便携安装。整个应用文件夹可以连同数据一起移动到另一台机器。</value></data>
|
||||
<data name="DataLocation_ButtonCancel" xml:space="preserve"><value>取消</value></data>
|
||||
<data name="DataLocation_ButtonConfirm" xml:space="preserve"><value>确认</value></data>
|
||||
<data name="DataLocation_MigrateWarning" xml:space="preserve"><value>检测到已有的系统数据。选择便携模式将自动迁移当前数据。</value></data>
|
||||
|
||||
<!-- LoadingDetailsWindow -->
|
||||
<data name="Loading_Title" xml:space="preserve"><value>阑山桌面 - 加载详情</value></data>
|
||||
<data name="Loading_StartingDesktop" xml:space="preserve"><value>正在启动阑山桌面</value></data>
|
||||
<data name="Loading_StatusInitializing" xml:space="preserve"><value>正在初始化...</value></data>
|
||||
<data name="Loading_StatusPreparing" xml:space="preserve"><value>正在准备组件</value></data>
|
||||
<data name="Loading_LoadingItems" xml:space="preserve"><value>加载项目</value></data>
|
||||
<data name="Loading_Done" xml:space="preserve"><value>完成</value></data>
|
||||
<data name="Loading_ErrorOccurred" xml:space="preserve"><value>加载时发生错误。</value></data>
|
||||
<data name="Loading_ButtonDetails" xml:space="preserve"><value>详情</value></data>
|
||||
<data name="Loading_ButtonCancel" xml:space="preserve"><value>取消</value></data>
|
||||
<data name="Loading_StageReady" xml:space="preserve"><value>准备就绪</value></data>
|
||||
<data name="Loading_ItemPlugin" xml:space="preserve"><value>正在加载插件...</value></data>
|
||||
<data name="Loading_ItemComponent" xml:space="preserve"><value>正在加载组件...</value></data>
|
||||
<data name="Loading_ItemResource" xml:space="preserve"><value>正在加载资源...</value></data>
|
||||
<data name="Loading_ItemData" xml:space="preserve"><value>正在加载数据...</value></data>
|
||||
<data name="Loading_ItemDownload" xml:space="preserve"><value>正在下载...</value></data>
|
||||
<data name="Loading_ItemProcess" xml:space="preserve"><value>正在处理...</value></data>
|
||||
<data name="Loading_ItemComplete" xml:space="preserve"><value>完成</value></data>
|
||||
<data name="Loading_TypePlugin" xml:space="preserve"><value>插件</value></data>
|
||||
<data name="Loading_TypeComponent" xml:space="preserve"><value>组件</value></data>
|
||||
<data name="Loading_TypeResource" xml:space="preserve"><value>资源</value></data>
|
||||
<data name="Loading_TypeData" xml:space="preserve"><value>数据</value></data>
|
||||
<data name="Loading_TypeNetwork" xml:space="preserve"><value>网络</value></data>
|
||||
<data name="Loading_TypeSettings" xml:space="preserve"><value>设置</value></data>
|
||||
<data name="Loading_TypeSystem" xml:space="preserve"><value>系统</value></data>
|
||||
<data name="Loading_TypeOther" xml:space="preserve"><value>其他</value></data>
|
||||
|
||||
<!-- UpdateWindow -->
|
||||
<data name="Update_Title" xml:space="preserve"><value>阑山桌面 - 更新</value></data>
|
||||
<data name="Update_AppName" xml:space="preserve"><value>阑山桌面</value></data>
|
||||
<data name="Update_StatusUpdate" xml:space="preserve"><value>更新</value></data>
|
||||
<data name="Update_StatusUpdating" xml:space="preserve"><value>正在更新,请稍候...</value></data>
|
||||
<data name="Update_Complete" xml:space="preserve"><value>更新完成</value></data>
|
||||
<data name="Update_Failed" xml:space="preserve"><value>更新失败</value></data>
|
||||
<data name="Update_FailedMessage" xml:space="preserve"><value>更新过程中发生错误</value></data>
|
||||
<data name="Update_DebugTitle" xml:space="preserve"><value>[调试模式] 更新页面</value></data>
|
||||
<data name="Update_DebugMessage" xml:space="preserve"><value>预览更新进度界面</value></data>
|
||||
|
||||
<!-- ErrorDebugWindow -->
|
||||
<data name="DebugDebug_Title" xml:space="preserve"><value>调试模式</value></data>
|
||||
<data name="DebugDebug_SettingsTitle" xml:space="preserve"><value>调试设置</value></data>
|
||||
<data name="DebugDebug_DevMode" xml:space="preserve"><value>开发模式</value></data>
|
||||
<data name="DebugDebug_DevModeDesc" xml:space="preserve"><value>启用后自动扫描开发目录</value></data>
|
||||
<data name="DebugDebug_On" xml:space="preserve"><value>开</value></data>
|
||||
<data name="DebugDebug_Off" xml:space="preserve"><value>关</value></data>
|
||||
<data name="DebugDebug_AppPath" xml:space="preserve"><value>应用路径</value></data>
|
||||
<data name="DebugDebug_NotSelected" xml:space="preserve"><value>未选择</value></data>
|
||||
<data name="DebugDebug_Browse" xml:space="preserve"><value>浏览...</value></data>
|
||||
<data name="DebugDebug_Warning" xml:space="preserve"><value>此功能仅供开发人员使用</value></data>
|
||||
<data name="DebugDebug_ButtonCancel" xml:space="preserve"><value>取消</value></data>
|
||||
<data name="DebugDebug_ButtonOk" xml:space="preserve"><value>确定</value></data>
|
||||
<data name="DebugDebug_SelectExeDialog" xml:space="preserve"><value>选择阑山桌面主程序可执行文件</value></data>
|
||||
|
||||
<!-- OobeWindow -->
|
||||
<data name="Oobe_Title" xml:space="preserve"><value>欢迎使用阑山桌面</value></data>
|
||||
<data name="Oobe_WelcomeTitle" xml:space="preserve"><value>欢迎使用阑山桌面</value></data>
|
||||
<data name="Oobe_WelcomeSubtitle" xml:space="preserve"><value>你的桌面,不止一面</value></data>
|
||||
<data name="Oobe_ButtonGetStarted" xml:space="preserve"><value>开始使用</value></data>
|
||||
<data name="Oobe_AppearanceTitle" xml:space="preserve"><value>个性化你的桌面</value></data>
|
||||
<data name="Oobe_AppearanceDesc" xml:space="preserve"><value>选择你喜欢的主题样式,可随时在设置中更改</value></data>
|
||||
<data name="Oobe_AppearanceMode" xml:space="preserve"><value>外观模式</value></data>
|
||||
<data name="Oobe_LightMode" xml:space="preserve"><value>浅色模式</value></data>
|
||||
<data name="Oobe_DarkMode" xml:space="preserve"><value>深色模式</value></data>
|
||||
<data name="Oobe_ThemeColor" xml:space="preserve"><value>主题色</value></data>
|
||||
<data name="Oobe_MonetSource" xml:space="preserve"><value>莫奈取色来源</value></data>
|
||||
<data name="Oobe_MonetFromWallpaper" xml:space="preserve"><value>从桌面壁纸取色</value></data>
|
||||
<data name="Oobe_MonetFromCustomImage" xml:space="preserve"><value>自定义图片取色</value></data>
|
||||
<data name="Oobe_MonetDisabled" xml:space="preserve"><value>不使用莫奈取色</value></data>
|
||||
<data name="Oobe_DataLocationTitle" xml:space="preserve"><value>选择数据保存位置</value></data>
|
||||
<data name="Oobe_SystemProfile" xml:space="preserve"><value>保存在系统用户目录(推荐)</value></data>
|
||||
<data name="Oobe_SystemProfileDesc" xml:space="preserve"><value>数据与当前 Windows 用户绑定,在应用重新安装和更新后保持完整。</value></data>
|
||||
<data name="Oobe_Portable" xml:space="preserve"><value>保存在应用安装目录(便携模式)</value></data>
|
||||
<data name="Oobe_PortableDesc" xml:space="preserve"><value>适用于便携安装。整个应用文件夹可以连同数据一起移动到另一台机器。</value></data>
|
||||
<data name="Oobe_NotWritable" xml:space="preserve"><value>无法保存到应用目录</value></data>
|
||||
<data name="Oobe_NotWritableDesc" xml:space="preserve"><value>当前安装目录需要管理员权限才能写入。数据将存储在系统用户目录中。</value></data>
|
||||
<data name="Oobe_StartupTitle" xml:space="preserve"><value>启动与展示</value></data>
|
||||
<data name="Oobe_ShowInTaskbar" xml:space="preserve"><value>在任务栏显示主桌面窗口</value></data>
|
||||
<data name="Oobe_SlideTransition" xml:space="preserve"><value>以滑动方式显示主窗口</value></data>
|
||||
<data name="Oobe_FadeTransition" xml:space="preserve"><value>启动时使用淡入过渡</value></data>
|
||||
<data name="Oobe_FusedDesktop" xml:space="preserve"><value>融合桌面与弹入手势</value></data>
|
||||
<data name="Oobe_AutoStart" xml:space="preserve"><value>登录 Windows 时自动启动阑山桌面</value></data>
|
||||
<data name="Oobe_PrivacyTitle" xml:space="preserve"><value>信息与隐私</value></data>
|
||||
<data name="Oobe_CrashReports" xml:space="preserve"><value>发送匿名崩溃报告</value></data>
|
||||
<data name="Oobe_UsageStats" xml:space="preserve"><value>发送匿名使用统计</value></data>
|
||||
<data name="Oobe_PrivacyTrackingId" xml:space="preserve"><value>隐私追踪 ID</value></data>
|
||||
<data name="Oobe_Agree" xml:space="preserve"><value>同意</value></data>
|
||||
<data name="Oobe_PrivacyPolicyLink" xml:space="preserve"><value>《阑山桌面遥测隐私数据收集协议》</value></data>
|
||||
<data name="Oobe_ButtonBack" xml:space="preserve"><value>返回</value></data>
|
||||
<data name="Oobe_ButtonNext" xml:space="preserve"><value>下一步</value></data>
|
||||
<data name="Oobe_CompleteTitle" xml:space="preserve"><value>欢迎使用阑山桌面</value></data>
|
||||
<data name="Oobe_CompleteSubtitle" xml:space="preserve"><value>你的桌面,不止一面</value></data>
|
||||
|
||||
<!-- MigrationPromptWindow -->
|
||||
<data name="Migration_Title" xml:space="preserve"><value>阑山桌面 - 版本迁移</value></data>
|
||||
<data name="Migration_DetectedOldVersion" xml:space="preserve"><value>检测到旧版本</value></data>
|
||||
<data name="Migration_DetectedDesc" xml:space="preserve"><value>检测到您的系统中安装了旧版本的阑山桌面(0.8.4)...</value></data>
|
||||
<data name="Migration_Version" xml:space="preserve"><value>版本:</value></data>
|
||||
<data name="Migration_Location" xml:space="preserve"><value>位置:</value></data>
|
||||
<data name="Migration_Type" xml:space="preserve"><value>类型:</value></data>
|
||||
<data name="Migration_Installed" xml:space="preserve"><value>安装版</value></data>
|
||||
<data name="Migration_UninstallNote" xml:space="preserve"><value>卸载旧版本不会影响新版本的使用,您的个人数据将保留。</value></data>
|
||||
<data name="Migration_ButtonViewLocation" xml:space="preserve"><value>查看位置</value></data>
|
||||
<data name="Migration_ButtonSkip" xml:space="preserve"><value>暂不处理</value></data>
|
||||
<data name="Migration_ButtonUninstall" xml:space="preserve"><value>卸载旧版本</value></data>
|
||||
|
||||
<!-- PrivacyPolicyWindow -->
|
||||
<data name="Privacy_Title" xml:space="preserve"><value>阑山桌面遥测隐私数据收集协议</value></data>
|
||||
<data name="Privacy_Header" xml:space="preserve"><value>阑山桌面遥测隐私数据收集协议</value></data>
|
||||
<data name="Privacy_Description" xml:space="preserve"><value>请仔细阅读以下协议内容,了解我们如何收集、使用和保护您的数据</value></data>
|
||||
<data name="Privacy_ButtonClose" xml:space="preserve"><value>关闭</value></data>
|
||||
|
||||
<!-- DevDebugWindow -->
|
||||
<data name="DevDebug_Title" xml:space="preserve"><value>开发调试窗口</value></data>
|
||||
<data name="DevDebug_Splash" xml:space="preserve"><value>启动画面</value></data>
|
||||
<data name="DevDebug_Error" xml:space="preserve"><value>错误页面</value></data>
|
||||
<data name="DevDebug_Update" xml:space="preserve"><value>更新页面</value></data>
|
||||
<data name="DevDebug_Oobe" xml:space="preserve"><value>OOBE页面</value></data>
|
||||
<data name="DevDebug_DataLocation" xml:space="preserve"><value>数据位置选择</value></data>
|
||||
<data name="DevDebug_EnableFeature" xml:space="preserve"><value>启用功能</value></data>
|
||||
<data name="DevDebug_Open" xml:space="preserve"><value>打开</value></data>
|
||||
<data name="DevDebug_SetAllViewMode" xml:space="preserve"><value>全部设为查看模式</value></data>
|
||||
<data name="DevDebug_SetAllFunctionMode" xml:space="preserve"><value>全部设为功能模式</value></data>
|
||||
<data name="DevDebug_Close" xml:space="preserve"><value>关闭</value></data>
|
||||
|
||||
<!-- LauncherFlowCoordinator -->
|
||||
<data name="Coordinator_SlowDeviceMessage" xml:space="preserve"><value>设备较慢,仍在启动,请稍候。</value></data>
|
||||
<data name="Coordinator_RunningHostMessage" xml:space="preserve"><value>桌面主进程仍在运行,Launcher 会继续等待,不会重复启动。</value></data>
|
||||
|
||||
<!-- App.axaml.cs preview strings -->
|
||||
<data name="Preview_SplashInitializing" xml:space="preserve"><value>正在初始化...</value></data>
|
||||
<data name="Preview_SplashCheckingUpdates" xml:space="preserve"><value>正在检查更新...</value></data>
|
||||
<data name="Preview_SplashCheckingPlugins" xml:space="preserve"><value>正在检查插件...</value></data>
|
||||
<data name="Preview_SplashLaunchingHost" xml:space="preserve"><value>正在启动主程序...</value></data>
|
||||
<data name="Preview_SplashReady" xml:space="preserve"><value>准备就绪</value></data>
|
||||
<data name="Preview_ErrorMessage" xml:space="preserve"><value>[预览] 这是启动器错误窗口预览。</value></data>
|
||||
<data name="Preview_UpdateProcessing" xml:space="preserve"><value>正在处理 {0}...</value></data>
|
||||
<data name="Preview_ActivationConnecting" xml:space="preserve"><value>正在连接到活跃的启动器...</value></data>
|
||||
</root>
|
||||
```
|
||||
|
||||
- [ ] **Step 2: 创建 en-US RESX 文件**
|
||||
|
||||
创建 `Resources/Strings.en-US.resx`,包含所有字符串的英文翻译。结构与默认文件相同,仅 `<value>` 内容为英文。
|
||||
|
||||
```xml
|
||||
<!-- 示例条目 -->
|
||||
<data name="Splash_Title" xml:space="preserve"><value>LanMountain Desktop</value></data>
|
||||
<data name="Splash_AppName" xml:space="preserve"><value>LanMountain Desktop</value></data>
|
||||
<data name="Splash_StatusInitializing" xml:space="preserve"><value>Initializing...</value></data>
|
||||
<data name="Error_TitleCannotConfirm" xml:space="preserve"><value>Launcher could not confirm startup</value></data>
|
||||
<data name="Error_MessageNotReached" xml:space="preserve"><value>LanMountain Desktop did not reach the expected startup state.</value></data>
|
||||
<!-- ... 所有键的英文翻译 ... -->
|
||||
```
|
||||
|
||||
- [ ] **Step 3: 创建 ja-JP RESX 文件**
|
||||
|
||||
创建 `Resources/Strings.ja-JP.resx`,包含所有字符串的日语翻译。
|
||||
|
||||
- [ ] **Step 4: 创建 ko-KR RESX 文件**
|
||||
|
||||
创建 `Resources/Strings.ko-KR.resx`,包含所有字符串的韩语翻译。
|
||||
|
||||
- [ ] **Step 5: 修改 .csproj 添加 RESX 配置**
|
||||
|
||||
在 `LanMountainDesktop.Launcher.csproj` 的 `<ItemGroup>` 中添加:
|
||||
|
||||
```xml
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Resources\Strings.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Strings.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
```
|
||||
|
||||
注意:使用 `PublicResXFileCodeGenerator` 而非 `ResXFileCodeGenerator`,生成 `public` 类以便 AXAML 的 `x:Static` 可以访问。
|
||||
|
||||
- [ ] **Step 6: 修改 AOT props 添加资源程序集保留**
|
||||
|
||||
在 `LanMountainDesktop.Launcher.AOT.props` 的 AOT 修剪配置 `<ItemGroup>` 中添加:
|
||||
|
||||
```xml
|
||||
<TrimmerRootAssembly Include="LanMountainDesktop.Launcher" />
|
||||
```
|
||||
|
||||
- [ ] **Step 7: 运行构建验证 RESX 生成**
|
||||
|
||||
Run: `dotnet build LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj -c Debug`
|
||||
Expected: 构建成功,`Resources/Strings.Designer.cs` 自动生成
|
||||
|
||||
---
|
||||
|
||||
### Task 2: 创建语言偏好服务
|
||||
|
||||
**Files:**
|
||||
- Create: `LanMountainDesktop.Launcher/Services/LanguagePreferenceService.cs`
|
||||
- Modify: `LanMountainDesktop.Launcher/Program.cs`
|
||||
|
||||
- [ ] **Step 1: 创建 LanguagePreferenceService**
|
||||
|
||||
```csharp
|
||||
using System.Globalization;
|
||||
using System.Text.Json.Nodes;
|
||||
|
||||
namespace LanMountainDesktop.Launcher.Services;
|
||||
|
||||
internal static class LanguagePreferenceService
|
||||
{
|
||||
public static string ResolveLanguageCode(string appRoot)
|
||||
{
|
||||
try
|
||||
{
|
||||
var dataLocationResolver = new DataLocationResolver(appRoot);
|
||||
var settingsPath = HostAppSettingsOobeMerger.GetSettingsFilePath(dataLocationResolver.ResolveDataRoot());
|
||||
if (!File.Exists(settingsPath))
|
||||
{
|
||||
return "zh-CN";
|
||||
}
|
||||
|
||||
var root = JsonNode.Parse(File.ReadAllText(settingsPath))?.AsObject();
|
||||
if (root is not null &&
|
||||
root.TryGetPropertyValue("LanguageCode", out var node) &&
|
||||
node is JsonValue value &&
|
||||
value.TryGetValue<string>(out var code) &&
|
||||
!string.IsNullOrWhiteSpace(code))
|
||||
{
|
||||
return NormalizeLanguageCode(code);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
return "zh-CN";
|
||||
}
|
||||
|
||||
public static void ApplyLanguage(string languageCode)
|
||||
{
|
||||
var normalized = NormalizeLanguageCode(languageCode);
|
||||
var culture = CultureInfo.GetCultureInfo(normalized);
|
||||
CultureInfo.DefaultThreadCurrentCulture = culture;
|
||||
CultureInfo.DefaultThreadCurrentUICulture = culture;
|
||||
Thread.CurrentThread.CurrentCulture = culture;
|
||||
Thread.CurrentThread.CurrentUICulture = culture;
|
||||
}
|
||||
|
||||
private static string NormalizeLanguageCode(string code)
|
||||
{
|
||||
return code.ToLowerInvariant() switch
|
||||
{
|
||||
"en-us" or "en" => "en-US",
|
||||
"ja-jp" or "ja" => "ja-JP",
|
||||
"ko-kr" or "ko" => "ko-KR",
|
||||
_ => "zh-CN"
|
||||
};
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- [ ] **Step 2: 在 Program.cs 中调用语言初始化**
|
||||
|
||||
在 `Program.Main` 方法中,`BuildAvaloniaApp().StartWithClassicDesktopLifetime(args)` 之前添加语言初始化:
|
||||
|
||||
```csharp
|
||||
var appRoot = Commands.ResolveAppRoot(commandContext);
|
||||
var languageCode = LanguagePreferenceService.ResolveLanguageCode(appRoot);
|
||||
LanguagePreferenceService.ApplyLanguage(languageCode);
|
||||
```
|
||||
|
||||
- [ ] **Step 3: 构建验证**
|
||||
|
||||
Run: `dotnet build LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj -c Debug`
|
||||
Expected: 构建成功
|
||||
|
||||
---
|
||||
|
||||
### Task 3: 替换 SplashWindow 硬编码字符串
|
||||
|
||||
**Files:**
|
||||
- Modify: `LanMountainDesktop.Launcher/Views/SplashWindow.axaml`
|
||||
- Modify: `LanMountainDesktop.Launcher/Views/SplashWindow.axaml.cs`
|
||||
|
||||
- [ ] **Step 1: 在 SplashWindow.axaml 中添加 RESX 命名空间并替换字符串**
|
||||
|
||||
在 `<Window>` 标签添加命名空间:
|
||||
```xml
|
||||
xmlns:res="clr-namespace:LanMountainDesktop.Launcher.Resources"
|
||||
```
|
||||
|
||||
替换硬编码字符串:
|
||||
- `Title="LanMountain Desktop"` → `Title="{x:Static res:Strings.Splash_Title}"`
|
||||
- `Text="LanMountain Desktop"` (AppNameText) → `Text="{x:Static res:Strings.Splash_AppName}"`
|
||||
- `Text="Initializing..."` (StatusText) → `Text="{x:Static res:Strings.Splash_StatusInitializing}"`
|
||||
|
||||
注意:`VersionText` 的 `Text="0.0.0-dev (Administrate)"` 是动态设置的占位文本,保留原样(由 code-behind `SetVersionInfo` 方法设置)。
|
||||
|
||||
- [ ] **Step 2: 在 SplashWindow.axaml.cs 中替换 C# 硬编码字符串**
|
||||
|
||||
将 `"[Debug Mode] Splash Preview"` 替换为 `Strings.Splash_DebugPreview`。
|
||||
|
||||
- [ ] **Step 3: 构建验证**
|
||||
|
||||
Run: `dotnet build LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj -c Debug`
|
||||
Expected: 构建成功
|
||||
|
||||
---
|
||||
|
||||
### Task 4: 替换 ErrorWindow 硬编码字符串
|
||||
|
||||
**Files:**
|
||||
- Modify: `LanMountainDesktop.Launcher/Views/ErrorWindow.axaml`
|
||||
- Modify: `LanMountainDesktop.Launcher/Views/ErrorWindow.axaml.cs`
|
||||
|
||||
- [ ] **Step 1: 在 ErrorWindow.axaml 中添加 RESX 命名空间并替换字符串**
|
||||
|
||||
添加命名空间 `xmlns:res="clr-namespace:LanMountainDesktop.Launcher.Resources"`
|
||||
|
||||
AXAML 替换:
|
||||
- `Title="LanMountain Desktop"` → `Title="{x:Static res:Strings.Error_Title}"`
|
||||
- `Text="Launcher could not confirm startup"` → `Text="{x:Static res:Strings.Error_TitleCannotConfirm}"`
|
||||
- `Text="LanMountain Desktop did not reach..."` → `Text="{x:Static res:Strings.Error_MessageNotReached}"`
|
||||
- `Title="Startup recovery"` → `Title="{x:Static res:Strings.Error_SuggestionTitle}"`
|
||||
- `Message="You can inspect logs..."` → `Message="{x:Static res:Strings.Error_SuggestionMessage}"`
|
||||
- `Header="Diagnostic details"` → `Header="{x:Static res:Strings.Error_DiagnosticHeader}"`
|
||||
- `Text="Open Logs"` → `Text="{x:Static res:Strings.Error_ButtonOpenLogs}"`
|
||||
- `Text="Copy"` → `Text="{x:Static res:Strings.Error_ButtonCopy}"`
|
||||
- `Content="Wait"` → `Content="{x:Static res:Strings.Error_ButtonWait}"`
|
||||
- `Text="Exit"` → `Text="{x:Static res:Strings.Error_ButtonExit}"`
|
||||
- `Content="Retry"` → `Content="{x:Static res:Strings.Error_ButtonRetry}"`
|
||||
|
||||
- [ ] **Step 2: 在 ErrorWindow.axaml.cs 中替换 C# 硬编码字符串**
|
||||
|
||||
将所有硬编码字符串替换为 `Strings.XXX` 调用:
|
||||
- `"LanMountain Desktop did not reach..."` → `Strings.Error_MessageNotReached`
|
||||
- `"[Debug] Launcher error"` → `Strings.Error_DebugTitle`
|
||||
- `"Launcher could not find the desktop executable"` → `Strings.Error_HostNotFoundTitle`
|
||||
- `"Pick another executable..."` → `Strings.Error_HostNotFoundMessage`
|
||||
- `"Launcher could not confirm startup"` → `Strings.Error_TitleCannotConfirm`
|
||||
- `"Inspect logs, then retry..."` → `Strings.Error_GenericMessage`
|
||||
- `"Inspect logs or exit..."` → `Strings.Error_RunningHostMessage`
|
||||
- `"Retry"` → `Strings.Error_ButtonRetry`
|
||||
- `"Activate"` → `Strings.Error_ButtonActivate`
|
||||
- `"Wait"` → `Strings.Error_ButtonWait`
|
||||
- `"Startup is still pending"` → `Strings.Error_PendingTitle`
|
||||
- `"The desktop process is still running..."` → `Strings.Error_PendingMessage`
|
||||
|
||||
- [ ] **Step 3: 构建验证**
|
||||
|
||||
Run: `dotnet build LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj -c Debug`
|
||||
Expected: 构建成功
|
||||
|
||||
---
|
||||
|
||||
### Task 5: 替换 MultiInstancePromptWindow 硬编码字符串
|
||||
|
||||
**Files:**
|
||||
- Modify: `LanMountainDesktop.Launcher/Views/MultiInstancePromptWindow.axaml`
|
||||
- Modify: `LanMountainDesktop.Launcher/Views/MultiInstancePromptWindow.axaml.cs`
|
||||
|
||||
- [ ] **Step 1: 在 MultiInstancePromptWindow.axaml 中替换字符串**
|
||||
|
||||
添加命名空间,替换:
|
||||
- `Title="LanMountain Desktop"` → `Title="{x:Static res:Strings.MultiInstance_Title}"`
|
||||
- `Text="LanMountain Desktop is already running"` → `Text="{x:Static res:Strings.MultiInstance_AlreadyRunning}"`
|
||||
- `Text="Launcher found an existing..."` → `Text="{x:Static res:Strings.MultiInstance_AlreadyRunningMessage}"`
|
||||
- `Title="Repeated launch"` → `Title="{x:Static res:Strings.MultiInstance_RepeatedLaunchTitle}"`
|
||||
- `Message="Your current setting..."` → `Message="{x:Static res:Strings.MultiInstance_RepeatedLaunchMessage}"`
|
||||
- `Text="No second Host process..."` → `Text="{x:Static res:Strings.MultiInstance_NoSecondProcess}"`
|
||||
- `Text="Copy"` → `Text="{x:Static res:Strings.MultiInstance_ButtonCopy}"`
|
||||
- `Text="Close"` → `Text="{x:Static res:Strings.MultiInstance_ButtonClose}"`
|
||||
- `Text="Open desktop"` → `Text="{x:Static res:Strings.MultiInstance_ButtonOpenDesktop}"`
|
||||
|
||||
- [ ] **Step 2: 在 MultiInstancePromptWindow.axaml.cs 中替换 C# 硬编码字符串**
|
||||
|
||||
将格式化字符串替换为 `string.Format(Strings.MultiInstance_DetailsFormat, processId, shellState)` 等。
|
||||
|
||||
- [ ] **Step 3: 构建验证**
|
||||
|
||||
Run: `dotnet build LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj -c Debug`
|
||||
Expected: 构建成功
|
||||
|
||||
---
|
||||
|
||||
### Task 6: 替换 DataLocationPromptWindow 硬编码字符串
|
||||
|
||||
**Files:**
|
||||
- Modify: `LanMountainDesktop.Launcher/Views/DataLocationPromptWindow.axaml`
|
||||
- Modify: `LanMountainDesktop.Launcher/Views/DataLocationPromptWindow.axaml.cs`
|
||||
|
||||
- [ ] **Step 1: 在 DataLocationPromptWindow.axaml 中替换字符串**
|
||||
|
||||
替换所有 12 个硬编码字符串为 `x:Static` 引用。
|
||||
|
||||
- [ ] **Step 2: 在 DataLocationPromptWindow.axaml.cs 中替换 C# 硬编码字符串**
|
||||
|
||||
将 `"Existing system data was detected..."` 替换为 `Strings.DataLocation_MigrateWarning`。
|
||||
|
||||
- [ ] **Step 3: 构建验证**
|
||||
|
||||
Run: `dotnet build LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj -c Debug`
|
||||
Expected: 构建成功
|
||||
|
||||
---
|
||||
|
||||
### Task 7: 替换 LoadingDetailsWindow 硬编码字符串
|
||||
|
||||
**Files:**
|
||||
- Modify: `LanMountainDesktop.Launcher/Views/LoadingDetailsWindow.axaml`
|
||||
- Modify: `LanMountainDesktop.Launcher/Views/LoadingDetailsWindow.axaml.cs`
|
||||
|
||||
- [ ] **Step 1: 在 LoadingDetailsWindow.axaml 中替换字符串**
|
||||
|
||||
替换所有硬编码字符串为 `x:Static` 引用。
|
||||
|
||||
- [ ] **Step 2: 在 LoadingDetailsWindow.axaml.cs 中替换 C# 硬编码字符串**
|
||||
|
||||
替换 `GetStageDescription`、`GetItemDescription`、`GetTypeLabel` 方法中的硬编码字符串为 `Strings.XXX` 调用。
|
||||
|
||||
- [ ] **Step 3: 构建验证**
|
||||
|
||||
Run: `dotnet build LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj -c Debug`
|
||||
Expected: 构建成功
|
||||
|
||||
---
|
||||
|
||||
### Task 8: 替换 UpdateWindow 硬编码字符串
|
||||
|
||||
**Files:**
|
||||
- Modify: `LanMountainDesktop.Launcher/Views/UpdateWindow.axaml`
|
||||
- Modify: `LanMountainDesktop.Launcher/Views/UpdateWindow.axaml.cs`
|
||||
|
||||
- [ ] **Step 1: 在 UpdateWindow.axaml 中替换字符串**
|
||||
|
||||
替换 `"Update"` 为 `x:Static res:Strings.Update_StatusUpdate`。
|
||||
|
||||
- [ ] **Step 2: 在 UpdateWindow.axaml.cs 中替换 C# 硬编码字符串**
|
||||
|
||||
替换 `"更新完成"`、`"更新失败"`、`"更新过程中发生错误"`、`"[调试模式] 更新页面"`、`"预览更新进度界面"` 为 `Strings.XXX` 调用。
|
||||
|
||||
- [ ] **Step 3: 构建验证**
|
||||
|
||||
Run: `dotnet build LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj -c Debug`
|
||||
Expected: 构建成功
|
||||
|
||||
---
|
||||
|
||||
### Task 9: 替换 ErrorDebugWindow 硬编码字符串
|
||||
|
||||
**Files:**
|
||||
- Modify: `LanMountainDesktop.Launcher/Views/ErrorDebugWindow.axaml`
|
||||
- Modify: `LanMountainDesktop.Launcher/Views/ErrorDebugWindow.axaml.cs`
|
||||
|
||||
- [ ] **Step 1: 在 ErrorDebugWindow.axaml 中替换字符串**
|
||||
|
||||
该窗口已使用中文,替换所有硬编码中文字符串为 `x:Static` 引用。
|
||||
|
||||
- [ ] **Step 2: 在 ErrorDebugWindow.axaml.cs 中替换 C# 硬编码字符串**
|
||||
|
||||
替换 `"Select LanMountainDesktop host executable"` 和 `"Not selected"` 为 `Strings.DebugDebug_SelectExeDialog` 和 `Strings.DebugDebug_NotSelected`。
|
||||
|
||||
- [ ] **Step 3: 构建验证**
|
||||
|
||||
Run: `dotnet build LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj -c Debug`
|
||||
Expected: 构建成功
|
||||
|
||||
---
|
||||
|
||||
### Task 10: 替换 OobeWindow 硬编码字符串
|
||||
|
||||
**Files:**
|
||||
- Modify: `LanMountainDesktop.Launcher/Views/OobeWindow.axaml`
|
||||
- Modify: `LanMountainDesktop.Launcher/Views/OobeWindow.axaml.cs`
|
||||
|
||||
这是最大的单个任务,OobeWindow 有约 42 个硬编码字符串。
|
||||
|
||||
- [ ] **Step 1: 在 OobeWindow.axaml 中替换字符串**
|
||||
|
||||
添加命名空间,逐个替换所有硬编码中文字符串为 `x:Static` 引用。包括:
|
||||
- 窗口标题、欢迎页文本
|
||||
- 外观设置页文本
|
||||
- 数据位置页文本
|
||||
- 启动展示页文本
|
||||
- 隐私页文本
|
||||
- 完成页文本
|
||||
- 导航按钮文本
|
||||
|
||||
- [ ] **Step 2: 在 OobeWindow.axaml.cs 中替换 C# 硬编码字符串(如有)**
|
||||
|
||||
检查 code-behind 中是否有动态设置的硬编码字符串并替换。
|
||||
|
||||
- [ ] **Step 3: 构建验证**
|
||||
|
||||
Run: `dotnet build LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj -c Debug`
|
||||
Expected: 构建成功
|
||||
|
||||
---
|
||||
|
||||
### Task 11: 替换 MigrationPromptWindow 硬编码字符串
|
||||
|
||||
**Files:**
|
||||
- Modify: `LanMountainDesktop.Launcher/Views/MigrationPromptWindow.axaml`
|
||||
- Modify: `LanMountainDesktop.Launcher/Views/MigrationPromptWindow.axaml.cs`
|
||||
|
||||
- [ ] **Step 1: 在 MigrationPromptWindow.axaml 中替换字符串**
|
||||
|
||||
替换所有硬编码中文字符串为 `x:Static` 引用。
|
||||
|
||||
- [ ] **Step 2: 在 MigrationPromptWindow.axaml.cs 中替换 C# 硬编码字符串(如有)**
|
||||
|
||||
- [ ] **Step 3: 构建验证**
|
||||
|
||||
Run: `dotnet build LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj -c Debug`
|
||||
Expected: 构建成功
|
||||
|
||||
---
|
||||
|
||||
### Task 12: 替换 PrivacyPolicyWindow 硬编码字符串
|
||||
|
||||
**Files:**
|
||||
- Modify: `LanMountainDesktop.Launcher/Views/PrivacyPolicyWindow.axaml`
|
||||
- Modify: `LanMountainDesktop.Launcher/Views/PrivacyPolicyWindow.axaml.cs`
|
||||
|
||||
- [ ] **Step 1: 在 PrivacyPolicyWindow.axaml 中替换字符串**
|
||||
|
||||
替换标题、描述、关闭按钮等硬编码字符串。
|
||||
|
||||
- [ ] **Step 2: 在 PrivacyPolicyWindow.axaml.cs 中处理隐私政策正文**
|
||||
|
||||
隐私政策正文(约 80 行 Markdown)目前硬编码在 C# 中。考虑:
|
||||
- 方案 A:将 Markdown 正文也放入 RESX(支持多语言隐私政策)
|
||||
- 方案 B:保留 Markdown 正文在 C# 中,仅替换窗口标题和按钮
|
||||
|
||||
推荐方案 A,将隐私政策 Markdown 正文放入 RESX 的 `Privacy_PolicyContent` 键中。
|
||||
|
||||
- [ ] **Step 3: 构建验证**
|
||||
|
||||
Run: `dotnet build LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj -c Debug`
|
||||
Expected: 构建成功
|
||||
|
||||
---
|
||||
|
||||
### Task 13: 替换 DevDebugWindow 硬编码字符串
|
||||
|
||||
**Files:**
|
||||
- Modify: `LanMountainDesktop.Launcher/Views/DevDebugWindow.axaml`
|
||||
- Modify: `LanMountainDesktop.Launcher/Views/DevDebugWindow.axaml.cs`
|
||||
|
||||
- [ ] **Step 1: 在 DevDebugWindow.axaml 中替换字符串**
|
||||
|
||||
替换所有硬编码中文字符串为 `x:Static` 引用。
|
||||
|
||||
- [ ] **Step 2: 在 DevDebugWindow.axaml.cs 中替换 C# 硬编码字符串(如有)**
|
||||
|
||||
- [ ] **Step 3: 构建验证**
|
||||
|
||||
Run: `dotnet build LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj -c Debug`
|
||||
Expected: 构建成功
|
||||
|
||||
---
|
||||
|
||||
### Task 14: 替换 LauncherFlowCoordinator 和 App.axaml.cs 硬编码字符串
|
||||
|
||||
**Files:**
|
||||
- Modify: `LanMountainDesktop.Launcher/Services/LauncherFlowCoordinator.cs`
|
||||
- Modify: `LanMountainDesktop.Launcher/App.axaml.cs`
|
||||
|
||||
- [ ] **Step 1: 在 LauncherFlowCoordinator.cs 中替换字符串**
|
||||
|
||||
替换:
|
||||
- `"设备较慢,仍在启动,请稍候。"` → `Strings.Coordinator_SlowDeviceMessage`
|
||||
- `"桌面主进程仍在运行..."` → `Strings.Coordinator_RunningHostMessage`
|
||||
|
||||
- [ ] **Step 2: 在 App.axaml.cs 中替换预览模式字符串**
|
||||
|
||||
替换 `SimulateSplashPreviewAsync` 中的硬编码消息数组:
|
||||
```csharp
|
||||
var messages = new[] { Strings.Preview_SplashInitializing, Strings.Preview_SplashCheckingUpdates, Strings.Preview_SplashCheckingPlugins, Strings.Preview_SplashLaunchingHost, Strings.Preview_SplashReady };
|
||||
```
|
||||
|
||||
替换 `HandlePreviewCommand` 中的 `"[Preview] This is the launcher error window preview."` → `Strings.Preview_ErrorMessage`
|
||||
|
||||
替换 `RunApplyUpdateWithWindowAsync` 中的硬编码字符串:
|
||||
- `"Verifying update..."` → 使用 RESX 键
|
||||
- `"Applying plugin upgrades..."` → 使用 RESX 键
|
||||
- `"Cleaning up old deployments..."` → 使用 RESX 键
|
||||
|
||||
替换 `SimulateUpdatePreviewAsync` 中的 `$"Processing {stages[i]}..."` → `string.Format(Strings.Preview_UpdateProcessing, stages[i])`
|
||||
|
||||
替换 `AttachToExistingCoordinatorAsync` 中的 `"Connecting to the active launcher..."` → `Strings.Preview_ActivationConnecting`
|
||||
|
||||
- [ ] **Step 3: 构建验证**
|
||||
|
||||
Run: `dotnet build LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj -c Debug`
|
||||
Expected: 构建成功
|
||||
|
||||
---
|
||||
|
||||
### Task 15: 完整构建和运行验证
|
||||
|
||||
**Files:** 无新增/修改
|
||||
|
||||
- [ ] **Step 1: 完整解决方案构建**
|
||||
|
||||
Run: `dotnet build LanMountainDesktop.slnx -c Debug`
|
||||
Expected: 构建成功,无错误
|
||||
|
||||
- [ ] **Step 2: 运行启动器预览命令验证中文**
|
||||
|
||||
Run: `dotnet run --project LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj -- preview-splash`
|
||||
Expected: 启动画面显示中文
|
||||
|
||||
- [ ] **Step 3: 验证英文模式**
|
||||
|
||||
临时将 `LanguagePreferenceService.ResolveLanguageCode` 返回 `"en-US"` 后运行预览命令,验证英文显示。
|
||||
|
||||
- [ ] **Step 4: 运行测试**
|
||||
|
||||
Run: `dotnet test LanMountainDesktop.slnx -c Debug`
|
||||
Expected: 所有测试通过
|
||||
|
||||
---
|
||||
|
||||
### Task 16: AOT 发布冒烟测试
|
||||
|
||||
**Files:** 无新增/修改
|
||||
|
||||
- [ ] **Step 1: AOT 发布测试**
|
||||
|
||||
Run: `dotnet publish LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj -c Release -r win-x64 /p:PublishAot=true`
|
||||
Expected: 发布成功
|
||||
|
||||
- [ ] **Step 2: 运行 AOT 发布产物验证**
|
||||
|
||||
运行发布后的可执行文件,验证 RESX 资源正确加载。
|
||||
|
||||
---
|
||||
|
||||
## 实施顺序建议
|
||||
|
||||
1. **Task 1** (RESX 基础设施) → **Task 2** (语言偏好服务) — 必须首先完成
|
||||
2. **Task 3-9** (英文窗口) — 优先处理,解决用户提出的"只有英文"问题
|
||||
3. **Task 10-13** (中文窗口) — 次优先,完成完整 i18n 覆盖
|
||||
4. **Task 14** (服务层和 App) — 与 Task 3-13 并行或随后
|
||||
5. **Task 15-16** (验证) — 最后执行
|
||||
|
||||
## 风险与注意事项
|
||||
|
||||
1. **AOT 兼容性**:`ResourceManager` 在 Native AOT 下可能需要额外配置。如果 AOT 发布失败,需要添加 `DynamicDependency` 属性或使用 `System.Resources.Extensions` 包的源生成器。
|
||||
2. **OOBE 首次运行**:OOBE 在首次运行时 `settings.json` 不存在,此时 `LanguagePreferenceService` 会回退到 `zh-CN`。这是合理的行为。
|
||||
3. **`x:Static` 与 Avalonia CompiledBindings**:项目启用了 `AvaloniaUseCompiledBindingsByDefault`,需要确认 `x:Static` 在编译绑定模式下正常工作。如有问题,可在特定 AXAML 文件中添加 `x:CompileBindings="False"`。
|
||||
4. **RESX Designer.cs 生成**:确保 `.csproj` 中使用 `PublicResXFileCodeGenerator` 生成 `public` 类,否则 `x:Static` 无法访问。
|
||||
5. **隐私政策多语言**:隐私政策 Markdown 正文较长,放入 RESX 可能影响可读性。可考虑保留在 C# 中或使用独立资源文件。
|
||||
805
.trae/documents/launcher_comprehensive_improvement_plan.md
Normal file
805
.trae/documents/launcher_comprehensive_improvement_plan.md
Normal file
@@ -0,0 +1,805 @@
|
||||
# LanMountainDesktop Launcher 全面改进计划
|
||||
|
||||
## 概述
|
||||
|
||||
本计划旨在将 LanMountainDesktop 的 Launcher 改进为符合原子化架构的独立启动器,参考 ClassIsland 的极简设计,同时保留阑山桌面的特色功能。
|
||||
|
||||
## 目标
|
||||
|
||||
1. **P0 (必须完成)**: 重写 Launcher 为极简模式,移除与主程序的耦合
|
||||
2. **P1 (应该完成)**: 将 OOBE、Splash、更新、插件管理迁移到主程序
|
||||
3. **P2 (推荐完成)**: 实现 Launcher 自更新机制
|
||||
4. **P3 (可选优化)**: 性能优化和代码清理
|
||||
5. **P4 (长期规划)**: 增强功能和可扩展性
|
||||
|
||||
## 当前问题
|
||||
|
||||
1. Launcher 是 Avalonia 应用,启动慢、内存占用高
|
||||
2. Launcher 引用了 PluginSdk,与主程序有耦合
|
||||
3. 主程序引用了 Launcher,构建关系复杂
|
||||
4. Launcher 职责过多(OOBE + Splash + 更新 + 插件 + 启动)
|
||||
5. 缺少 Launcher 自更新机制
|
||||
6. GitHub Actions 工作流需要适配新的目录结构
|
||||
|
||||
## 改进后架构
|
||||
|
||||
```
|
||||
安装根目录/
|
||||
├── LanMountainDesktop.exe ← 启动器(唯一入口,极简,~100行代码)
|
||||
├── app-1.0.0/ ← 版本目录
|
||||
│ ├── .current ← 当前版本标记
|
||||
│ ├── LanMountainDesktop.exe ← 主程序
|
||||
│ └── ... (所有依赖)
|
||||
└── .launcher/ ← 启动器数据(可选)
|
||||
└── snapshots/ ← 版本快照
|
||||
```
|
||||
|
||||
## 详细实施步骤
|
||||
|
||||
### P0: 基础架构重构
|
||||
|
||||
#### 1. 重写 Launcher 为极简模式
|
||||
|
||||
**文件**: `LanMountainDesktop.Launcher/Program.cs`
|
||||
|
||||
**目标**:
|
||||
- 代码量控制在 100 行以内
|
||||
- 零外部依赖(不使用 Avalonia)
|
||||
- 只负责:版本选择、启动主程序、清理旧版本
|
||||
|
||||
**完整实现代码**:
|
||||
|
||||
```csharp
|
||||
// LanMountainDesktop.Launcher/Program.cs
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LanMountainDesktop.Launcher;
|
||||
|
||||
internal static class Program
|
||||
{
|
||||
private const string HostExecutableName = "LanMountainDesktop.exe";
|
||||
private const string HostExecutableNameLinux = "LanMountainDesktop";
|
||||
|
||||
[STAThread]
|
||||
private static int Main(string[] args)
|
||||
{
|
||||
var rootDir = GetRootDirectory();
|
||||
|
||||
// 1. 查找最佳版本
|
||||
var installation = FindBestVersion(rootDir);
|
||||
if (installation == null)
|
||||
{
|
||||
ShowError("找不到有效的 LanMountainDesktop 版本,请重新安装。");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// 2. 清理旧版本(异步,不阻塞)
|
||||
_ = Task.Run(() => CleanupOldVersions(rootDir));
|
||||
|
||||
// 3. 启动主程序
|
||||
return LaunchHost(installation, args);
|
||||
}
|
||||
|
||||
private static string GetRootDirectory()
|
||||
{
|
||||
return Path.GetFullPath(
|
||||
Path.GetDirectoryName(Environment.ProcessPath) ?? "");
|
||||
}
|
||||
|
||||
private static string? FindBestVersion(string rootDir)
|
||||
{
|
||||
var exeName = OperatingSystem.IsWindows()
|
||||
? HostExecutableName
|
||||
: HostExecutableNameLinux;
|
||||
|
||||
return Directory.GetDirectories(rootDir)
|
||||
.Where(x => IsValidVersionDirectory(x, exeName))
|
||||
.OrderBy(x => File.Exists(Path.Combine(x, ".current")) ? 0 : 1)
|
||||
.ThenByDescending(x => ParseVersion(Path.GetFileName(x)))
|
||||
.FirstOrDefault();
|
||||
}
|
||||
|
||||
private static bool IsValidVersionDirectory(string path, string exeName)
|
||||
{
|
||||
var dirName = Path.GetFileName(path);
|
||||
return dirName.StartsWith("app-") &&
|
||||
!File.Exists(Path.Combine(path, ".destroy")) &&
|
||||
!File.Exists(Path.Combine(path, ".partial")) &&
|
||||
File.Exists(Path.Combine(path, exeName));
|
||||
}
|
||||
|
||||
private static Version ParseVersion(string dirName)
|
||||
{
|
||||
// app-1.0.0 or app-1.0.0-123
|
||||
var parts = dirName.Split('-');
|
||||
if (parts.Length >= 2 && Version.TryParse(parts[1], out var v))
|
||||
return v;
|
||||
return new Version(0, 0);
|
||||
}
|
||||
|
||||
private static void CleanupOldVersions(string rootDir)
|
||||
{
|
||||
try
|
||||
{
|
||||
var oldVersions = Directory.GetDirectories(rootDir)
|
||||
.Where(x => File.Exists(Path.Combine(x, ".destroy")));
|
||||
|
||||
foreach (var dir in oldVersions)
|
||||
{
|
||||
try { Directory.Delete(dir, recursive: true); } catch { }
|
||||
}
|
||||
}
|
||||
catch { /* 忽略清理失败 */ }
|
||||
}
|
||||
|
||||
private static int LaunchHost(string installation, string[] args)
|
||||
{
|
||||
var exeName = OperatingSystem.IsWindows()
|
||||
? HostExecutableName
|
||||
: HostExecutableNameLinux;
|
||||
var exePath = Path.Combine(installation, exeName);
|
||||
|
||||
// Linux/macOS: 确保可执行权限
|
||||
if (!OperatingSystem.IsWindows())
|
||||
{
|
||||
EnsureExecutable(exePath);
|
||||
}
|
||||
|
||||
var startInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = exePath,
|
||||
WorkingDirectory = Path.GetDirectoryName(installation),
|
||||
UseShellExecute = true
|
||||
};
|
||||
|
||||
foreach (var arg in args)
|
||||
startInfo.ArgumentList.Add(arg);
|
||||
|
||||
// 传递环境变量
|
||||
startInfo.EnvironmentVariables["LMD_PACKAGE_ROOT"] =
|
||||
Path.GetDirectoryName(installation);
|
||||
startInfo.EnvironmentVariables["LMD_VERSION"] =
|
||||
Path.GetFileName(installation).Replace("app-", "");
|
||||
|
||||
try
|
||||
{
|
||||
Process.Start(startInfo);
|
||||
return 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ShowError($"启动失败: {ex.Message}");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
private static void EnsureExecutable(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
Process.Start(new ProcessStartInfo
|
||||
{
|
||||
FileName = "chmod",
|
||||
Arguments = $"+x \"{path}\"",
|
||||
CreateNoWindow = true
|
||||
})?.WaitForExit();
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private static void ShowError(string message)
|
||||
{
|
||||
if (OperatingSystem.IsWindows())
|
||||
{
|
||||
// Win32 MessageBox
|
||||
try
|
||||
{
|
||||
MessageBox(IntPtr.Zero, message, "LanMountainDesktop", 0x10);
|
||||
}
|
||||
catch
|
||||
{
|
||||
Console.Error.WriteLine(message);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.Error.WriteLine(message);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
|
||||
private static extern int MessageBox(IntPtr hWnd, string text, string caption, uint type);
|
||||
}
|
||||
```
|
||||
|
||||
#### 2. 修改 Launcher 项目文件
|
||||
|
||||
**文件**: `LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj`
|
||||
|
||||
**完整内容**:
|
||||
|
||||
```xml
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>1.0.0</Version>
|
||||
<ApplicationIcon>Assets\logo_nightly.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- 图标资源 -->
|
||||
<ItemGroup>
|
||||
<Content Include="..\LanMountainDesktop\Assets\logo_nightly.ico" Link="Assets\logo_nightly.ico">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
```
|
||||
|
||||
#### 3. 移除主程序对 Launcher 的引用
|
||||
|
||||
**文件**: `LanMountainDesktop/LanMountainDesktop.csproj`
|
||||
|
||||
**修改**: 删除以下行
|
||||
```xml
|
||||
<!-- 删除这一行 -->
|
||||
<ProjectReference Include="..\LanMountainDesktop.Launcher\LanMountainDesktop.Launcher.csproj" ReferenceOutputAssembly="false" />
|
||||
```
|
||||
|
||||
#### 4. 修改主程序支持新架构
|
||||
|
||||
**文件**: `LanMountainDesktop/Program.cs`
|
||||
|
||||
**修改**: 添加环境变量读取
|
||||
|
||||
```csharp
|
||||
// 在 Program.cs 中添加
|
||||
internal static class LaunchContext
|
||||
{
|
||||
public static string? PackageRoot =>
|
||||
Environment.GetEnvironmentVariable("LMD_PACKAGE_ROOT");
|
||||
public static string? Version =>
|
||||
Environment.GetEnvironmentVariable("LMD_VERSION");
|
||||
public static bool IsLaunchedByLauncher =>
|
||||
!string.IsNullOrEmpty(PackageRoot);
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### P1: 功能迁移
|
||||
|
||||
#### 5. 将 OOBE 迁移到主程序
|
||||
|
||||
**新建文件**: `LanMountainDesktop/Services/Oobe/OobeService.cs`
|
||||
|
||||
```csharp
|
||||
using LanMountainDesktop.Models;
|
||||
using LanMountainDesktop.Services.Settings;
|
||||
|
||||
namespace LanMountainDesktop.Services.Oobe;
|
||||
|
||||
public class OobeService
|
||||
{
|
||||
private readonly string _oobeStatePath;
|
||||
|
||||
public OobeService()
|
||||
{
|
||||
var appData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
||||
_oobeStatePath = Path.Combine(appData, "LanMountainDesktop", ".oobe_completed");
|
||||
}
|
||||
|
||||
public bool IsFirstRun()
|
||||
{
|
||||
return !File.Exists(_oobeStatePath);
|
||||
}
|
||||
|
||||
public void MarkCompleted()
|
||||
{
|
||||
var dir = Path.GetDirectoryName(_oobeStatePath);
|
||||
if (!Directory.Exists(dir))
|
||||
Directory.CreateDirectory(dir);
|
||||
File.WriteAllText(_oobeStatePath, DateTime.UtcNow.ToString("O"));
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**新建文件**: `LanMountainDesktop/Views/Oobe/OobeWindow.axaml`
|
||||
|
||||
```xml
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="LanMountainDesktop.Views.Oobe.OobeWindow"
|
||||
Title="欢迎使用阑山桌面"
|
||||
Width="800"
|
||||
Height="600"
|
||||
WindowStartupLocation="CenterScreen">
|
||||
<Grid>
|
||||
<!-- OOBE 界面内容 -->
|
||||
<TextBlock Text="欢迎使用阑山桌面" FontSize="24" HorizontalAlignment="Center" Margin="0,50,0,0"/>
|
||||
<Button Content="开始使用" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,0,0,50" Click="OnStartClick"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
```
|
||||
|
||||
**修改文件**: `LanMountainDesktop/App.axaml.cs`
|
||||
|
||||
```csharp
|
||||
// 在 OnFrameworkInitializationCompleted 中添加
|
||||
private async Task InitializeOobeAsync()
|
||||
{
|
||||
var oobeService = new OobeService();
|
||||
if (oobeService.IsFirstRun())
|
||||
{
|
||||
var oobeWindow = new Views.Oobe.OobeWindow();
|
||||
await oobeWindow.ShowDialog();
|
||||
oobeService.MarkCompleted();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### 6. 将 Splash 迁移到主程序
|
||||
|
||||
**新建文件**: `LanMountainDesktop/Views/Splash/SplashWindow.axaml`
|
||||
|
||||
```xml
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="LanMountainDesktop.Views.Splash.SplashWindow"
|
||||
Title="阑山桌面"
|
||||
Width="400"
|
||||
Height="300"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
ShowInTaskbar="False"
|
||||
SystemDecorations="None">
|
||||
<Grid Background="{DynamicResource SystemAccentColor}">
|
||||
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
<Image Source="/Assets/logo_nightly.png" Width="100" Height="100"/>
|
||||
<TextBlock Text="阑山桌面" FontSize="20" Margin="0,20,0,0" HorizontalAlignment="Center"/>
|
||||
<TextBlock x:Name="StatusText" Text="正在启动..." Margin="0,10,0,0" HorizontalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
```
|
||||
|
||||
**修改文件**: `LanMountainDesktop/App.axaml.cs`
|
||||
|
||||
```csharp
|
||||
// 在初始化时显示 Splash
|
||||
private SplashWindow? _splashWindow;
|
||||
|
||||
private void ShowSplash()
|
||||
{
|
||||
_splashWindow = new SplashWindow();
|
||||
_splashWindow.Show();
|
||||
}
|
||||
|
||||
private void CloseSplash()
|
||||
{
|
||||
_splashWindow?.Close();
|
||||
_splashWindow = null;
|
||||
}
|
||||
```
|
||||
|
||||
#### 7. 将更新逻辑迁移到主程序
|
||||
|
||||
**新建目录**: `LanMountainDesktop/Services/Update/`
|
||||
|
||||
**新建文件**: `LanMountainDesktop/Services/Update/UpdateService.cs`
|
||||
|
||||
```csharp
|
||||
using System.Net.Http.Json;
|
||||
using LanMountainDesktop.Models;
|
||||
|
||||
namespace LanMountainDesktop.Services.Update;
|
||||
|
||||
public class UpdateService
|
||||
{
|
||||
private readonly HttpClient _httpClient;
|
||||
private readonly string _currentVersion;
|
||||
|
||||
public UpdateService()
|
||||
{
|
||||
_httpClient = new HttpClient();
|
||||
_httpClient.DefaultRequestHeaders.Add("User-Agent", "LanMountainDesktop");
|
||||
_currentVersion = GetType().Assembly.GetName().Version?.ToString() ?? "1.0.0";
|
||||
}
|
||||
|
||||
public async Task<UpdateCheckResult> CheckForUpdateAsync(UpdateChannel channel)
|
||||
{
|
||||
// 调用 GitHub Release API
|
||||
var releases = await _httpClient.GetFromJsonAsync<List<GitHubRelease>>(
|
||||
"https://api.github.com/repos/ClassIsland/LanMountainDesktop/releases");
|
||||
|
||||
var latest = channel == UpdateChannel.Stable
|
||||
? releases?.FirstOrDefault(r => !r.Prerelease)
|
||||
: releases?.FirstOrDefault();
|
||||
|
||||
if (latest == null)
|
||||
return new UpdateCheckResult { HasUpdate = false };
|
||||
|
||||
var latestVersion = latest.TagName.TrimStart('v');
|
||||
var hasUpdate = new Version(latestVersion) > new Version(_currentVersion);
|
||||
|
||||
return new UpdateCheckResult
|
||||
{
|
||||
HasUpdate = hasUpdate,
|
||||
Version = latestVersion,
|
||||
DownloadUrl = latest.Assets.FirstOrDefault()?.BrowserDownloadUrl
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public class UpdateCheckResult
|
||||
{
|
||||
public bool HasUpdate { get; set; }
|
||||
public string? Version { get; set; }
|
||||
public string? DownloadUrl { get; set; }
|
||||
}
|
||||
|
||||
public enum UpdateChannel { Stable, Preview }
|
||||
|
||||
public class GitHubRelease
|
||||
{
|
||||
public string TagName { get; set; } = "";
|
||||
public bool Prerelease { get; set; }
|
||||
public List<GitHubAsset> Assets { get; set; } = new();
|
||||
}
|
||||
|
||||
public class GitHubAsset
|
||||
{
|
||||
public string BrowserDownloadUrl { get; set; } = "";
|
||||
}
|
||||
```
|
||||
|
||||
#### 8. 将插件管理迁移到主程序
|
||||
|
||||
**新建目录**: `LanMountainDesktop/Services/Plugins/`
|
||||
|
||||
**新建文件**: `LanMountainDesktop/Services/Plugins/PluginUpdateService.cs`
|
||||
|
||||
```csharp
|
||||
namespace LanMountainDesktop.Services.Plugins;
|
||||
|
||||
public class PluginUpdateService
|
||||
{
|
||||
private readonly string _pluginsDirectory;
|
||||
|
||||
public PluginUpdateService()
|
||||
{
|
||||
var appData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
||||
_pluginsDirectory = Path.Combine(appData, "LanMountainDesktop", "plugins");
|
||||
}
|
||||
|
||||
public async Task CheckAndUpdatePluginsAsync()
|
||||
{
|
||||
// 检查插件更新
|
||||
// 下载并安装更新
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### P2: 自更新机制
|
||||
|
||||
#### 9. 实现 Launcher 自更新
|
||||
|
||||
**修改文件**: `LanMountainDesktop.Launcher/Program.cs`
|
||||
|
||||
```csharp
|
||||
// 在 Main 方法开头添加自更新检查
|
||||
private static void CheckForLauncherUpdate()
|
||||
{
|
||||
var rootDir = GetRootDirectory();
|
||||
var updatePath = Path.Combine(rootDir, "LanMountainDesktop.Launcher.Update.exe");
|
||||
|
||||
if (File.Exists(updatePath))
|
||||
{
|
||||
// 有新版本 Launcher,替换自身
|
||||
try
|
||||
{
|
||||
var currentPath = Environment.ProcessPath;
|
||||
var backupPath = currentPath + ".old";
|
||||
|
||||
// 重命名当前版本
|
||||
if (File.Exists(backupPath))
|
||||
File.Delete(backupPath);
|
||||
File.Move(currentPath!, backupPath);
|
||||
|
||||
// 移动新版本
|
||||
File.Move(updatePath, currentPath!);
|
||||
|
||||
// 删除备份
|
||||
File.Delete(backupPath);
|
||||
|
||||
// 重启自己
|
||||
Process.Start(new ProcessStartInfo
|
||||
{
|
||||
FileName = currentPath,
|
||||
UseShellExecute = true
|
||||
});
|
||||
Environment.Exit(0);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 回滚
|
||||
Console.Error.WriteLine($"Launcher 更新失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### 10. 主程序支持更新 Launcher
|
||||
|
||||
**新建文件**: `LanMountainDesktop/Services/Update/LauncherUpdateService.cs`
|
||||
|
||||
```csharp
|
||||
namespace LanMountainDesktop.Services.Update;
|
||||
|
||||
public class LauncherUpdateService
|
||||
{
|
||||
private readonly HttpClient _httpClient;
|
||||
|
||||
public LauncherUpdateService()
|
||||
{
|
||||
_httpClient = new HttpClient();
|
||||
}
|
||||
|
||||
public async Task<bool> UpdateLauncherAsync(string downloadUrl)
|
||||
{
|
||||
var rootDir = LaunchContext.PackageRoot
|
||||
?? Path.GetDirectoryName(Environment.ProcessPath)!;
|
||||
var updatePath = Path.Combine(rootDir, "LanMountainDesktop.Launcher.Update.exe");
|
||||
|
||||
// 下载新版本
|
||||
var response = await _httpClient.GetAsync(downloadUrl);
|
||||
await using var fs = File.Create(updatePath);
|
||||
await response.Content.CopyToAsync(fs);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void RestartWithNewLauncher()
|
||||
{
|
||||
var launcherPath = Path.Combine(
|
||||
LaunchContext.PackageRoot ?? "",
|
||||
"LanMountainDesktop.exe");
|
||||
|
||||
Process.Start(new ProcessStartInfo
|
||||
{
|
||||
FileName = launcherPath,
|
||||
UseShellExecute = true
|
||||
});
|
||||
|
||||
// 退出主程序,让 Launcher 接管
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### P3: 清理旧代码
|
||||
|
||||
#### 11. 删除文件清单
|
||||
|
||||
**删除以下文件/目录**:
|
||||
|
||||
```
|
||||
LanMountainDesktop.Launcher/
|
||||
├── App.axaml ← 删除
|
||||
├── App.axaml.cs ← 删除
|
||||
├── Views/ ← 删除整个目录
|
||||
│ ├── OobeWindow.axaml
|
||||
│ ├── OobeWindow.axaml.cs
|
||||
│ ├── SplashWindow.axaml
|
||||
│ └── SplashWindow.axaml.cs
|
||||
├── Services/ ← 删除大部分
|
||||
│ ├── LauncherFlowCoordinator.cs ← 删除
|
||||
│ ├── OobeStateService.cs ← 删除
|
||||
│ ├── UpdateCheckService.cs ← 删除
|
||||
│ ├── UpdateEngineService.cs ← 删除
|
||||
│ ├── PluginInstallerService.cs ← 删除
|
||||
│ └── PluginUpgradeQueueService.cs ← 删除
|
||||
└── Models/ ← 删除(如不再需要)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### P4: GitHub Actions 工作流修改
|
||||
|
||||
#### 12. 修改 release.yml
|
||||
|
||||
**关键修改点**:
|
||||
|
||||
1. **Launcher 单独编译**:
|
||||
```yaml
|
||||
- name: Publish Launcher
|
||||
run: |
|
||||
dotnet publish LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj `
|
||||
-c Release `
|
||||
-o ./publish/launcher-win-x64 `
|
||||
--self-contained `
|
||||
-r win-x64 `
|
||||
-p:PublishSingleFile=false `
|
||||
-p:PublishTrimmed=false `
|
||||
-p:DebugType=none
|
||||
```
|
||||
|
||||
2. **目录结构调整**:
|
||||
```yaml
|
||||
- name: Restructure for Launcher
|
||||
run: |
|
||||
$version = "${{ needs.prepare.outputs.version }}"
|
||||
$publishDir = "publish/windows-x64"
|
||||
$launcherDir = "publish/launcher-win-x64"
|
||||
$appDir = "app-$version"
|
||||
|
||||
# 创建新结构
|
||||
$newStructure = "publish-launcher/windows-x64"
|
||||
New-Item -ItemType Directory -Path $newStructure -Force
|
||||
|
||||
# 移动主程序到 app-{version}/
|
||||
$appPath = Join-Path $newStructure $appDir
|
||||
Move-Item -Path $publishDir -Destination $appPath -Force
|
||||
|
||||
# 复制 Launcher 到根目录
|
||||
Copy-Item -Path "$launcherDir\*" -Destination $newStructure -Recurse -Force
|
||||
|
||||
# 创建 .current 标记
|
||||
New-Item -ItemType File -Path (Join-Path $appPath ".current") -Force
|
||||
```
|
||||
|
||||
3. **Linux/macOS 同样调整**:
|
||||
- Linux: 修改 DEB 打包流程
|
||||
- macOS: 修改 DMG 打包流程
|
||||
|
||||
#### 13. 修改 build.yml
|
||||
|
||||
**修改**: 移除 Launcher 相关构建步骤,因为 Launcher 现在完全独立
|
||||
|
||||
---
|
||||
|
||||
### P5: 图标资源处理
|
||||
|
||||
#### 14. Launcher 图标配置
|
||||
|
||||
**方案**: 使用链接方式引用主程序图标
|
||||
|
||||
**文件**: `LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj`
|
||||
|
||||
```xml
|
||||
<ItemGroup>
|
||||
<!-- 链接主程序的图标 -->
|
||||
<Content Include="..\LanMountainDesktop\Assets\logo_nightly.ico" Link="Assets\logo_nightly.ico">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
```
|
||||
|
||||
#### 15. 安装程序配置
|
||||
|
||||
**文件**: `LanMountainDesktop/installer/LanMountainDesktop.iss` (Inno Setup)
|
||||
|
||||
**关键配置**:
|
||||
|
||||
```ini
|
||||
[Setup]
|
||||
AppName=阑山桌面
|
||||
AppVersion={#MyAppVersion}
|
||||
DefaultDirName={autopf}\LanMountainDesktop
|
||||
OutputBaseFilename=LanMountainDesktop-Setup-{#MyAppVersion}-x64
|
||||
SetupIconFile=..\Assets\logo_nightly.ico
|
||||
UninstallDisplayIcon={app}\LanMountainDesktop.exe
|
||||
|
||||
[Files]
|
||||
; Launcher
|
||||
Source: "..\..\publish\windows-x64\LanMountainDesktop.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
; 主程序版本目录
|
||||
Source: "..\..\publish\windows-x64\app-{#MyAppVersion}\*"; DestDir: "{app}\app-{#MyAppVersion}"; Flags: ignoreversion recursesubdirs
|
||||
|
||||
[Icons]
|
||||
; 桌面快捷方式
|
||||
Name: "{autodesktop}\阑山桌面"; Filename: "{app}\LanMountainDesktop.exe"; IconFilename: "{app}\LanMountainDesktop.exe"
|
||||
; 开始菜单
|
||||
Name: "{group}\阑山桌面"; Filename: "{app}\LanMountainDesktop.exe"; IconFilename: "{app}\LanMountainDesktop.exe"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 文件变更清单
|
||||
|
||||
### 修改文件
|
||||
|
||||
1. `LanMountainDesktop.Launcher/Program.cs` - 完全重写
|
||||
2. `LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj` - 简化依赖
|
||||
3. `LanMountainDesktop/LanMountainDesktop.csproj` - 移除 Launcher 引用
|
||||
4. `LanMountainDesktop/Program.cs` - 添加 LaunchContext
|
||||
5. `LanMountainDesktop/App.axaml.cs` - 添加 OOBE/Splash/更新入口
|
||||
6. `.github/workflows/release.yml` - 调整打包流程
|
||||
7. `.github/workflows/build.yml` - 适配新构建流程
|
||||
|
||||
### 新增文件
|
||||
|
||||
1. `LanMountainDesktop/Services/Oobe/OobeService.cs`
|
||||
2. `LanMountainDesktop/Views/Oobe/OobeWindow.axaml`
|
||||
3. `LanMountainDesktop/Views/Oobe/OobeWindow.axaml.cs`
|
||||
4. `LanMountainDesktop/Views/Splash/SplashWindow.axaml`
|
||||
5. `LanMountainDesktop/Views/Splash/SplashWindow.axaml.cs`
|
||||
6. `LanMountainDesktop/Services/Update/UpdateService.cs`
|
||||
7. `LanMountainDesktop/Services/Update/LauncherUpdateService.cs`
|
||||
8. `LanMountainDesktop/Services/Plugins/PluginUpdateService.cs`
|
||||
|
||||
### 删除文件
|
||||
|
||||
1. `LanMountainDesktop.Launcher/App.axaml`
|
||||
2. `LanMountainDesktop.Launcher/App.axaml.cs`
|
||||
3. `LanMountainDesktop.Launcher/Views/` 目录
|
||||
4. `LanMountainDesktop.Launcher/Services/LauncherFlowCoordinator.cs`
|
||||
5. `LanMountainDesktop.Launcher/Services/OobeStateService.cs`
|
||||
6. `LanMountainDesktop.Launcher/Services/UpdateCheckService.cs`
|
||||
7. `LanMountainDesktop.Launcher/Services/UpdateEngineService.cs`
|
||||
8. `LanMountainDesktop.Launcher/Services/PluginInstallerService.cs`
|
||||
9. `LanMountainDesktop.Launcher/Services/PluginUpgradeQueueService.cs`
|
||||
|
||||
---
|
||||
|
||||
## 风险与回滚方案
|
||||
|
||||
### 风险
|
||||
|
||||
1. **启动失败**: 新 Launcher 可能有 bug 导致无法启动
|
||||
2. **更新中断**: 更新逻辑迁移可能导致更新失败
|
||||
3. **图标丢失**: 图标配置错误导致快捷方式无图标
|
||||
|
||||
### 回滚方案
|
||||
|
||||
1. 保留原 Launcher 代码分支
|
||||
2. 准备紧急修复版本
|
||||
3. 用户可手动下载完整安装包恢复
|
||||
|
||||
---
|
||||
|
||||
## 验证清单
|
||||
|
||||
- [ ] Launcher 能正常启动主程序
|
||||
- [ ] 版本选择逻辑正确
|
||||
- [ ] 旧版本清理正常
|
||||
- [ ] OOBE 流程正常
|
||||
- [ ] Splash 显示正常
|
||||
- [ ] 更新检查正常
|
||||
- [ ] 插件安装正常
|
||||
- [ ] GitHub Actions 打包成功
|
||||
- [ ] 安装程序图标正常
|
||||
- [ ] 快捷方式图标正常
|
||||
|
||||
---
|
||||
|
||||
## 实施顺序建议
|
||||
|
||||
### 第一阶段(立即实施)
|
||||
1. 重写 Launcher Program.cs
|
||||
2. 修改 Launcher.csproj
|
||||
3. 移除主程序对 Launcher 的引用
|
||||
4. 测试基本启动功能
|
||||
|
||||
### 第二阶段(功能迁移)
|
||||
1. 迁移 OOBE 到主程序
|
||||
2. 迁移 Splash 到主程序
|
||||
3. 迁移更新逻辑到主程序
|
||||
4. 迁移插件管理到主程序
|
||||
|
||||
### 第三阶段(CI/CD)
|
||||
1. 修改 release.yml
|
||||
2. 修改 build.yml
|
||||
3. 测试打包流程
|
||||
4. 验证安装程序
|
||||
|
||||
### 第四阶段(优化)
|
||||
1. 实现 Launcher 自更新
|
||||
2. 性能优化
|
||||
3. 清理旧代码
|
||||
725
.trae/documents/launcher_improved_plan_v2.md
Normal file
725
.trae/documents/launcher_improved_plan_v2.md
Normal file
@@ -0,0 +1,725 @@
|
||||
# LanMountainDesktop Launcher 改进计划 V2
|
||||
|
||||
## 核心设计理念
|
||||
|
||||
**Launcher 是核心协调器,不是极简启动器**
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Launcher 职责定位 │
|
||||
├─────────────────────────────────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ Launcher 负责(启动前 & 退出后): │
|
||||
│ ┌─────────────────────────────────────────────────────────────────────┐ │
|
||||
│ │ • OOBE 首次引导 │ │
|
||||
│ │ • 启动动画 (Splash) │ │
|
||||
│ │ • 插件安装 │ │
|
||||
│ │ • 插件更新 │ │
|
||||
│ │ • 应用增量更新安装(不是下载!) │ │
|
||||
│ │ • 应用静默更新安装 │ │
|
||||
│ └─────────────────────────────────────────────────────────────────────┘ │
|
||||
│ │
|
||||
│ 主程序负责(运行时): │
|
||||
│ ┌─────────────────────────────────────────────────────────────────────┐ │
|
||||
│ │ • 多线程下载(有完整 Downloader) │ │
|
||||
│ │ • 更新渠道切换 │ │
|
||||
│ │ • 下载管理 │ │
|
||||
│ │ • 与 Launcher 通讯(启动进度) │ │
|
||||
│ └─────────────────────────────────────────────────────────────────────┘ │
|
||||
│ │
|
||||
│ 关键优势: │
|
||||
│ • Launcher 在应用启动前运行 → 可以安装更新而不担心文件占用 │
|
||||
│ • Launcher 在应用退出后运行 → 可以完成待处理的安装任务 │
|
||||
│ • 主程序专注下载 → 利用完整的多线程下载器提高效率 │
|
||||
│ │
|
||||
└─────────────────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
## 为什么保留 Avalonia?
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────────────────┐
|
||||
│ 保留 Avalonia 的理由 │
|
||||
├─────────────────────────────────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ 1. 启动画面 (Splash) │
|
||||
│ ┌─────────────────────────────────────────────────────────────────┐ │
|
||||
│ │ • 需要显示启动进度 │ │
|
||||
│ │ • 需要显示品牌 Logo │ │
|
||||
│ │ • 需要流畅的动画效果 │ │
|
||||
│ │ • 纯 Win32 实现复杂且不易维护 │ │
|
||||
│ └─────────────────────────────────────────────────────────────────┘ │
|
||||
│ │
|
||||
│ 2. OOBE 首次引导 │
|
||||
│ ┌─────────────────────────────────────────────────────────────────┐ │
|
||||
│ │ • 需要多步骤向导界面 │ │
|
||||
│ │ • 需要丰富的交互控件 │ │
|
||||
│ │ • 需要与主程序一致的视觉风格 │ │
|
||||
│ │ • Avalonia 提供完整的 UI 框架 │ │
|
||||
│ └─────────────────────────────────────────────────────────────────┘ │
|
||||
│ │
|
||||
│ 3. 与主程序的技术栈一致 │
|
||||
│ ┌─────────────────────────────────────────────────────────────────┐ │
|
||||
│ │ • 共享主题和资源 │ │
|
||||
│ │ • 共享控件和样式 │ │
|
||||
│ │ • 便于维护和迭代 │ │
|
||||
│ └─────────────────────────────────────────────────────────────────┘ │
|
||||
│ │
|
||||
└─────────────────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
## 改进后的架构设计
|
||||
|
||||
### 目录结构(保持不变)
|
||||
|
||||
```
|
||||
安装根目录/
|
||||
├── LanMountainDesktop.exe ← Launcher(Avalonia 应用)
|
||||
├── app-1.0.0/ ← 版本目录
|
||||
│ ├── .current ← 当前版本标记
|
||||
│ ├── LanMountainDesktop.exe ← 主程序
|
||||
│ └── ... (所有依赖)
|
||||
└── .launcher/ ← Launcher 数据目录
|
||||
├── update/ ← 更新缓存
|
||||
│ └── incoming/ ← 下载的更新包(主程序下载到这里)
|
||||
└── snapshots/ ← 版本快照
|
||||
```
|
||||
|
||||
### 核心流程设计
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────────────────┐
|
||||
│ 启动流程(含通讯机制) │
|
||||
├─────────────────────────────────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ 1. 用户启动 LanMountainDesktop.exe (Launcher) │
|
||||
│ ↓ │
|
||||
│ 2. Launcher 检查是否有待处理的更新安装 │
|
||||
│ ↓ │
|
||||
│ 3. 有更新?──Yes──▶ 显示 Splash "正在安装更新..." │
|
||||
│ ↓ ↓ │
|
||||
│ No 安装更新(增量/静默) │
|
||||
│ ↓ ↓ │
|
||||
│ 4. 检查是否首次运行 ──Yes──▶ 显示 OOBE 窗口 │
|
||||
│ ↓ No ↓ │
|
||||
│ 5. 显示 Splash "正在启动..." 完成 OOBE │
|
||||
│ ↓ │
|
||||
│ 6. 启动主程序进程(带通讯参数) │
|
||||
│ ↓ │
|
||||
│ 7. Launcher 保持运行,监听主程序进度 ─────── IPC 通讯 ───────▶ 主程序 │
|
||||
│ ↓ │
|
||||
│ 8. 主程序报告启动进度 ─────── IPC 通讯 ───────▶ Launcher 更新 Splash │
|
||||
│ ↓ │
|
||||
│ 9. 主程序完全启动 ──Yes──▶ Launcher 关闭 Splash,进入后台/退出 │
|
||||
│ │
|
||||
└─────────────────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
### 退出流程
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────────────────┐
|
||||
│ 退出流程(处理待安装任务) │
|
||||
├─────────────────────────────────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ 1. 主程序准备退出 │
|
||||
│ ↓ │
|
||||
│ 2. 检查是否有待安装的更新/插件 ──Yes──▶ 重启 Launcher 并传递参数 │
|
||||
│ ↓ No ↓ │
|
||||
│ 3. 正常退出 Launcher 在应用退出后运行 │
|
||||
│ ↓ │
|
||||
│ 安装待处理的任务 │
|
||||
│ ↓ │
|
||||
│ 完成后再次启动主程序 │
|
||||
│ │
|
||||
└─────────────────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
## Launcher 与主程序的通讯机制
|
||||
|
||||
### IPC 方案选择
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────────────────┐
|
||||
│ IPC 通讯方案 │
|
||||
├─────────────────────────────────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ 方案 1: 命令行参数 + 退出码(推荐用于启动阶段) │
|
||||
│ ┌─────────────────────────────────────────────────────────────────────┐ │
|
||||
│ │ Launcher 启动主程序: │ │
|
||||
│ │ LanMountainDesktop.exe --launcher-pid 12345 --ipc-port 50000 │ │
|
||||
│ │ │ │
|
||||
│ │ 主程序通过命名管道/HTTP 与 Launcher 通讯 │ │
|
||||
│ └─────────────────────────────────────────────────────────────────────┘ │
|
||||
│ │
|
||||
│ 方案 2: 命名管道(推荐用于进度报告) │
|
||||
│ ┌─────────────────────────────────────────────────────────────────────┐ │
|
||||
│ │ [历史方案] Launcher 创建命名管道: \\.\pipe\LanMountainDesktop_Launcher │ │
|
||||
│ │ 主程序连接并发送进度消息 │ │
|
||||
│ │ │ │
|
||||
│ │ 消息格式: JSON │ │
|
||||
│ │ {"stage": "initializing", "progress": 30, "message": "加载设置..."} │ │
|
||||
│ └─────────────────────────────────────────────────────────────────────┘ │
|
||||
│ │
|
||||
│ 方案 3: 共享内存/文件(简单状态同步) │
|
||||
│ ┌─────────────────────────────────────────────────────────────────────┐ │
|
||||
│ │ Launcher 和主程序读写同一个状态文件 │ │
|
||||
│ │ .launcher/state/startup_status.json │ │
|
||||
│ └─────────────────────────────────────────────────────────────────────┘ │
|
||||
│ │
|
||||
└─────────────────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
### 通讯协议设计
|
||||
|
||||
```csharp
|
||||
// 共享契约(LanMountainDesktop.Shared.Contracts)
|
||||
namespace LanMountainDesktop.Shared.Contracts.Launcher;
|
||||
|
||||
public enum StartupStage
|
||||
{
|
||||
Initializing,
|
||||
LoadingSettings,
|
||||
LoadingPlugins,
|
||||
InitializingUI,
|
||||
Ready
|
||||
}
|
||||
|
||||
public record StartupProgressMessage
|
||||
{
|
||||
public StartupStage Stage { get; init; }
|
||||
public int ProgressPercent { get; init; } // 0-100
|
||||
public string? Message { get; init; }
|
||||
public DateTimeOffset Timestamp { get; init; } = DateTimeOffset.UtcNow;
|
||||
}
|
||||
|
||||
public static class LauncherIpc
|
||||
{
|
||||
public const string PipeName = "LanMountainDesktop_Launcher";
|
||||
public const string EnvironmentVariablePrefix = "LMD_";
|
||||
}
|
||||
```
|
||||
|
||||
## 详细实施步骤
|
||||
|
||||
### P0: 架构调整(核心)
|
||||
|
||||
#### 1. 调整 Launcher 项目引用
|
||||
|
||||
**文件**: `LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj`
|
||||
|
||||
**修改**:
|
||||
- 保留 Avalonia 依赖
|
||||
- 移除 PluginSdk 引用(Launcher 不需要)
|
||||
- 添加 Shared.Contracts 引用(用于 IPC)
|
||||
|
||||
```xml
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<ApplicationIcon>Assetsogo_nightly.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- 保留 Avalonia -->
|
||||
<PackageReference Include="Avalonia" Version="11.3.12" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="11.3.12" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.12" />
|
||||
|
||||
<!-- 只引用 Shared.Contracts(IPC 协议) -->
|
||||
<ProjectReference Include="..\LanMountainDesktop.Shared.Contracts\LanMountainDesktop.Shared.Contracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- 图标资源 -->
|
||||
<ItemGroup>
|
||||
<Content Include="..\LanMountainDesktop\Assets\logo_nightly.ico" Link="Assets\logo_nightly.ico">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
```
|
||||
|
||||
#### 2. 移除主程序对 Launcher 的引用
|
||||
|
||||
**文件**: `LanMountainDesktop/LanMountainDesktop.csproj`
|
||||
|
||||
**修改**: 删除 Launcher 引用
|
||||
```xml
|
||||
<!-- 删除 -->
|
||||
<!-- <ProjectReference Include="..\LanMountainDesktop.Launcher\LanMountainDesktop.Launcher.csproj" ReferenceOutputAssembly="false" /> -->
|
||||
```
|
||||
|
||||
#### 3. 创建 IPC 通讯契约
|
||||
|
||||
**新建文件**: `LanMountainDesktop.Shared.Contracts/Launcher/LauncherIpc.cs`
|
||||
|
||||
```csharp
|
||||
namespace LanMountainDesktop.Shared.Contracts.Launcher;
|
||||
|
||||
public enum StartupStage
|
||||
{
|
||||
Initializing,
|
||||
LoadingSettings,
|
||||
LoadingPlugins,
|
||||
InitializingUI,
|
||||
Ready
|
||||
}
|
||||
|
||||
public record StartupProgressMessage
|
||||
{
|
||||
public StartupStage Stage { get; init; }
|
||||
public int ProgressPercent { get; init; }
|
||||
public string? Message { get; init; }
|
||||
public DateTimeOffset Timestamp { get; init; } = DateTimeOffset.UtcNow;
|
||||
}
|
||||
|
||||
public static class LauncherIpcConstants
|
||||
{
|
||||
public const string PipeName = "LanMountainDesktop_Launcher";
|
||||
public const string LauncherPidEnvVar = "LMD_LAUNCHER_PID";
|
||||
public const string PackageRootEnvVar = "LMD_PACKAGE_ROOT";
|
||||
public const string VersionEnvVar = "LMD_VERSION";
|
||||
}
|
||||
```
|
||||
|
||||
### P1: Launcher 端实现
|
||||
|
||||
#### 4. 实现 IPC 服务端
|
||||
|
||||
**历史方案,已废弃**: `LanMountainDesktop.Launcher/Services/Ipc/LauncherIpcServer.cs`
|
||||
|
||||
```csharp
|
||||
using System.IO.Pipes;
|
||||
using System.Text.Json;
|
||||
using LanMountainDesktop.Shared.Contracts.Launcher;
|
||||
|
||||
namespace LanMountainDesktop.Launcher.Services.Ipc;
|
||||
|
||||
public class LauncherIpcServer : IDisposable
|
||||
{
|
||||
private readonly CancellationTokenSource _cts = new();
|
||||
private NamedPipeServerStream? _pipeServer;
|
||||
private readonly Action<StartupProgressMessage> _onProgress;
|
||||
|
||||
public LauncherIpcServer(Action<StartupProgressMessage> onProgress)
|
||||
{
|
||||
_onProgress = onProgress;
|
||||
}
|
||||
|
||||
public async Task StartAsync()
|
||||
{
|
||||
while (!_cts.Token.IsCancellationRequested)
|
||||
{
|
||||
try
|
||||
{
|
||||
_pipeServer = new NamedPipeServerStream(
|
||||
LauncherIpcConstants.PipeName,
|
||||
PipeDirection.In,
|
||||
1,
|
||||
PipeTransmissionMode.Message);
|
||||
|
||||
await _pipeServer.WaitForConnectionAsync(_cts.Token);
|
||||
|
||||
using var reader = new StreamReader(_pipeServer);
|
||||
var json = await reader.ReadToEndAsync(_cts.Token);
|
||||
|
||||
if (!string.IsNullOrEmpty(json))
|
||||
{
|
||||
var message = JsonSerializer.Deserialize<StartupProgressMessage>(json);
|
||||
if (message != null)
|
||||
{
|
||||
_onProgress(message);
|
||||
}
|
||||
}
|
||||
|
||||
_pipeServer.Disconnect();
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
break;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.Error.WriteLine($"IPC error: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_cts.Cancel();
|
||||
_pipeServer?.Dispose();
|
||||
_cts.Dispose();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### 5. 修改 Launcher 启动流程
|
||||
|
||||
**修改文件**: `LanMountainDesktop.Launcher/Services/LauncherFlowCoordinator.cs`
|
||||
|
||||
```csharp
|
||||
public async Task<LauncherResult> RunAsync()
|
||||
{
|
||||
// 1. 清理旧版本
|
||||
_deploymentLocator.CleanupDestroyedDeployments();
|
||||
|
||||
// 2. 检查并安装待处理的更新(主程序下载的)
|
||||
var pendingUpdate = _updateEngine.CheckPendingUpdate();
|
||||
if (pendingUpdate.HasUpdate)
|
||||
{
|
||||
_splashWindow?.UpdateStatus("正在安装更新...");
|
||||
var updateResult = await _updateEngine.ApplyPendingUpdateAsync();
|
||||
if (!updateResult.Success)
|
||||
{
|
||||
return updateResult;
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 检查并安装待处理的插件更新
|
||||
var pendingPlugins = _pluginUpgradeQueueService.CheckPendingUpgrades();
|
||||
if (pendingPlugins.HasUpgrades)
|
||||
{
|
||||
_splashWindow?.UpdateStatus("正在更新插件...");
|
||||
var pluginResult = _pluginUpgradeQueueService.ApplyPendingUpgrades();
|
||||
if (!pluginResult.Success)
|
||||
{
|
||||
return pluginResult;
|
||||
}
|
||||
}
|
||||
|
||||
// 4. OOBE
|
||||
if (_oobeStateService.IsFirstRun())
|
||||
{
|
||||
_splashWindow?.Hide();
|
||||
foreach (var step in _oobeSteps)
|
||||
{
|
||||
await step.RunAsync(CancellationToken.None);
|
||||
}
|
||||
_splashWindow?.Show();
|
||||
}
|
||||
|
||||
// 5. 启动 IPC 服务端监听主程序进度
|
||||
using var ipcServer = new LauncherIpcServer(msg =>
|
||||
{
|
||||
_splashWindow?.UpdateProgress(msg.ProgressPercent, msg.Message);
|
||||
});
|
||||
_ = ipcServer.StartAsync();
|
||||
|
||||
// 6. 启动主程序
|
||||
_splashWindow?.UpdateStatus("正在启动...");
|
||||
var hostResult = LaunchHostWithIpc();
|
||||
if (!hostResult.Success)
|
||||
{
|
||||
return hostResult;
|
||||
}
|
||||
|
||||
// 7. 等待主程序报告就绪或超时
|
||||
await WaitForHostReadyOrTimeoutAsync(TimeSpan.FromSeconds(30));
|
||||
|
||||
return new LauncherResult { Success = true };
|
||||
}
|
||||
```
|
||||
|
||||
### P2: 主程序端实现
|
||||
|
||||
#### 6. 实现 IPC 客户端
|
||||
|
||||
**历史方案,已废弃**: `LanMountainDesktop/Services/Launcher/LauncherIpcClient.cs`
|
||||
|
||||
```csharp
|
||||
using System.IO.Pipes;
|
||||
using System.Text.Json;
|
||||
using LanMountainDesktop.Shared.Contracts.Launcher;
|
||||
|
||||
namespace LanMountainDesktop.Services.Launcher;
|
||||
|
||||
public class LauncherIpcClient : IDisposable
|
||||
{
|
||||
private NamedPipeClientStream? _pipeClient;
|
||||
|
||||
public async Task ConnectAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
_pipeClient = new NamedPipeClientStream(
|
||||
".",
|
||||
LauncherIpcConstants.PipeName,
|
||||
PipeDirection.Out);
|
||||
|
||||
await _pipeClient.ConnectAsync(5000, cancellationToken);
|
||||
}
|
||||
|
||||
public async Task ReportProgressAsync(StartupProgressMessage message)
|
||||
{
|
||||
if (_pipeClient?.IsConnected != true)
|
||||
return;
|
||||
|
||||
var json = JsonSerializer.Serialize(message);
|
||||
using var writer = new StreamWriter(_pipeClient, leaveOpen: true);
|
||||
await writer.WriteAsync(json);
|
||||
await writer.FlushAsync();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_pipeClient?.Dispose();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### 7. 主程序启动时报告进度
|
||||
|
||||
**修改文件**: `LanMountainDesktop/App.axaml.cs`
|
||||
|
||||
```csharp
|
||||
public override async void OnFrameworkInitializationCompleted()
|
||||
{
|
||||
// 检查是否从 Launcher 启动
|
||||
var launcherPid = Environment.GetEnvironmentVariable(LauncherIpcConstants.LauncherPidEnvVar);
|
||||
if (!string.IsNullOrEmpty(launcherPid))
|
||||
{
|
||||
// 连接到 Launcher 的 IPC 服务端
|
||||
_launcherIpc = new LauncherIpcClient();
|
||||
await _launcherIpc.ConnectAsync();
|
||||
|
||||
// 报告启动进度
|
||||
await _launcherIpc.ReportProgressAsync(new StartupProgressMessage
|
||||
{
|
||||
Stage = StartupStage.Initializing,
|
||||
ProgressPercent = 10,
|
||||
Message = "正在初始化..."
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化设置
|
||||
await _launcherIpc?.ReportProgressAsync(new StartupProgressMessage
|
||||
{
|
||||
Stage = StartupStage.LoadingSettings,
|
||||
ProgressPercent = 30,
|
||||
Message = "正在加载设置..."
|
||||
});
|
||||
InitializeSettings();
|
||||
|
||||
// 加载插件
|
||||
await _launcherIpc?.ReportProgressAsync(new StartupProgressMessage
|
||||
{
|
||||
Stage = StartupStage.LoadingPlugins,
|
||||
ProgressPercent = 50,
|
||||
Message = "正在加载插件..."
|
||||
});
|
||||
await InitializePluginsAsync();
|
||||
|
||||
// 初始化 UI
|
||||
await _launcherIpc?.ReportProgressAsync(new StartupProgressMessage
|
||||
{
|
||||
Stage = StartupStage.InitializingUI,
|
||||
ProgressPercent = 80,
|
||||
Message = "正在初始化界面..."
|
||||
});
|
||||
InitializeUI();
|
||||
|
||||
// 就绪
|
||||
await _launcherIpc?.ReportProgressAsync(new StartupProgressMessage
|
||||
{
|
||||
Stage = StartupStage.Ready,
|
||||
ProgressPercent = 100,
|
||||
Message = "就绪"
|
||||
});
|
||||
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
}
|
||||
```
|
||||
|
||||
### P3: 更新流程整合
|
||||
|
||||
#### 8. 主程序下载更新
|
||||
|
||||
**主程序职责**:
|
||||
```csharp
|
||||
// 主程序中的更新服务
|
||||
public class AppUpdateService
|
||||
{
|
||||
public async Task DownloadUpdateAsync(string version, string downloadUrl)
|
||||
{
|
||||
// 使用多线程下载器下载更新包
|
||||
var downloader = new MultiThreadedDownloader();
|
||||
var targetPath = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
|
||||
"LanMountainDesktop",
|
||||
".launcher",
|
||||
"update",
|
||||
"incoming",
|
||||
$"update-{version}.zip");
|
||||
|
||||
await downloader.DownloadAsync(downloadUrl, targetPath);
|
||||
|
||||
// 标记为待安装
|
||||
File.WriteAllText(
|
||||
Path.Combine(Path.GetDirectoryName(targetPath)!, ".pending"),
|
||||
version);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### 9. Launcher 安装更新
|
||||
|
||||
**Launcher 职责**:
|
||||
```csharp
|
||||
// Launcher 中的更新安装服务
|
||||
public class UpdateInstallationService
|
||||
{
|
||||
public async Task<InstallResult> InstallPendingUpdateAsync()
|
||||
{
|
||||
var pendingPath = Path.Combine(
|
||||
_appRoot,
|
||||
".launcher",
|
||||
"update",
|
||||
"incoming",
|
||||
".pending");
|
||||
|
||||
if (!File.Exists(pendingPath))
|
||||
return InstallResult.NoUpdate;
|
||||
|
||||
var version = File.ReadAllText(pendingPath);
|
||||
var updatePackagePath = Path.Combine(
|
||||
Path.GetDirectoryName(pendingPath)!,
|
||||
$"update-{version}.zip");
|
||||
|
||||
// 创建新版本目录
|
||||
var newVersionDir = Path.Combine(_appRoot, $"app-{version}");
|
||||
Directory.CreateDirectory(newVersionDir);
|
||||
File.WriteAllText(Path.Combine(newVersionDir, ".partial"), "");
|
||||
|
||||
// 解压更新包
|
||||
ZipFile.ExtractToDirectory(updatePackagePath, newVersionDir);
|
||||
|
||||
// 验证文件完整性
|
||||
// ...
|
||||
|
||||
// 切换版本标记
|
||||
var currentDir = _deploymentLocator.FindCurrentDeploymentDirectory();
|
||||
if (currentDir != null)
|
||||
{
|
||||
File.Delete(Path.Combine(currentDir, ".current"));
|
||||
File.WriteAllText(Path.Combine(currentDir, ".destroy"), "");
|
||||
}
|
||||
|
||||
File.WriteAllText(Path.Combine(newVersionDir, ".current"), "");
|
||||
File.Delete(Path.Combine(newVersionDir, ".partial"));
|
||||
|
||||
// 清理待安装标记
|
||||
File.Delete(pendingPath);
|
||||
File.Delete(updatePackagePath);
|
||||
|
||||
return InstallResult.Success;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### P4: GitHub Actions 工作流
|
||||
|
||||
#### 10. 修改 release.yml
|
||||
|
||||
**关键修改点**:
|
||||
|
||||
```yaml
|
||||
# 1. Launcher 单独编译(保留 Avalonia)
|
||||
- name: Publish Launcher
|
||||
run: |
|
||||
dotnet publish LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj `
|
||||
-c Release `
|
||||
-o ./publish/launcher-win-x64 `
|
||||
--self-contained `
|
||||
-r win-x64 `
|
||||
-p:PublishSingleFile=false `
|
||||
-p:DebugType=none
|
||||
|
||||
# 2. 目录结构调整
|
||||
- name: Restructure for Launcher
|
||||
run: |
|
||||
$version = "${{ needs.prepare.outputs.version }}"
|
||||
$publishDir = "publish/windows-x64"
|
||||
$launcherDir = "publish/launcher-win-x64"
|
||||
$appDir = "app-$version"
|
||||
|
||||
# 创建新结构
|
||||
$newStructure = "publish-launcher/windows-x64"
|
||||
New-Item -ItemType Directory -Path $newStructure -Force
|
||||
|
||||
# 移动主程序到 app-{version}/
|
||||
$appPath = Join-Path $newStructure $appDir
|
||||
Move-Item -Path $publishDir -Destination $appPath -Force
|
||||
|
||||
# 复制 Launcher 到根目录
|
||||
Copy-Item -Path "$launcherDir\*" -Destination $newStructure -Recurse -Force
|
||||
|
||||
# 创建 .current 标记
|
||||
New-Item -ItemType File -Path (Join-Path $appPath ".current") -Force
|
||||
```
|
||||
|
||||
## 文件变更清单
|
||||
|
||||
### 修改文件
|
||||
|
||||
1. `LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj` - 调整引用
|
||||
2. `LanMountainDesktop/LanMountainDesktop.csproj` - 移除 Launcher 引用
|
||||
3. `LanMountainDesktop.Launcher/Services/LauncherFlowCoordinator.cs` - 添加 IPC 和更新安装
|
||||
4. `LanMountainDesktop/App.axaml.cs` - 添加 IPC 客户端和进度报告
|
||||
5. `.github/workflows/release.yml` - 调整打包流程
|
||||
|
||||
### 新增文件
|
||||
|
||||
1. `LanMountainDesktop.Shared.Contracts/Launcher/LauncherIpc.cs` - IPC 契约
|
||||
2. `LanMountainDesktop.Launcher/Services/Ipc/LauncherIpcServer.cs` - 历史启动进度 IPC 服务端,已由公共 IPC 通知替代
|
||||
3. `LanMountainDesktop/Services/Launcher/LauncherIpcClient.cs` - 历史启动进度 IPC 客户端,已由公共 IPC 通知替代
|
||||
4. `LanMountainDesktop.Launcher/Services/Update/UpdateInstallationService.cs` - 更新安装
|
||||
|
||||
### 删除文件
|
||||
|
||||
1. 主程序对 Launcher 的项目引用(已存在)
|
||||
|
||||
## 实施顺序
|
||||
|
||||
### 第一阶段:基础架构
|
||||
1. 创建 IPC 契约(Shared.Contracts)
|
||||
2. 调整 Launcher 项目引用
|
||||
3. 移除主程序对 Launcher 的引用
|
||||
4. 测试基本启动
|
||||
|
||||
### 第二阶段:IPC 实现
|
||||
1. 实现 Launcher IPC 服务端
|
||||
2. 实现主程序 IPC 客户端
|
||||
3. 测试进度报告
|
||||
|
||||
### 第三阶段:更新流程
|
||||
1. 主程序实现下载功能
|
||||
2. Launcher 实现安装功能
|
||||
3. 测试完整更新流程
|
||||
|
||||
### 第四阶段:CI/CD
|
||||
1. 修改 GitHub Actions
|
||||
2. 测试打包流程
|
||||
3. 验证安装程序
|
||||
|
||||
## 验证清单
|
||||
|
||||
- [ ] Launcher 能正常启动主程序
|
||||
- [ ] Launcher 显示 Splash 并接收进度更新
|
||||
- [ ] 主程序能向 Launcher 报告启动进度
|
||||
- [ ] 主程序能下载更新
|
||||
- [ ] Launcher 能安装待处理的更新
|
||||
- [ ] OOBE 流程正常
|
||||
- [ ] 插件更新流程正常
|
||||
- [ ] GitHub Actions 打包成功
|
||||
- [ ] 安装程序图标正常
|
||||
- [ ] 快捷方式图标正常
|
||||
|
||||
## 2026 Multi-instance Policy Update
|
||||
|
||||
- The old launcher progress pipe is historical only; current startup progress uses public IPC.
|
||||
- Launcher now reads Host `settings.json` for `MultiInstanceLaunchBehavior` before normal launch.
|
||||
- Existing Host behavior is policy-driven: restart app, open desktop silently, prompt only, or notify and open desktop.
|
||||
- Host no longer owns the single-instance listener or already-running prompt; repeated-launch policy lives in Launcher.
|
||||
- The repeated-launch prompt is a Fluent Launcher window; Host public IPC only exposes execution actions such as activate, restart, and exit.
|
||||
212
.trae/documents/update-settings-redesign.md
Normal file
212
.trae/documents/update-settings-redesign.md
Normal file
@@ -0,0 +1,212 @@
|
||||
# 更新设置界面重设计实施计划
|
||||
|
||||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||
|
||||
**Goal:** 将更新设置页面从丑陋的卡片堆叠布局重设计为遵循 Fluent Design 的 FASettingsExpander 列表布局,与项目其他设置页面保持视觉一致性。
|
||||
|
||||
**Architecture:** 移除所有 `Border.settings-section-card` 包裹,改用 `FASettingsExpander` + `IconText` 分节标题 + `Separator` 分隔线的统一模式。操作按钮改为仅显示当前可用操作。版本信息改为 `FASettingsExpanderItem` 行项目展示。ViewModel 层新增 `ActiveActions` 计算属性来驱动按钮可见性。
|
||||
|
||||
**Tech Stack:** Avalonia UI 11, FluentAvalonia 2.x, CommunityToolkit.Mvvm
|
||||
|
||||
---
|
||||
|
||||
## 当前状态分析
|
||||
|
||||
### 现有文件
|
||||
|
||||
| 文件 | 职责 |
|
||||
|------|------|
|
||||
| `LanMountainDesktop/Views/SettingsPages/UpdateSettingsPage.axaml` | 更新页面 AXAML 布局 |
|
||||
| `LanMountainDesktop/Views/SettingsPages/UpdateSettingsPage.axaml.cs` | 代码隐藏 |
|
||||
| `LanMountainDesktop/ViewModels/UpdateSettingsViewModel.cs` | 视图模型 |
|
||||
| `LanMountainDesktop/Styles/SettingsCardStyles.axaml` | 通用设置样式 |
|
||||
| `LanMountainDesktop/Controls/IconText.axaml(.cs)` | 分节标题控件 |
|
||||
| `LanMountainDesktop.Shared.Contracts/Update/UpdateState.cs` | UpdatePhase 枚举和扩展方法 |
|
||||
|
||||
### 核心问题
|
||||
|
||||
1. **4 个 `Border.settings-section-card` 卡片**:状态卡、版本信息卡、进度卡、操作卡,每个都带边框+阴影+圆角,视觉零碎
|
||||
2. **FAInfoBar 嵌套在卡片内**:冗余的容器层级
|
||||
3. **7 个按钮 3×3 网格**:大量按钮在当前阶段不可用但仍然占据空间
|
||||
4. **与其他设置页面风格不一致**:GeneralSettingsPage、AppearanceSettingsPage 等全部使用 `FASettingsExpander` 列表
|
||||
|
||||
### 参考基准
|
||||
|
||||
- [GeneralSettingsPage.axaml](file:///d:/github/LanMountainDesktop/LanMountainDesktop/Views/SettingsPages/GeneralSettingsPage.axaml):`IconText` 分节标题 → `FASettingsExpander` 列表 → `Separator` 分隔
|
||||
- [AppearanceSettingsPage.axaml](file:///d:/github/LanMountainDesktop/LanMountainDesktop/Views/SettingsPages/AppearanceSettingsPage.axaml):同上模式
|
||||
- [AboutSettingsPage.axaml](file:///d:/github/LanMountainDesktop/LanMountainDesktop/Views/SettingsPages/AboutSettingsPage.axaml):`FAInfoBar` 用于静态信息展示
|
||||
- Windows 11 设置 > Windows Update:顶部状态区 + 进度条 + 操作按钮,下方展开区展示详情
|
||||
|
||||
---
|
||||
|
||||
## 设计决策
|
||||
|
||||
| 决策项 | 选择 | 理由 |
|
||||
|--------|------|------|
|
||||
| 布局模式 | FASettingsExpander 列表 | 与其他设置页面统一,Fluent Design 原生控件 |
|
||||
| 按钮策略 | 仅显示可用操作 | 简洁、不混乱,Windows 11 更新页面也是此模式 |
|
||||
| 版本信息 | FASettingsExpanderItem 行项目 | 每行一个信息,干净可扫描 |
|
||||
| 进度展示 | 内嵌在状态 Expander 内 | 进度是状态的一部分,不应独立成卡 |
|
||||
| 偏好设置 | 保留 FASettingsExpander | 已经是正确模式,微调即可 |
|
||||
|
||||
---
|
||||
|
||||
## 新布局结构
|
||||
|
||||
```
|
||||
ScrollViewer
|
||||
└── StackPanel (settings-page-container settings-page-animated)
|
||||
├── TextBlock (settings-section-title: "更新")
|
||||
├── TextBlock (settings-section-description: 描述文字)
|
||||
│
|
||||
├── IconText (Icon="ArrowSync", Text="更新状态")
|
||||
│
|
||||
├── FASettingsExpander "检查更新" (IsClickEnabled=True, Command=CheckCommand)
|
||||
│ ├── IconSource: ArrowSync 图标
|
||||
│ └── Footer: Button "检查更新" (仅 CanCheck 时可见)
|
||||
│
|
||||
├── FASettingsExpander "更新进度" (IsVisible=IsBusy||IsProgressVisible||IsPaused)
|
||||
│ ├── IconSource: FAProgressRing / 对应阶段图标
|
||||
│ ├── Footer: PhaseText + ProgressFraction
|
||||
│ └── FASettingsExpanderItem
|
||||
│ ├── ProgressBar (ProgressFraction)
|
||||
│ ├── ProgressDetail 文字
|
||||
│ └── 操作按钮行 (仅可用操作)
|
||||
│ ├── Button "下载" (CanDownload)
|
||||
│ ├── Button "安装" (CanInstall)
|
||||
│ ├── Button "暂停" (CanPause)
|
||||
│ ├── Button "继续" (CanResume)
|
||||
│ ├── Button "回滚" (CanRollback)
|
||||
│ └── Button "取消" (CanCancel)
|
||||
│
|
||||
├── FASettingsExpander "暂停" (IsVisible=IsPaused)
|
||||
│ └── FAInfoBar (PausedBadgeText + PausedHintText)
|
||||
│
|
||||
├── Separator (settings-separator)
|
||||
│
|
||||
├── IconText (Icon="Info", Text="版本信息")
|
||||
│
|
||||
├── FASettingsExpander "当前版本" (IsClickEnabled=False)
|
||||
│ ├── IconSource: 版本图标
|
||||
│ └── Footer: CurrentVersionText
|
||||
│
|
||||
├── FASettingsExpander "最新版本" (IsClickEnabled=False)
|
||||
│ ├── IconSource: 下载图标
|
||||
│ └── Footer: LatestVersionText (或 "已是最新")
|
||||
│
|
||||
├── FASettingsExpander "发布时间" (IsClickEnabled=False)
|
||||
│ ├── IconSource: 日历图标
|
||||
│ └── Footer: PublishedAtText
|
||||
│
|
||||
├── FASettingsExpander "上次检查" (IsClickEnabled=False)
|
||||
│ ├── IconSource: 时钟图标
|
||||
│ └── Footer: LastCheckedText
|
||||
│
|
||||
├── FASettingsExpander "更新类型" (IsClickEnabled=False)
|
||||
│ ├── IconSource: 标签图标
|
||||
│ └── Footer: UpdateTypeText
|
||||
│
|
||||
├── Separator (settings-separator)
|
||||
│
|
||||
├── IconText (Icon="Settings", Text="更新偏好")
|
||||
│
|
||||
└── FASettingsExpander "更新偏好" (IsExpanded=True)
|
||||
├── IconSource: 设置齿轮图标
|
||||
├── FASettingsExpanderItem "更新频道"
|
||||
│ └── Footer: ComboBox (stable/preview)
|
||||
├── FASettingsExpanderItem "下载源"
|
||||
│ └── Footer: ComboBox (plonds/github/proxy)
|
||||
├── FASettingsExpanderItem "更新模式"
|
||||
│ └── Footer: ComboBox (manual/confirm/silent)
|
||||
└── FASettingsExpanderItem "下载线程数"
|
||||
└── Footer: Slider + TextBlock
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Proposed Changes
|
||||
|
||||
### Task 1: 重写 UpdateSettingsPage.axaml 布局
|
||||
|
||||
**Files:**
|
||||
- Modify: `LanMountainDesktop/Views/SettingsPages/UpdateSettingsPage.axaml`
|
||||
|
||||
**What:** 完全重写 AXAML,将 4 个 `Border.settings-section-card` 替换为 `FASettingsExpander` 列表布局。
|
||||
|
||||
**Key changes:**
|
||||
1. 移除所有 `Border.settings-section-card` 包裹
|
||||
2. 使用 `controls:IconText` 做分节标题(与 GeneralSettingsPage 一致)
|
||||
3. 状态区域:`FASettingsExpander` + `IsClickEnabled=True` + `Command=CheckCommand`,Footer 放检查按钮
|
||||
4. 进度区域:`FASettingsExpander` 内嵌 ProgressBar + 操作按钮,仅 `IsBusy||IsProgressVisible||IsPaused` 时可见
|
||||
5. 版本信息:每个字段一个 `FASettingsExpander`,Footer 直接显示值(参考 Windows 11 更新页面的行项目模式)
|
||||
6. 偏好设置:保留 `FASettingsExpander` + `FASettingsExpanderItem` 模式,但将 TextBox 改为 ComboBox(更符合 Fluent 规范)
|
||||
7. 使用 `Separator classes="settings-separator"` 分隔三大区域
|
||||
|
||||
**Why:** 与项目其他设置页面统一风格,遵循 Fluent Design,消除卡片堆叠的视觉噪音。
|
||||
|
||||
**How:**
|
||||
- 参照 GeneralSettingsPage.axaml 的布局模式
|
||||
- 参照 AppearanceSettingsPage.axaml 的 FASettingsExpander 使用方式
|
||||
- 参照 AboutSettingsPage.axaml 的 FAInfoBar 使用方式
|
||||
|
||||
### Task 2: 更新 ViewModel — 添加 ComboBox 数据源和按钮可见性属性
|
||||
|
||||
**Files:**
|
||||
- Modify: `LanMountainDesktop/ViewModels/UpdateSettingsViewModel.cs`
|
||||
|
||||
**What:**
|
||||
1. 将更新频道、下载源、更新模式从 `TextBox` 绑定改为 `ComboBox` 绑定,添加 `ObservableCollection<SelectionOption>` 类型的数据源属性
|
||||
2. 添加 `IsProgressSectionVisible` 计算属性(`IsBusy || IsProgressVisible || IsPaused`)
|
||||
3. 添加 `IsUpdateAvailableSectionVisible` 计算属性(`IsUpdateAvailable`)
|
||||
4. 添加 `IsStatusInfoVisible` 计算属性(有 StatusMessage 且非空闲时)
|
||||
5. 移除不再需要的独立按钮文本属性(CheckButtonText 保留,其他按钮文本属性保留但仅在可见时使用)
|
||||
|
||||
**Why:** ComboBox 比 TextBox 更适合有限选项的输入,且与 GeneralSettingsPage 的模式一致。按钮可见性属性让 AXAML 可以用 `IsVisible` 绑定控制按钮显示。
|
||||
|
||||
**How:**
|
||||
- 参考 GeneralSettingsPageViewModel 中 SelectionOption 的使用方式
|
||||
- 在 `OnCurrentPhaseChanged` 中触发新属性的 OnPropertyChanged
|
||||
|
||||
### Task 3: 将偏好设置 TextBox 替换为 ComboBox
|
||||
|
||||
**Files:**
|
||||
- Modify: `LanMountainDesktop/Views/SettingsPages/UpdateSettingsPage.axaml` (在 Task 1 中一并完成)
|
||||
- Modify: `LanMountainDesktop/ViewModels/UpdateSettingsViewModel.cs` (在 Task 2 中一并完成)
|
||||
|
||||
**What:** 将更新频道、下载源、更新模式三个 `TextBox` 替换为 `ComboBox`,使用 `SelectionOption` 数据模板。
|
||||
|
||||
**Why:** 有限选项应使用 ComboBox 而非自由文本输入,这是 Fluent Design 的基本规范,也与 GeneralSettingsPage 中的语言/时区选择一致。
|
||||
|
||||
### Task 4: 构建验证
|
||||
|
||||
**Files:**
|
||||
- 无新文件
|
||||
|
||||
**What:** 运行 `dotnet build` 确保编译通过,检查 AXAML 绑定是否正确。
|
||||
|
||||
---
|
||||
|
||||
## Assumptions & Decisions
|
||||
|
||||
1. **不修改 UpdateOrchestrator 和 UpdateState** — 只改 UI 层和 ViewModel 的展示逻辑,不改底层更新引擎
|
||||
2. **不修改 SettingsCardStyles.axaml** — 通用样式保持不变,移除的是 UpdateSettingsPage 对它的使用
|
||||
3. **保留所有 ViewModel 属性** — 即使某些属性在新布局中不再直接使用(如独立的 ActionsTitle),也保留以避免破坏本地化系统
|
||||
4. **ComboBox 选项硬编码在 ViewModel** — 参考 GeneralSettingsPageViewModel 的 SelectionOption 模式
|
||||
5. **进度区域在空闲时隐藏** — 不显示空的进度条,只在有活动时展示
|
||||
6. **FAInfoBar 仅用于暂停/错误提示** — 不再嵌套在卡片内,直接放在 FASettingsExpanderItem 内
|
||||
|
||||
---
|
||||
|
||||
## Verification Steps
|
||||
|
||||
1. `dotnet build LanMountainDesktop.slnx -c Debug` 编译通过
|
||||
2. 运行应用,导航到设置 > 更新页面,验证:
|
||||
- 页面布局与 GeneralSettingsPage 风格一致
|
||||
- 无圆角矩形卡片包裹
|
||||
- 检查更新按钮可用
|
||||
- 进度区域在空闲时隐藏
|
||||
- 版本信息以行项目形式展示
|
||||
- 偏好设置使用 ComboBox
|
||||
- 操作按钮仅显示当前可用的
|
||||
3. 点击「检查更新」,验证状态变化和进度展示
|
||||
4. 验证偏好设置的 ComboBox 选择能正确保存和加载
|
||||
559
.trae/documents/weather-widget-material-redesign.md
Normal file
559
.trae/documents/weather-widget-material-redesign.md
Normal file
@@ -0,0 +1,559 @@
|
||||
# 天气组件 Material Design 重设计计划
|
||||
|
||||
> **目标:** 全面重构阑山桌面天气组件的视觉设计,遵循 Material Design 3 规范,参考 Google Weather、几何天气、Breez 天气和柠檬天气的设计语言。
|
||||
|
||||
---
|
||||
|
||||
## 当前状态分析
|
||||
|
||||
### 现有组件
|
||||
1. **WeatherWidget** - 基础天气(温度+天气状况+位置)
|
||||
2. **ExtendedWeatherWidget** - 扩展天气(含指标、逐小时、逐日预报)
|
||||
3. **HourlyWeatherWidget** - 逐小时天气
|
||||
4. **MultiDayWeatherWidget** - 多日天气
|
||||
5. **WeatherClockWidget** - 天气时钟
|
||||
|
||||
### 现有问题
|
||||
- 排版层次不清晰,文字大小对比不够
|
||||
- 布局过于紧凑,缺乏呼吸感
|
||||
- 内部卡片使用简单纯色背景,缺乏 Material 风格
|
||||
- 背景场景和前景内容缺乏深度分离
|
||||
- 圆角和间距不统一
|
||||
|
||||
### 现有视觉系统
|
||||
- 4套调色板:Google(默认)、Geometric、Breezy、LemonFlutter
|
||||
- 动态背景场景:MaterialWeatherSceneControl 绘制渐变+装饰
|
||||
- 图标系统:WeatherIconView + WeatherIconAssetResolver
|
||||
|
||||
---
|
||||
|
||||
## 设计方向
|
||||
|
||||
### 核心原则
|
||||
1. **Material Design 3** - 使用 M3 的排版、颜色、间距和形状规范
|
||||
2. **信息层级清晰** - 大字体温度、次要信息弱化
|
||||
3. **呼吸感** - 合理的间距和留白
|
||||
4. **深度感** - 前景卡片与背景场景分离
|
||||
5. **圆角一致性** - 遵循 DesignCornerRadius 规范
|
||||
|
||||
### 参考风格
|
||||
- **Google Weather** - 大字体温度、清晰层级、圆角卡片、柔和渐变
|
||||
- **几何天气** - 几何装饰、现代感
|
||||
- **Breez** - 清新留白、柔和色彩
|
||||
- **柠檬天气** - 活泼明亮
|
||||
|
||||
---
|
||||
|
||||
## 具体改动计划
|
||||
|
||||
### Task 1: 优化 MaterialWeatherPalette 和调色板系统
|
||||
|
||||
**文件:** `LanMountainDesktop/Views/Components/MaterialWeatherVisualTheme.cs`
|
||||
|
||||
**改动:**
|
||||
- 调整所有调色板的对比度,确保文字可读性
|
||||
- 优化背景渐变色彩,更加柔和自然
|
||||
- 统一文字主色和次色的对比度比例
|
||||
- 为每个风格增加 `SurfaceColor` 和 `SurfaceVariantColor` 用于卡片背景
|
||||
|
||||
**当前调色板字段:**
|
||||
```csharp
|
||||
public sealed record MaterialWeatherPalette(
|
||||
Color BackgroundTop,
|
||||
Color BackgroundBottom,
|
||||
Color PrimaryShape,
|
||||
Color SecondaryShape,
|
||||
Color AccentShape,
|
||||
Color TextPrimary,
|
||||
Color TextSecondary,
|
||||
Color SurfaceTint,
|
||||
Color OverlayTint);
|
||||
```
|
||||
|
||||
**新增字段:**
|
||||
```csharp
|
||||
Color SurfaceColor, // 卡片表面色(低透明度白色/黑色)
|
||||
Color SurfaceVariantColor, // 变体表面色
|
||||
Color OutlineColor // 分割线/边框色
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 2: 重构 WeatherWidget(基础天气组件)
|
||||
|
||||
**文件:**
|
||||
- `LanMountainDesktop/Views/Components/WeatherWidget.axaml`
|
||||
- `LanMountainDesktop/Views/Components/WeatherWidget.axaml.cs`
|
||||
|
||||
**设计目标:**
|
||||
- 大字体温度显示(类似 Google Weather)
|
||||
- 天气状况文字清晰可读
|
||||
- 位置和温度范围弱化显示
|
||||
- 图标与文字对齐优化
|
||||
|
||||
**XAML 改动:**
|
||||
```xml
|
||||
<Border x:Name="RootBorder"
|
||||
CornerRadius="{DynamicResource DesignCornerRadiusComponent}"
|
||||
ClipToBounds="True">
|
||||
<Grid>
|
||||
<components:MaterialWeatherSceneControl x:Name="Scene" />
|
||||
<Border x:Name="OverlayBorder" />
|
||||
|
||||
<!-- 主内容区 -->
|
||||
<Grid x:Name="ContentGrid"
|
||||
RowDefinitions="*,Auto"
|
||||
Margin="20,16,20,14">
|
||||
|
||||
<!-- 上半区:温度 + 图标 -->
|
||||
<Grid ColumnDefinitions="*,Auto">
|
||||
<StackPanel VerticalAlignment="Center" Spacing="4">
|
||||
<!-- 温度:超大字体 -->
|
||||
<TextBlock x:Name="TemperatureTextBlock"
|
||||
Text="--°"
|
||||
FontSize="72"
|
||||
FontWeight="Bold"
|
||||
LineHeight="72" />
|
||||
<!-- 天气状况 -->
|
||||
<TextBlock x:Name="ConditionTextBlock"
|
||||
Text="Loading"
|
||||
FontSize="18"
|
||||
FontWeight="SemiBold"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- 右侧图标 -->
|
||||
<components:WeatherIconView x:Name="MainIcon"
|
||||
Grid.Column="1"
|
||||
Width="72"
|
||||
Height="72"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
|
||||
<!-- 底部信息栏 -->
|
||||
<Grid Grid.Row="1" ColumnDefinitions="*,Auto">
|
||||
<TextBlock x:Name="LocationTextBlock"
|
||||
Text="Weather"
|
||||
FontSize="13"
|
||||
FontWeight="Medium"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
VerticalAlignment="Bottom" />
|
||||
<TextBlock x:Name="RangeTextBlock"
|
||||
Grid.Column="1"
|
||||
Text="-- / --"
|
||||
FontSize="13"
|
||||
FontWeight="Medium"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
```
|
||||
|
||||
**CS 改动:**
|
||||
- 调整响应式布局的字体缩放比例
|
||||
- 更新颜色绑定使用新的调色板字段
|
||||
|
||||
---
|
||||
|
||||
### Task 3: 重构 ExtendedWeatherWidget(扩展天气组件)
|
||||
|
||||
**文件:**
|
||||
- `LanMountainDesktop/Views/Components/ExtendedWeatherWidget.axaml`
|
||||
- `LanMountainDesktop/Views/Components/ExtendedWeatherWidget.axaml.cs`
|
||||
|
||||
**设计目标:**
|
||||
- 顶部区域:位置+温度+图标横向排列
|
||||
- 指标区域:使用 Material 3 风格的标签卡片
|
||||
- 逐小时预报:水平滚动卡片,时间+图标+温度
|
||||
- 逐日预报:列表式布局,日期+图标+高低温
|
||||
|
||||
**XAML 改动:**
|
||||
```xml
|
||||
<Border x:Name="RootBorder"
|
||||
CornerRadius="{DynamicResource DesignCornerRadiusComponent}"
|
||||
ClipToBounds="True">
|
||||
<Grid>
|
||||
<components:MaterialWeatherSceneControl x:Name="Scene" />
|
||||
<Border x:Name="OverlayBorder" />
|
||||
|
||||
<Grid x:Name="ContentGrid"
|
||||
RowDefinitions="Auto,Auto,Auto,Auto"
|
||||
Margin="20,16,20,14"
|
||||
RowSpacing="12">
|
||||
|
||||
<!-- 顶部:位置 + 图标 + 温度 -->
|
||||
<Grid ColumnDefinitions="*,Auto,Auto" VerticalAlignment="Center">
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock x:Name="LocationTextBlock"
|
||||
Text="Weather"
|
||||
FontSize="13"
|
||||
FontWeight="Medium"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
Opacity="0.72" />
|
||||
<TextBlock x:Name="ConditionTextBlock"
|
||||
Text="Loading"
|
||||
FontSize="16"
|
||||
FontWeight="SemiBold"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
</StackPanel>
|
||||
<components:WeatherIconView x:Name="MainIcon"
|
||||
Grid.Column="1"
|
||||
Width="56"
|
||||
Height="56"
|
||||
Margin="0,0,10,0" />
|
||||
<TextBlock x:Name="TemperatureTextBlock"
|
||||
Grid.Column="2"
|
||||
Text="--°"
|
||||
FontSize="56"
|
||||
FontWeight="Bold"
|
||||
VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
|
||||
<!-- 指标区域 -->
|
||||
<UniformGrid x:Name="MetricGrid" Grid.Row="1" Rows="1" Columns="3" />
|
||||
|
||||
<!-- 逐小时预报 -->
|
||||
<Border Grid.Row="2"
|
||||
Background="{DynamicResource SurfaceColor}"
|
||||
CornerRadius="{DynamicResource DesignCornerRadiusMd}"
|
||||
Padding="10,8">
|
||||
<UniformGrid x:Name="HourlyGrid" Rows="1" Columns="6" />
|
||||
</Border>
|
||||
|
||||
<!-- 逐日预报 -->
|
||||
<Border Grid.Row="3"
|
||||
Background="{DynamicResource SurfaceColor}"
|
||||
CornerRadius="{DynamicResource DesignCornerRadiusMd}"
|
||||
Padding="10,8">
|
||||
<UniformGrid x:Name="DailyGrid" Rows="1" Columns="5" />
|
||||
</Border>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
```
|
||||
|
||||
**CS 改动:**
|
||||
- `CreateMetric` 方法:使用圆角卡片,Material 3 风格标签
|
||||
- `BuildHourlyItems` 方法:改进卡片样式,统一圆角
|
||||
- `BuildDailyItems` 方法:改进卡片样式,统一圆角
|
||||
|
||||
---
|
||||
|
||||
### Task 4: 重构 HourlyWeatherWidget(逐小时天气组件)
|
||||
|
||||
**文件:**
|
||||
- `LanMountainDesktop/Views/Components/HourlyWeatherWidget.axaml`
|
||||
- `LanMountainDesktop/Views/Components/HourlyWeatherWidget.axaml.cs`
|
||||
|
||||
**设计目标:**
|
||||
- 顶部简洁信息栏
|
||||
- 逐小时预报使用 Material 卡片风格
|
||||
- 时间、图标、温度垂直排列
|
||||
|
||||
**XAML 改动:**
|
||||
```xml
|
||||
<Border x:Name="RootBorder"
|
||||
CornerRadius="{DynamicResource DesignCornerRadiusComponent}"
|
||||
ClipToBounds="True">
|
||||
<Grid>
|
||||
<components:MaterialWeatherSceneControl x:Name="Scene" />
|
||||
<Border x:Name="OverlayBorder" />
|
||||
|
||||
<Grid x:Name="ContentGrid"
|
||||
RowDefinitions="Auto,*"
|
||||
Margin="18,14"
|
||||
RowSpacing="12">
|
||||
|
||||
<!-- 顶部信息栏 -->
|
||||
<Grid ColumnDefinitions="Auto,*,Auto,Auto" VerticalAlignment="Center">
|
||||
<TextBlock x:Name="TemperatureTextBlock"
|
||||
Text="--°"
|
||||
FontSize="42"
|
||||
FontWeight="Bold"
|
||||
VerticalAlignment="Center" />
|
||||
<StackPanel Grid.Column="1" Margin="12,0,0,0" VerticalAlignment="Center">
|
||||
<TextBlock x:Name="ConditionTextBlock"
|
||||
Text="Loading"
|
||||
FontSize="15"
|
||||
FontWeight="SemiBold"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock x:Name="LocationTextBlock"
|
||||
Text="Weather"
|
||||
FontSize="12"
|
||||
FontWeight="Medium"
|
||||
Opacity="0.72"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
</StackPanel>
|
||||
<TextBlock x:Name="RangeTextBlock"
|
||||
Grid.Column="2"
|
||||
Text="-- / --"
|
||||
FontSize="12"
|
||||
FontWeight="Medium"
|
||||
VerticalAlignment="Center"
|
||||
Opacity="0.72"
|
||||
Margin="0,0,10,0" />
|
||||
<components:WeatherIconView x:Name="MainIcon"
|
||||
Grid.Column="3"
|
||||
Width="48"
|
||||
Height="48" />
|
||||
</Grid>
|
||||
|
||||
<!-- 逐小时预报卡片容器 -->
|
||||
<Border Grid.Row="1"
|
||||
Background="{DynamicResource SurfaceColor}"
|
||||
CornerRadius="{DynamicResource DesignCornerRadiusMd}"
|
||||
Padding="8,6">
|
||||
<UniformGrid x:Name="HourlyGrid" Rows="1" Columns="6" />
|
||||
</Border>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 5: 重构 MultiDayWeatherWidget(多日天气组件)
|
||||
|
||||
**文件:**
|
||||
- `LanMountainDesktop/Views/Components/MultiDayWeatherWidget.axaml`
|
||||
- `LanMountainDesktop/Views/Components/MultiDayWeatherWidget.axaml.cs`
|
||||
|
||||
**设计目标:**
|
||||
- 左侧:当前天气信息(图标+温度+状况+位置)
|
||||
- 右侧:多日预报列表,使用行式布局
|
||||
|
||||
**XAML 改动:**
|
||||
```xml
|
||||
<Border x:Name="RootBorder"
|
||||
CornerRadius="{DynamicResource DesignCornerRadiusComponent}"
|
||||
ClipToBounds="True">
|
||||
<Grid>
|
||||
<components:MaterialWeatherSceneControl x:Name="Scene" />
|
||||
<Border x:Name="OverlayBorder" />
|
||||
|
||||
<Grid x:Name="ContentGrid"
|
||||
ColumnDefinitions="1.2*,1.6*"
|
||||
Margin="18,14"
|
||||
ColumnSpacing="14">
|
||||
|
||||
<!-- 左侧当前天气 -->
|
||||
<StackPanel VerticalAlignment="Center" Spacing="6">
|
||||
<components:WeatherIconView x:Name="MainIcon"
|
||||
Width="64"
|
||||
Height="64"
|
||||
HorizontalAlignment="Left" />
|
||||
<TextBlock x:Name="TemperatureTextBlock"
|
||||
Text="--°"
|
||||
FontSize="42"
|
||||
FontWeight="Bold" />
|
||||
<TextBlock x:Name="ConditionTextBlock"
|
||||
Text="Loading"
|
||||
FontSize="15"
|
||||
FontWeight="SemiBold"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock x:Name="LocationTextBlock"
|
||||
Text="Weather"
|
||||
FontSize="12"
|
||||
FontWeight="Medium"
|
||||
Opacity="0.72"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- 右侧多日预报 -->
|
||||
<Border Grid.Column="1"
|
||||
Background="{DynamicResource SurfaceColor}"
|
||||
CornerRadius="{DynamicResource DesignCornerRadiusMd}"
|
||||
Padding="10,8">
|
||||
<ItemsControl x:Name="DailyItemsControl" />
|
||||
</Border>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 6: 重构 WeatherClockWidget(天气时钟组件)
|
||||
|
||||
**文件:**
|
||||
- `LanMountainDesktop/Views/Components/WeatherClockWidget.axaml`
|
||||
- `LanMountainDesktop/Views/Components/WeatherClockWidget.axaml.cs`
|
||||
|
||||
**设计目标:**
|
||||
- 左侧:大字体时间+日期
|
||||
- 右侧:天气图标+温度+状况
|
||||
- 信息层级清晰
|
||||
|
||||
**XAML 改动:**
|
||||
```xml
|
||||
<Border x:Name="RootBorder"
|
||||
CornerRadius="{DynamicResource DesignCornerRadiusComponent}"
|
||||
ClipToBounds="True">
|
||||
<Grid>
|
||||
<components:MaterialWeatherSceneControl x:Name="Scene" />
|
||||
<Border x:Name="OverlayBorder" />
|
||||
|
||||
<Grid x:Name="ContentGrid"
|
||||
ColumnDefinitions="*,Auto"
|
||||
Margin="18,12"
|
||||
ColumnSpacing="12">
|
||||
|
||||
<!-- 左侧时间 -->
|
||||
<StackPanel VerticalAlignment="Center" Spacing="2">
|
||||
<TextBlock x:Name="TimeTextBlock"
|
||||
Text="--:--"
|
||||
FontSize="38"
|
||||
FontWeight="Bold"
|
||||
LineHeight="38" />
|
||||
<TextBlock x:Name="DateTextBlock"
|
||||
Text="Weather"
|
||||
FontSize="12"
|
||||
FontWeight="Medium"
|
||||
Opacity="0.72"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- 右侧天气 -->
|
||||
<StackPanel Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"
|
||||
Spacing="1">
|
||||
<components:WeatherIconView x:Name="MainIcon"
|
||||
Width="44"
|
||||
Height="44"
|
||||
HorizontalAlignment="Right" />
|
||||
<TextBlock x:Name="TemperatureTextBlock"
|
||||
Text="--°"
|
||||
FontSize="20"
|
||||
FontWeight="SemiBold"
|
||||
HorizontalAlignment="Right" />
|
||||
<TextBlock x:Name="ConditionTextBlock"
|
||||
Text="Loading"
|
||||
FontSize="11"
|
||||
FontWeight="Medium"
|
||||
HorizontalAlignment="Right"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
MaxWidth="100"
|
||||
Opacity="0.82" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 7: 更新 ExtendedWeatherWidget 的代码后置文件
|
||||
|
||||
**文件:** `LanMountainDesktop/Views/Components/ExtendedWeatherWidget.axaml.cs`
|
||||
|
||||
**改动:**
|
||||
- `CreateMetric` 方法改进:
|
||||
- 使用 `DesignCornerRadiusSm` 圆角
|
||||
- 使用新的 `SurfaceColor` 作为卡片背景
|
||||
- 优化字体大小和间距
|
||||
|
||||
- `BuildHourlyItems` 方法改进:
|
||||
- 使用 `DesignCornerRadiusSm` 圆角
|
||||
- 使用 `SurfaceColor` 作为卡片背景
|
||||
- 时间、图标、温度垂直排列,居中对齐
|
||||
|
||||
- `BuildDailyItems` 方法改进:
|
||||
- 使用 `DesignCornerRadiusSm` 圆角
|
||||
- 使用 `SurfaceColor` 作为卡片背景
|
||||
- 日期、图标、高低温垂直排列
|
||||
|
||||
---
|
||||
|
||||
### Task 8: 更新 HourlyWeatherWidget 的代码后置文件
|
||||
|
||||
**文件:** `LanMountainDesktop/Views/Components/HourlyWeatherWidget.axaml.cs`
|
||||
|
||||
**改动:**
|
||||
- `CreateChip` 方法改进:
|
||||
- 使用 `DesignCornerRadiusSm` 圆角
|
||||
- 使用 `SurfaceColor` 作为卡片背景
|
||||
- 优化垂直排列的间距
|
||||
|
||||
---
|
||||
|
||||
### Task 9: 更新 MultiDayWeatherWidget 的代码后置文件
|
||||
|
||||
**文件:** `LanMountainDesktop/Views/Components/MultiDayWeatherWidget.axaml.cs`
|
||||
|
||||
**改动:**
|
||||
- `CreateRow` 方法改进:
|
||||
- 添加底部分割线(除最后一行)
|
||||
- 优化列间距和对齐
|
||||
- 高低温使用不同透明度区分
|
||||
|
||||
---
|
||||
|
||||
### Task 10: 更新 MaterialWeatherVisualTheme 调色板
|
||||
|
||||
**文件:** `LanMountainDesktop/Views/Components/MaterialWeatherVisualTheme.cs`
|
||||
|
||||
**改动:**
|
||||
- 为 `MaterialWeatherPalette` 添加新字段:
|
||||
- `SurfaceColor` - 用于卡片表面
|
||||
- `SurfaceVariantColor` - 用于变体表面
|
||||
- `OutlineColor` - 用于分割线
|
||||
|
||||
- 更新所有调色板生成方法:
|
||||
- `ResolveGooglePalette`
|
||||
- `ResolveGeometricPalette`
|
||||
- `ResolveBreezyPalette`
|
||||
- `ResolveLemonPalette`
|
||||
|
||||
- 每个调色板需要为白天/夜晚模式提供合适的 SurfaceColor:
|
||||
- 白天:低透明度白色(如 `#14FFFFFF`)
|
||||
- 夜晚:低透明度黑色(如 `#1A000000`)
|
||||
|
||||
---
|
||||
|
||||
### Task 11: 构建和测试
|
||||
|
||||
**命令:**
|
||||
```bash
|
||||
dotnet build LanMountainDesktop.slnx -c Debug
|
||||
dotnet test LanMountainDesktop.slnx -c Debug
|
||||
```
|
||||
|
||||
**验证清单:**
|
||||
- [ ] 所有天气组件正常编译
|
||||
- [ ] 运行时无异常
|
||||
- [ ] 4套视觉风格正常切换
|
||||
- [ ] 响应式布局正常工作
|
||||
- [ ] 圆角资源正确应用
|
||||
|
||||
---
|
||||
|
||||
## 文件改动汇总
|
||||
|
||||
| 文件 | 改动类型 | 说明 |
|
||||
|------|---------|------|
|
||||
| `MaterialWeatherVisualTheme.cs` | 修改 | 添加 SurfaceColor 等字段,更新所有调色板 |
|
||||
| `WeatherWidget.axaml` | 修改 | 重构布局,优化排版 |
|
||||
| `WeatherWidget.axaml.cs` | 修改 | 调整响应式布局和颜色绑定 |
|
||||
| `ExtendedWeatherWidget.axaml` | 修改 | 重构布局,添加卡片容器 |
|
||||
| `ExtendedWeatherWidget.axaml.cs` | 修改 | 改进卡片创建方法 |
|
||||
| `HourlyWeatherWidget.axaml` | 修改 | 重构布局,添加卡片容器 |
|
||||
| `HourlyWeatherWidget.axaml.cs` | 修改 | 改进卡片创建方法 |
|
||||
| `MultiDayWeatherWidget.axaml` | 修改 | 重构布局,添加卡片容器 |
|
||||
| `MultiDayWeatherWidget.axaml.cs` | 修改 | 改进行创建方法 |
|
||||
| `WeatherClockWidget.axaml` | 修改 | 重构布局,优化排版 |
|
||||
| `WeatherClockWidget.axaml.cs` | 修改 | 调整响应式布局 |
|
||||
|
||||
---
|
||||
|
||||
## 设计规范检查清单
|
||||
|
||||
- [ ] 所有组件根容器使用 `DesignCornerRadiusComponent`
|
||||
- [ ] 内部卡片使用 `DesignCornerRadiusMd` 或 `DesignCornerRadiusSm`
|
||||
- [ ] 不使用硬编码圆角值
|
||||
- [ ] 文字对比度符合 VISUAL_SPEC 要求
|
||||
- [ ] 间距使用一致的倍数(4px 基线)
|
||||
- [ ] 字体层级:温度(64-72px) > 状况(16-18px) > 位置/范围(12-13px)
|
||||
342
.trae/documents/weather-widget-visual-redesign.md
Normal file
342
.trae/documents/weather-widget-visual-redesign.md
Normal file
@@ -0,0 +1,342 @@
|
||||
# 天气组件视觉重构 Implementation Plan
|
||||
|
||||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||
|
||||
**Goal:** 彻底重构阑山桌面天气系列组件的背景视觉和文字排版,为每种图标风格(Google Weather / Geometric / Breezy / Lemon)提供独立的背景配色和视觉质感,参考各天气 App 的 Material Design 风格,实现几何质感+柔和渐变+层次分明的排版。
|
||||
|
||||
**Architecture:** 保留现有数据层(WeatherWidgetBase、WeatherSnapshot、WeatherIconAssetResolver)和组件注册机制不变。核心改动:1) 将 `MaterialWeatherVisualTheme.ResolvePalette()` 扩展为按 styleId 分派不同配色方案;2) 重构 `MaterialWeatherSceneControl` 为按 styleId 渲染不同背景风格;3) 改进各天气 Widget 的文字排版层次。先创建 HTML Mock 验证视觉效果。
|
||||
|
||||
**Tech Stack:** Avalonia UI (XAML + C# code-behind)、HTML/CSS (Mock 预览)
|
||||
|
||||
---
|
||||
|
||||
## 当前状态分析
|
||||
|
||||
### 现有天气组件体系
|
||||
5 个天气组件,全部继承自 `WeatherWidgetBase`:
|
||||
|
||||
| 组件 | 文件 | 功能 |
|
||||
|------|------|------|
|
||||
| WeatherWidget | `WeatherWidget.axaml(.cs)` | 基础天气:温度+状况+图标+位置 |
|
||||
| WeatherClockWidget | `WeatherClockWidget.axaml(.cs)` | 天气+时钟 |
|
||||
| ExtendedWeatherWidget | `ExtendedWeatherWidget.axaml(.cs)` | 扩展天气:含指标/小时/多日预报 |
|
||||
| HourlyWeatherWidget | `HourlyWeatherWidget.axaml(.cs)` | 逐小时天气 |
|
||||
| MultiDayWeatherWidget | `MultiDayWeatherWidget.axaml(.cs)` | 多日天气 |
|
||||
|
||||
### 核心问题
|
||||
|
||||
1. **背景与图标风格脱钩**: `MaterialWeatherVisualTheme.ResolvePalette()` 只返回一套配色,与 `WeatherVisualStyleId`(GoogleWeatherV4/Geometric/Breezy/LemonFlutter)完全无关。切换图标风格时背景不变。
|
||||
2. **背景视觉单调**: `MaterialWeatherSceneControl` 只有一种手绘几何风格(椭圆+云+雨滴),质感差,缺乏各 App 的特色。
|
||||
3. **文字排版粗糙**: 温度数字不够大,信息层次不分明,指标用纯文字堆叠,预报区域无卡片样式。
|
||||
4. **半透明遮罩硬编码**: 所有组件都覆盖 `<Border Background="#30FFFFFF" />` 等硬编码遮罩,不随风格变化。
|
||||
|
||||
### 各天气 App 风格特征
|
||||
|
||||
**Google Weather (v4)**:
|
||||
- 背景:大面积柔和蓝白渐变,晴天偏暖黄蓝,雨天偏深蓝灰
|
||||
- 装饰:极简,几乎无几何装饰,纯靠渐变色彩表现天气氛围
|
||||
- 排版:温度超大(72px+),天气状况中等,位置小字
|
||||
|
||||
**Geometric Weather (几何天气)**:
|
||||
- 背景:深色系渐变(深蓝/深紫/深灰),搭配半透明几何圆形装饰
|
||||
- 装饰:大面积半透明圆形叠加,营造深度感
|
||||
- 排版:紧凑信息密度,指标用小标签
|
||||
|
||||
**Breezy Weather (微风天气)**:
|
||||
- 背景:清新渐变(浅蓝/浅绿/浅紫),比 Geometric 更明亮
|
||||
- 装饰:柔和波浪线条 + 少量几何装饰,Material Design 风格
|
||||
- 排版:卡片式预报,圆角芯片
|
||||
|
||||
**Lemon Weather (柠檬天气)**:
|
||||
- 背景:暖色系渐变(橙黄/粉紫/暖蓝),柠檬2偏扁平,柠檬3偏Material
|
||||
- 装饰:天气场景装饰(太阳光芒/云朵轮廓/雨丝),更有场景感
|
||||
- 排版:温度超大,天气图标突出
|
||||
|
||||
---
|
||||
|
||||
## 设计方案
|
||||
|
||||
### 视觉论文 (Visual Thesis)
|
||||
每种图标风格拥有独特的背景渐变配色和几何装饰语言——Google 纯净渐变、Geometric 深色几何、Breezy 清新波浪、Lemon 暖色场景——配合超大温度数字和层次分明的排版,在桌面小组件空间内实现 Material Design 的几何质感。
|
||||
|
||||
### 配色方案设计
|
||||
|
||||
每种风格 × 每种天气条件 × 昼夜 = 独立配色。以下为关键配色定义:
|
||||
|
||||
#### Google Weather 风格
|
||||
| 天气 | 白天 Top→Bottom | 夜晚 Top→Bottom |
|
||||
|------|----------------|----------------|
|
||||
| Clear | #4FC3F7 → #B3E5FC | #0D47A1 → #1A237E |
|
||||
| PartlyCloudy | #81D4FA → #E1F5FE | #1565C0 → #283593 |
|
||||
| Cloudy | #90A4AE → #CFD8DC | #37474F → #455A64 |
|
||||
| Rain | #78909C → #B0BEC5 | #263238 → #37474F |
|
||||
| Storm | #546E7A → #78909C | #1A1A2E → #263238 |
|
||||
| Snow | #E1F5FE → #FFFFFF | #1A237E → #283593 |
|
||||
| Fog/Haze | #B0BEC5 → #ECEFF1 | #455A64 → #546E7A |
|
||||
|
||||
#### Geometric 风格
|
||||
| 天气 | 白天 Top→Bottom | 夜晚 Top→Bottom |
|
||||
|------|----------------|----------------|
|
||||
| Clear | #1A237E → #3949AB | #0A0E27 → #1A1A3E |
|
||||
| PartlyCloudy | #283593 → #5C6BC0 | #0D1033 → #1E1E4A |
|
||||
| Cloudy | #37474F → #607D8B | #1A1A2E → #2D2D44 |
|
||||
| Rain | #1A237E → #3F51B5 | #0A0E27 → #1A1A3E |
|
||||
| Storm | #1A1A2E → #3F51B5 | #050510 → #1A1A2E |
|
||||
| Snow | #E8EAF6 → #C5CAE9 | #1A237E → #283593 |
|
||||
| Fog/Haze | #455A64 → #78909C | #1A1A2E → #37474F |
|
||||
|
||||
#### Breezy 风格
|
||||
| 天气 | 白天 Top→Bottom | 夜晚 Top→Bottom |
|
||||
|------|----------------|----------------|
|
||||
| Clear | #4DD0E1 → #80DEEA | #006064 → #00838F |
|
||||
| PartlyCloudy | #4FC3F7 → #B2EBF2 | #00695C → #00897B |
|
||||
| Cloudy | #80CBC4 → #B2DFDB | #37474F → #546E7A |
|
||||
| Rain | #4DB6AC → #80CBC4 | #004D40 → #00695C |
|
||||
| Storm | #26A69A → #4DB6AC | #1A1A2E → #004D40 |
|
||||
| Snow | #E0F7FA → #FFFFFF | #006064 → #00838F |
|
||||
| Fog/Haze | #80CBC4 → #E0F7FA | #37474F → #546E7A |
|
||||
|
||||
#### Lemon 风格
|
||||
| 天气 | 白天 Top→Bottom | 夜晚 Top→Bottom |
|
||||
|------|----------------|----------------|
|
||||
| Clear | #FFB74D → #FFF176 | #1A237E → #311B92 |
|
||||
| PartlyCloudy | #FF8A65 → #FFCC80 | #283593 → #4A148C |
|
||||
| Cloudy | #BCAAA4 → #D7CCC8 | #37474F → #4E342E |
|
||||
| Rain | #90A4AE → #B0BEC5 | #1A1A2E → #311B92 |
|
||||
| Storm | #78909C → #90A4AE | #0D0D1A → #1A1A2E |
|
||||
| Snow | #FFF9C4 → #FFFFFF | #1A237E → #311B92 |
|
||||
| Fog/Haze | #D7CCC8 → #EFEBE9 | #4E342E → #5D4037 |
|
||||
|
||||
### 排版改进方案
|
||||
|
||||
1. **温度超大化**: 温度字号从 56-58px 提升到 64-72px(基础组件),形成视觉锚点
|
||||
2. **层次分明**: 温度 → 天气状况 → 位置/指标,字号递减,透明度递减
|
||||
3. **指标标签化**: 湿度/风速/AQI 用半透明圆角标签展示,而非纯文字
|
||||
4. **预报芯片化**: 小时/每日预报用圆角半透明芯片卡片
|
||||
5. **图标间距**: 天气图标与文字之间增加 8-12px 间距
|
||||
|
||||
---
|
||||
|
||||
## 文件变更清单
|
||||
|
||||
| 文件 | 操作 | 说明 |
|
||||
|------|------|------|
|
||||
| `Views/Components/MaterialWeatherVisualTheme.cs` | 修改 | 扩展 ResolvePalette 支持 styleId 分派,新增4套风格配色 |
|
||||
| `Views/Components/MaterialWeatherSceneControl.cs` | 修改 | 按 styleId 渲染不同背景风格(纯渐变/深色几何/清新波浪/暖色场景) |
|
||||
| `Views/Components/WeatherWidgetBase.cs` | 修改 | 传递 styleId 到 SceneControl.Apply(),移除硬编码遮罩 |
|
||||
| `Views/Components/WeatherWidget.axaml` | 修改 | 改进排版层次,移除硬编码遮罩 |
|
||||
| `Views/Components/WeatherWidget.axaml.cs` | 修改 | 适配新排版 |
|
||||
| `Views/Components/WeatherClockWidget.axaml` | 修改 | 改进排版,移除硬编码遮罩 |
|
||||
| `Views/Components/WeatherClockWidget.axaml.cs` | 修改 | 适配新排版 |
|
||||
| `Views/Components/ExtendedWeatherWidget.axaml` | 修改 | 改进排版,指标标签化,预报芯片化 |
|
||||
| `Views/Components/ExtendedWeatherWidget.axaml.cs` | 修改 | 适配新排版+标签+芯片 |
|
||||
| `Views/Components/HourlyWeatherWidget.axaml` | 修改 | 改进排版,预报芯片化 |
|
||||
| `Views/Components/HourlyWeatherWidget.axaml.cs` | 修改 | 适配新排版+芯片 |
|
||||
| `Views/Components/MultiDayWeatherWidget.axaml` | 修改 | 改进排版 |
|
||||
| `Views/Components/MultiDayWeatherWidget.axaml.cs` | 修改 | 适配新排版 |
|
||||
| `mocks/weather-widget-mock.html` | 新建 | HTML Mock 预览(4种风格×2种天气×2种主题) |
|
||||
|
||||
---
|
||||
|
||||
## Task 分解
|
||||
|
||||
### Task 1: 创建 HTML Mock 预览
|
||||
|
||||
**Files:**
|
||||
- Create: `mocks/weather-widget-mock.html`
|
||||
|
||||
- [ ] **Step 1: 创建 HTML Mock 文件**
|
||||
|
||||
创建完整的 HTML Mock,包含:
|
||||
- 4 种风格(Google / Geometric / Breezy / Lemon)× 2 种天气(晴/雨)× 2 种主题(亮/暗)
|
||||
- 每种风格展示基础天气组件(温度+状况+图标+位置)
|
||||
- 改进后的排版:超大温度、层次分明、指标标签化
|
||||
- 亮色/暗色主题切换按钮
|
||||
|
||||
- [ ] **Step 2: 在浏览器中打开 Mock 验证效果**
|
||||
|
||||
Run: `start mocks/weather-widget-mock.html`
|
||||
|
||||
---
|
||||
|
||||
### Task 2: 扩展 MaterialWeatherVisualTheme 支持多风格配色
|
||||
|
||||
**Files:**
|
||||
- Modify: `LanMountainDesktop/Views/Components/MaterialWeatherVisualTheme.cs`
|
||||
|
||||
- [ ] **Step 1: 修改 ResolvePalette 方法签名**
|
||||
|
||||
将 `ResolvePalette(MaterialWeatherCondition condition, bool isNight)` 改为 `ResolvePalette(string? styleId, MaterialWeatherCondition condition, bool isNight)`,内部按 styleId 分派到不同配色方案。
|
||||
|
||||
- [ ] **Step 2: 新增 Google Weather 配色表**
|
||||
|
||||
为 GoogleWeatherV4 风格定义所有天气条件×昼夜的配色(参考上面配色方案设计章节)。
|
||||
|
||||
- [ ] **Step 3: 新增 Geometric 配色表**
|
||||
|
||||
为 Geometric 风格定义深色系配色。
|
||||
|
||||
- [ ] **Step 4: 新增 Breezy 配色表**
|
||||
|
||||
为 Breezy 风格定义清新渐变配色。
|
||||
|
||||
- [ ] **Step 5: 新增 Lemon 配色表**
|
||||
|
||||
为 LemonFlutter 风格定义暖色系配色。
|
||||
|
||||
- [ ] **Step 6: 更新所有调用点**
|
||||
|
||||
将所有 `ResolvePalette(condition, isNight)` 调用改为 `ResolvePalette(styleId, condition, isNight)`。
|
||||
|
||||
---
|
||||
|
||||
### Task 3: 重构 MaterialWeatherSceneControl 支持多风格背景
|
||||
|
||||
**Files:**
|
||||
- Modify: `LanMountainDesktop/Views/Components/MaterialWeatherSceneControl.cs`
|
||||
|
||||
- [ ] **Step 1: 扩展 Apply 方法签名**
|
||||
|
||||
将 `Apply(MaterialWeatherCondition condition, MaterialWeatherPalette palette, bool isLive)` 改为 `Apply(string? styleId, MaterialWeatherCondition condition, MaterialWeatherPalette palette, bool isLive)`,存储 styleId。
|
||||
|
||||
- [ ] **Step 2: 实现 Google Weather 风格渲染**
|
||||
|
||||
纯渐变背景,无几何装饰。背景使用 palette 的 BackgroundTop→BackgroundBottom 渐变。仅保留天气特效(雨滴/雪花/雾线)。
|
||||
|
||||
- [ ] **Step 3: 实现 Geometric 风格渲染**
|
||||
|
||||
深色渐变 + 大面积半透明几何圆形叠加。在基础渐变上叠加 2-3 个大椭圆(使用 palette 的 PrimaryShape/SecondaryShape/AccentShape),营造深度感。保留天气特效。
|
||||
|
||||
- [ ] **Step 4: 实现 Breezy 风格渲染**
|
||||
|
||||
清新渐变 + 柔和波浪线条。在基础渐变上绘制 2-3 条正弦波浪线(使用 palette 的 SurfaceTint),营造微风感。保留天气特效。
|
||||
|
||||
- [ ] **Step 5: 实现 Lemon 风格渲染**
|
||||
|
||||
暖色渐变 + 天气场景装饰。晴天绘制太阳光芒(放射线),多云绘制云朵轮廓,雨天绘制雨丝。保留天气特效。
|
||||
|
||||
- [ ] **Step 6: 更新所有调用点**
|
||||
|
||||
将所有 `SceneControl.Apply(condition, palette, isLive)` 改为 `SceneControl.Apply(styleId, condition, palette, isLive)`。
|
||||
|
||||
---
|
||||
|
||||
### Task 4: 更新 WeatherWidgetBase 传递 styleId
|
||||
|
||||
**Files:**
|
||||
- Modify: `LanMountainDesktop/Views/Components/WeatherWidgetBase.cs`
|
||||
|
||||
- [ ] **Step 1: 修改 ApplyCurrentScene 方法**
|
||||
|
||||
在 `ApplyCurrentScene()` 中将 `CurrentVisualStyleId` 传递给 `SceneControl.Apply()`。
|
||||
|
||||
- [ ] **Step 2: 修改 ApplySnapshot 中的 ResolvePalette 调用**
|
||||
|
||||
将 `MaterialWeatherVisualTheme.ResolvePalette(CurrentCondition, isNight)` 改为 `MaterialWeatherVisualTheme.ResolvePalette(CurrentVisualStyleId, CurrentCondition, isNight)`。
|
||||
|
||||
---
|
||||
|
||||
### Task 5: 改进各天气 Widget 的 XAML 排版
|
||||
|
||||
**Files:**
|
||||
- Modify: `WeatherWidget.axaml` — 移除硬编码遮罩 `<Border Background="#30FFFFFF" />`,改用 palette 驱动的半透明遮罩
|
||||
- Modify: `WeatherClockWidget.axaml` — 同上
|
||||
- Modify: `ExtendedWeatherWidget.axaml` — 同上 + 指标区域改用标签样式
|
||||
- Modify: `HourlyWeatherWidget.axaml` — 同上 + 预报区域改用芯片样式
|
||||
- Modify: `MultiDayWeatherWidget.axaml` — 同上
|
||||
|
||||
- [ ] **Step 1: 移除所有硬编码遮罩**
|
||||
|
||||
将 `<Border Background="#30FFFFFF" />` / `#42FFFFFF` / `#34FFFFFF` / `#38FFFFFF` / `#3CFFFFFF` 替换为 `<Border x:Name="OverlayBorder" />`,在 code-behind 中根据 palette 设置遮罩颜色。
|
||||
|
||||
- [ ] **Step 2: 改进 WeatherWidget 排版**
|
||||
|
||||
增大温度字号(58→64),增加图标与文字间距,调整位置文字透明度。
|
||||
|
||||
- [ ] **Step 3: 改进 WeatherClockWidget 排版**
|
||||
|
||||
增大时钟字号,增加天气信息与时间间距。
|
||||
|
||||
- [ ] **Step 4: 改进 ExtendedWeatherWidget 排版**
|
||||
|
||||
指标用半透明圆角标签,小时/每日预报用圆角芯片卡片。
|
||||
|
||||
- [ ] **Step 5: 改进 HourlyWeatherWidget 排版**
|
||||
|
||||
预报区域用圆角芯片卡片样式。
|
||||
|
||||
- [ ] **Step 6: 改进 MultiDayWeatherWidget 排版**
|
||||
|
||||
每日预报行增加分隔线和更好的间距。
|
||||
|
||||
---
|
||||
|
||||
### Task 6: 更新各天气 Widget 的 code-behind
|
||||
|
||||
**Files:**
|
||||
- Modify: 所有天气 Widget 的 `.axaml.cs` 文件
|
||||
|
||||
- [ ] **Step 1: 更新 WeatherWidget.axaml.cs**
|
||||
|
||||
- 设置 OverlayBorder 背景
|
||||
- 增大温度字号
|
||||
- 适配新排版参数
|
||||
|
||||
- [ ] **Step 2: 更新 WeatherClockWidget.axaml.cs**
|
||||
|
||||
- 设置 OverlayBorder 背景
|
||||
- 适配新排版
|
||||
|
||||
- [ ] **Step 3: 更新 ExtendedWeatherWidget.axaml.cs**
|
||||
|
||||
- 设置 OverlayBorder 背景
|
||||
- 指标标签化(CreateMetric 改为带圆角背景的标签)
|
||||
- 预报芯片化
|
||||
|
||||
- [ ] **Step 4: 更新 HourlyWeatherWidget.axaml.cs**
|
||||
|
||||
- 设置 OverlayBorder 背景
|
||||
- 预报芯片化(CreateChip 改为带圆角背景的芯片)
|
||||
|
||||
- [ ] **Step 5: 更新 MultiDayWeatherWidget.axaml.cs**
|
||||
|
||||
- 设置 OverlayBorder 背景
|
||||
- 适配新排版
|
||||
|
||||
---
|
||||
|
||||
### Task 7: 验证与测试
|
||||
|
||||
- [ ] **Step 1: 运行项目查看效果**
|
||||
|
||||
Run: `dotnet run --project LanMountainDesktop/LanMountainDesktop.csproj`
|
||||
|
||||
- [ ] **Step 2: 运行相关测试**
|
||||
|
||||
Run: `dotnet test LanMountainDesktop.slnx -c Debug`
|
||||
|
||||
- [ ] **Step 3: 检查圆角规范合规**
|
||||
|
||||
确认所有组件 RootBorder 使用 `DesignCornerRadiusComponent`,新增的标签/芯片使用 `DesignCornerRadiusSm`/`DesignCornerRadiusMd`。
|
||||
|
||||
---
|
||||
|
||||
## 假设与决策
|
||||
|
||||
1. **4 套独立风格**: 每种图标风格对应独立的背景配色和装饰风格,切换图标风格时背景也跟着变
|
||||
2. **配色表驱动**: 所有颜色定义在 `MaterialWeatherVisualTheme` 中,不硬编码到 SceneControl
|
||||
3. **保留天气特效**: 雨滴/雪花/雾线/闪电等天气特效在所有风格中保留,但颜色跟随 palette
|
||||
4. **遮罩动态化**: 半透明遮罩颜色从 palette 中派生,而非硬编码 `#30FFFFFF`
|
||||
5. **排版渐进改进**: 不做大规模 XAML 重构,而是在现有结构上优化字号/间距/透明度
|
||||
6. **数据层不变**: WeatherSnapshot、WeatherIconAssetResolver、WeatherWidgetBase 的数据逻辑不变
|
||||
7. **接口兼容**: IDesktopComponentWidget 等接口实现不变
|
||||
|
||||
## 验证步骤
|
||||
|
||||
1. HTML Mock 在浏览器中展示 4 种风格效果满意
|
||||
2. Avalonia 项目编译通过
|
||||
3. 运行项目,切换图标风格时背景配色和装饰风格跟着变化
|
||||
4. 亮色/暗色主题切换正常
|
||||
5. 5 个天气组件排版层次分明
|
||||
6. 指标标签化和预报芯片化正常显示
|
||||
7. 测试通过
|
||||
112
.trae/skills/refactoring-insight/SKILL.md
Normal file
112
.trae/skills/refactoring-insight/SKILL.md
Normal file
@@ -0,0 +1,112 @@
|
||||
---
|
||||
name: "refactoring-insight"
|
||||
description: "Analyzes codebase for refactoring opportunities: large files, code duplication, god classes, naming inconsistencies, tight coupling, and missing abstractions. Invoke when user asks for refactoring insight/analysis or wants to improve code architecture."
|
||||
---
|
||||
|
||||
# Refactoring Insight
|
||||
|
||||
Deep codebase analysis skill that identifies structural problems and produces prioritized refactoring recommendations.
|
||||
|
||||
## When to Invoke
|
||||
|
||||
- User asks for "refactoring insight", "refactoring analysis", "code quality analysis", "architecture review"
|
||||
- User wants to understand what should be refactored in the codebase
|
||||
- User asks "where are the code smells?" or "what needs refactoring?"
|
||||
|
||||
## Analysis Dimensions
|
||||
|
||||
Run all 6 dimensions in parallel where possible. For each dimension, use search agents to gather data, then synthesize findings.
|
||||
|
||||
### 1. Large Files / God Classes
|
||||
|
||||
- Find all .cs files over 300 lines, sorted by line count descending
|
||||
- Identify partial classes and sum their total line count across files
|
||||
- Flag classes with 15+ methods or constructors taking 8+ parameters
|
||||
- Focus on: Views/, ViewModels/, Services/, plugins/
|
||||
|
||||
**Output**: Table of files with line counts and responsibility summary.
|
||||
|
||||
### 2. Code Duplication
|
||||
|
||||
Search for these specific duplication patterns:
|
||||
|
||||
- **Service boilerplate**: Repeated DI registration, `new` instantiation instead of DI
|
||||
- **Data service pattern**: Services that fetch/parse/transform data similarly (Load → Map → Save)
|
||||
- **Localization pattern**: `private readonly LocalizationService _localizationService = new();` and `L()` helper method repetitions
|
||||
- **Helper method duplication**: Methods like `ResolveUnifiedMainRadiusValue`, `NormalizeConfig`, `ParticleState` classes copied across files
|
||||
- **Error handling pattern**: Identical try-catch blocks repeated in multiple methods
|
||||
- **Settings snapshot pattern**: `_settingsFacade.Settings.LoadSnapshot<T>(scope)` call sites
|
||||
|
||||
**Output**: List of duplicated patterns with file locations and line numbers.
|
||||
|
||||
### 3. Tight Coupling
|
||||
|
||||
- Services instantiated via `new` instead of DI injection
|
||||
- ViewModels directly accessing infrastructure-layer APIs (e.g., `LoadSnapshot/SaveSnapshot`)
|
||||
- Hard-coded dependencies (GitHub repo owner/name, default values)
|
||||
- `Application.Current` upcasting to access services: `(Application.Current as App)?.SomeService`
|
||||
- Platform-specific code embedded in cross-platform services without interface abstraction
|
||||
|
||||
**Output**: Table of coupling violations with severity (high/medium/low).
|
||||
|
||||
### 4. Naming Inconsistencies
|
||||
|
||||
- Service suffix inconsistency: `Service` vs `Store` vs `Helper` vs `Provider` vs `Manager` vs `Factory` for similar responsibilities
|
||||
- Model suffix inconsistency: `Snapshot` vs `State` vs `Types` for similar concepts
|
||||
- Platform prefix inconsistency: `Windows`/`Linux` full name vs `Mac` abbreviation
|
||||
- Confusing names: services with similar names but different responsibilities (e.g., `NotificationService` vs `NotificationListenerService`)
|
||||
|
||||
**Output**: Categorized list of naming inconsistencies.
|
||||
|
||||
### 5. Missing Abstractions
|
||||
|
||||
- Services without corresponding interfaces (check for `I<ServiceName>` pattern)
|
||||
- Common patterns that could be extracted into base classes:
|
||||
- `SettingsPageViewModelBase` for shared ViewModel boilerplate
|
||||
- `JsonFileSettingsService<TSnapshot>` for repeated settings persistence
|
||||
- `SettingsDomainServiceBase<TState>` for Load-Map-Save pattern
|
||||
- `DesktopComponentWidgetBase` for shared Widget code
|
||||
- `ComponentEditorViewBase` enhancements (e.g., `_suppressEvents` pattern)
|
||||
- Static singleton/Factory providers repeating thread-safe lazy-load boilerplate
|
||||
|
||||
**Output**: List of missing abstractions with proposed base class/interface names.
|
||||
|
||||
### 6. Misplaced Responsibilities
|
||||
|
||||
- Files in wrong directories (e.g., data access in Settings/, UI services mixed with data services)
|
||||
- ViewModels containing business logic or file system operations
|
||||
- Widget code-behind files with excessive logic (>200 lines)
|
||||
- Platform-specific services not organized into subdirectories
|
||||
|
||||
**Output**: List of misplaced files/classes with recommended new locations.
|
||||
|
||||
## Output Format
|
||||
|
||||
Produce a structured report with:
|
||||
|
||||
1. **Summary table**: Total metrics (file count, duplication count, etc.)
|
||||
2. **Priority-ranked findings**: P0 (must fix), P1 (should fix), P2 (recommended), P3 (nice to have)
|
||||
3. **Each finding includes**: Problem description, affected files with links, specific line numbers, recommended action, estimated impact
|
||||
|
||||
### Priority Criteria
|
||||
|
||||
- **P0**: Files over 1000 lines with mixed responsibilities; patterns duplicated 10+ times; god classes with 20+ dependencies
|
||||
- **P1**: Patterns duplicated 5-9 times; services without interfaces that are widely used; DI bypass affecting testability
|
||||
- **P2**: Patterns duplicated 3-4 times; naming inconsistencies affecting readability; misplaced files
|
||||
- **P3**: Minor naming variations; single-instance duplications; organizational improvements
|
||||
|
||||
## Project-Specific Context
|
||||
|
||||
This skill is aware of the LanMountainDesktop project structure:
|
||||
|
||||
- `LanMountainDesktop/Services/` — Business and infrastructure services
|
||||
- `LanMountainDesktop/Services/Settings/` — Settings subsystem
|
||||
- `LanMountainDesktop/ViewModels/` — View models
|
||||
- `LanMountainDesktop/Views/Components/` — Desktop widget components
|
||||
- `LanMountainDesktop/Views/ComponentEditors/` — Widget editor views
|
||||
- `LanMountainDesktop/plugins/` — Plugin runtime
|
||||
- `LanMountainDesktop.PluginSdk/` — Plugin SDK public API
|
||||
- `LanMountainDesktop.Shared.Contracts/` — Host/plugin shared contracts
|
||||
- `LanMountainDesktop.Appearance/` — Appearance and corner radius infrastructure
|
||||
|
||||
When analyzing, respect the project's architectural boundaries documented in `docs/ARCHITECTURE.md` and `docs/ECOSYSTEM_BOUNDARIES.md`.
|
||||
7
.trae/specs/air-app-whiteboard/checklist.md
Normal file
7
.trae/specs/air-app-whiteboard/checklist.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Checklist
|
||||
|
||||
- [x] Main app builds in Debug.
|
||||
- [x] AirAppHost builds in Debug.
|
||||
- [x] Tests project builds in Debug.
|
||||
- [x] `AirAppLauncherServiceTests` pass.
|
||||
- [ ] Manual UI verification on a running desktop session.
|
||||
26
.trae/specs/air-app-whiteboard/spec.md
Normal file
26
.trae/specs/air-app-whiteboard/spec.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# Air APP Whiteboard
|
||||
|
||||
## Goal
|
||||
|
||||
Allow the built-in whiteboard desktop components to open a full-screen Air APP that runs in `LanMountainDesktop.AirAppHost` and reuses the same persisted whiteboard note as the source component instance.
|
||||
|
||||
## Scope
|
||||
|
||||
- Add a toolbar surface-mode button to `WhiteboardWidget`.
|
||||
- In component mode, the button opens the `whiteboard` Air APP through `IAirAppLauncherService`.
|
||||
- In Air APP mode, the same button saves the current note and closes the Air APP window.
|
||||
- `DesktopWhiteboard` and `DesktopBlackboardLandscape` share the same mechanism and keep using their component id plus placement id as the note identity.
|
||||
- `LanMountainDesktop.AirAppHost` may reference the host assembly to reuse built-in UI controls, but the host app must not reference AirAppHost as a normal assembly dependency.
|
||||
|
||||
## Out of Scope
|
||||
|
||||
- Third-party Air APP SDK declarations.
|
||||
- Whiteboard feature rewrites or alternate whiteboard persistence.
|
||||
- Taskbar minimization behavior; v1 closes the Air APP window when the user exits from the bottom toolbar.
|
||||
|
||||
## Acceptance
|
||||
|
||||
- Building the main app also builds and copies `LanMountainDesktop.AirAppHost` output.
|
||||
- Clicking the whiteboard toolbar full-screen button launches a separate AirAppHost process.
|
||||
- Repeated opens of the same whiteboard component instance activate the existing process instead of spawning duplicates.
|
||||
- Closing and reopening the Air APP keeps the same whiteboard contents.
|
||||
8
.trae/specs/air-app-whiteboard/tasks.md
Normal file
8
.trae/specs/air-app-whiteboard/tasks.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# Tasks
|
||||
|
||||
- [x] Add `whiteboard` launch support to `AirAppLauncherService`.
|
||||
- [x] Add whiteboard single-instance keys based on component id and placement id.
|
||||
- [x] Add component/Air APP surface modes to `WhiteboardWidget`.
|
||||
- [x] Render `WhiteboardWidget` full screen from `LanMountainDesktop.AirAppHost`.
|
||||
- [x] Keep AirAppHost build/copy output available from the main app build.
|
||||
- [x] Add launcher argument and instance-key tests.
|
||||
8
.trae/specs/air-app-window-chrome/checklist.md
Normal file
8
.trae/specs/air-app-window-chrome/checklist.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# Checklist
|
||||
|
||||
- [x] Descriptor supports Standard, Borderless, FullScreen, Tool, and BackgroundOnly modes.
|
||||
- [x] World Clock Air APP uses FluentAvalonia standard title-bar chrome.
|
||||
- [x] Whiteboard Air APP opens as a fullscreen titlebar-less window.
|
||||
- [x] Air APP windows do not use fused desktop bottom-most services.
|
||||
- [x] Air APP windows do not use `Topmost=true` promotion.
|
||||
- [ ] Manual verification for each chrome mode once non-built-in Air APP declarations are added.
|
||||
22
.trae/specs/air-app-window-chrome/spec.md
Normal file
22
.trae/specs/air-app-window-chrome/spec.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# Air APP Window Chrome
|
||||
|
||||
## Goal
|
||||
|
||||
Give Air APPs explicit window chrome modes so title bars, fullscreen windows, borderless windows, tool windows, and future background-only apps are configured by the Air APP host instead of ad hoc component code.
|
||||
|
||||
## Behavior
|
||||
|
||||
- Air APP host resolves an `AirAppWindowDescriptor` from launch options before creating content.
|
||||
- Supported chrome modes are `Standard`, `Borderless`, `FullScreen`, `Tool`, and `BackgroundOnly`.
|
||||
- `Standard` uses FluentAvalonia `FAAppWindow` title-bar chrome and normal app-window behavior.
|
||||
- `Borderless` removes title-bar chrome while keeping a normal app window surface.
|
||||
- `FullScreen` removes title-bar chrome and enters fullscreen.
|
||||
- `Tool` keeps FluentAvalonia title-bar chrome but disables resizing and hides the taskbar entry.
|
||||
- `BackgroundOnly` is reserved for a later background Air APP lifecycle and is not used by built-in v1 apps.
|
||||
- Built-in `world-clock` uses `Standard`; built-in `whiteboard` uses `FullScreen`.
|
||||
|
||||
## Out of Scope
|
||||
|
||||
- Third-party plugin Air APP declarations.
|
||||
- Replacing Launcher lifecycle IPC.
|
||||
- Moving title-bar rendering into desktop components.
|
||||
8
.trae/specs/air-app-window-chrome/tasks.md
Normal file
8
.trae/specs/air-app-window-chrome/tasks.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# Tasks
|
||||
|
||||
- [x] Add `AirAppWindowChromeMode` and `AirAppWindowDescriptor`.
|
||||
- [x] Map built-in `world-clock` to `Standard` chrome.
|
||||
- [x] Map built-in `whiteboard` to `FullScreen` chrome.
|
||||
- [x] Apply descriptor settings from `AirAppWindow`.
|
||||
- [x] Add regression tests for supported modes and built-in mode mapping.
|
||||
- [x] Replace the hand-rolled Air APP title bar with FluentAvalonia `FAAppWindow` chrome.
|
||||
21
.trae/specs/avalonia-12-migration/checklist.md
Normal file
21
.trae/specs/avalonia-12-migration/checklist.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# Checklist
|
||||
|
||||
- [x] `Directory.Packages.props` contains the Avalonia 12 dependency baseline.
|
||||
- [x] Main host references `Avalonia.Controls.WebView`.
|
||||
- [x] Source no longer references `WebView.Avalonia`, `AvaloniaWebView`, or `.UseDesktopWebView()`.
|
||||
- [x] `BrowserWidget` uses `NativeWebView.Source`, `Navigate`, `Refresh()`, `NavigationStarted`, and `EnvironmentRequested`.
|
||||
- [x] WebView blanking navigates to `about:blank`.
|
||||
- [x] Plugin SDK package version is `5.0.0`.
|
||||
- [x] `PluginSdkInfo.ApiVersion` is `5.0.0`.
|
||||
- [x] Plugin template package version default is `5.0.0`.
|
||||
- [x] Plugin template manifest `apiVersion` is `5.0.0`.
|
||||
- [x] Launcher data location config resolution cannot recurse through `ResolveDataRoot()`.
|
||||
- [x] `OobeStateServiceTests` pass.
|
||||
- [x] `dotnet build LanMountainDesktop.slnx -c Debug` has 0 errors.
|
||||
- [x] `dotnet test LanMountainDesktop.slnx -c Debug` completes without a test host stack overflow.
|
||||
- [ ] Windows host smoke test completed.
|
||||
- [ ] Windows Launcher smoke test completed.
|
||||
- [ ] Settings window FluentAvalonia 3 smoke test completed.
|
||||
- [ ] Component editor Material smoke test completed.
|
||||
- [ ] BrowserWidget navigation/refresh/page activation smoke test completed.
|
||||
- [ ] WebView2 missing-runtime diagnostic smoke test completed.
|
||||
49
.trae/specs/avalonia-12-migration/spec.md
Normal file
49
.trae/specs/avalonia-12-migration/spec.md
Normal file
@@ -0,0 +1,49 @@
|
||||
# Avalonia 12 Full Stack Migration
|
||||
|
||||
## Summary
|
||||
|
||||
LanMountainDesktop has moved its desktop stack to the Avalonia 12 baseline. The migration covers the main host, Launcher, Plugin SDK, plugin runtime loading policy, official WebView usage, ClassIsland Markdown, FluentAvalonia, FluentIcons, and Material-related dependencies.
|
||||
|
||||
## Requirements
|
||||
|
||||
### Requirement: Centralized Avalonia 12 dependency baseline
|
||||
|
||||
The solution SHALL use central package management for direct Avalonia-facing projects and keep the core UI dependency baseline on Avalonia `12.0.1`.
|
||||
|
||||
Required package baseline:
|
||||
|
||||
- `Avalonia*` `12.0.1`
|
||||
- `Avalonia.Controls.WebView` `12.0.0`
|
||||
- `ClassIsland.Markdown.Avalonia` `12.0.0`
|
||||
- `FluentAvaloniaUI` `3.0.0-preview1`
|
||||
- `FluentIcons.Avalonia` `2.1.325`
|
||||
- `Material.Avalonia` `3.16.0`
|
||||
- `Material.Icons.Avalonia` `3.0.2`
|
||||
|
||||
### Requirement: Official WebView
|
||||
|
||||
The host SHALL use `Avalonia.Controls.NativeWebView` for the browser widget and SHALL NOT reference `WebView.Avalonia`, `AvaloniaWebView`, or `.UseDesktopWebView()`.
|
||||
|
||||
Windows WebView2 user data configuration SHALL be supplied through `EnvironmentRequested` using `WindowsWebView2EnvironmentRequestedEventArgs.UserDataFolder`.
|
||||
|
||||
### Requirement: Plugin SDK v5
|
||||
|
||||
The Plugin SDK API baseline SHALL be `5.0.0`. SDK v4 plugins are treated as incompatible until rebuilt.
|
||||
|
||||
The SDK SHALL keep the existing public UI extension shape, including `SettingsPageBase` and Avalonia `Control` based desktop components.
|
||||
|
||||
### Requirement: Launcher data location stability
|
||||
|
||||
Launcher data location configuration SHALL be read from a fixed bootstrap Launcher data directory so resolving the selected data root cannot recursively require resolving itself.
|
||||
|
||||
### Requirement: OOBE state compatibility
|
||||
|
||||
The Launcher SHALL read current OOBE state from the resolved `Launcher/state` directory and SHALL continue to migrate the legacy `.launcher/state/first_run_completed` marker.
|
||||
|
||||
## Acceptance
|
||||
|
||||
- `dotnet build LanMountainDesktop.slnx -c Debug` completes with 0 errors.
|
||||
- `OobeStateServiceTests` pass.
|
||||
- Full `dotnet test LanMountainDesktop.slnx -c Debug` no longer aborts from `DataLocationResolver` recursion.
|
||||
- Plugin template defaults to SDK package version `5.0.0` and manifest `apiVersion` `5.0.0`.
|
||||
- Current developer documentation points to SDK v5 and Avalonia 12.
|
||||
18
.trae/specs/avalonia-12-migration/tasks.md
Normal file
18
.trae/specs/avalonia-12-migration/tasks.md
Normal file
@@ -0,0 +1,18 @@
|
||||
# Tasks
|
||||
|
||||
- [x] Centralize Avalonia 12 package versions in `Directory.Packages.props`.
|
||||
- [x] Move the host, Launcher, Plugin SDK, DesktopHost, Shared.Contracts, and Avalonia-facing projects onto central package versions.
|
||||
- [x] Replace third-party `WebView.Avalonia` usage with official `NativeWebView`.
|
||||
- [x] Configure WebView2 user data through `EnvironmentRequested`.
|
||||
- [x] Move FluentAvalonia usages to the FA3 control names and package baseline.
|
||||
- [x] Move FluentIcons usage to `FluentIcons.Avalonia` and remove the old `.Fluent` package.
|
||||
- [x] Update Plugin SDK package version and API baseline to `5.0.0`.
|
||||
- [x] Update plugin runtime shared assembly policy for Avalonia 12 / FluentAvalonia / FluentIcons / Material.
|
||||
- [x] Fix Avalonia 12 compile breaks in window chrome, binding plugin access, clipboard, bitmap copy, and icon source usage.
|
||||
- [x] Fix Launcher data location recursion by using a fixed bootstrap config path.
|
||||
- [x] Fix OOBE state tests and legacy marker compatibility.
|
||||
- [x] Update PluginTemplate defaults to SDK v5.
|
||||
- [x] Add SDK v5 migration documentation.
|
||||
- [x] Update current docs from SDK v4 / Avalonia 11 examples to SDK v5 / Avalonia 12.
|
||||
- [x] Run full solution tests and record any remaining non-upgrade failures.
|
||||
- [ ] Perform Windows manual smoke test for host, Launcher, settings, component editor, BrowserWidget, and WebView2 missing-runtime handling.
|
||||
13
.trae/specs/clock-air-app-mvp/checklist.md
Normal file
13
.trae/specs/clock-air-app-mvp/checklist.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# Checklist
|
||||
|
||||
- [x] Clicking `DesktopClock` and `DesktopWorldClock` opens the same global Clock Air APP type.
|
||||
- [x] Repeated `world-clock` open requests use the global `world-clock:clock-suite:global` instance key.
|
||||
- [x] Whiteboard Air APP keeps its per-component instance key behavior.
|
||||
- [x] Clock Air APP opens as a normal application window, not a desktop-layer window.
|
||||
- [x] Clock Air APP settings are independent from desktop clock widget settings.
|
||||
- [x] Corrupt Clock Air APP settings fall back to defaults.
|
||||
- [x] World clock time labels support 12-hour, 24-hour, and follow-system formatting.
|
||||
- [x] Added localization keys are present in all four supported language files.
|
||||
- [x] Build and automated tests pass.
|
||||
- [ ] Manual visual verification in all four languages.
|
||||
- [ ] Manual verification that minimizing keeps stopwatch and timer running while closing stops them.
|
||||
42
.trae/specs/clock-air-app-mvp/spec.md
Normal file
42
.trae/specs/clock-air-app-mvp/spec.md
Normal file
@@ -0,0 +1,42 @@
|
||||
# Clock Air APP MVP
|
||||
|
||||
## Goal
|
||||
|
||||
Upgrade the built-in `world-clock` Air APP into a focused clock suite while keeping desktop clock widgets as lightweight launch entry points.
|
||||
|
||||
## Scope
|
||||
|
||||
- Keep the existing Air APP id `world-clock` for Launcher lifecycle compatibility.
|
||||
- Use one global Clock Air APP instance for every clock widget entry point.
|
||||
- Provide four tabs: World Clock, Stopwatch, Timer, and Settings.
|
||||
- Store Clock Air APP settings independently from desktop widget settings at `AirApps/Clock/settings.json`.
|
||||
- Follow the host language setting and provide localized text for `zh-CN`, `en-US`, `ja-JP`, and `ko-KR`.
|
||||
|
||||
## Behavior
|
||||
|
||||
- `world-clock` opens as a standard resizable FluentAvalonia window.
|
||||
- The default window size is approximately `780x560`, with a minimum of `680x480`.
|
||||
- World Clock shows local time and a configurable city list.
|
||||
- Default city list is Beijing, London, Sydney, and New York.
|
||||
- Users can add, remove, and reorder city entries during the Air APP session; the list persists across restarts.
|
||||
- Stopwatch supports start, pause, resume, lap, and reset; laps are kept in the current window session, up to 50 entries.
|
||||
- Timer supports fixed presets, a custom minute duration, start, pause, resume, reset, and a completed state.
|
||||
- Closing the Clock Air APP stops stopwatch and timer activity.
|
||||
- Minimizing the window keeps stopwatch and timer activity running.
|
||||
- Timer completion can activate the Clock Air APP window when the setting is enabled.
|
||||
|
||||
## Settings
|
||||
|
||||
- Time format: follow system, 24-hour, or 12-hour.
|
||||
- Show seconds.
|
||||
- Startup tab: last used tab, World Clock, Stopwatch, or Timer.
|
||||
- Activate window when timer finishes.
|
||||
|
||||
## Out of Scope
|
||||
|
||||
- Desktop clock widget visual redesign.
|
||||
- Alarms.
|
||||
- Focus mode.
|
||||
- System notifications.
|
||||
- Running stopwatch or timer after the Air APP window is closed.
|
||||
- Third-party plugin Air APP declarations.
|
||||
15
.trae/specs/clock-air-app-mvp/tasks.md
Normal file
15
.trae/specs/clock-air-app-mvp/tasks.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# Tasks
|
||||
|
||||
- [x] Add Clock Air APP settings snapshot and JSON store.
|
||||
- [x] Add shared Clock Air APP time formatting helpers.
|
||||
- [x] Add stopwatch and timer state models with focused tests.
|
||||
- [x] Replace the old world-clock view with `ClockAirAppView`.
|
||||
- [x] Configure `world-clock` as a standard resizable Air APP window.
|
||||
- [x] Make `world-clock` use a global single-instance key independent of source component id.
|
||||
- [x] Add world clock city add, remove, and reorder behavior.
|
||||
- [x] Add stopwatch tab with lap support.
|
||||
- [x] Add timer tab with presets and custom duration.
|
||||
- [x] Add independent Clock Air APP settings tab.
|
||||
- [x] Add `zh-CN`, `en-US`, `ja-JP`, and `ko-KR` localization keys.
|
||||
- [x] Ensure AirAppHost output includes localization JSON resources.
|
||||
- [x] Add regression tests for Launcher keying, descriptors, settings, formatting, stopwatch, timer, and localization coverage.
|
||||
104
.trae/specs/data-settings-page/design.md
Normal file
104
.trae/specs/data-settings-page/design.md
Normal file
@@ -0,0 +1,104 @@
|
||||
# 数据设置页设计文档
|
||||
|
||||
## 概述
|
||||
|
||||
在设置窗口中新增「数据」设置页,用于可视化展示和管理阑山桌面产生的各类本地数据。采用 Fluent Design 风格的横向堆叠条形图展示存储分布。
|
||||
|
||||
## 设计目标
|
||||
|
||||
1. 让用户直观了解阑山桌面占用的存储空间
|
||||
2. 提供各类数据的占比可视化
|
||||
3. 支持按类别清理数据
|
||||
4. 显示相对于磁盘总容量的占比
|
||||
|
||||
## 页面结构
|
||||
|
||||
### 存储概览区域
|
||||
|
||||
顶部一个卡片,包含:
|
||||
- **横向堆叠条形图** — 各类数据用不同颜色的分段表示
|
||||
- **总占用大小** — 阑山桌面数据总大小(如 "1.2 GB")
|
||||
- **磁盘占比** — 占总磁盘空间的百分比(如 "占 C 盘 0.5%")
|
||||
- **图例** — 各颜色对应的数据类型
|
||||
|
||||
### 数据类型详情列表
|
||||
|
||||
下方列表展示每类数据:
|
||||
- 图标 + 名称
|
||||
- 占用大小
|
||||
- 描述/路径提示
|
||||
- 「清理」按钮(如适用)
|
||||
|
||||
### 操作按钮
|
||||
|
||||
- 「刷新」— 重新扫描数据大小
|
||||
- 「一键清理」— 清理所有可清理的数据
|
||||
|
||||
## 数据类型
|
||||
|
||||
| 类型 | 颜色 | 可清理 | 路径 |
|
||||
|------|------|--------|------|
|
||||
| 日志文件 | 灰色 | 是 | `log/` |
|
||||
| 白板笔记 | 橙色 | 是(过期) | `Whiteboards/` |
|
||||
| 插件数据 | 蓝色 | 是 | `Extensions/Plugins/` |
|
||||
| 插件市场缓存 | 紫色 | 是 | `PluginMarket/` |
|
||||
| 壁纸文件 | 粉色 | 是 | `Wallpapers/` |
|
||||
| 设置文件 | 绿色 | 否 | `settings.json` |
|
||||
|
||||
## 技术实现
|
||||
|
||||
### 新增文件
|
||||
|
||||
- `LanMountainDesktop/Views/SettingsPages/DataSettingsPage.axaml` — 页面视图
|
||||
- `LanMountainDesktop/Views/SettingsPages/DataSettingsPage.axaml.cs` — 页面代码隐藏
|
||||
- `LanMountainDesktop/ViewModels/DataSettingsPageViewModel.cs` — 视图模型
|
||||
- `LanMountainDesktop/Services/DataStorageService.cs` — 数据扫描服务
|
||||
|
||||
### 修改文件
|
||||
|
||||
- `LanMountainDesktop/Views/SettingsWindow.axaml.cs` — 图标映射(MapIcon)添加 Database 图标
|
||||
|
||||
### 设置页注册
|
||||
|
||||
```csharp
|
||||
[SettingsPageInfo(
|
||||
"data",
|
||||
"Data",
|
||||
SettingsPageCategory.General,
|
||||
IconKey = "Database",
|
||||
SortOrder = 5,
|
||||
TitleLocalizationKey = "settings.data.title",
|
||||
DescriptionLocalizationKey = "settings.data.description")]
|
||||
```
|
||||
|
||||
## 视觉设计
|
||||
|
||||
### 堆叠条形图
|
||||
|
||||
- 高度:24-32dp
|
||||
- 圆角:使用 `DesignCornerRadiusSm`
|
||||
- 分段间距:2dp
|
||||
- 未占用空间:透明或浅色背景
|
||||
|
||||
### 颜色方案
|
||||
|
||||
使用 Material Design 颜色,与主题协调:
|
||||
- 日志:Gray / BlueGray
|
||||
- 白板:Orange / Amber
|
||||
- 插件:Blue / Indigo
|
||||
- 缓存:Purple / DeepPurple
|
||||
- 壁纸:Pink
|
||||
- 设置:Green / Teal
|
||||
|
||||
## 交互行为
|
||||
|
||||
1. 页面加载时自动扫描数据大小(异步)
|
||||
2. 显示加载指示器
|
||||
3. 清理操作需要确认对话框
|
||||
4. 清理完成后自动刷新数据
|
||||
|
||||
## 安全考虑
|
||||
|
||||
- 清理前确认用户意图
|
||||
- 设置文件不可清理(防止误删配置)
|
||||
- 清理操作记录日志
|
||||
777
.trae/specs/data-settings-page/plan.md
Normal file
777
.trae/specs/data-settings-page/plan.md
Normal file
@@ -0,0 +1,777 @@
|
||||
# 数据设置页实现计划
|
||||
|
||||
> **Goal:** 在设置窗口中新增「数据」设置页,可视化展示阑山桌面各类本地数据的存储占用,支持数据清理。
|
||||
|
||||
> **Architecture:** 采用 MVVM 模式,新增 DataStorageService 负责异步扫描各类数据大小,DataSettingsPage 使用 Fluent Design 横向堆叠条形图展示存储分布。
|
||||
|
||||
> **Tech Stack:** Avalonia UI, FluentAvaloniaUI, CommunityToolkit.Mvvm, C# 13
|
||||
|
||||
---
|
||||
|
||||
## 文件结构
|
||||
|
||||
| 文件 | 职责 |
|
||||
|------|------|
|
||||
| `LanMountainDesktop/Services/DataStorageService.cs` | 扫描各类数据目录大小,计算磁盘总容量 |
|
||||
| `LanMountainDesktop/ViewModels/DataSettingsPageViewModel.cs` | 数据设置页视图模型,绑定存储数据和清理命令 |
|
||||
| `LanMountainDesktop/Views/SettingsPages/DataSettingsPage.axaml` | 数据设置页 XAML 视图(堆叠条形图 + 列表) |
|
||||
| `LanMountainDesktop/Views/SettingsPages/DataSettingsPage.axaml.cs` | 页面代码隐藏,注册设置页属性 |
|
||||
| `LanMountainDesktop/Views/SettingsWindow.axaml.cs` | 修改图标映射,添加 Database 图标 |
|
||||
|
||||
---
|
||||
|
||||
## Task 1: 创建 DataStorageService
|
||||
|
||||
**Files:**
|
||||
- Create: `LanMountainDesktop/Services/DataStorageService.cs`
|
||||
|
||||
**职责:** 扫描阑山桌面各类数据的存储占用,计算磁盘总容量。
|
||||
|
||||
- [ ] **Step 1: 创建 DataStorageService**
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LanMountainDesktop.Services;
|
||||
|
||||
public sealed record StorageCategoryInfo(
|
||||
string Id,
|
||||
string Name,
|
||||
string Description,
|
||||
string DirectoryPath,
|
||||
bool IsCleanable,
|
||||
string ColorHex);
|
||||
|
||||
public sealed record StorageScanResult(
|
||||
StorageCategoryInfo Category,
|
||||
long SizeBytes,
|
||||
double PercentageOfTotal);
|
||||
|
||||
public sealed class DataStorageService
|
||||
{
|
||||
private static readonly IReadOnlyList<StorageCategoryInfo> Categories = new List<StorageCategoryInfo>
|
||||
{
|
||||
new("logs", "日志文件", "应用运行日志", "", true, "#9E9E9E"),
|
||||
new("whiteboards", "白板笔记", "桌面白板笔记数据", "", true, "#FF9800"),
|
||||
new("plugins", "插件数据", "已安装插件文件", "", true, "#2196F3"),
|
||||
new("market", "插件市场缓存", "插件市场元数据缓存", "", true, "#9C27B0"),
|
||||
new("wallpapers", "壁纸文件", "下载的壁纸资源", "", true, "#E91E63"),
|
||||
new("settings", "设置文件", "应用配置数据", "", false, "#4CAF50")
|
||||
};
|
||||
|
||||
public IReadOnlyList<StorageCategoryInfo> GetCategories() => Categories;
|
||||
|
||||
public async Task<IReadOnlyList<StorageScanResult>> ScanAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
var results = new List<StorageScanResult>();
|
||||
var dataRoot = AppDataPathProvider.GetDataRoot();
|
||||
var logDirectory = AppLogger.LogDirectory;
|
||||
|
||||
long totalSize = 0;
|
||||
var categorySizes = new Dictionary<string, long>();
|
||||
|
||||
foreach (var category in Categories)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
string path = category.Id switch
|
||||
{
|
||||
"logs" => logDirectory,
|
||||
"settings" => dataRoot,
|
||||
_ => Path.Combine(dataRoot, category.DirectoryPath)
|
||||
};
|
||||
|
||||
long size = 0;
|
||||
if (category.Id == "settings")
|
||||
{
|
||||
size = await GetSettingsSizeAsync(dataRoot, cancellationToken);
|
||||
}
|
||||
else if (Directory.Exists(path))
|
||||
{
|
||||
size = await GetDirectorySizeAsync(path, cancellationToken);
|
||||
}
|
||||
|
||||
categorySizes[category.Id] = size;
|
||||
totalSize += size;
|
||||
}
|
||||
|
||||
foreach (var category in Categories)
|
||||
{
|
||||
var size = categorySizes.GetValueOrDefault(category.Id, 0);
|
||||
var percentage = totalSize > 0 ? (double)size / totalSize * 100 : 0;
|
||||
results.Add(new StorageScanResult(category, size, percentage));
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
public async Task<long> GetTotalDiskSpaceAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
var dataRoot = AppDataPathProvider.GetDataRoot();
|
||||
var driveInfo = new DriveInfo(Path.GetPathRoot(dataRoot) ?? dataRoot);
|
||||
return driveInfo.TotalSize;
|
||||
}, cancellationToken);
|
||||
}
|
||||
|
||||
public async Task<long> GetAvailableDiskSpaceAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
var dataRoot = AppDataPathProvider.GetDataRoot();
|
||||
var driveInfo = new DriveInfo(Path.GetPathRoot(dataRoot) ?? dataRoot);
|
||||
return driveInfo.AvailableFreeSpace;
|
||||
}, cancellationToken);
|
||||
}
|
||||
|
||||
public async Task<bool> CleanCategoryAsync(string categoryId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var category = Categories.FirstOrDefault(c =>
|
||||
string.Equals(c.Id, categoryId, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (category is null || !category.IsCleanable)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var dataRoot = AppDataPathProvider.GetDataRoot();
|
||||
string path = categoryId switch
|
||||
{
|
||||
"logs" => AppLogger.LogDirectory,
|
||||
_ => Path.Combine(dataRoot, category.DirectoryPath)
|
||||
};
|
||||
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (categoryId == "logs")
|
||||
{
|
||||
foreach (var file in Directory.GetFiles(path, "*.log"))
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
TryDeleteFile(file);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var file in Directory.GetFiles(path, "*", SearchOption.AllDirectories))
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
TryDeleteFile(file);
|
||||
}
|
||||
|
||||
foreach (var dir in Directory.GetDirectories(path, "*", SearchOption.AllDirectories)
|
||||
.OrderByDescending(d => d.Length))
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
TryDeleteDirectory(dir);
|
||||
}
|
||||
}
|
||||
|
||||
AppLogger.Info("DataStorage", $"Cleaned category '{categoryId}' at '{path}'.");
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AppLogger.Warn("DataStorage", $"Failed to clean category '{categoryId}'.", ex);
|
||||
return false;
|
||||
}
|
||||
}, cancellationToken);
|
||||
}
|
||||
|
||||
private static async Task<long> GetDirectorySizeAsync(string path, CancellationToken cancellationToken)
|
||||
{
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
long size = 0;
|
||||
try
|
||||
{
|
||||
foreach (var file in Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories))
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
try
|
||||
{
|
||||
var info = new FileInfo(file);
|
||||
if (info.Exists)
|
||||
{
|
||||
size += info.Length;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore files we can't access
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore directories we can't access
|
||||
}
|
||||
|
||||
return size;
|
||||
}, cancellationToken);
|
||||
}
|
||||
|
||||
private static async Task<long> GetSettingsSizeAsync(string dataRoot, CancellationToken cancellationToken)
|
||||
{
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
long size = 0;
|
||||
var settingFiles = new[] { "settings.json", "plugin-settings.json", "launcher-settings.json" };
|
||||
foreach (var file in settingFiles)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
var path = Path.Combine(dataRoot, file);
|
||||
if (File.Exists(path))
|
||||
{
|
||||
try
|
||||
{
|
||||
size += new FileInfo(path).Length;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return size;
|
||||
}, cancellationToken);
|
||||
}
|
||||
|
||||
private static void TryDeleteFile(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
File.SetAttributes(path, FileAttributes.Normal);
|
||||
File.Delete(path);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore deletion failures
|
||||
}
|
||||
}
|
||||
|
||||
private static void TryDeleteDirectory(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
Directory.Delete(path, false);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore deletion failures
|
||||
}
|
||||
}
|
||||
|
||||
public static string FormatBytes(long bytes)
|
||||
{
|
||||
const long KB = 1024;
|
||||
const long MB = KB * 1024;
|
||||
const long GB = MB * 1024;
|
||||
const long TB = GB * 1024;
|
||||
|
||||
return bytes switch
|
||||
{
|
||||
>= TB => $"{bytes / (double)TB:F2} TB",
|
||||
>= GB => $"{bytes / (double)GB:F2} GB",
|
||||
>= MB => $"{bytes / (double)MB:F2} MB",
|
||||
>= KB => $"{bytes / (double)KB:F2} KB",
|
||||
_ => $"{bytes} B"
|
||||
};
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Task 2: 创建 DataSettingsPageViewModel
|
||||
|
||||
**Files:**
|
||||
- Create: `LanMountainDesktop/ViewModels/DataSettingsPageViewModel.cs`
|
||||
|
||||
- [ ] **Step 1: 创建 ViewModel**
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Threading;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using LanMountainDesktop.Services;
|
||||
|
||||
namespace LanMountainDesktop.ViewModels;
|
||||
|
||||
public sealed partial class DataStorageItemViewModel : ObservableObject
|
||||
{
|
||||
public string Id { get; }
|
||||
public string Name { get; }
|
||||
public string Description { get; }
|
||||
public string ColorHex { get; }
|
||||
public bool IsCleanable { get; }
|
||||
|
||||
[ObservableProperty]
|
||||
private string _sizeText = "--";
|
||||
|
||||
[ObservableProperty]
|
||||
private double _percentage;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _isCleaning;
|
||||
|
||||
public DataStorageItemViewModel(StorageCategoryInfo category)
|
||||
{
|
||||
Id = category.Id;
|
||||
Name = category.Name;
|
||||
Description = category.Description;
|
||||
ColorHex = category.ColorHex;
|
||||
IsCleanable = category.IsCleanable;
|
||||
}
|
||||
|
||||
public void UpdateSize(long sizeBytes, double percentage)
|
||||
{
|
||||
SizeText = DataStorageService.FormatBytes(sizeBytes);
|
||||
Percentage = percentage;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed partial class DataSettingsPageViewModel : ViewModelBase
|
||||
{
|
||||
private readonly DataStorageService _storageService = new();
|
||||
private CancellationTokenSource? _scanCts;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _pageTitle = "数据与存储";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _totalSizeText = "--";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _diskUsageText = "--";
|
||||
|
||||
[ObservableProperty]
|
||||
private double _diskUsagePercentage;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _isScanning;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _hasData;
|
||||
|
||||
public ObservableCollection<DataStorageItemViewModel> Items { get; } = new();
|
||||
|
||||
public DataSettingsPageViewModel()
|
||||
{
|
||||
var categories = _storageService.GetCategories();
|
||||
foreach (var category in categories)
|
||||
{
|
||||
Items.Add(new DataStorageItemViewModel(category));
|
||||
}
|
||||
|
||||
_ = ScanAsync();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task ScanAsync()
|
||||
{
|
||||
_scanCts?.Cancel();
|
||||
_scanCts = new CancellationTokenSource();
|
||||
var token = _scanCts.Token;
|
||||
|
||||
IsScanning = true;
|
||||
try
|
||||
{
|
||||
var results = await _storageService.ScanAsync(token);
|
||||
var totalSize = results.Sum(r => r.SizeBytes);
|
||||
var totalDisk = await _storageService.GetTotalDiskSpaceAsync(token);
|
||||
|
||||
await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
TotalSizeText = DataStorageService.FormatBytes(totalSize);
|
||||
DiskUsagePercentage = totalDisk > 0 ? (double)totalSize / totalDisk * 100 : 0;
|
||||
DiskUsageText = $"占总磁盘 {DiskUsagePercentage:F1}%";
|
||||
HasData = totalSize > 0;
|
||||
|
||||
foreach (var result in results)
|
||||
{
|
||||
var item = Items.FirstOrDefault(i =>
|
||||
string.Equals(i.Id, result.Category.Id, StringComparison.OrdinalIgnoreCase));
|
||||
item?.UpdateSize(result.SizeBytes, result.PercentageOfTotal);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
// Ignore cancellation
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AppLogger.Warn("DataSettings", "Failed to scan storage.", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
IsScanning = false;
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task CleanAsync(string categoryId)
|
||||
{
|
||||
var item = Items.FirstOrDefault(i =>
|
||||
string.Equals(i.Id, categoryId, StringComparison.OrdinalIgnoreCase));
|
||||
if (item is null || !item.IsCleanable)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
item.IsCleaning = true;
|
||||
try
|
||||
{
|
||||
await _storageService.CleanCategoryAsync(categoryId);
|
||||
await ScanAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AppLogger.Warn("DataSettings", $"Failed to clean category '{categoryId}'.", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
item.IsCleaning = false;
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task CleanAllAsync()
|
||||
{
|
||||
foreach (var item in Items.Where(i => i.IsCleanable))
|
||||
{
|
||||
item.IsCleaning = true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
foreach (var item in Items.Where(i => i.IsCleanable))
|
||||
{
|
||||
await _storageService.CleanCategoryAsync(item.Id);
|
||||
}
|
||||
|
||||
await ScanAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AppLogger.Warn("DataSettings", "Failed to clean all categories.", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
foreach (var item in Items)
|
||||
{
|
||||
item.IsCleaning = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Task 3: 创建 DataSettingsPage.axaml
|
||||
|
||||
**Files:**
|
||||
- Create: `LanMountainDesktop/Views/SettingsPages/DataSettingsPage.axaml`
|
||||
|
||||
- [ ] **Step 1: 创建 XAML 视图**
|
||||
|
||||
```xml
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:LanMountainDesktop.ViewModels"
|
||||
xmlns:ui="using:FluentAvalonia.UI.Controls"
|
||||
xmlns:fi="using:FluentIcons.Avalonia"
|
||||
x:Class="LanMountainDesktop.Views.SettingsPages.DataSettingsPage"
|
||||
x:DataType="vm:DataSettingsPageViewModel">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Classes="settings-page-container settings-page-animated"
|
||||
Spacing="16">
|
||||
|
||||
<!-- 存储概览卡片 -->
|
||||
<Border Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
|
||||
CornerRadius="{DynamicResource DesignCornerRadiusMd}"
|
||||
Padding="20">
|
||||
<StackPanel Spacing="12">
|
||||
<TextBlock Text="存储概览"
|
||||
FontSize="16"
|
||||
FontWeight="SemiBold" />
|
||||
|
||||
<!-- 堆叠条形图 -->
|
||||
<Grid Height="28"
|
||||
IsVisible="{Binding HasData}">
|
||||
<Border Background="{DynamicResource ControlFillColorTertiaryBrush}"
|
||||
CornerRadius="{DynamicResource DesignCornerRadiusSm}"
|
||||
ClipToBounds="True">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
x:Name="StorageBarPanel">
|
||||
<!-- 动态生成分段 -->
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<!-- 总大小和磁盘占比 -->
|
||||
<Grid ColumnDefinitions="*,Auto">
|
||||
<StackPanel Grid.Column="0"
|
||||
Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<TextBlock Text="{Binding TotalSizeText}"
|
||||
FontSize="24"
|
||||
FontWeight="SemiBold" />
|
||||
<TextBlock Text="{Binding DiskUsageText}"
|
||||
VerticalAlignment="Bottom"
|
||||
Margin="0,0,0,4"
|
||||
Opacity="0.7" />
|
||||
</StackPanel>
|
||||
<Button Grid.Column="1"
|
||||
Command="{Binding ScanCommand}"
|
||||
IsEnabled="{Binding !IsScanning}"
|
||||
VerticalAlignment="Center">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Spacing="6">
|
||||
<fi:FluentIcon Icon="ArrowSync"
|
||||
IconVariant="Regular"
|
||||
FontSize="14" />
|
||||
<TextBlock Text="刷新" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</Grid>
|
||||
|
||||
<!-- 图例 -->
|
||||
<ItemsControl ItemsSource="{Binding Items}"
|
||||
IsVisible="{Binding HasData}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel Orientation="Horizontal"
|
||||
ItemWidth="140"
|
||||
ItemHeight="28" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate x:DataType="vm:DataStorageItemViewModel">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Spacing="6"
|
||||
VerticalAlignment="Center">
|
||||
<Border Width="12"
|
||||
Height="12"
|
||||
CornerRadius="2"
|
||||
Background="{Binding ColorHex, Converter={StaticResource HexToBrushConverter}}" />
|
||||
<TextBlock Text="{Binding Name}"
|
||||
FontSize="12"
|
||||
Opacity="0.8" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 数据类型详情列表 -->
|
||||
<TextBlock Text="数据详情"
|
||||
FontSize="16"
|
||||
FontWeight="SemiBold"
|
||||
Margin="0,8,0,0" />
|
||||
|
||||
<ItemsControl ItemsSource="{Binding Items}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate x:DataType="vm:DataStorageItemViewModel">
|
||||
<Border Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
|
||||
CornerRadius="{DynamicResource DesignCornerRadiusMd}"
|
||||
Padding="16"
|
||||
Margin="0,4">
|
||||
<Grid ColumnDefinitions="Auto,*,Auto,Auto"
|
||||
ColumnSpacing="12">
|
||||
<Border Grid.Column="0"
|
||||
Width="12"
|
||||
Height="12"
|
||||
CornerRadius="2"
|
||||
Background="{Binding ColorHex, Converter={StaticResource HexToBrushConverter}}"
|
||||
VerticalAlignment="Center" />
|
||||
|
||||
<StackPanel Grid.Column="1"
|
||||
VerticalAlignment="Center">
|
||||
<TextBlock Text="{Binding Name}"
|
||||
FontWeight="SemiBold" />
|
||||
<TextBlock Text="{Binding Description}"
|
||||
FontSize="12"
|
||||
Opacity="0.6" />
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock Grid.Column="2"
|
||||
Text="{Binding SizeText}"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="SemiBold"
|
||||
Opacity="0.8" />
|
||||
|
||||
<Button Grid.Column="3"
|
||||
Command="{Binding $parent[ItemsControl].((vm:DataSettingsPageViewModel)DataContext).CleanCommand}"
|
||||
CommandParameter="{Binding Id}"
|
||||
IsVisible="{Binding IsCleanable}"
|
||||
IsEnabled="{Binding !IsCleaning}"
|
||||
VerticalAlignment="Center">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Spacing="4">
|
||||
<fi:FluentIcon Icon="Delete"
|
||||
IconVariant="Regular"
|
||||
FontSize="14" />
|
||||
<TextBlock Text="清理" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
<!-- 一键清理 -->
|
||||
<Button Command="{Binding CleanAllCommand}"
|
||||
HorizontalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Center"
|
||||
Margin="0,8">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Spacing="6">
|
||||
<fi:FluentIcon Icon="Broom"
|
||||
IconVariant="Regular"
|
||||
FontSize="16" />
|
||||
<TextBlock Text="一键清理所有可清理数据" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Task 4: 创建 DataSettingsPage.axaml.cs
|
||||
|
||||
**Files:**
|
||||
- Create: `LanMountainDesktop/Views/SettingsPages/DataSettingsPage.axaml.cs`
|
||||
|
||||
- [ ] **Step 1: 创建代码隐藏**
|
||||
|
||||
```csharp
|
||||
using LanMountainDesktop.PluginSdk;
|
||||
using LanMountainDesktop.ViewModels;
|
||||
|
||||
namespace LanMountainDesktop.Views.SettingsPages;
|
||||
|
||||
[SettingsPageInfo(
|
||||
"data",
|
||||
"Data",
|
||||
SettingsPageCategory.General,
|
||||
IconKey = "Database",
|
||||
SortOrder = 5,
|
||||
TitleLocalizationKey = "settings.data.title",
|
||||
DescriptionLocalizationKey = "settings.data.description")]
|
||||
public partial class DataSettingsPage : SettingsPageBase
|
||||
{
|
||||
public DataSettingsPage()
|
||||
: this(new DataSettingsPageViewModel())
|
||||
{
|
||||
}
|
||||
|
||||
public DataSettingsPage(DataSettingsPageViewModel viewModel)
|
||||
{
|
||||
ViewModel = viewModel;
|
||||
DataContext = ViewModel;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public DataSettingsPageViewModel ViewModel { get; }
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Task 5: 修改 SettingsWindow.axaml.cs 添加图标映射
|
||||
|
||||
**Files:**
|
||||
- Modify: `LanMountainDesktop/Views/SettingsWindow.axaml.cs`
|
||||
|
||||
- [ ] **Step 1: 在 MapIcon 方法中添加 Database 图标映射**
|
||||
|
||||
在 `MapIcon` 方法的 switch 表达式中添加:
|
||||
|
||||
```csharp
|
||||
"Database" => Symbol.Database,
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Task 6: 添加颜色转换器(如需要)
|
||||
|
||||
**Files:**
|
||||
- Modify: `LanMountainDesktop/Theme/` 或 `LanMountainDesktop/Controls/` 中的资源字典
|
||||
|
||||
如果项目中没有 HexToBrushConverter,需要创建一个简单的值转换器:
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using Avalonia.Data.Converters;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace LanMountainDesktop.Converters;
|
||||
|
||||
public class HexToBrushConverter : IValueConverter
|
||||
{
|
||||
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is string hex && !string.IsNullOrWhiteSpace(hex))
|
||||
{
|
||||
try
|
||||
{
|
||||
return new SolidColorBrush(Color.Parse(hex));
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore parse errors
|
||||
}
|
||||
}
|
||||
|
||||
return new SolidColorBrush(Colors.Gray);
|
||||
}
|
||||
|
||||
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 测试验证
|
||||
|
||||
1. 构建项目:`dotnet build LanMountainDesktop.slnx -c Debug`
|
||||
2. 运行应用:`dotnet run --project LanMountainDesktop/LanMountainDesktop.csproj`
|
||||
3. 打开设置窗口,确认「数据」选项卡出现在左侧导航中
|
||||
4. 点击「数据」选项卡,确认:
|
||||
- 堆叠条形图显示各类数据占比
|
||||
- 总大小和磁盘占比显示正确
|
||||
- 数据详情列表显示每类数据大小
|
||||
- 刷新按钮可以重新扫描
|
||||
- 清理按钮可以清理对应数据
|
||||
13
.trae/specs/dock-back-to-windows-button-display/checklist.md
Normal file
13
.trae/specs/dock-back-to-windows-button-display/checklist.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# Checklist
|
||||
|
||||
- [ ] `AppSettingsSnapshot.BackToWindowsButtonDisplayMode` exists and defaults to `IconAndText`.
|
||||
- [ ] `AppSettingsSnapshot` contains icon source, Fluent icon name, and text icon settings with safe defaults.
|
||||
- [ ] General > Basic Settings includes one folded back-to-platform button settings expander.
|
||||
- [ ] The expander includes the display-mode dropdown.
|
||||
- [ ] The expander includes nested icon source, Fluent icon popup picker, and text icon input controls.
|
||||
- [ ] The Dock button left icon slot renders either a Fluent icon or custom text.
|
||||
- [ ] `IconAndText`, `IconOnly`, and `TextOnly` modes update the Dock button live.
|
||||
- [ ] Icon source, Fluent icon name, and text icon updates refresh the Dock button live.
|
||||
- [ ] The selected mode is preserved when MainWindow saves app settings.
|
||||
- [ ] Localization keys exist for zh-CN, en-US, ja-JP, and ko-KR.
|
||||
- [ ] `dotnet build LanMountainDesktop.slnx -c Debug` succeeds.
|
||||
29
.trae/specs/dock-back-to-windows-button-display/spec.md
Normal file
29
.trae/specs/dock-back-to-windows-button-display/spec.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# Dock Back To Windows Button Display
|
||||
|
||||
## Summary
|
||||
|
||||
The Dock "Back to platform" action should expose a configurable left icon slot while keeping the localized platform text fixed.
|
||||
|
||||
## Requirements
|
||||
|
||||
- The default display mode is `IconAndText` so existing users keep a familiar Dock layout after upgrade.
|
||||
- The localized platform text remains controlled by the app and is not user-editable.
|
||||
- General > Basic Settings exposes one Fluent Avalonia `FASettingsExpander` for the back-to-platform button, with icon-related controls folded into nested `FASettingsExpanderItem` rows.
|
||||
- The main row exposes a dropdown with `IconAndText`, `IconOnly`, and `TextOnly` options.
|
||||
- A nested icon source row selects Fluent icon or text icon.
|
||||
- Fluent icon mode uses a popup picker-style flyout with search and a grid of the full FluentIcons `Icon` enum.
|
||||
- Text icon mode lets the user enter short text for the left icon slot.
|
||||
- Changing the dropdown persists to `AppSettingsSnapshot.BackToWindowsButtonDisplayMode` and updates the Dock button without restarting.
|
||||
- Changing the icon source, Fluent icon, or text icon persists to app settings and updates the Dock button without restarting.
|
||||
- `IconOnly` keeps the existing tooltip text so the button remains understandable.
|
||||
- `PinnedTaskbarActions` continues to control whether the action is visible; it does not replace the display mode setting.
|
||||
|
||||
## Acceptance Scenarios
|
||||
|
||||
- With default settings, the Dock button shows a small circle icon and the localized platform text.
|
||||
- Selecting icon only hides the platform text and keeps the configured left icon visible.
|
||||
- Selecting text only hides the left icon slot and keeps the localized platform text visible.
|
||||
- Choosing a Fluent icon changes the left icon slot.
|
||||
- Entering a short text icon changes the left icon slot.
|
||||
- Restarting the app restores the selected display mode.
|
||||
- Clicking the button still runs the existing minimize/back-to-platform behavior.
|
||||
11
.trae/specs/external-ipc-public-api/checklist.md
Normal file
11
.trae/specs/external-ipc-public-api/checklist.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# External IPC Public API Checklist
|
||||
|
||||
- [x] Host can expose strong-typed public IPC services.
|
||||
- [x] External .NET client can connect and call built-in services.
|
||||
- [x] Host publishes launcher startup and loading-state notifications through routed notify.
|
||||
- [x] Launcher consumes routed notify instead of the old primary custom named-pipe path.
|
||||
- [x] Plugin SDK exposes public IPC contribution primitives.
|
||||
- [x] Plugin runtime can discover and register plugin public IPC services.
|
||||
- [x] Public catalog includes built-in and plugin-contributed services.
|
||||
- [x] `catalog.changed` is emitted when new services are added after startup.
|
||||
- [ ] Add example external client sample.
|
||||
24
.trae/specs/external-ipc-public-api/spec.md
Normal file
24
.trae/specs/external-ipc-public-api/spec.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# External IPC Public API Spec
|
||||
|
||||
## Goal
|
||||
|
||||
Provide a single `dotnetCampus.Ipc` based external integration layer for:
|
||||
|
||||
- Host public APIs
|
||||
- Launcher/OOBE startup progress and loading-state notifications
|
||||
- plugin-contributed public services and live event push
|
||||
|
||||
## Delivered
|
||||
|
||||
- `LanMountainDesktop.Shared.IPC` project
|
||||
- `[IpcPublic]` based built-in public contracts
|
||||
- `PublicIpcHostService` and `LanMountainDesktopIpcClient`
|
||||
- Launcher migrated to Host public IPC notifications
|
||||
- Plugin SDK public IPC contribution API
|
||||
- Host runtime integration for plugin public IPC services
|
||||
|
||||
## Out of Scope
|
||||
|
||||
- plugin process isolation
|
||||
- non-.NET strong-typed public IPC clients
|
||||
- live plugin public service removal without restart
|
||||
12
.trae/specs/external-ipc-public-api/tasks.md
Normal file
12
.trae/specs/external-ipc-public-api/tasks.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# External IPC Public API Tasks
|
||||
|
||||
- [x] Add `LanMountainDesktop.Shared.IPC`
|
||||
- [x] Expose built-in `[IpcPublic]` services
|
||||
- [x] Add routed notify constants and public IPC client/host wrappers
|
||||
- [x] Start Host public IPC during app startup
|
||||
- [x] Move Launcher startup progress consumption to the new IPC base
|
||||
- [x] Add plugin public IPC registration/contributor SDK
|
||||
- [x] Register plugin-contributed public services into Host catalog
|
||||
- [x] Add integration tests for strong-typed public service access and plugin registration descriptors
|
||||
- [ ] Expand built-in public service surface beyond the first minimal set
|
||||
- [ ] Add non-.NET bridge guidance and samples
|
||||
@@ -0,0 +1,14 @@
|
||||
- [x] ComponentCategoryIconResolver 基于 IconKey 正确解析分类图标
|
||||
- [x] IconKey 为 "Clock" 时解析为 Icon.Clock
|
||||
- [x] IconKey 为 "WeatherSunny" 时解析为 Icon.WeatherSunny
|
||||
- [x] IconKey 为 "News" 时解析为 Icon.News
|
||||
- [x] IconKey 为 "Edit" 时解析为 Icon.Edit
|
||||
- [x] IconKey 为无效值时回退到 Icon.Apps
|
||||
- [x] 分类 ID 为 "all" 时返回 Icon.Apps
|
||||
- [x] ComponentLibraryCategoryViewModel.Icon 类型为 FluentIcons.Common.Icon
|
||||
- [x] FusedDesktopComponentLibraryControl.axaml.cs 不再包含硬编码 ResolveCategoryIcon 方法
|
||||
- [x] ComponentLibraryWindow.axaml.cs 不再包含硬编码 ResolveCategoryIcon 方法
|
||||
- [x] MainWindow.ComponentSystem.cs 不再包含硬编码 ResolveComponentLibraryCategoryIcon 方法
|
||||
- [x] 三处组件库入口对同一分类显示相同图标
|
||||
- [x] dotnet build 无编译错误
|
||||
- [x] dotnet test 全部通过
|
||||
73
.trae/specs/fused-desktop-category-icon-unification/spec.md
Normal file
73
.trae/specs/fused-desktop-category-icon-unification/spec.md
Normal file
@@ -0,0 +1,73 @@
|
||||
# 融合桌面组件库分类图标统一规格
|
||||
|
||||
## Why
|
||||
|
||||
融合桌面组件库窗口(FusedDesktopComponentLibraryControl)的分类图标使用了手动硬编码的 `ResolveCategoryIcon` 方法映射分类 ID 到 `Symbol` 枚举,与阑山桌面主窗口(MainWindow)中的映射存在不一致(例如 `Info` 分类在主窗口映射到 `Symbol.Apps`,在融合桌面映射到 `Symbol.Info`)。同时,`DesktopComponentDefinition.IconKey` 字段已经存储了正确的 FluentIcon 枚举名称字符串,但未被利用。需要统一三处图标映射逻辑,确保所有组件库入口的分类图标一致且正确。
|
||||
|
||||
## What Changes
|
||||
|
||||
- **统一分类图标映射**:将三处分散的 `ResolveCategoryIcon`/`ResolveComponentLibraryCategoryIcon` 方法合并为共享的统一映射
|
||||
- **使用 `IconKey` 驱动图标**:分类图标应基于该分类下组件的 `IconKey` 字段推导,而非硬编码的分类 ID 映射
|
||||
- **使用 `FluentIcons.Common.Icon` 枚举**:`fi:FluentIcon` 控件使用 `Icon` 枚举(非 `Symbol` 枚举),分类图标应使用 `Icon` 枚举以与 `fi:FluentIcon` 兼容
|
||||
- **修改 ViewModel**:`ComponentLibraryCategoryViewModel.Icon` 属性类型从 `Symbol` 改为 `Icon`
|
||||
|
||||
## Impact
|
||||
|
||||
- 受影响文件:
|
||||
- `LanMountainDesktop/ViewModels/ComponentLibraryWindowViewModel.cs`(Icon 属性类型从 Symbol 改为 Icon)
|
||||
- `LanMountainDesktop/Views/FusedDesktopComponentLibraryControl.axaml`(绑定路径不变,但 Icon 类型变化)
|
||||
- `LanMountainDesktop/Views/FusedDesktopComponentLibraryControl.axaml.cs`(移除硬编码映射,使用统一方法)
|
||||
- `LanMountainDesktop/Views/ComponentLibraryWindow.axaml.cs`(移除硬编码映射,使用统一方法)
|
||||
- `LanMountainDesktop/Views/MainWindow.ComponentSystem.cs`(移除硬编码映射,使用统一方法)
|
||||
- 新增共享映射工具类(或在现有服务中添加)
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: 统一分类图标映射
|
||||
|
||||
系统 SHALL 提供一个共享的分类图标映射方法,所有组件库入口(阑山桌面主窗口、融合桌面组件库、独立组件库窗口)均使用此方法。
|
||||
|
||||
#### Scenario: 图标映射来源
|
||||
- **GIVEN** 一个组件分类 ID
|
||||
- **WHEN** 需要获取该分类的图标
|
||||
- **THEN** 系统应基于该分类下组件的 `IconKey` 字段推导分类图标
|
||||
- **AND** 推导规则为:取该分类下第一个组件的 `IconKey`,解析为 `FluentIcons.Common.Icon` 枚举值
|
||||
- **AND** 若 `IconKey` 无法解析为有效的 `Icon` 枚举值,则回退到 `Icon.Apps`
|
||||
|
||||
#### Scenario: 特殊分类处理
|
||||
- **GIVEN** 分类 ID 为 "all"
|
||||
- **WHEN** 需要获取该分类的图标
|
||||
- **THEN** 系统应返回 `Icon.Apps`
|
||||
|
||||
#### Scenario: 三处映射一致性
|
||||
- **GIVEN** 任意一个组件分类
|
||||
- **WHEN** 在阑山桌面主窗口、融合桌面组件库、独立组件库窗口中显示该分类
|
||||
- **THEN** 三处应显示完全相同的图标
|
||||
|
||||
### Requirement: ViewModel 使用 Icon 枚举
|
||||
|
||||
`ComponentLibraryCategoryViewModel.Icon` 属性 SHALL 使用 `FluentIcons.Common.Icon` 枚举类型(而非 `FluentIcons.Common.Symbol`),以与 `fi:FluentIcon` 控件的 `Icon` 属性兼容。
|
||||
|
||||
#### Scenario: XAML 绑定兼容
|
||||
- **GIVEN** `ComponentLibraryCategoryViewModel.Icon` 属性类型为 `Icon`
|
||||
- **WHEN** 在 XAML 中通过 `{Binding Icon}` 绑定到 `fi:FluentIcon` 控件
|
||||
- **THEN** 图标应正确渲染,无需额外转换
|
||||
|
||||
## MODIFIED Requirements
|
||||
|
||||
### Requirement: 分类图标解析
|
||||
|
||||
原实现使用硬编码的 `if/switch` 语句将分类 ID 映射到 `Symbol` 枚举,新实现改为:
|
||||
|
||||
- 使用 `DesktopComponentDefinition.IconKey` 字段作为图标来源
|
||||
- 通过 `Enum.TryParse<Icon>(iconKey, ignoreCase: true, out var icon)` 解析
|
||||
- 解析失败时回退到 `Icon.Apps`
|
||||
- 移除所有三处硬编码映射方法
|
||||
|
||||
### Requirement: ComponentLibraryCategoryViewModel.Icon 类型
|
||||
|
||||
原类型为 `Symbol`,修改为 `Icon`,与 `fi:FluentIcon` 控件的 `Icon` 依赖属性类型一致。
|
||||
|
||||
## REMOVED Requirements
|
||||
|
||||
无移除的需求。
|
||||
38
.trae/specs/fused-desktop-category-icon-unification/tasks.md
Normal file
38
.trae/specs/fused-desktop-category-icon-unification/tasks.md
Normal file
@@ -0,0 +1,38 @@
|
||||
# Tasks
|
||||
|
||||
- [x] Task 1: 创建共享分类图标映射工具
|
||||
- [x] SubTask 1.1: 在 `LanMountainDesktop.ComponentSystem` 命名空间下创建 `ComponentCategoryIconResolver` 静态类
|
||||
- [x] SubTask 1.2: 实现 `ResolveCategoryIcon(string categoryId, IEnumerable<DesktopComponentDefinition> categoryComponents)` 方法,基于 IconKey 解析为 `FluentIcons.Common.Icon`
|
||||
- [x] SubTask 1.3: 添加单元测试验证图标解析逻辑(TDD:先写失败测试,再实现)
|
||||
|
||||
- [x] Task 2: 修改 ViewModel 的 Icon 属性类型
|
||||
- [x] SubTask 2.1: 将 `ComponentLibraryCategoryViewModel.Icon` 属性类型从 `Symbol` 改为 `Icon`
|
||||
- [x] SubTask 2.2: 更新构造函数参数类型
|
||||
|
||||
- [x] Task 3: 更新 FusedDesktopComponentLibraryControl.axaml.cs
|
||||
- [x] SubTask 3.1: 移除 `ResolveCategoryIcon` 硬编码方法
|
||||
- [x] SubTask 3.2: 在 `LoadCategories` 中使用 `ComponentCategoryIconResolver.ResolveCategoryIcon`
|
||||
- [x] SubTask 3.3: 更新 "all" 分类图标从 `Symbol.Apps` 改为 `Icon.Apps`
|
||||
|
||||
- [x] Task 4: 更新 ComponentLibraryWindow.axaml.cs
|
||||
- [x] SubTask 4.1: 移除 `ResolveCategoryIcon` 硬编码方法
|
||||
- [x] SubTask 4.2: 使用 `ComponentCategoryIconResolver.ResolveCategoryIcon`
|
||||
|
||||
- [x] Task 5: 更新 MainWindow.ComponentSystem.cs
|
||||
- [x] SubTask 5.1: 移除 `ResolveComponentLibraryCategoryIcon` 硬编码方法
|
||||
- [x] SubTask 5.2: 使用 `ComponentCategoryIconResolver.ResolveCategoryIcon`
|
||||
- [x] SubTask 5.3: 更新 `ComponentLibraryCategory` 记录的 `Icon` 字段类型从 `Symbol` 改为 `Icon`
|
||||
- [x] SubTask 5.4: 更新 `GetComponentLibraryCategories` 方法中的图标解析调用
|
||||
|
||||
- [x] Task 6: 更新 XAML 绑定
|
||||
- [x] SubTask 6.1: 验证 `FusedDesktopComponentLibraryControl.axaml` 中 `fi:FluentIcon Icon="{Binding Icon}"` 绑定在新类型下正常工作
|
||||
|
||||
- [x] Task 7: 构建验证
|
||||
- [x] SubTask 7.1: 运行 `dotnet build` 确保无编译错误
|
||||
- [x] SubTask 7.2: 运行 `dotnet test` 确保所有测试通过
|
||||
|
||||
# Task Dependencies
|
||||
- Task 2 依赖于 Task 1(共享映射工具)
|
||||
- Task 3、4、5 依赖于 Task 1 和 Task 2
|
||||
- Task 6 依赖于 Task 2(类型变更后验证绑定)
|
||||
- Task 7 依赖于所有前置任务
|
||||
166
.trae/specs/fused-desktop-library-redesign/spec.md
Normal file
166
.trae/specs/fused-desktop-library-redesign/spec.md
Normal file
@@ -0,0 +1,166 @@
|
||||
# 融合桌面组件库窗口重设计规格
|
||||
|
||||
## Why
|
||||
|
||||
当前融合桌面组件库窗口(FusedDesktopComponentLibraryWindow)的UI设计较为基础,与Windows 11小组件编辑面板相比,缺乏现代化的交互体验和视觉层次。用户需要一个更直观、更美观的界面来浏览和添加组件到系统桌面(负一屏)。
|
||||
|
||||
参考Windows 11小组件编辑面板的设计特点:
|
||||
|
||||
* 左侧分类列表,右侧选中组件的详细预览
|
||||
|
||||
* 大型组件预览区域,让用户清楚看到组件效果
|
||||
|
||||
* 底部明显的"添加"操作按钮
|
||||
|
||||
* 简洁的关闭按钮(X)在右上角
|
||||
|
||||
* 深色主题配合毛玻璃效果
|
||||
|
||||
## What Changes
|
||||
|
||||
* **重新设计窗口布局**:从左右分栏(分类列表+组件网格)改为左侧面板+右侧预览区的布局
|
||||
|
||||
* **添加组件详情预览区**:选中组件后右侧显示大尺寸预览和组件信息
|
||||
|
||||
* **优化关闭按钮**:使用标准的X图标按钮,不使用圆形样式
|
||||
|
||||
* **添加底部操作栏**:包含"添加到桌面"主操作按钮和"查找更多组件"链接
|
||||
|
||||
* **复用阑山桌面组件库分类**:使用相同的分类ID、图标和本地化文本
|
||||
|
||||
* **移除搜索功能**:参考Windows 11设计,暂不提供搜索
|
||||
|
||||
## Impact
|
||||
|
||||
* 受影响文件:
|
||||
|
||||
* `LanMountainDesktop/Views/FusedDesktopComponentLibraryWindow.axaml`
|
||||
|
||||
* `LanMountainDesktop/Views/FusedDesktopComponentLibraryWindow.axaml.cs`
|
||||
|
||||
* `LanMountainDesktop/Views/FusedDesktopComponentLibraryControl.axaml`
|
||||
|
||||
* `LanMountainDesktop/Views/FusedDesktopComponentLibraryControl.axaml.cs`
|
||||
|
||||
* `LanMountainDesktop/ViewModels/ComponentLibraryWindowViewModel.cs`(可能需要添加新属性)
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: 窗口布局重设计
|
||||
|
||||
系统应提供一个类似于Windows 11小组件编辑面板的组件库窗口。
|
||||
|
||||
#### Scenario: 窗口整体结构
|
||||
|
||||
* **GIVEN** 用户从托盘菜单打开融合桌面组件库
|
||||
|
||||
* **WHEN** 窗口显示时
|
||||
|
||||
* **THEN** 窗口应呈现:
|
||||
|
||||
* 顶部标题栏:左侧显示"添加小组件"标题,右侧有关闭按钮(X)
|
||||
|
||||
* 左侧面板:分类列表(复用阑山桌面组件库的分类和图标)
|
||||
|
||||
* 右侧主区域:选中组件的大尺寸预览 + 组件信息 + 添加按钮
|
||||
|
||||
* 底部:"查找更多组件"链接
|
||||
|
||||
#### Scenario: 分类列表交互
|
||||
|
||||
* **GIVEN** 左侧显示组件分类列表
|
||||
|
||||
* **WHEN** 用户点击某个分类
|
||||
|
||||
* **THEN** 右侧应显示该分类下的第一个组件的预览
|
||||
|
||||
* **AND** 分类项应有选中状态视觉反馈
|
||||
|
||||
* **AND** 分类图标和名称应与阑山桌面组件库保持一致
|
||||
|
||||
#### Scenario: 组件预览区
|
||||
|
||||
* **GIVEN** 用户选中一个组件
|
||||
|
||||
* **WHEN** 预览区显示时
|
||||
|
||||
* **THEN** 应显示:
|
||||
|
||||
* 组件标题(大字号)
|
||||
|
||||
* 大尺寸组件预览图(接近实际尺寸)
|
||||
|
||||
* 组件描述/功能说明
|
||||
|
||||
* 底部"添加到桌面"按钮
|
||||
|
||||
#### Scenario: 添加组件操作
|
||||
|
||||
* **GIVEN** 用户查看组件预览
|
||||
|
||||
* **WHEN** 用户点击"添加到桌面"按钮
|
||||
|
||||
* **THEN** 组件应被添加到系统桌面(负一屏)中央
|
||||
|
||||
* **AND** 窗口应关闭
|
||||
|
||||
#### Scenario: 关闭按钮样式
|
||||
|
||||
* **GIVEN** 窗口标题栏有关闭按钮
|
||||
|
||||
* **THEN** 关闭按钮应使用标准的X图标
|
||||
|
||||
* **AND** 不使用圆形背景或特殊样式
|
||||
|
||||
* **AND** 使用 `DesignCornerRadiusSm` 动态资源
|
||||
|
||||
#### Scenario: 查找更多组件链接
|
||||
|
||||
* **GIVEN** 窗口底部显示"查找更多组件"链接
|
||||
|
||||
* **WHEN** 用户点击该链接
|
||||
|
||||
* **THEN** 应打开设置窗口的插件目录页面(后续将改为插件市场)
|
||||
|
||||
## MODIFIED Requirements
|
||||
|
||||
### Requirement: 组件列表展示
|
||||
|
||||
原实现使用网格展示所有组件,新实现改为:
|
||||
|
||||
* 左侧列表仅显示分类(复用阑山桌面组件库的分类ID和图标映射)
|
||||
|
||||
* 右侧预览区一次只显示一个组件的详细信息
|
||||
|
||||
* ~~移除搜索功能~~(根据Windows 11设计,暂不提供搜索)
|
||||
|
||||
### Requirement: 关闭按钮圆角规范
|
||||
|
||||
原实现关闭按钮使用硬编码 `CornerRadius="18"`,应改为使用动态资源 `DesignCornerRadiusSm`。
|
||||
|
||||
### Requirement: 分类图标复用
|
||||
|
||||
分类图标映射应与阑山桌面组件库保持一致:
|
||||
|
||||
* Clock -> Symbol.Clock
|
||||
|
||||
* Date -> Symbol.CalendarDate
|
||||
|
||||
* Weather -> Symbol.WeatherSunny
|
||||
|
||||
* Board -> Symbol.Edit
|
||||
|
||||
* Media -> Symbol.Play
|
||||
|
||||
* Info -> Symbol.Info
|
||||
|
||||
* Calculator -> Symbol.Calculator
|
||||
|
||||
* Study -> Symbol.Hourglass
|
||||
|
||||
* 其他 -> Symbol.Apps
|
||||
|
||||
## REMOVED Requirements
|
||||
|
||||
* ~~搜索功能~~:根据Windows 11小组件面板设计,暂不提供搜索功能
|
||||
|
||||
35
.trae/specs/fused-desktop-library-redesign/tasks.md
Normal file
35
.trae/specs/fused-desktop-library-redesign/tasks.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# Tasks
|
||||
|
||||
- [x] Task 1: 修改 FusedDesktopComponentLibraryWindow.axaml 窗口布局
|
||||
- [x] SubTask 1.1: 重新设计标题栏,使用标准X关闭按钮,移除圆形样式,使用 DesignCornerRadiusSm
|
||||
- [x] SubTask 1.2: 调整窗口整体布局为左侧面板+右侧预览区
|
||||
- [x] SubTask 1.3: 添加底部"查找更多组件"链接区域
|
||||
|
||||
- [x] Task 2: 修改 FusedDesktopComponentLibraryControl.axaml 控件布局
|
||||
- [x] SubTask 2.1: 重新设计左侧面板:仅保留分类列表(移除搜索框)
|
||||
- [x] SubTask 2.2: 重新设计右侧预览区:组件标题 + 大尺寸预览 + 描述 + 添加按钮
|
||||
- [x] SubTask 2.3: 优化分类列表项样式,添加选中状态视觉反馈
|
||||
- [x] SubTask 2.4: 复用阑山桌面组件库的分类图标映射
|
||||
|
||||
- [x] Task 3: 更新 ViewModel 支持新交互模式
|
||||
- [x] SubTask 3.1: 在 ComponentLibraryWindowViewModel 中添加 SelectedComponent 属性
|
||||
- [x] SubTask 3.2: 添加组件描述属性支持
|
||||
|
||||
- [x] Task 4: 更新 FusedDesktopComponentLibraryControl.axaml.cs 代码逻辑
|
||||
- [x] SubTask 4.1: 修改分类选择逻辑,选中分类时显示该分类第一个组件
|
||||
- [x] SubTask 4.2: 添加组件选中逻辑
|
||||
- [x] SubTask 4.3: 移除搜索相关代码
|
||||
- [x] SubTask 4.4: 复用阑山桌面组件库的分类图标和本地化方法
|
||||
- [x] SubTask 4.5: 添加"查找更多组件"链接点击处理(打开设置窗口插件目录)
|
||||
|
||||
- [x] Task 5: 验证和测试
|
||||
- [x] SubTask 5.1: 验证关闭按钮使用动态圆角资源 DesignCornerRadiusSm
|
||||
- [x] SubTask 5.2: 验证窗口布局符合Windows 11小组件面板风格
|
||||
- [x] SubTask 5.3: 验证分类图标与阑山桌面组件库一致
|
||||
- [x] SubTask 5.4: 验证组件添加功能正常工作
|
||||
- [x] SubTask 5.5: 验证"查找更多组件"链接能打开设置窗口
|
||||
|
||||
# Task Dependencies
|
||||
- Task 3 依赖于 Task 1 和 Task 2 的UI设计确定
|
||||
- Task 4 依赖于 Task 3 的ViewModel更新
|
||||
- Task 5 依赖于所有前置任务完成
|
||||
6
.trae/specs/independent-settings-window/checklist.md
Normal file
6
.trae/specs/independent-settings-window/checklist.md
Normal file
@@ -0,0 +1,6 @@
|
||||
- [x] 从桌面、托盘、IPC、组件库进入设置时,都会落到同一个设置窗口
|
||||
- [x] 设置已打开时再次触发设置入口,只会聚焦已有窗口,不会切换成关闭
|
||||
- [x] 设置窗口始终拥有独立任务栏图标,不受“桌面主窗口在任务栏显示图标”开关影响
|
||||
- [x] 点击“回到 Windows”后,只隐藏或最小化桌面主窗口,设置窗口保持可见
|
||||
- [x] 启用滑入滑出动画后,只有主窗口参与动画,设置窗口不参与
|
||||
- [x] 点击设置窗口关闭按钮后会真实关闭;再次打开时创建新的居中窗口
|
||||
78
.trae/specs/independent-settings-window/spec.md
Normal file
78
.trae/specs/independent-settings-window/spec.md
Normal file
@@ -0,0 +1,78 @@
|
||||
# 独立设置窗口 Spec
|
||||
|
||||
## Why
|
||||
|
||||
- 当前设置窗口仍然带有桌面壳的 owner / anchor 语义,点击“回到 Windows”或触发桌面动画时,容易被一起隐藏或重新定位。
|
||||
- 产品新增了“在任务栏显示图标”和“启用滑入滑出动画”设置,需要明确边界:它们只影响桌面主窗口,不影响设置窗口。
|
||||
- 桌面底栏、托盘菜单、IPC、组件库等入口应当始终打开同一个独立设置窗口,而不是切换成附属浮窗或开关行为。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 将设置窗口改为独立顶层窗口,始终使用自己的任务栏按钮和图标。
|
||||
- `SettingsWindowService.Open` 改为幂等的 open-or-focus;重复打开只聚焦已有窗口,并在提供目标页时切换到对应页面。
|
||||
- 移除 `Owner`、锚点定位和 `Toggle` 语义;首次打开按参考屏幕居中,关闭为真实关闭。
|
||||
- 桌面壳的“回到 Windows”、最小化到托盘/任务栏、滑入滑出动画,只影响 `MainWindow`,不会影响设置窗口。
|
||||
- 统一桌面、托盘、IPC、组件库等设置入口,全部走 `OpenIndependentSettingsModule`。
|
||||
- 设置页文案明确“在任务栏显示图标”只控制桌面主窗口;设置窗口始终保留独立任务栏图标。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected code:
|
||||
- `LanMountainDesktop/Services/Settings/SettingsWindowService.cs`
|
||||
- `LanMountainDesktop/App.axaml.cs`
|
||||
- `LanMountainDesktop/Views/MainWindow.axaml.cs`
|
||||
- `LanMountainDesktop/Views/MainWindow.ComponentSystem.cs`
|
||||
- `LanMountainDesktop/Views/FusedDesktopComponentLibraryControl.axaml.cs`
|
||||
- `LanMountainDesktop/Views/SettingsPages/GeneralSettingsPage.axaml`
|
||||
- Affected behavior:
|
||||
- 设置窗口生命周期
|
||||
- 设置入口一致性
|
||||
- 任务栏图标与桌面壳显示边界
|
||||
|
||||
---
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: 设置窗口为独立顶层窗口
|
||||
|
||||
系统 SHALL 将设置窗口作为独立顶层窗口显示,而不是作为桌面主窗口的附属子窗。
|
||||
|
||||
#### Scenario: 设置窗口拥有独立任务栏图标
|
||||
- **WHEN** 用户打开设置窗口
|
||||
- **THEN** 设置窗口使用独立顶层窗口方式显示
|
||||
- **AND THEN** 设置窗口在任务栏中保留自己的独立按钮和图标
|
||||
- **AND THEN** “在任务栏显示图标”开关不会影响设置窗口的任务栏按钮
|
||||
|
||||
### Requirement: 设置入口统一为 open-or-focus
|
||||
|
||||
系统 SHALL 让所有设置入口打开或聚焦同一个设置窗口实例。
|
||||
|
||||
#### Scenario: 已打开时重复触发设置入口
|
||||
- **WHEN** 设置窗口已经打开,用户再次从桌面、托盘或 IPC 触发打开设置
|
||||
- **THEN** 系统只聚焦现有设置窗口
|
||||
- **AND THEN** 如果请求包含目标页,则导航到目标页
|
||||
- **AND THEN** 不会把已打开的设置窗口当作开关关闭
|
||||
|
||||
### Requirement: 设置窗口不参与桌面壳可见性切换
|
||||
|
||||
系统 SHALL 让桌面壳的隐藏、最小化和进出场动画只作用于主窗口。
|
||||
|
||||
#### Scenario: 回到 Windows 时设置窗口保持可见
|
||||
- **WHEN** 主窗口执行“回到 Windows”并隐藏到托盘或最小化到任务栏
|
||||
- **THEN** 设置窗口保持当前可见状态
|
||||
- **AND THEN** 设置窗口不会跟随主窗口一起隐藏、最小化或重定位
|
||||
|
||||
#### Scenario: 桌面滑入滑出动画不作用于设置窗口
|
||||
- **WHEN** 启用了滑入滑出动画并触发主窗口退场或入场
|
||||
- **THEN** 只有主窗口参与动画
|
||||
- **AND THEN** 设置窗口不会消失,也不会跟随主窗口做进出场动画
|
||||
|
||||
### Requirement: 关闭设置窗口时真实销毁实例
|
||||
|
||||
系统 SHALL 在用户关闭设置窗口时真实关闭该窗口实例。
|
||||
|
||||
#### Scenario: 关闭后再次打开
|
||||
- **WHEN** 用户点击设置窗口右上角关闭按钮
|
||||
- **THEN** 当前设置窗口实例被关闭并销毁
|
||||
- **AND THEN** 下次再次打开设置时创建新的设置窗口实例
|
||||
- **AND THEN** 新窗口按参考屏幕居中显示
|
||||
25
.trae/specs/independent-settings-window/tasks.md
Normal file
25
.trae/specs/independent-settings-window/tasks.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Tasks
|
||||
|
||||
- [x] Task 1: 简化设置窗口打开契约
|
||||
- [x] 将 `SettingsWindowOpenRequest` 从 owner / anchor 语义改为目标页 + 参考屏幕语义
|
||||
- [x] 移除 `ISettingsWindowService.Toggle`
|
||||
|
||||
- [x] Task 2: 重做设置窗口服务行为
|
||||
- [x] 设置窗口始终使用 `Show()` 打开
|
||||
- [x] 设置窗口始终 `ShowInTaskbar = true`
|
||||
- [x] 已打开时只聚焦并在需要时切页
|
||||
- [x] 关闭后销毁实例,下次打开重新创建并居中
|
||||
|
||||
- [x] Task 3: 统一设置入口并解耦桌面壳
|
||||
- [x] 桌面底栏设置按钮改为 open-or-focus
|
||||
- [x] 组件库入口改为复用 `OpenIndependentSettingsModule`
|
||||
- [x] 移除 `MainWindow` 上的设置窗口锚点逻辑
|
||||
|
||||
- [x] Task 4: 明确产品边界
|
||||
- [x] 调整“在任务栏显示图标”文案,限定为桌面主窗口
|
||||
- [x] 新增独立设置窗口 feature spec
|
||||
- [x] 在窗口过渡动画 spec 中补充“设置窗口不参与动画”
|
||||
|
||||
- [x] Task 5: 验证
|
||||
- [x] 运行 `dotnet build LanMountainDesktop.slnx -c Debug`
|
||||
- [x] 运行与新 helper 相关的测试
|
||||
10
.trae/specs/launcher-managed-air-app-lifecycle/checklist.md
Normal file
10
.trae/specs/launcher-managed-air-app-lifecycle/checklist.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# Checklist
|
||||
|
||||
- [x] `LanMountainDesktop.Shared.IPC` builds in Debug.
|
||||
- [x] `LanMountainDesktop.Launcher` builds in Debug.
|
||||
- [x] `LanMountainDesktop` builds in Debug.
|
||||
- [x] `LanMountainDesktop.AirAppHost` builds in Debug.
|
||||
- [x] `LanMountainDesktop.Tests` builds in Debug.
|
||||
- [x] Air APP launcher and lifecycle unit tests pass.
|
||||
- [x] Direct-host fallback starts Launcher in `air-app-broker` mode instead of debug/normal launch mode.
|
||||
- [ ] Manual process-lifetime verification with the running desktop.
|
||||
22
.trae/specs/launcher-managed-air-app-lifecycle/spec.md
Normal file
22
.trae/specs/launcher-managed-air-app-lifecycle/spec.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# Launcher Managed Air APP Lifecycle
|
||||
|
||||
## Goal
|
||||
|
||||
Make Launcher the authoritative lifecycle manager for built-in Air APP processes. The desktop host requests Air APP operations through IPC, while Launcher creates, activates, tracks, and cleans up Air APP host processes.
|
||||
|
||||
## Behavior
|
||||
|
||||
- Launcher exposes `IAirAppLifecycleService` on the dedicated `LanMountainDesktop.Launcher.AirApp.v1` pipe.
|
||||
- Desktop host calls Launcher IPC for `world-clock` and `whiteboard`; it does not directly start `LanMountainDesktop.AirAppHost`.
|
||||
- If the dedicated pipe is unavailable, the desktop host starts Launcher with the hidden `air-app-broker --requester-pid <pid>` command and retries the Air APP request.
|
||||
- `air-app-broker` starts only the Air APP lifecycle IPC broker. It bypasses OOBE, Splash, debug preview windows, and normal desktop launch orchestration.
|
||||
- Launcher keeps one Air APP process per `{appId}:{sourceComponentId}:{sourcePlacementId}` key.
|
||||
- AirAppHost receives Launcher pipe and instance key at startup, registers after the window opens, and unregisters on close.
|
||||
- Launcher remains alive while the main desktop process or any Air APP process is alive.
|
||||
- Broker mode remains alive while the requester desktop process or any Air APP process is alive; after both are gone, it exits.
|
||||
|
||||
## Out of Scope
|
||||
|
||||
- Third-party plugin-declared Air APP metadata.
|
||||
- Cross-machine IPC.
|
||||
- Persisting the Air APP instance table across OS reboot.
|
||||
11
.trae/specs/launcher-managed-air-app-lifecycle/tasks.md
Normal file
11
.trae/specs/launcher-managed-air-app-lifecycle/tasks.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# Tasks
|
||||
|
||||
- [x] Add shared Air APP lifecycle IPC contracts.
|
||||
- [x] Add Launcher Air APP lifecycle service and dedicated IPC host.
|
||||
- [x] Make Launcher remain alive while desktop or Air APP processes exist.
|
||||
- [x] Route desktop Air APP launch requests through Launcher IPC.
|
||||
- [x] Add hidden `air-app-broker` Launcher command for direct-host development fallback.
|
||||
- [x] Make desktop fallback start `air-app-broker --requester-pid <pid>` instead of normal `launch`.
|
||||
- [x] Add broker lifetime and command recognition tests.
|
||||
- [x] Add AirAppHost registration and unregister best-effort calls.
|
||||
- [x] Add lifecycle service and request-building tests.
|
||||
@@ -0,0 +1,9 @@
|
||||
# Launcher OOBE and Elevation Hardening Checklist
|
||||
|
||||
- [ ] New install shows OOBE once.
|
||||
- [ ] Same-user reinstall does not show OOBE again.
|
||||
- [ ] `postinstall` launch path is handled without misclassifying the user state.
|
||||
- [ ] `apply-update` and `plugin-install` do not auto-enter OOBE.
|
||||
- [ ] Default plugin install does not request UAC.
|
||||
- [ ] Logs include OOBE status, suppression reason, and launch source.
|
||||
- [ ] Startup presentation step inside `OobeWindow` (after data location) writes host `settings.json` and syncs Windows Run when autostart is chosen (Launcher executable).
|
||||
43
.trae/specs/launcher-oobe-elevation-hardening/spec.md
Normal file
43
.trae/specs/launcher-oobe-elevation-hardening/spec.md
Normal file
@@ -0,0 +1,43 @@
|
||||
# Launcher OOBE and Elevation Hardening Spec
|
||||
|
||||
## Goal
|
||||
|
||||
Stabilize the launcher startup path so that:
|
||||
|
||||
- OOBE does not reappear for the same Windows user after reinstall/upgrade.
|
||||
- Normal startup, OOBE, update checks, incremental downloads, and default plugin installs do not trigger unexpected UAC prompts.
|
||||
- Only the approved elevation paths remain allowed.
|
||||
|
||||
## Scope
|
||||
|
||||
- Launcher OOBE state handling
|
||||
- launch source classification
|
||||
- elevation boundary cleanup
|
||||
- plugin install default behavior
|
||||
- diagnostic logging and troubleshooting guidance
|
||||
|
||||
## Behavior
|
||||
|
||||
- OOBE state is stored as a per-user truth source at `%LOCALAPPDATA%\LanMountainDesktop\.launcher\state\oobe-state.json`.
|
||||
- `first_run_completed` is treated as a legacy compatibility marker only.
|
||||
- `launchSource` values are treated as:
|
||||
- `normal`
|
||||
- `postinstall`
|
||||
- `apply-update`
|
||||
- `plugin-install`
|
||||
- `debug-preview`
|
||||
- Automatic OOBE is allowed only for normal user-mode startup.
|
||||
- `postinstall` may show OOBE only when the launcher is not elevated and user state is available.
|
||||
- `apply-update`, `plugin-install`, and `debug-preview` must not auto-enter OOBE.
|
||||
- Allowed elevation paths are limited to:
|
||||
- the installer itself
|
||||
- full installer update application
|
||||
- user-confirmed legacy uninstall
|
||||
- Default plugin installation targets the current user's LocalAppData scope and must not request elevation by default.
|
||||
|
||||
## Acceptance
|
||||
|
||||
- Same-user reinstall does not re-enter OOBE.
|
||||
- Missing or damaged OOBE state does not silently bounce the user back into OOBE loops.
|
||||
- Default plugin installation path never triggers surprise UAC.
|
||||
- Logs can explain why OOBE was shown or suppressed and why elevation was or was not requested.
|
||||
9
.trae/specs/launcher-oobe-elevation-hardening/tasks.md
Normal file
9
.trae/specs/launcher-oobe-elevation-hardening/tasks.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# Launcher OOBE and Elevation Hardening Tasks
|
||||
|
||||
- [ ] Move OOBE state to a single per-user JSON source.
|
||||
- [ ] Treat `first_run_completed` as legacy migration-only state.
|
||||
- [ ] Add explicit `launchSource` handling for startup and maintenance flows.
|
||||
- [ ] Suppress auto-OOBE for maintenance and elevated launch contexts.
|
||||
- [ ] Remove default elevation from plugin installation into the user data scope.
|
||||
- [ ] Add structured diagnostics for OOBE decisions and elevation reasons.
|
||||
- [ ] Update launcher docs and troubleshooting guidance.
|
||||
10
.trae/specs/launcher-shell-hardening/checklist.md
Normal file
10
.trae/specs/launcher-shell-hardening/checklist.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# 验收清单
|
||||
|
||||
- [ ] 设置页重启后,Launcher 能重新接管并恢复到正确展示形态。
|
||||
- [ ] 插件升级辅助程序完成后,回拉的是 Launcher 而不是宿主 exe。
|
||||
- [ ] 已在托盘中的实例再次启动时,不会出现第二个主进程。
|
||||
- [ ] 托盘初始化失败时,应用不会进入无入口的 `TrayOnly`。
|
||||
- [ ] 托盘运行中丢失时,watchdog 能重建或自动恢复前台。
|
||||
- [ ] Launcher UI 版本与应用设置页版本一致。
|
||||
- [ ] 发布 tag `vX.Y.Z.W` 时,manifest、程序集、`version.json`、安装包和资产命名一致。
|
||||
- [ ] 100% / 150% / 200% / 250% 缩放下,Launcher OOBE、主窗口、通知动画正常。
|
||||
@@ -0,0 +1,29 @@
|
||||
# Launcher Coordinator And Always-On Tray Addendum
|
||||
|
||||
## Launcher-to-launcher coordination
|
||||
|
||||
- Launcher reserves startup ownership in `%LocalAppData%\LanMountainDesktop\.launcher\state\startup-attempt.json` before it starts the host process.
|
||||
- The reserved record includes `CoordinatorPid`, `CoordinatorPipeName`, `HeartbeatAtUtc`, `PublicIpcConnected`, `ShellStatus`, and `ReservedBeforeHostStart`.
|
||||
- Only the active coordinator may call `Process.Start()` for the host. Secondary Launchers attach to the coordinator pipe and request desktop activation or status.
|
||||
- If the coordinator heartbeat is newer than `10s` and the coordinator pid is alive, a new Launcher must not take over.
|
||||
- If the coordinator is stale, the next Launcher may take over the same pending attempt instead of creating a second host attempt.
|
||||
- Normal launches probe Host Public IPC first. If a host is already running, Launcher activates that instance and exits without starting another host.
|
||||
|
||||
## Finer shell status
|
||||
|
||||
- Public shell IPC exposes `GetShellStatusAsync()`, `ActivateMainWindowWithStatusAsync()`, `EnsureTrayReadyAsync()`, and `EnsureTaskbarEntryAsync()`.
|
||||
- `PublicShellStatus` separates process, shell state, main-window visibility, tray health, taskbar-entry health, and Public IPC readiness.
|
||||
- Launcher success/failure details must include coordinator pid, attempt id, host pid, Public IPC status, tray state, and taskbar usability when available.
|
||||
|
||||
## Always-on tray and taskbar repair
|
||||
|
||||
- The tray icon and menu are mandatory application-liveness indicators and are not controlled by user settings.
|
||||
- Tray watchdog starts during shell initialization and keeps running until application exit.
|
||||
- `ShowInTaskbar=true` means hidden/background states prefer `MinimizedToTaskbar`; it never disables the tray.
|
||||
- `ShowInTaskbar=false` is the only mode that may enter pure `TrayOnly`, and only after `TrayReady`.
|
||||
- When taskbar entry is requested but missing, shell repair recreates or shows the main window minimized with `ShowInTaskbar=true` while keeping the tray visible.
|
||||
|
||||
## Regression coverage
|
||||
|
||||
- Unit tests cover active coordinator rejection, stale heartbeat takeover, and host-pid assignment after a reserved attempt.
|
||||
- Manual QA still needs multi-process Launcher concurrency and real tray loss simulation on Windows.
|
||||
83
.trae/specs/launcher-shell-hardening/spec.md
Normal file
83
.trae/specs/launcher-shell-hardening/spec.md
Normal file
@@ -0,0 +1,83 @@
|
||||
# Launcher 外壳托管、托盘兜底与高分屏动画修复
|
||||
|
||||
## 背景
|
||||
|
||||
当前桌面应用在以下场景存在明显不稳定性:
|
||||
|
||||
- 设置页或升级后的“重启”没有统一回到 Launcher。
|
||||
- 已有实例处于托盘时,再次启动容易误报“窗口未显示”,甚至重复拉起。
|
||||
- 托盘初始化失败或运行中丢失时,应用可能进入无恢复入口状态。
|
||||
- Launcher 和宿主的版本来源不一致,发布后容易出现 UI 版本错乱。
|
||||
- 高分屏和混合缩放环境下,Launcher OOBE、主窗口入场和通知动画存在像素/DIP 混用问题。
|
||||
|
||||
## 目标
|
||||
|
||||
- Launcher 成为正式环境唯一的启动与重启入口。
|
||||
- 进入 `TrayOnly` 前必须先确认托盘可恢复。
|
||||
- Launcher UI 显示的版本号等于应用版本号。
|
||||
- 发布工作流显式同步主程序、Launcher、manifest 和产物版本。
|
||||
- 动画和定位统一按 DIP 与缩放计算。
|
||||
|
||||
## 行为要求
|
||||
|
||||
### 1. 重启接管
|
||||
|
||||
- 应用内重启、插件升级后的重启都必须优先回到 Launcher。
|
||||
- Launcher 对 `SecondaryActivationSucceeded` 只认定为一次成功重定向,不允许再做 fallback 二次拉起。
|
||||
- Launcher 启动成功判定区分三类场景:
|
||||
- 前台启动:`DesktopVisible` 或 `ActivationRedirected`
|
||||
- 重启到最小化:`BackgroundReady`
|
||||
- 重启到托盘:`TrayReady + BackgroundReady`
|
||||
|
||||
### 2. 托盘硬约束
|
||||
|
||||
- 托盘状态机必须至少覆盖:
|
||||
- `Unavailable`
|
||||
- `Initializing`
|
||||
- `Ready`
|
||||
- `Recovering`
|
||||
- `Failed`
|
||||
- `HideMainWindowToTray`、关闭到托盘、重启恢复到托盘前都必须先执行托盘就绪检查。
|
||||
- 如果托盘不可用:
|
||||
- 优先回退到任务栏最小化
|
||||
- 若任务栏入口也不可用,则强制恢复前台可见
|
||||
- 托盘处于隐藏态期间必须运行 watchdog;连续恢复失败时自动恢复主窗口。
|
||||
|
||||
### 3. 版本来源
|
||||
|
||||
- Launcher 只能显示应用版本,不能显示 Launcher 自身硬编码版本。
|
||||
- 版本解析优先顺序:
|
||||
- `version.json`
|
||||
- 主程序文件版本 / 信息版本
|
||||
- `app-<version>` 部署目录
|
||||
- Release 工作流必须显式打版本补丁,避免仓库默认占位值被误当成正式版本。
|
||||
|
||||
### 4. 高分屏动画
|
||||
|
||||
- 主窗口、通知、Launcher OOBE 的动画位移必须使用 DIP 或基于缩放换算后的尺寸。
|
||||
- 不允许直接把 `PixelRect` 宽高当作 `TranslateTransform` 或 `DesiredSize` 的输入。
|
||||
- 淡入和位移动画应并行执行,避免先淡入后滑动造成观感异常。
|
||||
|
||||
## 验收
|
||||
|
||||
- 已在托盘中的实例再次通过 Launcher 启动时,只激活已有实例。
|
||||
- 设置页重启和插件升级重启后,不再出现“窗口未显示但后台已有多个进程”。
|
||||
- 托盘失败时应用仍保持可恢复。
|
||||
- Launcher 与应用设置页显示相同版本。
|
||||
- 100% / 150% / 200% / 250% 缩放下,Launcher OOBE、主窗口入场、通知位置与动画正常。
|
||||
|
||||
### 5. Launcher IPC and error surface follow-up
|
||||
|
||||
- The legacy `LanMountainDesktop_Launcher` named-pipe startup progress channel is retired. Public IPC notifications and host exit codes are the only startup state sources.
|
||||
- Normal Launcher launches must probe public IPC for an existing Host before starting a new Host process. Host no longer owns multi-instance policy, activation prompts, or the old single-instance pipe.
|
||||
- `SecondaryActivationSucceeded` is a success terminal state. `SecondaryActivationFailed` and `RestartLockNotAcquired` may surface as failures only after public IPC recovery has failed.
|
||||
- Launcher startup errors must use FluentAvalonia resources, Fluent icons, an InfoBar recovery hint, and copyable diagnostics instead of the old hard-coded dark panel.
|
||||
|
||||
### 6. Multi-instance behavior setting
|
||||
|
||||
- App settings include `MultiInstanceLaunchBehavior` with default `NotifyAndOpenDesktop`.
|
||||
- General settings exposes the behavior under Basic Settings with four choices: restart app, open desktop silently, prompt only, and notify plus open desktop.
|
||||
- Launcher reads the Host `settings.json` before a normal launch and applies the selected behavior when public IPC reports an existing Host.
|
||||
- `PromptOnly` shows a Fluent Launcher prompt and does not open the desktop automatically.
|
||||
- `NotifyAndOpenDesktop` activates the existing Host and shows the already-running notice from Launcher.
|
||||
- `RestartApp` requests restart through public IPC and must not create a second Host if the restart request fails.
|
||||
@@ -0,0 +1,37 @@
|
||||
# Launcher Slow-Startup And Startup Visual Addendum
|
||||
|
||||
## New startup timing contract
|
||||
|
||||
- `30s` is a soft timeout, not a failure threshold.
|
||||
- After `30s`, if the desktop process is still alive or Public IPC is connected, Launcher must stay in a waiting state and must not start another host process.
|
||||
- `120s` is the hard timeout.
|
||||
- Before returning `desktop_not_visible`, Launcher must attempt one foreground recovery through `ActivateMainWindowAsync()`.
|
||||
|
||||
## Startup attempt de-duplication
|
||||
|
||||
- Launcher persists the current startup attempt in `%LocalAppData%\LanMountainDesktop\.launcher\state\startup-attempt.json`.
|
||||
- A second Launcher process must attach to a live pending attempt instead of calling `Process.Start()` again.
|
||||
- Closing the splash window does not cancel startup; it transitions the attempt into detached waiting and preserves recovery state for the next Launcher run.
|
||||
|
||||
## Startup visual modes
|
||||
|
||||
- `EnableSlideTransition = true` forces `StartupVisualMode.SlideSplash` and automatically disables fade.
|
||||
- `EnableSlideTransition = false && EnableFadeTransition = false` resolves to `StartupVisualMode.StaticSplash`.
|
||||
- `EnableSlideTransition = false && EnableFadeTransition = true` resolves to `StartupVisualMode.Fade`.
|
||||
|
||||
## UX safeguards
|
||||
|
||||
- If the host process is still alive at failure time, the failure dialog must prefer:
|
||||
- `Activate`
|
||||
- `Wait`
|
||||
- `Open Logs`
|
||||
- `Exit`
|
||||
- Retry is only valid when Launcher is not about to create a duplicate desktop process.
|
||||
|
||||
## Launcher coordinator guard
|
||||
|
||||
- Startup attempts are now reserved before host launch, so concurrent Launchers cannot all reach `Process.Start()`.
|
||||
- A live coordinator is identified by `CoordinatorPid`, `CoordinatorPipeName`, and a heartbeat newer than `10s`.
|
||||
- Secondary Launchers send `activate-desktop` or `attach` to the coordinator pipe and then exit with the coordinator status.
|
||||
- If Host Public IPC is already available during a normal launch, Launcher activates the existing desktop and does not start a new host process.
|
||||
- Public shell status now reports tray readiness and taskbar-entry usability separately, allowing Launcher to distinguish "running but hidden" from "not recoverable".
|
||||
21
.trae/specs/launcher-shell-hardening/tasks.md
Normal file
21
.trae/specs/launcher-shell-hardening/tasks.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# 任务拆解
|
||||
|
||||
- [x] 为 Launcher/宿主共享新增重启来源、父进程和展示模式参数。
|
||||
- [x] 修复 Launcher 对 `SecondaryActivationSucceeded` 的重复 fallback 拉起。
|
||||
- [x] 让 Launcher 成功判定支持 `TrayReady` 与 `BackgroundReady`。
|
||||
- [x] 应用重启默认优先回到 Launcher,而不是直接回拉宿主 exe。
|
||||
- [x] 抽出独立托盘服务,集中处理创建、刷新、watchdog 与状态流转。
|
||||
- [x] 在进入 `TrayOnly` 前增加托盘就绪校验与回退策略。
|
||||
- [x] 为运行中托盘丢失增加 watchdog 和自动恢复逻辑。
|
||||
- [x] 统一公共 IPC、设置页与 Launcher 的版本读取入口。
|
||||
- [x] 将仓库默认版本改为开发占位值,并在 Release 工作流中加入显式打版本步骤。
|
||||
- [x] 修复主窗口入场、通知定位和 Launcher OOBE 的高分屏动画/定位问题。
|
||||
- [x] 补充规格与版本同步说明文档。
|
||||
- [ ] 追加针对托盘恢复和启动判定的自动化回归测试。
|
||||
|
||||
- [x] Remove the legacy `LanMountainDesktop_Launcher` startup progress pipe; launcher progress now uses public IPC plus host exit-code classification only.
|
||||
- [x] Move normal multi-open probing into Launcher before host launch and remove Host-side single-instance prompt/listener code.
|
||||
- [x] Refresh the Launcher error window with Fluent resources, InfoBar, Fluent icons, command bar actions, and copyable diagnostic details.
|
||||
- [x] Add app-level `MultiInstanceLaunchBehavior` setting and expose it in General > Basic Settings.
|
||||
- [x] Make Launcher apply restart/open silently/prompt only/notify and open behavior before starting a new Host.
|
||||
- [x] Add a Fluent Launcher multi-instance prompt; Host public IPC stays limited to activation/status/restart/exit actions.
|
||||
@@ -0,0 +1,17 @@
|
||||
# Tray Menu Shutdown Addendum
|
||||
|
||||
## Requirements
|
||||
|
||||
- Tray menu `Exit App` must commit an irreversible host shutdown request.
|
||||
- Once shutdown is committed, tray menu actions must not reopen the desktop, settings window, or component library.
|
||||
- Shutdown cleanup must release Public IPC, plugin runtime, tray icon, fused desktop edit UI, and telemetry resources before the forced-exit deadline.
|
||||
- Forced process termination must be scheduled when the shutdown request is accepted, not only after Avalonia lifetime exit.
|
||||
- Restart must preserve `RestartRequested` intent and must not route through an exit path that overwrites it.
|
||||
- Fused desktop component library menu activation must reuse the existing library window and must exit edit mode if opening fails.
|
||||
|
||||
## Acceptance
|
||||
|
||||
- Selecting `Exit App` from the tray leaves no background host process and allows a later Launcher start to perform multi-instance detection through public IPC.
|
||||
- Selecting `Restart App` starts the Launcher or upgrade helper once, then shuts down the old host as a restart.
|
||||
- Repeated tray clicks during shutdown are ignored and logged.
|
||||
- Repeated component-library clicks focus the existing window instead of opening duplicates.
|
||||
11
.trae/specs/launcher-upgrade/checklist.md
Normal file
11
.trae/specs/launcher-upgrade/checklist.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# Launcher Upgrade Checklist
|
||||
|
||||
- [x] Build passes for `LanMountainDesktop.Launcher`.
|
||||
- [x] `update check` command returns structured JSON result.
|
||||
- [x] `plugin update` command returns structured JSON result.
|
||||
- [x] Legacy plugin install arguments still execute.
|
||||
- [x] OOBE and splash are implemented as separate windows.
|
||||
- [x] Update and rollback logic use version directory markers.
|
||||
|
||||
- [ ] Treat `first_run_completed` as legacy-only compatibility data.
|
||||
- [ ] Keep the authoritative OOBE state in `%LOCALAPPDATA%\LanMountainDesktop\.launcher\state\oobe-state.json`.
|
||||
60
.trae/specs/launcher-upgrade/spec.md
Normal file
60
.trae/specs/launcher-upgrade/spec.md
Normal file
@@ -0,0 +1,60 @@
|
||||
# Launcher Upgrade Spec
|
||||
|
||||
## Goal
|
||||
|
||||
Upgrade `LanMountainDesktop.Launcher` into the unified Launcher for:
|
||||
|
||||
- OOBE first-run entry
|
||||
- startup splash window
|
||||
- silent/incremental/rollback update
|
||||
- plugin install/update
|
||||
|
||||
## Scope (Phase 1)
|
||||
|
||||
- Avalonia GUI launcher with two windows:
|
||||
- `OOBEWindow` (first run only)
|
||||
- `SplashWindow` (every launch)
|
||||
- Default command `launch`
|
||||
- CLI commands:
|
||||
- `update check|download|apply|rollback`
|
||||
- `plugin install|update`
|
||||
- Legacy compatibility:
|
||||
- `--source --plugins-dir --result` still works for plugin install
|
||||
|
||||
## Update Behavior
|
||||
|
||||
- ClassIsland-style deployment folders:
|
||||
- `app-<version>-<number>/`
|
||||
- marker files `.current`, `.partial`, `.destroy`
|
||||
- Signed file map:
|
||||
- `files.json`
|
||||
- `files.json.sig`
|
||||
- `public-key.pem`
|
||||
- Incremental update:
|
||||
- `replace` from archive
|
||||
- `reuse` from current deployment
|
||||
- `delete` skip file in target deployment
|
||||
- Rollback:
|
||||
- snapshot metadata is written before apply
|
||||
- automatic rollback on apply failure
|
||||
- manual rollback via command
|
||||
|
||||
## OOBE and Splash
|
||||
|
||||
- OOBE is independent from splash.
|
||||
- OOBE shows only:
|
||||
- welcome text: `欢迎使用阑山桌面`
|
||||
- arrow button for continue
|
||||
- Splash shows only:
|
||||
- app name: `阑山桌面`
|
||||
|
||||
## Extensibility
|
||||
|
||||
- `IOobeStep` for future multi-step OOBE
|
||||
- `ISplashStageReporter` for future startup progress visualization
|
||||
|
||||
## Compatibility Addendum
|
||||
|
||||
- The current production OOBE state format is a per-user JSON file at `%LOCALAPPDATA%\LanMountainDesktop\.launcher\state\oobe-state.json`.
|
||||
- `first_run_completed` remains legacy compatibility data only.
|
||||
- Same-user reinstall or upgrade should not re-enter OOBE.
|
||||
12
.trae/specs/launcher-upgrade/tasks.md
Normal file
12
.trae/specs/launcher-upgrade/tasks.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# Launcher Upgrade Tasks
|
||||
|
||||
- [x] Convert `LanMountainDesktop.Launcher` to Avalonia launcher entry.
|
||||
- [x] Add OOBE window with first-run marker handling.
|
||||
- [x] Add splash window for every startup.
|
||||
- [x] Implement unified command parsing with default `launch`.
|
||||
- [x] Keep legacy plugin install args compatibility.
|
||||
- [x] Add plugin pending upgrade queue processing.
|
||||
- [x] Implement incremental update apply with signed file map.
|
||||
- [x] Implement snapshot-based rollback and manual rollback command.
|
||||
- [x] Add update check/download/apply/rollback CLI commands.
|
||||
- [x] Add launcher spec files under `.trae/specs/launcher-upgrade/`.
|
||||
42
.trae/specs/localization-fix/checklist.md
Normal file
42
.trae/specs/localization-fix/checklist.md
Normal file
@@ -0,0 +1,42 @@
|
||||
# 本地化修复 Checklist
|
||||
|
||||
## MainWindow 修复
|
||||
- [ ] `TaskbarProfileDisplayNameTextBlock.Text` 在中文下显示"用户"(或保持动态)
|
||||
- [ ] `TaskbarProfileSettingsActionTextBlock.Text` 在中文下显示"设置"
|
||||
- [ ] `TaskbarProfileDesktopEditActionTextBlock.Text` 在中文下显示"桌面编辑"
|
||||
- [ ] `TaskbarProfilePowerActionTextBlock.Text` 在中文下显示"电源"
|
||||
- [ ] `TaskbarPowerBackTextBlock.Text` 在中文下显示"返回"
|
||||
- [ ] `TaskbarPowerTitleTextBlock.Text` 在中文下显示"电源"
|
||||
- [ ] `PowerShutdownTextBlock.Text` 在中文下显示"关机"
|
||||
- [ ] `PowerRestartTextBlock.Text` 在中文下显示"重启"
|
||||
- [ ] `PowerLogoutTextBlock.Text` 在中文下显示"注销"
|
||||
- [ ] `PowerSleepTextBlock.Text` 在中文下显示"睡眠"
|
||||
- [ ] `PowerLockTextBlock.Text` 在中文下显示"锁定屏幕"
|
||||
- [ ] `ComponentLibraryTitleTextBlock.Text` 在中文下显示"桌面编辑"
|
||||
- [ ] `ComponentLibraryEmptyTextBlock.Text` 在中文下显示"左右滑动选择类别,点击进入,然后拖动组件到桌面放置。"
|
||||
- [ ] `ComponentLibraryBackTextBlock.Text` 在中文下显示"返回"
|
||||
- [ ] `ComponentLibraryCollapsedChipTextBlock.Text` 在中文下显示"桌面编辑"
|
||||
|
||||
## Launcher 修复
|
||||
- [ ] `SplashWindow` 在中文下显示中文启动文本
|
||||
- [ ] `DataLocationPromptWindow` 在中文下全部显示中文
|
||||
- [ ] `ErrorWindow` 在中文下全部显示中文
|
||||
- [ ] `LoadingDetailsWindow` 在中文下全部显示中文
|
||||
- [ ] `UpdateWindow` 在中文下显示中文标题
|
||||
|
||||
## 组件修复
|
||||
- [ ] `BrowserWidget` 在中文下显示"浏览器运行时不可用"
|
||||
- [ ] `WhiteboardWidget` 工具提示在中文下显示"笔"、"橡皮擦"、"清空"、"导出 SVG"
|
||||
- [ ] `HolidayCalendarWidget` 在中文下显示"节假日倒计时"、"天"
|
||||
- [ ] `BilibiliHotSearchWidget` 在中文下显示"热门话题"
|
||||
- [ ] `WallpaperSettingsPage` 自定义颜色 Tooltip 在中文下显示"自定义颜色"
|
||||
|
||||
## 资源文件
|
||||
- [ ] `zh-CN.json` 包含所有新增键值
|
||||
- [ ] `en-US.json` 包含所有新增键值
|
||||
- [ ] Launcher 本地化文件包含所有新增键值
|
||||
|
||||
## 构建与质量
|
||||
- [ ] `dotnet build LanMountainDesktop.slnx -c Debug` 编译通过,无错误
|
||||
- [ ] 无新增警告
|
||||
- [ ] 无遗漏的硬编码英文(通过 `grep -r 'Text="[a-zA-Z]'` 等检查)
|
||||
85
.trae/specs/localization-fix/spec.md
Normal file
85
.trae/specs/localization-fix/spec.md
Normal file
@@ -0,0 +1,85 @@
|
||||
# 本地化修复 Spec
|
||||
|
||||
## Why
|
||||
|
||||
- 项目在中文设置下,多处 UI 仍显示英文。
|
||||
- 主要问题集中在:
|
||||
1. `MainWindow.axaml` 中任务栏头像弹窗、电源菜单、组件库等文本硬编码为英文,且未被 `ApplyLocalization()` 覆盖。
|
||||
2. `LanMountainDesktop.Launcher` 的所有视图完全没有接入本地化系统。
|
||||
3. 部分组件(BrowserWidget、WhiteboardWidget、HolidayCalendarWidget 等)存在未覆盖的硬编码英文。
|
||||
4. 少量设置页面 Tooltip 硬编码英文。
|
||||
|
||||
## What Changes
|
||||
|
||||
### 1. MainWindow.axaml 硬编码修复
|
||||
将以下硬编码文本改为由 `ApplyLocalization()` 通过 `L()` 动态设置:
|
||||
- 任务栏头像弹窗:`User` → `power.user` / `Settings` → `settings.title` / `Edit Desktop` → `button.component_library` / `Power` → `power.title`
|
||||
- 电源菜单:`Back` → `common.back` / `Power` → `power.title` / `Shutdown` → `power.shutdown` / `Restart` → `power.restart` / `Log Out` → `power.logout` / `Sleep` → `power.sleep` / `Lock Screen` → `power.lock_screen`
|
||||
- 组件库:`Widgets` → `component_library.title` / `Back` → `common.back` / `No components.` → `component_library.empty`
|
||||
- 悬浮芯片:`Widgets` → `component_library.title`
|
||||
|
||||
### 2. Launcher 视图本地化
|
||||
为 `LanMountainDesktop.Launcher/Views/` 下的窗口引入独立本地化机制(复用 `LocalizationService` 或内嵌资源字典):
|
||||
- `SplashWindow.axaml`:`LanMountain Desktop`、`Initializing...`
|
||||
- `DataLocationPromptWindow.axaml`:全部文本
|
||||
- `ErrorWindow.axaml`:全部文本
|
||||
- `LoadingDetailsWindow.axaml`:全部文本
|
||||
- `UpdateWindow.axaml`:`Update`
|
||||
|
||||
### 3. 组件硬编码修复
|
||||
- `BrowserWidget.axaml`:`Browser runtime unavailable.` → 新增键 `browser.widget.unavailable`
|
||||
- `WhiteboardWidget.axaml`:`Pen` / `Eraser` / `Clear` / `Export SVG` → 新增键 `whiteboard.tool.pen` 等
|
||||
- `HolidayCalendarWidget.axaml`:`Holiday countdown` / `Days` → 新增键 `holiday.widget.title` / `holiday.widget.days`
|
||||
- `BilibiliHotSearchWidget.axaml`:`Trending Topic` → 新增键 `bilihot.widget.trending_topic`
|
||||
- `WallpaperSettingsPage.axaml`:`Custom color` Tooltip → 复用 `settings.wallpaper.custom_color_tooltip`
|
||||
|
||||
### 4. 本地化资源文件补充
|
||||
在 `zh-CN.json` 和 `en-US.json` 中补充上述新增键值。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected code:
|
||||
- `LanMountainDesktop/Views/MainWindow.axaml`
|
||||
- `LanMountainDesktop/Views/MainWindow.SettingsHardCut.Stubs.cs`
|
||||
- `LanMountainDesktop.Launcher/Views/*.axaml`(多个文件)
|
||||
- `LanMountainDesktop/Views/Components/BrowserWidget.axaml`
|
||||
- `LanMountainDesktop/Views/Components/WhiteboardWidget.axaml`
|
||||
- `LanMountainDesktop/Views/Components/HolidayCalendarWidget.axaml`
|
||||
- `LanMountainDesktop/Views/Components/BilibiliHotSearchWidget.axaml`
|
||||
- `LanMountainDesktop/Views/SettingsPages/WallpaperSettingsPage.axaml`
|
||||
- `LanMountainDesktop/Localization/zh-CN.json`
|
||||
- `LanMountainDesktop/Localization/en-US.json`
|
||||
- Affected behavior:
|
||||
- 中文设置下上述位置将正确显示中文。
|
||||
- Launcher 各窗口将支持中英文切换。
|
||||
|
||||
---
|
||||
|
||||
## Requirements
|
||||
|
||||
### Requirement: MainWindow 任务栏弹窗与电源菜单本地化
|
||||
系统 SHALL 在 `ApplyLocalization()` 中覆盖任务栏头像弹窗和电源菜单的所有文本。
|
||||
|
||||
#### Scenario: 中文设置下打开任务栏弹窗
|
||||
- **WHEN** 语言设置为中文
|
||||
- **THEN** 弹窗中显示"设置"、"桌面编辑"、"电源"等中文文本
|
||||
- **AND THEN** 电源菜单中显示"返回"、"关机"、"重启"、"注销"、"睡眠"、"锁定屏幕"等中文文本
|
||||
|
||||
### Requirement: Launcher 窗口本地化
|
||||
系统 SHALL 让 Launcher 的所有窗口文本通过本地化服务获取。
|
||||
|
||||
#### Scenario: 中文设置下启动应用
|
||||
- **WHEN** 语言设置为中文
|
||||
- **THEN** SplashWindow 显示中文启动文本
|
||||
- **AND THEN** 数据位置选择、错误页、加载详情页等显示中文
|
||||
|
||||
### Requirement: 组件与设置页硬编码修复
|
||||
系统 SHALL 移除或覆盖所有组件和设置页中的英文硬编码文本。
|
||||
|
||||
#### Scenario: 中文设置下查看各组件
|
||||
- **WHEN** 语言设置为中文
|
||||
- **THEN** BrowserWidget 显示"浏览器运行时不可用"
|
||||
- **AND THEN** WhiteboardWidget 工具提示显示"笔"、"橡皮擦"、"清空"、"导出 SVG"
|
||||
- **AND THEN** HolidayCalendarWidget 显示"节假日倒计时"、"天"
|
||||
- **AND THEN** BilibiliHotSearchWidget 显示"热门话题"
|
||||
- **AND THEN** 壁纸设置页自定义颜色 Tooltip 显示"自定义颜色"
|
||||
39
.trae/specs/localization-fix/tasks.md
Normal file
39
.trae/specs/localization-fix/tasks.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# 本地化修复 Tasks
|
||||
|
||||
## Task 1: MainWindow.axaml 硬编码文本移除与代码覆盖
|
||||
- [ ] 1.1 在 `MainWindow.axaml` 中,将任务栏头像弹窗的 `User`、`Settings`、`Edit Desktop`、`Power` 的 `Text` 属性改为空或绑定(保留 x:Name)
|
||||
- [ ] 1.2 在 `MainWindow.axaml` 中,将电源菜单的 `Back`、`Power`、`Shutdown`、`Restart`、`Log Out`、`Sleep`、`Lock Screen` 的 `Text` 属性改为空或绑定
|
||||
- [ ] 1.3 在 `MainWindow.axaml` 中,将组件库的 `Widgets`、`Back`、`No components.` 的 `Text` 属性改为空或绑定
|
||||
- [ ] 1.4 在 `MainWindow.axaml` 中,将悬浮芯片的 `Widgets` 的 `Text` 属性改为空或绑定
|
||||
- [ ] 1.5 在 `MainWindow.SettingsHardCut.Stubs.cs` 的 `ApplyLocalization()` 中补充上述所有控件的 `L()` 赋值
|
||||
|
||||
## Task 2: Launcher 视图本地化
|
||||
- [ ] 2.1 在 `LanMountainDesktop.Launcher` 中引入 `LocalizationService`(或共享主应用服务)
|
||||
- [ ] 2.2 为 Launcher 创建独立的 `Localization/` 目录和 `zh-CN.json` / `en-US.json`
|
||||
- [ ] 2.3 修改 `SplashWindow.axaml`:将 `LanMountain Desktop`、`Initializing...` 改为动态绑定
|
||||
- [ ] 2.4 修改 `DataLocationPromptWindow.axaml`:将所有文本改为动态绑定
|
||||
- [ ] 2.5 修改 `ErrorWindow.axaml`:将所有文本改为动态绑定
|
||||
- [ ] 2.6 修改 `LoadingDetailsWindow.axaml`:将所有文本改为动态绑定
|
||||
- [ ] 2.7 修改 `UpdateWindow.axaml`:将 `Update` 改为动态绑定
|
||||
- [ ] 2.8 在 Launcher 启动流程中初始化语言设置
|
||||
|
||||
## Task 3: 组件硬编码修复
|
||||
- [ ] 3.1 `BrowserWidget.axaml`:将 `Browser runtime unavailable.` 改为绑定,并在代码后置中通过 `L()` 设置
|
||||
- [ ] 3.2 `WhiteboardWidget.axaml`:将 `Pen`、`Eraser`、`Clear`、`Export SVG` Tooltip 改为绑定,并在代码后置中通过 `L()` 设置
|
||||
- [ ] 3.3 `HolidayCalendarWidget.axaml`:将 `Holiday countdown`、`Days` 改为绑定,并在代码后置中通过 `L()` 设置
|
||||
- [ ] 3.4 `BilibiliHotSearchWidget.axaml`:将 `Trending Topic` 改为绑定,并在代码后置中通过 `L()` 设置
|
||||
- [ ] 3.5 `WallpaperSettingsPage.axaml`:将 `Custom color` Tooltip 改为绑定到 `settings.wallpaper.custom_color_tooltip`
|
||||
|
||||
## Task 4: 本地化资源文件补充
|
||||
- [ ] 4.1 在 `zh-CN.json` 中补充以下键值:
|
||||
- `browser.widget.unavailable`
|
||||
- `whiteboard.tool.pen`、`whiteboard.tool.eraser`、`whiteboard.tool.clear`、`whiteboard.tool.export_svg`
|
||||
- `holiday.widget.title`、`holiday.widget.days`
|
||||
- `bilihot.widget.trending_topic`
|
||||
- `power.user`(或复用现有键)
|
||||
- [ ] 4.2 在 `en-US.json` 中补充上述键值的英文版本
|
||||
- [ ] 4.3 为 Launcher 创建独立的本地化 JSON 文件并填充中英文
|
||||
|
||||
## Task 5: 验证
|
||||
- [ ] 5.1 执行 `dotnet build LanMountainDesktop.slnx -c Debug` 确保编译通过
|
||||
- [ ] 5.2 检查是否有遗漏的硬编码英文(通过正则搜索)
|
||||
42
.trae/specs/main-window-desktop-layer/design.md
Normal file
42
.trae/specs/main-window-desktop-layer/design.md
Normal file
@@ -0,0 +1,42 @@
|
||||
# Main Window Desktop Layer Design
|
||||
|
||||
## Window Roles
|
||||
|
||||
Lan Mountain Desktop now has three separate window-layer roles:
|
||||
|
||||
- `MainDesktopWindow`: the normal desktop host window. With `EnableMainWindowDesktopLayer`, this window is moved to the desktop layer so it does not cover ordinary apps.
|
||||
- `FusedDesktopSurface`: fused desktop component windows such as `DesktopWidgetWindow` and `TransparentOverlayWindow`. These continue to use `IWindowBottomMostService` and their existing click-through region service.
|
||||
- `AirApp`: independent Air APP windows. These are ordinary app windows and do not use desktop-layer services or global `Topmost` promotion.
|
||||
|
||||
## Service Boundary
|
||||
|
||||
`IMainWindowDesktopLayerService` is dedicated to the main window only. It does not reuse fused desktop passthrough services because the main window must stay interactive.
|
||||
|
||||
Windows behavior:
|
||||
|
||||
- Save original parent, style, and extended style before enabling.
|
||||
- Try to attach the main window to the desktop icon host.
|
||||
- If that host is not found, use `HWND_BOTTOM`.
|
||||
- On disable, restore the saved parent and styles as best effort.
|
||||
|
||||
Non-Windows behavior:
|
||||
|
||||
- Keep a null implementation.
|
||||
- Log that the platform is unsupported.
|
||||
|
||||
## Settings Flow
|
||||
|
||||
The developer settings page owns confirmation UX for conflicts:
|
||||
|
||||
- Fused desktop toggle and main-window desktop-layer toggle are one-way bound.
|
||||
- Toggle click handlers ask for confirmation before saving conflicting states.
|
||||
- The view model writes both keys together so runtime listeners receive a coherent change set.
|
||||
|
||||
## Runtime Flow
|
||||
|
||||
Main-window restore paths call `ActivateOrRefreshMainWindowLayer`.
|
||||
|
||||
- If `EnableMainWindowDesktopLayer` is enabled, the app refreshes the desktop-layer attachment and hides the taskbar entry.
|
||||
- If disabled, the app restores ordinary activation behavior, including the existing temporary foreground promotion.
|
||||
|
||||
Settings changes call both fused desktop and main-window desktop-layer runtime application paths so switching modes is immediate.
|
||||
20
.trae/specs/main-window-desktop-layer/requirements.md
Normal file
20
.trae/specs/main-window-desktop-layer/requirements.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# Main Window Desktop Layer
|
||||
|
||||
## Requirements
|
||||
|
||||
- Add a developer option named `EnableMainWindowDesktopLayer`.
|
||||
- When enabled, the main Lan Mountain desktop window behaves like a desktop-surface window: ordinary application windows can stay above it.
|
||||
- The feature is implemented as desktop-layer or bottom placement, not as `Topmost`.
|
||||
- The option is mutually exclusive with `EnableFusedDesktop`.
|
||||
- Enabling main-window desktop layer while fused desktop is enabled must ask for confirmation, then disable fused desktop on confirm or roll back on cancel.
|
||||
- Enabling fused desktop while main-window desktop layer is enabled must ask for confirmation, then disable main-window desktop layer on confirm or roll back on cancel.
|
||||
- Air APP windows remain ordinary application windows and must not be attached to the desktop layer.
|
||||
- On Windows, the main window should attach to the desktop icon host when available and fall back to `HWND_BOTTOM` when unavailable.
|
||||
- On non-Windows platforms, the setting may exist but the layer service is a no-op and must not throw.
|
||||
|
||||
## Acceptance
|
||||
|
||||
- Opening another app above Lan Mountain Desktop keeps that app visible when main-window desktop layer is enabled.
|
||||
- Restoring the main window from tray keeps the desktop-layer behavior and does not perform a temporary `Topmost` promotion.
|
||||
- Turning the option off restores normal main-window behavior as far as possible.
|
||||
- Fused desktop component windows keep their existing bottom-most behavior and remain isolated from the main-window service.
|
||||
10
.trae/specs/main-window-desktop-layer/tasks.md
Normal file
10
.trae/specs/main-window-desktop-layer/tasks.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# Main Window Desktop Layer Tasks
|
||||
|
||||
- [x] Add `EnableMainWindowDesktopLayer` to app settings with a disabled default.
|
||||
- [x] Add developer settings UI and localization strings.
|
||||
- [x] Add confirmation flow for mutual exclusion with fused desktop.
|
||||
- [x] Add a dedicated main-window desktop-layer service.
|
||||
- [x] Wire main-window creation, restore, tray fallback, settings changes, and shutdown cleanup to the service.
|
||||
- [x] Keep Air APP windows outside this layer service.
|
||||
- [x] Add static regression tests for settings, restore paths, and service boundaries.
|
||||
- [ ] Perform manual Windows z-order validation with real apps.
|
||||
12
.trae/specs/material-color-service/checklist.md
Normal file
12
.trae/specs/material-color-service/checklist.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# Material Color Service Acceptance Checklist
|
||||
|
||||
- [x] `dotnet build LanMountainDesktop.slnx -c Debug` succeeds.
|
||||
- [x] `dotnet test LanMountainDesktop.slnx -c Debug` succeeds.
|
||||
- [x] Material & Color page exposes color source, wallpaper source, system material, native event preference, polling interval, manual refresh, semantic color preview, and surface preview.
|
||||
- [x] Appearance page no longer owns duplicate visible color/material controls.
|
||||
- [x] Appearance page view model preserves Material & Color settings instead of rewriting them.
|
||||
- [x] Component corner-radius settings preserve Material & Color fields instead of resetting them through old positional constructors.
|
||||
- [x] Component editor receives colors from `MaterialColorSnapshot`.
|
||||
- [x] Plugin SDK snapshot includes read-only color/material fields without breaking the existing constructor shape.
|
||||
- [x] Wallpaper source selection supports auto, app, and system modes.
|
||||
- [x] Native wallpaper event monitoring can be disabled and polling remains available.
|
||||
62
.trae/specs/material-color-service/spec.md
Normal file
62
.trae/specs/material-color-service/spec.md
Normal file
@@ -0,0 +1,62 @@
|
||||
# Material Color Service
|
||||
|
||||
## Goal
|
||||
|
||||
Unify Monet seed extraction, wallpaper color extraction, semantic color roles, host material surfaces, and plugin appearance snapshots behind one host-owned material/color source of truth.
|
||||
|
||||
## Scope
|
||||
|
||||
- Host service: `IMaterialColorService`
|
||||
- Compatibility facade: `IAppearanceThemeService`
|
||||
- Settings page: `MaterialColorSettingsPage`
|
||||
- Persisted settings:
|
||||
- `ThemeColorMode`
|
||||
- `ThemeColor`
|
||||
- `SelectedWallpaperSeed`
|
||||
- `SystemMaterialMode`
|
||||
- `ThemeWallpaperColorSource`
|
||||
- `UseNativeWallpaperChangeEvents`
|
||||
- `SystemWallpaperRefreshIntervalSeconds`
|
||||
- Plugin read-only appearance snapshot fields:
|
||||
- accent color
|
||||
- seed color
|
||||
- color source
|
||||
- system material mode
|
||||
- semantic color roles
|
||||
- material surfaces
|
||||
- wallpaper seed candidates
|
||||
|
||||
## Behavior
|
||||
|
||||
`IMaterialColorService` owns the live `MaterialColorSnapshot`. Consumers should derive colors and material values from this snapshot instead of recalculating from raw theme settings, wallpaper settings, or `MonetPalette`.
|
||||
|
||||
Supported color sources:
|
||||
|
||||
- `default_neutral`: stable neutral surfaces with the default accent.
|
||||
- `seed_monet`: user-selected seed color processed through Monet.
|
||||
- `wallpaper_monet`: wallpaper colors processed through Monet.
|
||||
|
||||
Wallpaper color source selection:
|
||||
|
||||
- `auto`: app wallpaper or app solid color first, then system wallpaper, then fallback.
|
||||
- `app`: app wallpaper or app solid color only, then fallback.
|
||||
- `system`: system wallpaper only, then fallback.
|
||||
|
||||
System wallpaper monitoring:
|
||||
|
||||
- Native Windows user preference events are preferred when enabled and available.
|
||||
- Polling remains active as the fallback path.
|
||||
- Manual refresh clears cached wallpaper candidates and rebuilds the snapshot.
|
||||
|
||||
## Refactor Rules
|
||||
|
||||
- New consumers must depend on `IMaterialColorService`, not on parallel combinations of theme settings, wallpaper settings, and `MonetColorService`.
|
||||
- `MonetColorService` remains the extraction/palette utility, not the application-wide coordinator.
|
||||
- Component/editor/plugin appearance code must consume `MaterialColorSnapshot` or a mapper produced from it.
|
||||
- Existing `IAppearanceThemeService` remains available for compatibility, but it must not become a second source of truth.
|
||||
|
||||
## Out Of Scope
|
||||
|
||||
- Plugin write access to global host appearance settings.
|
||||
- Market metadata or sample plugin changes.
|
||||
- Replacing the wallpaper picker page. It remains the asset/source management page.
|
||||
13
.trae/specs/material-color-service/tasks.md
Normal file
13
.trae/specs/material-color-service/tasks.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# Material Color Service Tasks
|
||||
|
||||
- [x] Add unified material/color snapshot models and `IMaterialColorService`.
|
||||
- [x] Persist wallpaper color source and native wallpaper event preference.
|
||||
- [x] Add the Material & Color settings page.
|
||||
- [x] Keep Appearance focused on theme mode, window chrome, and corner radius.
|
||||
- [x] Route plugin appearance snapshots through the material/color snapshot.
|
||||
- [x] Route component editor theming through the material/color snapshot.
|
||||
- [x] Remove legacy color/material preview and save logic from the Appearance page view model.
|
||||
- [x] Replace legacy positional `ThemeAppearanceSettingsState` writes with preserving `with` updates where found.
|
||||
- [x] Keep native wallpaper events optional with polling/manual refresh fallback.
|
||||
- [x] Add regression tests for normalization, plugin mapping, and component editor palette mapping.
|
||||
- [ ] Continue retiring legacy direct consumers of raw theme/wallpaper/Monet tuples when they are touched.
|
||||
12
.trae/specs/plugin-process-isolation/checklist.md
Normal file
12
.trae/specs/plugin-process-isolation/checklist.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# Checklist
|
||||
|
||||
- [x] `plugin.json` 缺省时仍默认为 `in-proc`
|
||||
- [x] 非法 `runtime.mode` 会给出清晰错误
|
||||
- [x] SDK 中已有 Worker 入口和隔离运行模式的公共接口
|
||||
- [x] IPC 契约已拆到独立工程,且不引用 Avalonia
|
||||
- [x] IPC 封装层已集中环境变量、启动参数和通知路由常量
|
||||
- [x] 架构文档已写明一期 `isolated-background`、二期 `isolated-window`
|
||||
- [x] 架构文档已写明 `IPluginExportRegistry` / `IPluginMessageBus` 不再作为隔离插件主边界
|
||||
- [x] 文档已写明 ClassIsland 的借鉴点与取舍
|
||||
- [ ] Host 在 Worker 崩溃时仅降级插件且不中断主程序
|
||||
- [ ] `isolated-background` 的组件、编辑器、设置页完成真实 IPC 回路
|
||||
41
.trae/specs/plugin-process-isolation/spec.md
Normal file
41
.trae/specs/plugin-process-isolation/spec.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# Plugin Process Isolation
|
||||
|
||||
## Why
|
||||
|
||||
现有插件体系仍是“同进程 + AssemblyLoadContext 隔离”,无法阻止插件 fatal crash 拖垮 Host,也无法阻止插件直接访问 Host 进程内对象和内存。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 增加插件运行模式概念:`in-proc`、`isolated-background`、`isolated-window`
|
||||
- 一期落地 `isolated-background`
|
||||
- 新建独立 IPC 契约包和 IPC 封装包
|
||||
- 在 `PluginSdk` 中新增 Worker 入口与 `runtime.mode`
|
||||
- 明确隔离模式下不再兼容对象实例共享型 API
|
||||
- 新增正式架构文档说明 UI 方案、迁移策略、残余风险和 ClassIsland 借鉴
|
||||
|
||||
## Impact
|
||||
|
||||
- `LanMountainDesktop.PluginSdk/`
|
||||
- `LanMountainDesktop.PluginTemplate/`
|
||||
- 新增 `LanMountainDesktop.PluginIsolation.Contracts/`
|
||||
- 新增 `LanMountainDesktop.PluginIsolation.Ipc/`
|
||||
- `docs/ARCHITECTURE.md`
|
||||
- `docs/PLUGIN_PROCESS_ISOLATION_ARCHITECTURE.md`
|
||||
|
||||
## Requirements
|
||||
|
||||
### Requirement 1
|
||||
|
||||
宿主必须同时支持存量 `in-proc` 插件与未来的隔离插件,不得以本次改造打断旧插件加载。
|
||||
|
||||
### Requirement 2
|
||||
|
||||
隔离插件的 Host/Worker 通信必须基于显式 IPC 路由和 DTO,而不是 Host 服务对象实例共享。
|
||||
|
||||
### Requirement 3
|
||||
|
||||
一期必须把后台逻辑隔离为独立 Worker 进程,并显式记录 Host UI 壳层的残余风险。
|
||||
|
||||
### Requirement 4
|
||||
|
||||
仓库文档必须把 ClassIsland IPC 的借鉴点和不照搬的部分写清楚,避免后续实现阶段误把插件协议做成远程对象模型。
|
||||
12
.trae/specs/plugin-process-isolation/tasks.md
Normal file
12
.trae/specs/plugin-process-isolation/tasks.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# Tasks
|
||||
|
||||
- [x] 梳理现有插件运行时、组件注册、设置页和共享对象边界
|
||||
- [x] 形成插件进程隔离架构文档
|
||||
- [x] 在 `.trae/specs/plugin-process-isolation/` 下补齐 spec、tasks、checklist
|
||||
- [x] 在 `PluginSdk` 中增加 `runtime.mode`、Worker 入口接口和运行模式枚举
|
||||
- [x] 新建 `LanMountainDesktop.PluginIsolation.Contracts`,沉淀纯 DTO、路由常量、错误码与 JSON context
|
||||
- [x] 新建 `LanMountainDesktop.PluginIsolation.Ipc`,沉淀 ClassIsland 风格的 IPC 包装外壳
|
||||
- [x] 更新插件模板 `plugin.json`,让新插件默认显式声明 `in-proc`
|
||||
- [ ] 在 Host 侧接入真实 Worker 进程拉起与 dotnetCampus.Ipc 传输绑定
|
||||
- [ ] 为 `isolated-background` 构建 Host UI 壳层适配器
|
||||
- [ ] 为故障、心跳、降级与恢复补齐端到端测试
|
||||
5
.trae/specs/runtime-packaging-fix/checklist.md
Normal file
5
.trae/specs/runtime-packaging-fix/checklist.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Runtime Packaging Fix Checklist
|
||||
|
||||
- [x] `dotnet build LanMountainDesktop.slnx -c Debug -v minimal` succeeds.
|
||||
- [x] Runtime probe, AirAppHost startup, and packaging policy tests pass.
|
||||
- [ ] Full `win-x64` package dry run completes without timeout.
|
||||
12
.trae/specs/runtime-packaging-fix/spec.md
Normal file
12
.trae/specs/runtime-packaging-fix/spec.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# Runtime Packaging Fix
|
||||
|
||||
Windows releases use the launcher as the only self-contained bootstrapper. The
|
||||
desktop host and AirAppHost are framework-dependent and rely on an
|
||||
architecture-matched .NET 10 Desktop Runtime installed by the Inno setup flow.
|
||||
|
||||
Acceptance:
|
||||
|
||||
- Windows installer payload does not bundle .NET shared runtime files.
|
||||
- Inno Setup downloads and silently installs the matching .NET 10 Desktop Runtime.
|
||||
- Launcher blocks framework-dependent host startup with `dotnet_runtime_missing` when the runtime is unavailable.
|
||||
- AirAppHost startup uses packaged executables or an explicit architecture-matched dotnet host for DLL fallback.
|
||||
7
.trae/specs/runtime-packaging-fix/tasks.md
Normal file
7
.trae/specs/runtime-packaging-fix/tasks.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Runtime Packaging Fix Tasks
|
||||
|
||||
- [x] Add launcher-side .NET runtime probe and host startup guard.
|
||||
- [x] Update AirAppHost process start behavior for packaged exe and DLL fallback.
|
||||
- [x] Update Windows packaging scripts and CI release workflow.
|
||||
- [x] Update Inno Setup prerequisite download/install flow.
|
||||
- [x] Add regression tests and runtime packaging documentation.
|
||||
25
.trae/specs/settings-window-fluent-shell-redesign/spec.md
Normal file
25
.trae/specs/settings-window-fluent-shell-redesign/spec.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Settings Window Fluent Shell Redesign
|
||||
|
||||
## Goal
|
||||
|
||||
Rebuild the settings window as an independent Fluent shell with a custom titlebar, titlebar hamburger menu, persistent side navigation, search, and Avalonia-standard system material support.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Keep the existing independent settings-window lifecycle: open-or-focus, no owner anchor, own taskbar entry.
|
||||
- Use a 48 DIP titlebar with Back, pane toggle, icon/title, search, restart action, more menu, and caption-button spacer.
|
||||
- Keep `FANavigationView` as the primary navigation surface with `OpenPaneLength` around 283 DIP.
|
||||
- Move the compact/minimal pane toggle from the navigation footer into the titlebar.
|
||||
- Add search over built-in settings pages and settings expanders; selecting a result navigates, expands, focuses, and highlights.
|
||||
- Add `auto` system material mode and make it the default.
|
||||
- Implement material with Avalonia `TransparencyLevelHint` only.
|
||||
- Preserve settings page layout as direct `ScrollViewer -> StackPanel -> FASettingsExpander` content.
|
||||
- Follow `docs/VISUAL_SPEC.md`, `docs/CORNER_RADIUS_SPEC.md`, and `docs/ai/SETTINGS_WINDOW_DESIGN.md`.
|
||||
|
||||
## Acceptance
|
||||
|
||||
- `dotnet build LanMountainDesktop.slnx -c Debug` succeeds.
|
||||
- `dotnet test LanMountainDesktop.slnx -c Debug` succeeds or any unrelated failures are documented.
|
||||
- The settings window can navigate by sidebar, titlebar Back, titlebar pane toggle, and search.
|
||||
- Appearance settings expose Auto, None, Mica, and/or Acrylic according to system support.
|
||||
- Existing dirty user changes are not reverted.
|
||||
13
.trae/specs/settings-window-fluent-shell-redesign/tasks.md
Normal file
13
.trae/specs/settings-window-fluent-shell-redesign/tasks.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# Tasks
|
||||
|
||||
- [x] Analyze current `SettingsWindow`, appearance theme service, and existing settings page layout.
|
||||
- [x] Compare ClassIsland `SettingsWindowNew` and SecRandom v3 Avalonia `SettingsView`.
|
||||
- [x] Replace footer fallback pane toggle with titlebar pane toggle.
|
||||
- [x] Add titlebar Back, search, restart, and more-options controls.
|
||||
- [x] Add settings navigation history.
|
||||
- [x] Add settings search service and result highlight.
|
||||
- [x] Add `auto` system material mode and Avalonia `TransparencyLevelHint` priority.
|
||||
- [x] Update appearance settings options and localization.
|
||||
- [x] Add focused tests for material normalization and search filtering.
|
||||
- [x] Add design/spec documentation.
|
||||
- [ ] Run full app manually on Windows 11 and Windows 10 to verify actual Mica/Acrylic backdrops.
|
||||
25
.trae/specs/update-settings-fluent-controls/spec.md
Normal file
25
.trae/specs/update-settings-fluent-controls/spec.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Update Settings Fluent Controls
|
||||
|
||||
## Goal
|
||||
|
||||
Make the Settings > Update page the single user-facing control surface for the host update flow.
|
||||
|
||||
## Requirements
|
||||
|
||||
- The page uses Fluent Avalonia settings controls for update status, release facts, update behavior, and transfer controls.
|
||||
- Users can choose update channel, download source, update mode, and download thread count.
|
||||
- Update mode options are:
|
||||
- Manual: do not automatically download or install.
|
||||
- Silent Download: check and download in the background, then wait for user installation confirmation.
|
||||
- Silent Install: check and download in the background, then apply when the app exits.
|
||||
- Users can opt into forced reinstall. When enabled, the update check targets the current version manifest where available and the UI labels the next payload as reinstall.
|
||||
- The page displays whether the current payload is an incremental update or reinstall/full installer.
|
||||
- The page exposes pause, resume, and cancel actions for resumable downloads and install recovery.
|
||||
- Existing PloNDS/FileMap incremental update and Launcher rollback ownership remain unchanged.
|
||||
|
||||
## Acceptance
|
||||
|
||||
- `UpdateSettingsPage` shows Fluent Avalonia controls for channel, mode, thread count, forced reinstall, pause/resume, and cancel.
|
||||
- `UpdateSettingsState` persists forced reinstall alongside other update preferences.
|
||||
- Automatic startup checks skip manual mode, download in silent download/silent install modes, and leave installation to explicit user action or exit-time apply.
|
||||
- Build succeeds for `LanMountainDesktop.slnx`.
|
||||
5
.trae/specs/velopack-update-integration/checklist.md
Normal file
5
.trae/specs/velopack-update-integration/checklist.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Checklist (Deprecated)
|
||||
|
||||
- [x] Spec marked as deprecated.
|
||||
- [x] Active implementation ownership moved to `pdc-incremental-migration`.
|
||||
- [x] No release workflow dependency remains on VeloPack.
|
||||
15
.trae/specs/velopack-update-integration/spec.md
Normal file
15
.trae/specs/velopack-update-integration/spec.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# VeloPack Update Integration (Deprecated)
|
||||
|
||||
## Status
|
||||
|
||||
This spec is deprecated and superseded by `.trae/specs/pdc-incremental-migration/`.
|
||||
|
||||
## Deprecation Reason
|
||||
|
||||
- VeloPack native package generation introduced unstable release blocking (version format coupling and platform divergence).
|
||||
- The project has switched back to signed FileMap incremental assets as the primary update path.
|
||||
- Launcher remains the update installer/rollback authority; packaging and distribution are being migrated to PDC/S3-compatible flows.
|
||||
|
||||
## Migration Note
|
||||
|
||||
Use `.trae/specs/pdc-incremental-migration/spec.md` as the active authority for incremental update implementation and acceptance.
|
||||
6
.trae/specs/velopack-update-integration/tasks.md
Normal file
6
.trae/specs/velopack-update-integration/tasks.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# Tasks (Deprecated)
|
||||
|
||||
- [x] Mark VeloPack integration spec as deprecated.
|
||||
- [x] Remove VeloPack runtime branches from launcher/host update path.
|
||||
- [x] Remove VeloPack release workflow packaging steps.
|
||||
- [ ] Keep archive for historical context only (no new implementation tasks here).
|
||||
7
.trae/specs/window-layer-isolation/checklist.md
Normal file
7
.trae/specs/window-layer-isolation/checklist.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Checklist
|
||||
|
||||
- [x] Air APP window code does not call fused desktop bottom-most APIs.
|
||||
- [x] Air APP window code does not set `Topmost = true`.
|
||||
- [x] Fused desktop overlay and widget windows still use bottom-most APIs.
|
||||
- [x] Fused desktop widget reload path refreshes desktop layer after showing.
|
||||
- [ ] Manual Windows z-order verification with fused desktop and Air APP windows.
|
||||
18
.trae/specs/window-layer-isolation/spec.md
Normal file
18
.trae/specs/window-layer-isolation/spec.md
Normal file
@@ -0,0 +1,18 @@
|
||||
# Window Layer Isolation
|
||||
|
||||
## Goal
|
||||
|
||||
Keep fused desktop component windows and Air APP windows in separate z-order roles.
|
||||
|
||||
## Behavior
|
||||
|
||||
- Fused desktop windows are desktop-surface windows. They may use `IWindowBottomMostService` and region passthrough, must stay attached to the Windows desktop icon host when supported, and must not cover ordinary apps.
|
||||
- Air APP windows are ordinary application windows. They must not use the fused desktop bottom-most service, must not attach to the desktop icon host, and must not use global `Topmost` promotion.
|
||||
- Re-showing or reloading fused desktop widgets refreshes their desktop layer after the window is visible.
|
||||
- Air APP activation uses normal window activation; repeated-open foreground recovery remains owned by Launcher lifecycle activation.
|
||||
|
||||
## Out of Scope
|
||||
|
||||
- Changing Air APP lifecycle IPC.
|
||||
- Changing whiteboard note sharing.
|
||||
- Implementing third-party Air APP SDK behavior.
|
||||
7
.trae/specs/window-layer-isolation/tasks.md
Normal file
7
.trae/specs/window-layer-isolation/tasks.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Tasks
|
||||
|
||||
- [x] Remove Air APP `Topmost` promotion from `AirAppWindow`.
|
||||
- [x] Add explicit desktop-layer refresh for fused desktop widget windows.
|
||||
- [x] Refresh fused desktop widget windows after show/reload.
|
||||
- [x] Add window-role diagnostics for desktop-surface and Air APP windows.
|
||||
- [x] Add static regression tests for window-layer isolation.
|
||||
24
.trae/specs/window-slide-transition/checklist.md
Normal file
24
.trae/specs/window-slide-transition/checklist.md
Normal file
@@ -0,0 +1,24 @@
|
||||
* [x] AppSettingsSnapshot 包含 EnableSlideTransition 字段且默认为 false
|
||||
|
||||
* [x] DesktopPage 拥有名为 DesktopPageSlideTransform 的 TranslateTransform
|
||||
|
||||
* [x] DesktopPage.Transitions 包含 Opacity 和 TranslateTransform.X 两个 DoubleTransition
|
||||
|
||||
* [x] 点击"回到 Windows"时播放退场动画(Opacity 淡出 或 Opacity+滑动),动画完成后再最小化
|
||||
|
||||
* [x] 从最小化恢复时 DesktopPage 先以 Opacity=0 遮住 Normal 中间态,FullScreen 生效后播放入场动画
|
||||
|
||||
* [x] 动画期间 DesktopPage.IsHitTestVisible 为 false,动画完成后恢复
|
||||
|
||||
* [x] 动画期间 OnWindowPropertyChanged 不执行强制全屏纠正
|
||||
|
||||
* [x] 快速连续操作不会导致动画冲突
|
||||
|
||||
* [x] GeneralSettingsPage 在 Windows 平台显示"滑入滑出过渡效果"开关
|
||||
|
||||
* [x] GeneralSettingsPage 在非 Windows 平台不显示该开关
|
||||
|
||||
* [x] EnableSlideTransition 设置持久化到 AppSettingsSnapshot 且立即生效
|
||||
|
||||
* [x] dotnet build 无编译错误
|
||||
|
||||
147
.trae/specs/window-slide-transition/spec.md
Normal file
147
.trae/specs/window-slide-transition/spec.md
Normal file
@@ -0,0 +1,147 @@
|
||||
# 窗口过渡动画 Spec
|
||||
|
||||
## Why
|
||||
|
||||
当前全屏窗口在"回到 Windows"(最小化)和"恢复应用"时存在严重的视觉问题:
|
||||
1. 恢复时经历 `Minimized → Normal → FullScreen` 两步跳变,用户会短暂看到无框小窗口
|
||||
2. 状态切换无任何过渡动画,体验生硬
|
||||
3. `OnWindowPropertyChanged` 使用 `Dispatcher.UIThread.Post` 延迟纠正,进一步延长了 Normal 中间态的可见时间
|
||||
|
||||
## What Changes
|
||||
|
||||
- 在 `MainWindow.axaml` 的 `DesktopPage` 上添加 `TranslateTransform` 和 `TranslateTransform.X` 过渡动画
|
||||
- 修改 `MainWindow.axaml.cs` 的 `OnMinimizeClick`,实现退场动画(滑出/淡出 → 最小化)
|
||||
- 修改 `App.axaml.cs` 的 `RestoreOrCreateMainWindow`,实现入场动画(全屏 → 滑入/淡入)
|
||||
- 修改 `MainWindow.axaml.cs` 的 `OnWindowPropertyChanged`,在动画期间暂停强制全屏逻辑
|
||||
- 在 `AppSettingsSnapshot` 中添加 `EnableSlideTransition` 设置项(默认关闭)
|
||||
- 在 `GeneralSettingsPageViewModel` 中添加对应 ViewModel 属性
|
||||
- 在 `GeneralSettingsPage.axaml` 中添加开关 UI(仅 Windows 平台显示)
|
||||
- 添加平台检测逻辑:Windows 且开启设置时使用滑入滑出,其他情况使用 Opacity 淡入淡出
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs: 窗口生命周期过渡动画
|
||||
- Affected code:
|
||||
- `LanMountainDesktop/Views/MainWindow.axaml` - DesktopPage 添加 TranslateTransform
|
||||
- `LanMountainDesktop/Views/MainWindow.axaml.cs` - OnMinimizeClick、OnWindowPropertyChanged、新增动画方法
|
||||
- `LanMountainDesktop/App.axaml.cs` - RestoreOrCreateMainWindow、OnMainWindowPropertyChanged
|
||||
- `LanMountainDesktop/Models/AppSettingsSnapshot.cs` - 新增 EnableSlideTransition 字段
|
||||
- `LanMountainDesktop/ViewModels/SettingsViewModels.cs` - GeneralSettingsPageViewModel 新增属性
|
||||
- `LanMountainDesktop/Views/SettingsPages/GeneralSettingsPage.axaml` - 新增开关 UI
|
||||
|
||||
---
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: 窗口退场过渡动画
|
||||
|
||||
系统 SHALL 在主窗口最小化/隐藏时播放退场过渡动画,消除窗口状态跳变的视觉闪烁。
|
||||
|
||||
#### Scenario: Opacity 淡出退场(所有平台默认)
|
||||
- **WHEN** 用户点击"回到 Windows"或触发最小化
|
||||
- **THEN** 系统将 `DesktopPage.Opacity` 设为 0,触发淡出动画
|
||||
- **AND THEN** 动画完成后执行 `WindowState = Minimized`
|
||||
- **AND THEN** 最小化完成后重置 `DesktopPage.Opacity = 1`(窗口已不可见)
|
||||
|
||||
#### Scenario: 滑出退场(Windows + 开启设置)
|
||||
- **WHEN** 用户点击"回到 Windows"且运行在 Windows 平台且已开启滑入滑出设置
|
||||
- **THEN** 系统同时将 `DesktopPage.Opacity` 设为 0 且 `DesktopPageSlideTransform.X` 设为屏幕宽度
|
||||
- **AND THEN** 动画完成后执行 `WindowState = Minimized`
|
||||
- **AND THEN** 最小化完成后重置 `DesktopPageSlideTransform.X = 0` 和 `DesktopPage.Opacity = 1`
|
||||
|
||||
### Requirement: 窗口入场过渡动画
|
||||
|
||||
系统 SHALL 在主窗口恢复时播放入场过渡动画,消除 Normal 中间态的视觉闪烁。
|
||||
|
||||
#### Scenario: Opacity 淡入入场(所有平台默认)
|
||||
- **WHEN** 主窗口从最小化/隐藏状态恢复
|
||||
- **THEN** 系统先将 `DesktopPage.Opacity` 设为 0(遮住 Normal 中间态)
|
||||
- **AND THEN** 完成 `Minimized → Normal → FullScreen` 状态切换
|
||||
- **AND THEN** 等 FullScreen 状态生效后将 `DesktopPage.Opacity` 设为 1,触发淡入动画
|
||||
|
||||
#### Scenario: 滑入入场(Windows + 开启设置)
|
||||
- **WHEN** 主窗口从最小化/隐藏状态恢复且运行在 Windows 平台且已开启滑入滑出设置
|
||||
- **THEN** 系统先将 `DesktopPage.Opacity` 设为 0 且 `DesktopPageSlideTransform.X` 设为屏幕宽度
|
||||
- **AND THEN** 完成 `Minimized → Normal → FullScreen` 状态切换
|
||||
- **AND THEN** 等 FullScreen 状态生效后同时将 `DesktopPage.Opacity` 设为 1 且 `DesktopPageSlideTransform.X` 设为 0,触发滑入+淡入组合动画
|
||||
|
||||
### Requirement: 动画期间交互保护
|
||||
|
||||
系统 SHALL 在过渡动画播放期间防止用户交互和状态冲突。
|
||||
|
||||
#### Scenario: 动画期间禁止交互
|
||||
- **WHEN** 退场或入场动画正在播放
|
||||
- **THEN** `DesktopPage.IsHitTestVisible` 设为 `false`
|
||||
- **AND THEN** 动画完成后恢复为 `true`
|
||||
|
||||
#### Scenario: 动画期间暂停强制全屏
|
||||
- **WHEN** 入场动画正在播放且窗口临时处于 Normal 状态
|
||||
- **THEN** `OnWindowPropertyChanged` 不执行强制全屏纠正
|
||||
- **AND THEN** 入场动画完成后恢复正常强制全屏逻辑
|
||||
|
||||
#### Scenario: 防止快速连续操作
|
||||
- **WHEN** 用户在动画播放期间再次触发最小化或恢复
|
||||
- **THEN** 系统忽略重复操作,避免动画冲突
|
||||
|
||||
### Requirement: 滑入滑出设置项
|
||||
|
||||
系统 SHALL 在基本设置页面提供"滑入滑出过渡效果"开关,仅 Windows 平台可见。
|
||||
|
||||
#### Scenario: 设置项可见性
|
||||
- **WHEN** 用户在 Windows 平台打开基本设置页面
|
||||
- **THEN** 显示"滑入滑出过渡效果"开关
|
||||
- **WHEN** 用户在非 Windows 平台打开基本设置页面
|
||||
- **THEN** 不显示该开关
|
||||
|
||||
#### Scenario: 设置项默认值
|
||||
- **WHEN** 用户首次安装应用
|
||||
- **THEN** `EnableSlideTransition` 默认为 `false`
|
||||
|
||||
#### Scenario: 设置持久化
|
||||
- **WHEN** 用户切换"滑入滑出过渡效果"开关
|
||||
- **THEN** 设置值立即持久化到 `AppSettingsSnapshot.EnableSlideTransition`
|
||||
- **AND THEN** 下次窗口过渡时立即生效,无需重启
|
||||
|
||||
### Requirement: DesktopPage TranslateTransform 声明
|
||||
|
||||
系统 SHALL 在 `DesktopPage` 上声明 `TranslateTransform` 和对应的过渡动画。
|
||||
|
||||
#### Scenario: XAML 声明
|
||||
- **WHEN** MainWindow 初始化
|
||||
- **THEN** `DesktopPage` 拥有名为 `DesktopPageSlideTransform` 的 `TranslateTransform`
|
||||
- **AND THEN** `DesktopPage.Transitions` 包含 `Opacity` 和 `TranslateTransform.X` 两个过渡
|
||||
- **AND THEN** 过渡时长使用 `FluttermotionToken.Duration.Page`(320ms)和 `FluttermotionToken.Duration.Intro`(400ms)
|
||||
- **AND THEN** 缓动函数使用 `0.05,0.75,0.10,1.00`(DecelerateBezier)
|
||||
|
||||
### Requirement: 设置窗口不参与桌面壳过渡动画
|
||||
|
||||
系统 SHALL 将桌面壳进出场动画限制在主窗口范围内,不影响独立设置窗口。
|
||||
|
||||
#### Scenario: 设置窗口在桌面动画期间保持独立
|
||||
- **WHEN** 主窗口执行滑入、滑出、最小化或恢复动画
|
||||
- **THEN** 设置窗口不参与该动画
|
||||
- **AND THEN** 设置窗口不会跟随主窗口一起隐藏、最小化或重定位
|
||||
|
||||
## MODIFIED Requirements
|
||||
|
||||
### Requirement: OnMinimizeClick 行为
|
||||
|
||||
**当前**: 直接设置 `WindowState = WindowState.Minimized`,无动画
|
||||
|
||||
**修改后**: 先播放退场动画,动画完成后再设置 `WindowState = WindowState.Minimized`
|
||||
|
||||
### Requirement: RestoreOrCreateMainWindow 行为
|
||||
|
||||
**当前**: `Show() → Normal → FullScreen`,无过渡动画,用户可见 Normal 中间态
|
||||
|
||||
**修改后**: 先将 `DesktopPage` 设为不可见(Opacity=0 + 可选滑出位),再执行状态切换,最后播放入场动画
|
||||
|
||||
### Requirement: OnWindowPropertyChanged 强制全屏逻辑
|
||||
|
||||
**当前**: 任何非 Minimized/FullScreen 状态立即纠正为 FullScreen
|
||||
|
||||
**修改后**: 动画期间允许临时 Normal 状态存在,动画完成后恢复强制全屏逻辑
|
||||
|
||||
## REMOVED Requirements
|
||||
|
||||
无移除的需求。
|
||||
52
.trae/specs/window-slide-transition/tasks.md
Normal file
52
.trae/specs/window-slide-transition/tasks.md
Normal file
@@ -0,0 +1,52 @@
|
||||
# Tasks
|
||||
|
||||
- [x] Task 1: 在 `AppSettingsSnapshot` 中添加 `EnableSlideTransition` 字段
|
||||
- [x] 添加 `public bool EnableSlideTransition { get; set; } = false;`
|
||||
- [x] 在 `Clone()` 方法中无需特殊处理(bool 是值类型)
|
||||
|
||||
- [x] Task 2: 在 `MainWindow.axaml` 的 `DesktopPage` 上添加 `TranslateTransform` 和过渡动画
|
||||
- [x] 添加 `<TranslateTransform />`
|
||||
- [x] 在 `Grid.Transitions` 中添加 `TranslateTransform.X` 的 `DoubleTransition`,使用 `FluttermotionToken.Duration.Intro` 和 DecelerateBezier 缓动
|
||||
|
||||
- [x] Task 3: 在 `MainWindow.axaml.cs` 中实现退场动画逻辑
|
||||
- [x] 添加 `_isSlideAnimationActive` 标志位
|
||||
- [x] 修改 `OnMinimizeClick`,调用新的 `SlideOutAndMinimizeAsync` 方法
|
||||
- [x] 实现 `SlideOutAndMinimizeAsync`:读取设置 → 播放退场动画(Opacity + 可选滑动)→ 等动画完成 → 最小化 → 重置位置
|
||||
- [x] 动画期间设置 `DesktopPage.IsHitTestVisible = false`
|
||||
|
||||
- [x] Task 4: 在 `MainWindow.axaml.cs` 中实现入场动画逻辑
|
||||
- [x] 添加 `public void PrepareEnterAnimation()` 方法:禁用过渡 → 设置初始位置(Opacity=0, X=屏幕宽度或0)→ 重新启用过渡
|
||||
- [x] 添加 `public void PlayEnterAnimation()` 方法:触发入场动画(Opacity=1, X=0)
|
||||
- [x] 添加 `private bool IsSlideTransitionEnabled()` 方法,从设置中读取
|
||||
|
||||
- [x] Task 5: 修改 `App.axaml.cs` 的 `RestoreOrCreateMainWindow`
|
||||
- [x] 在窗口状态切换前调用 `mainWindow.PrepareEnterAnimation()`
|
||||
- [x] 在 FullScreen 状态生效后调用 `mainWindow.PlayEnterAnimation()`
|
||||
|
||||
- [x] Task 6: 修改 `MainWindow.axaml.cs` 的 `OnWindowPropertyChanged`
|
||||
- [x] 当 `_isSlideAnimationActive` 为 true 时跳过强制全屏逻辑
|
||||
|
||||
- [x] Task 7: 在 `GeneralSettingsPageViewModel` 中添加 `EnableSlideTransition` 属性
|
||||
- [x] 添加 `[ObservableProperty] private bool _enableSlideTransition;`
|
||||
- [x] 添加 `OnEnableSlideTransitionChanged` 持久化方法
|
||||
- [x] 在构造函数和 `OnSettingsChanged` 中加载/同步该设置
|
||||
- [x] 添加 `IsSlideTransitionAvailable` 平台检测属性
|
||||
|
||||
- [x] Task 8: 在 `GeneralSettingsPage.axaml` 中添加"滑入滑出过渡效果"开关
|
||||
- [x] 在"运行时设置"分组中添加 `SettingsExpander`
|
||||
- [x] 仅 Windows 平台显示(使用 `IsVisible` 绑定到 `IsSlideTransitionAvailable`)
|
||||
- [x] 图标使用 `ArrowRight`
|
||||
|
||||
- [x] Task 9: 构建验证
|
||||
- [x] 执行 `dotnet build` 确保无编译错误
|
||||
|
||||
# Task Dependencies
|
||||
|
||||
- [Task 2] depends on [Task 1]
|
||||
- [Task 3] depends on [Task 1, Task 2]
|
||||
- [Task 4] depends on [Task 1, Task 2]
|
||||
- [Task 5] depends on [Task 4]
|
||||
- [Task 6] depends on [Task 3]
|
||||
- [Task 7] depends on [Task 1]
|
||||
- [Task 8] depends on [Task 7]
|
||||
- [Task 9] depends on [Task 3, Task 4, Task 5, Task 6, Task 7, Task 8]
|
||||
@@ -62,7 +62,10 @@ dotnet test LanMountainDesktop.slnx -c Debug
|
||||
### UI
|
||||
|
||||
- 主题、资源和视觉语义优先遵守 `docs/VISUAL_SPEC.md` 与 `docs/CORNER_RADIUS_SPEC.md`
|
||||
- **组件圆角**:所有内置与插件组件的根边框必须使用 `{DynamicResource DesignCornerRadiusComponent}` 资源。
|
||||
- **圆角规范 (AI 强制建议)**:
|
||||
- **桌面组件根容器**:必须且仅能使用 `{DynamicResource DesignCornerRadiusComponent}`。
|
||||
- **内部元素**:必须根据嵌套层级使用 `DesignCornerRadiusSm/Md/Lg` 等 Token,严禁硬编码像素值。
|
||||
- **禁止修改系数**:严禁在圆角资源上乘以任何 `scale` 变量,圆角现在由全局样式固定控制。
|
||||
- 设置页相关改动通常同时落在 `Views/`、`ViewModels/`、`Services/` 和 `.trae/specs/`
|
||||
- UI 启动与窗口生命周期主线在 `Program.cs` 和 `App.axaml.cs`
|
||||
|
||||
@@ -71,7 +74,7 @@ dotnet test LanMountainDesktop.slnx -c Debug
|
||||
- SDK 公共 API 以 `LanMountainDesktop.PluginSdk/` 为准
|
||||
- 共享契约以 `LanMountainDesktop.Shared.Contracts/` 为准
|
||||
- market 数据来源默认是兄弟仓库 `..\\LanAirApp`
|
||||
- 迁移或 breaking change 优先同步 `docs/PLUGIN_SDK_V4_MIGRATION.md`
|
||||
- 迁移或 breaking change 优先同步 `docs/PLUGIN_SDK_V5_MIGRATION.md`
|
||||
|
||||
### 设置与主题
|
||||
|
||||
@@ -88,6 +91,6 @@ dotnet test LanMountainDesktop.slnx -c Debug
|
||||
- 视觉规范:`docs/VISUAL_SPEC.md`
|
||||
- 圆角规范:`docs/CORNER_RADIUS_SPEC.md`
|
||||
- 生态边界:`docs/ECOSYSTEM_BOUNDARIES.md`
|
||||
- SDK v4 迁移:`docs/PLUGIN_SDK_V4_MIGRATION.md`
|
||||
- SDK v5 迁移:`docs/PLUGIN_SDK_V5_MIGRATION.md`
|
||||
|
||||
如果多个文档都提到同一件事,以 `docs/ai/DOC_SOURCES.md` 列出的权威来源为准。
|
||||
|
||||
237
CHANGELOG.md
Normal file
237
CHANGELOG.md
Normal file
@@ -0,0 +1,237 @@
|
||||
# 更新日志 / Changelog
|
||||
|
||||
## [0.8.4](https://github.com/yourorg/LanMountainDesktop/releases/tag/v0.8.4) - 2026-04-12
|
||||
|
||||
### 新增 (Added)
|
||||
|
||||
- ✨ **全新淡入淡出动画系统**: 引入了一套全新的淡入淡出动画效果
|
||||
- 提升界面切换和元素显示的视觉流畅度
|
||||
- 为用户带来更加自然优雅的交互体验
|
||||
|
||||
### 变更 (Changed)
|
||||
|
||||
- ♻️ **SDK 更新**: 更新插件 SDK,优化插件开发接口和兼容性
|
||||
- 🎨 **网速显示组件优化**: 优化了网速显示组件的显示效果
|
||||
- 改进数据展示方式,提升可读性
|
||||
- 优化视觉样式,与整体设计语言更加协调
|
||||
|
||||
### 修复 (Fixed)
|
||||
|
||||
- 无
|
||||
|
||||
### 移除 (Removed)
|
||||
|
||||
- 无
|
||||
|
||||
***
|
||||
|
||||
## [0.8.3.5](https://github.com/yourorg/LanMountainDesktop/releases/tag/v0.8.3.5) - 2026-04-12
|
||||
|
||||
### 新增 (Added)
|
||||
|
||||
- 无
|
||||
|
||||
### 变更 (Changed)
|
||||
|
||||
- ✨ **插件设置页面支持 View 展示**: 插件设置页面现在支持使用 View 进行展示
|
||||
- 插件开发者可以通过 View 自定义设置页面的 UI 和交互
|
||||
- 提供更灵活的设置页面展示方式,提升插件用户体验
|
||||
- 兼容原有的设置方式,平滑过渡
|
||||
- 🔧 **三指滑动与融合桌面功能开关位置调整**: 将三指滑动与融合桌面功能开关移动到了开发者设置界面
|
||||
- 优化设置页面结构,将高级功能集中管理
|
||||
- 普通用户界面更加简洁,开发者可在已有的开发者设置界面中访问相关设置
|
||||
|
||||
### 修复 (Fixed)
|
||||
|
||||
- 🐛 **快捷方式组件透明问题**: 修复了快捷方式组件无法正常透明的问题
|
||||
- 问题原因: 组件背景透明属性设置异常或渲染层级问题
|
||||
- 修复方案: 修正透明属性配置,确保快捷方式组件背景透明效果正常显示
|
||||
- 🐛 **插件无法正常升级问题**: 修复了插件无法正常升级的问题
|
||||
- 问题原因: 插件升级流程中存在异常,导致升级操作失败或中断
|
||||
- 修复方案: 修复插件升级逻辑,确保插件可以正常检测、下载和安装更新
|
||||
- 🐛 **开发者设置项持久化问题**: 修复了开发者设置项不能正确持久化的问题
|
||||
- 问题原因: 开发者设置项的保存或读取逻辑存在缺陷,导致设置无法正确保存或恢复
|
||||
- 修复方案: 修复设置持久化逻辑,确保开发者设置项能够正确保存并在重启后恢复
|
||||
|
||||
### 移除 (Removed)
|
||||
|
||||
- 🗑️ **不附带 .NET 10 依赖的轻量版安装包**: 移除了不附带 .NET 10 依赖的轻量版安装包
|
||||
- 简化版本发布和维护流程,统一提供完整依赖的安装包
|
||||
- 用户无需担心 .NET 运行时环境,安装后即可直接使用
|
||||
|
||||
***
|
||||
|
||||
## [0.8.3.4](https://github.com/yourorg/LanMountainDesktop/releases/tag/v0.8.3.4) - 2026-04-12
|
||||
|
||||
### 新增 (Added)
|
||||
|
||||
- 无
|
||||
|
||||
### 变更 (Changed)
|
||||
|
||||
- ♻️ **插件 SDK 更新**: 更新插件 SDK,优化插件开发接口和兼容性
|
||||
|
||||
### 修复 (Fixed)
|
||||
|
||||
- 🐛 **轻量版 .NET 依赖问题(实验性)**: 实验性修复了轻量版在 .NET 环境下的依赖问题
|
||||
- 问题原因: 轻量版与 .NET 的依赖兼容性存在冲突
|
||||
- 修复方案: 调整依赖配置,提升兼容性(实验性修复,持续观察中)
|
||||
|
||||
### 移除 (Removed)
|
||||
|
||||
- 无
|
||||
|
||||
***
|
||||
|
||||
## [0.8.3.3](https://github.com/yourorg/LanMountainDesktop/releases/tag/v0.8.3.3) - 2026-04-12
|
||||
|
||||
### 新增 (Added)
|
||||
|
||||
- ✨ **便签组件**: 全新便签组件上线,支持 Markdown 语法
|
||||
- 支持丰富的 Markdown 格式:标题、列表、加粗、斜体、代码块等
|
||||
- 便签内容自动保存,方便记录和管理日常备忘。丰富信息展示途径,让作业布置也可在阑山桌面完成。
|
||||
- ✨ **白板主题自适应笔色**: 白板功能新增主题自适应笔色支持
|
||||
- 根据当前主题自动调整画笔颜色,确保在不同主题下都有良好的书写体验
|
||||
- 深色主题下自动切换为浅色笔迹,浅色主题下使用深色笔迹
|
||||
|
||||
### 变更 (Changed)
|
||||
|
||||
- 🎨 **融合桌面设置组件库样式更新**: 优化融合桌面设置页面的组件库样式
|
||||
- 提升视觉一致性和用户体验
|
||||
- 统一组件风格,与整体设计语言保持协调
|
||||
|
||||
### 修复 (Fixed)
|
||||
|
||||
- 🐛 **白板无法使用问题**: 修复了白板功能无法正常使用的问题
|
||||
- 问题原因: 相关依赖或初始化逻辑异常导致白板功能失效
|
||||
- 修复方案: 修复了白板的依赖加载和初始化流程,恢复正常使用
|
||||
- 🐛 **央官网新闻组件显示问题**: 修复了央官网新闻组件的显示异常
|
||||
- 优化组件渲染逻辑,确保新闻内容正确展示
|
||||
- 🐛 **课程表组件显示问题**: 修复了课程表组件的显示异常
|
||||
- 优化组件布局和渲染,确保课程信息正确显示
|
||||
- 🐛 **轻量版 .NET 10 依赖问题(实验性)**: 实验性修复了轻量版在 .NET 10 环境下的依赖问题
|
||||
- 问题原因: 轻量版与 .NET 10 的依赖兼容性存在冲突
|
||||
- 修复方案: 调整依赖配置,提升与 .NET 10 的兼容性(实验性修复,持续观察中)
|
||||
|
||||
### 移除 (Removed)
|
||||
|
||||
- 无
|
||||
|
||||
***
|
||||
|
||||
## [0.8.3.2](https://github.com/yourorg/LanMountainDesktop/releases/tag/v0.8.3.2) - 2026-04-09
|
||||
|
||||
### 新增 (Added)
|
||||
|
||||
- ✨ **应用启动台图标卡片显示选项**: 新增应用启动台图标卡片显示设置
|
||||
- 用户可在设置中选择是否显示应用图标的专属卡片背景
|
||||
- 关闭后仅显示应用图标本身,更加简洁
|
||||
- 支持动态切换,实时预览效果
|
||||
|
||||
### 变更 (Changed)
|
||||
|
||||
- 无
|
||||
|
||||
### 修复 (Fixed)
|
||||
|
||||
- 🐛 **应用启动台文件夹应用数量限制**: 修复了应用启动台文件夹无法查看超过12个应用的问题
|
||||
- 问题原因: 文件夹弹窗未实现滚动功能,应用列表超出显示区域后被截断
|
||||
- 修复方案: 为文件夹内容区域添加滚动支持,允许用户滚动查看所有应用
|
||||
- 🐛 **电源菜单重启导致关机问题**: 修复了点击电源菜单"重启"选项却触发关机的问题
|
||||
- 问题原因: `SlideToShutDown.exe` 仅支持关机操作,不支持重启,错误地将其用于重启功能
|
||||
- 修复方案: 重启操作改为使用标准的二次确认对话框(所有平台统一),仅关机操作使用 SlideToShutDown 滑动界面
|
||||
- 🐛 **课表组件字体显示问题**: 修复了日间模式下课表组件字体颜色与背景色相近导致看不清的问题
|
||||
- 问题原因: 主题切换时增量更新逻辑未同步更新文字颜色
|
||||
- 修复方案: 在 `IncrementalUpdateItems()` 方法中同步更新课程项的文字颜色
|
||||
|
||||
### 移除 (Removed)
|
||||
|
||||
- 🗑️ **更新页面重复标题**: 移除了更新页面中重复的更新标题,优化页面布局
|
||||
|
||||
***
|
||||
|
||||
## [0.8.3.1](https://github.com/yourorg/LanMountainDesktop/releases/tag/v0.8.3.1) - 2026-04-08
|
||||
|
||||
### 新增 (Added)
|
||||
|
||||
- ✨ **快捷方式组件**: 新增快捷方式组件,可在阑山桌面内便捷打开系统应用与文件
|
||||
- 支持创建快捷方式,统一管理应用和文件
|
||||
- 提供单击打开和双击打开两种交互模式
|
||||
- 支持配置是否显示背景
|
||||
- 📝 初始化更新日志文档,为后续版本发布建立基础
|
||||
|
||||
### 变更 (Changed)
|
||||
|
||||
- 无
|
||||
|
||||
### 修复 (Fixed)
|
||||
|
||||
- 无
|
||||
|
||||
### 移除 (Removed)
|
||||
|
||||
- 无
|
||||
|
||||
***
|
||||
|
||||
所有重要的更改都将记录在此文件中。
|
||||
|
||||
格式基于 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.0.0/),
|
||||
并且本项目遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
|
||||
|
||||
***
|
||||
|
||||
## \[格式示例]
|
||||
|
||||
### 新增 (Added)
|
||||
|
||||
- 待发布的新功能
|
||||
|
||||
### 变更 (Changed)
|
||||
|
||||
- 待发布的变更
|
||||
|
||||
### 修复 (Fixed)
|
||||
|
||||
- 待发布的修复
|
||||
|
||||
### 移除 (Removed)
|
||||
|
||||
- 待发布的移除项
|
||||
|
||||
***
|
||||
|
||||
## 版本说明
|
||||
|
||||
### 版本号规则
|
||||
|
||||
本项目采用语义化版本号 `MAJOR.MINOR.PATCH.BUILD`:
|
||||
|
||||
- **MAJOR (主版本号)**: 不兼容的 API 修改
|
||||
- **MINOR (次版本号)**: 向下兼容的功能性新增
|
||||
- **PATCH (修订号)**: 向下兼容的问题修正
|
||||
- **BUILD (构建号)**: 内部构建版本,用于区分同一 PATCH 版本的不同构建
|
||||
|
||||
### 分类说明
|
||||
|
||||
- **新增 (Added)**: 新功能、新特性
|
||||
- **变更 (Changed)**: 对现有功能的变更
|
||||
- **修复 (Fixed)**: Bug 修复
|
||||
- **移除 (Removed)**: 移除的功能或特性
|
||||
|
||||
### 图例
|
||||
|
||||
- 🎉 **重大更新**: 重要功能或里程碑
|
||||
- ✨ **新功能**: 新增功能特性
|
||||
- 🐛 **Bug修复**: 问题修复
|
||||
- 🔧 **配置**: 配置相关变更
|
||||
- 📝 **文档**: 文档更新
|
||||
- 🎨 **样式**: UI/UX 改进
|
||||
- ♻️ **重构**: 代码重构
|
||||
- ⚡ **性能**: 性能优化
|
||||
- 🔒 **安全**: 安全相关
|
||||
- 🌐 **国际化**: 国际化/本地化
|
||||
|
||||
***
|
||||
|
||||
## 链接
|
||||
874
CODE_WIKI.md
Normal file
874
CODE_WIKI.md
Normal file
@@ -0,0 +1,874 @@
|
||||
# LanMountainDesktop Code Wiki
|
||||
|
||||
> 本文档是 LanMountainDesktop(阑山桌面)项目的结构化 Code Wiki,涵盖项目整体架构、主要模块职责、关键类与函数说明、依赖关系以及项目运行方式等关键信息。
|
||||
>
|
||||
> 生成日期:2026-05-07
|
||||
> 产品版本:1.0.0
|
||||
> Plugin SDK API 基线:5.0.0
|
||||
|
||||
---
|
||||
|
||||
## 目录
|
||||
|
||||
1. [项目概述](#1-项目概述)
|
||||
2. [整体架构](#2-整体架构)
|
||||
3. [项目结构与模块职责](#3-项目结构与模块职责)
|
||||
4. [关键类与函数说明](#4-关键类与函数说明)
|
||||
5. [依赖关系](#5-依赖关系)
|
||||
6. [项目运行方式](#6-项目运行方式)
|
||||
7. [启动流程详解](#7-启动流程详解)
|
||||
8. [插件系统架构](#8-插件系统架构)
|
||||
9. [数据流与交互模型](#9-数据流与交互模型)
|
||||
10. [测试体系](#10-测试体系)
|
||||
|
||||
---
|
||||
|
||||
## 1. 项目概述
|
||||
|
||||
### 1.1 产品定位
|
||||
|
||||
**阑山桌面(LanMountainDesktop)** 是一款跨平台桌面环境增强工具,基于 Avalonia UI 和 .NET 10 构建。
|
||||
|
||||
- **产品口号**:你的桌面,不止一面
|
||||
- **技术基线**:Avalonia UI + .NET 10
|
||||
- **支持平台**:Windows、Linux、macOS
|
||||
- **仓库角色**:桌面宿主、插件运行时、Plugin SDK 与共享契约的权威来源
|
||||
|
||||
### 1.2 目标用户
|
||||
|
||||
- **学生用户**:课程表、自习监测、计时、天气和日常信息聚合
|
||||
- **办公用户**:日历、资讯、最近文档、常用工具入口
|
||||
- **效率和美化爱好者**:自由布局、主题切换、插件扩展
|
||||
- **中文用户**:本地化界面、农历和节假日等本地语境支持
|
||||
|
||||
### 1.3 核心能力
|
||||
|
||||
- **桌面组件系统**:内置组件与扩展组件统一注册、统一放置约束
|
||||
- **插件系统**:宿主加载插件、整合设置页、组件与市场安装流
|
||||
- **外观系统**:主题、玻璃层级、圆角与颜色资源统一管理
|
||||
- **设置系统**:独立设置窗口、设置页注册与分域持久化
|
||||
- **跨平台运行**:基于 Avalonia 的桌面宿主运行在 Windows、Linux、macOS
|
||||
|
||||
### 1.4 生态边界
|
||||
|
||||
| 仓库 | 职责 |
|
||||
|------|------|
|
||||
| `LanMountainDesktop`(本仓库) | 宿主代码、插件运行时、SDK、共享契约、主题与设置基础设施 |
|
||||
| `LanAirApp`(兄弟仓库) | 插件市场元数据、开发者生态材料 |
|
||||
| `LanMountainDesktop.SamplePlugin` | 官方示例插件实现 |
|
||||
|
||||
---
|
||||
|
||||
## 2. 整体架构
|
||||
|
||||
### 2.1 架构分层
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────┐
|
||||
│ 用户界面层 (UI Layer) │
|
||||
│ Views/ │ ViewModels/ │ Theme/ │ Styles/ │ Localization/
|
||||
├─────────────────────────────────────────────────────────────┤
|
||||
│ 业务服务层 (Service Layer) │
|
||||
│ Services/ │ ComponentSystem/ │ DesktopEditing/ │ plugins/
|
||||
├─────────────────────────────────────────────────────────────┤
|
||||
│ 基础设施层 (Infrastructure) │
|
||||
│ DesktopHost/ │ Appearance/ │ Settings.Core/ │ Shared.IPC/
|
||||
├─────────────────────────────────────────────────────────────┤
|
||||
│ 抽象与契约层 (Abstractions) │
|
||||
│ Host.Abstractions/ │ Shared.Contracts/ │ PluginSdk/
|
||||
├─────────────────────────────────────────────────────────────┤
|
||||
│ 启动与更新层 (Launcher) │
|
||||
│ LanMountainDesktop.Launcher/ │
|
||||
└─────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
### 2.2 核心设计原则
|
||||
|
||||
1. **插件优先**:核心功能通过插件扩展,宿主提供运行时和基础设施
|
||||
2. **组件化桌面**:所有桌面元素都是组件,统一注册、统一放置
|
||||
3. **设置分域**:App / Launcher / ComponentInstance / Plugin 四级设置作用域
|
||||
4. **主题动态化**:支持 Material Design 3 动态配色、系统主题跟随
|
||||
5. **进程隔离预留**:当前为进程内加载,预留了隔离进程架构
|
||||
|
||||
---
|
||||
|
||||
## 3. 项目结构与模块职责
|
||||
|
||||
### 3.1 解决方案项目列表
|
||||
|
||||
| 项目路径 | 输出类型 | 主要职责 |
|
||||
|---------|---------|---------|
|
||||
| `LanMountainDesktop/` | WinExe | 主桌面宿主应用,包含 UI、服务、组件系统、插件运行时接入 |
|
||||
| `LanMountainDesktop.Launcher/` | WinExe | 启动器 - 负责 OOBE、Splash、版本管理、增量更新、插件安装 |
|
||||
| `LanMountainDesktop.PluginSdk/` | Library | 官方插件 SDK,定义插件可依赖的公开接口与打包行为 |
|
||||
| `LanMountainDesktop.Shared.Contracts/` | Library | 宿主与插件共享的稳定契约类型 |
|
||||
| `LanMountainDesktop.Shared.IPC/` | Library | 统一 IPC 基础,用于 Host 公共服务、Launcher/OOBE 启动通知、插件贡献的公共服务 |
|
||||
| `LanMountainDesktop.Appearance/` | Library | 主题、圆角、外观资源相关基础设施 |
|
||||
| `LanMountainDesktop.Settings.Core/` | Library | 设置域、持久化和设置基础抽象 |
|
||||
| `LanMountainDesktop.DesktopHost/` | Library | 桌面宿主流程与生命周期相关逻辑 |
|
||||
| `LanMountainDesktop.DesktopComponents.Runtime/` | Library | 组件运行时支撑能力 |
|
||||
| `LanMountainDesktop.Host.Abstractions/` | Library | 宿主侧抽象接口 |
|
||||
| `LanMountainDesktop.PluginIsolation.Contracts/` | Library | 插件隔离机制的传输无关 DTO、路由常量、错误码 |
|
||||
| `LanMountainDesktop.PluginIsolation.Ipc/` | Library | 插件隔离 IPC 外观,基于 dotnetCampus.Ipc |
|
||||
| `LanMountainDesktop.PluginTemplate/` | Library | `dotnet new lmd-plugin` 官方模板 |
|
||||
| `LanMountainDesktop.PluginUpgradeHelper/` | Library | 插件升级帮助程序 |
|
||||
| `LanMountainDesktop.Tests/` | Test | 宿主与 SDK 的测试项目 |
|
||||
|
||||
### 3.2 主宿主工程内部结构
|
||||
|
||||
```
|
||||
LanMountainDesktop/
|
||||
├── Program.cs # 进程启动主线
|
||||
├── App.axaml.cs # 应用初始化、主题、语言、托盘、插件运行时
|
||||
├── Views/ # 界面视图
|
||||
│ ├── MainWindow.axaml # 主窗口
|
||||
│ ├── SettingsWindow.axaml # 设置窗口
|
||||
│ ├── ComponentLibraryWindow.axaml # 组件库窗口
|
||||
│ ├── FusedDesktopComponentLibraryWindow.axaml # 融合桌面组件库
|
||||
│ ├── NotificationWindow.axaml # 通知窗口
|
||||
│ ├── TransparentOverlayWindow.axaml # 透明覆盖层窗口
|
||||
│ ├── SettingsPages/ # 设置页面
|
||||
│ ├── Components/ # 桌面组件视图
|
||||
│ └── ComponentEditors/ # 组件编辑器视图
|
||||
├── ViewModels/ # 视图模型
|
||||
│ ├── MainWindowViewModel.cs
|
||||
│ ├── ViewModelBase.cs
|
||||
│ └── ...
|
||||
├── Services/ # 业务服务层
|
||||
│ ├── AppearanceThemeService.cs # 外观主题服务
|
||||
│ ├── Settings/ # 设置相关服务
|
||||
│ ├── MaterialColorService.cs # Material 颜色服务
|
||||
│ ├── DesktopTrayService.cs # 桌面托盘服务
|
||||
│ ├── FusedDesktopManagerService.cs # 融合桌面管理
|
||||
│ └── ...
|
||||
├── ComponentSystem/ # 组件系统
|
||||
│ ├── ComponentRegistry.cs # 组件注册表
|
||||
│ ├── DesktopComponentDefinition.cs # 组件定义
|
||||
│ └── ...
|
||||
├── plugins/ # 插件运行时
|
||||
│ ├── PluginRuntimeService.cs # 插件运行时服务
|
||||
│ ├── PluginLoader.cs # 插件加载器
|
||||
│ └── ...
|
||||
├── Theme/ # 主题资源
|
||||
├── Styles/ # 样式规则
|
||||
├── DesktopEditing/ # 桌面布局编辑
|
||||
├── Localization/ # 本地化资源
|
||||
└── Models/ # 数据模型
|
||||
```
|
||||
|
||||
### 3.3 Launcher 工程结构
|
||||
|
||||
```
|
||||
LanMountainDesktop.Launcher/
|
||||
├── Program.cs # 启动器入口
|
||||
├── App.axaml.cs # 启动器应用初始化
|
||||
├── Views/ # 启动器视图
|
||||
│ ├── OobeWindow.axaml # 首次体验窗口
|
||||
│ └── SplashWindow.axaml # 启动动画窗口
|
||||
└── Services/ # 启动器服务
|
||||
├── DeploymentLocator.cs # 版本目录定位
|
||||
├── UpdateCheckService.cs # 更新检查
|
||||
├── UpdateEngineService.cs # 更新引擎
|
||||
├── LauncherFlowCoordinator.cs # 流程协调器
|
||||
├── OobeStateService.cs # OOBE 状态管理
|
||||
├── PluginInstallerService.cs # 插件安装
|
||||
└── PluginUpgradeQueueService.cs # 插件升级队列
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. 关键类与函数说明
|
||||
|
||||
### 4.1 应用程序入口与生命周期
|
||||
|
||||
#### `Program`(LanMountainDesktop/Program.cs)
|
||||
|
||||
**职责**:应用程序入口点,负责启动初始化、单实例控制、资源加载、渲染模式配置、日志初始化。
|
||||
|
||||
**关键属性**:
|
||||
|
||||
```csharp
|
||||
internal static string StartupRenderMode { get; private set; } = AppRenderingModeHelper.Default;
|
||||
```
|
||||
|
||||
**关键方法**:
|
||||
|
||||
| 方法 | 签名 | 说明 |
|
||||
|------|------|------|
|
||||
| `Main` | `public static void Main(string[] args)` | 应用入口,初始化日志、单实例、遥测,构建 Avalonia AppBuilder |
|
||||
| `BuildAvaloniaApp` | `public static AppBuilder BuildAvaloniaApp(string renderMode)` | 构建 Avalonia 应用,配置 Win32 渲染模式 |
|
||||
| `AcquireSingleInstance` | `private static SingleInstanceService AcquireSingleInstance(int? restartParentProcessId)` | 获取单实例锁,支持重启场景 |
|
||||
| `LoadConfiguredRenderMode` | `private static string LoadConfiguredRenderMode()` | 从设置加载配置的渲染模式 |
|
||||
| `RegisterGlobalExceptionLogging` | `private static void RegisterGlobalExceptionLogging()` | 注册全局未处理异常日志和遥测 |
|
||||
|
||||
#### `App`(LanMountainDesktop/App.axaml.cs)
|
||||
|
||||
**职责**:应用启动和生命周期管理,包含应用初始化、主窗口管理、插件运行时初始化、主题设置、设置系统初始化。
|
||||
|
||||
**关键属性**:
|
||||
|
||||
```csharp
|
||||
internal static SingleInstanceService? CurrentSingleInstanceService { get; set; }
|
||||
internal static IHostApplicationLifecycle? CurrentHostApplicationLifecycle { get; }
|
||||
internal static INotificationService? CurrentNotificationService { get; }
|
||||
public PluginRuntimeService? PluginRuntimeService => _pluginRuntimeService;
|
||||
public ISettingsFacadeService SettingsFacade => _settingsFacade;
|
||||
```
|
||||
|
||||
**关键方法**:
|
||||
|
||||
| 方法 | 签名 | 说明 |
|
||||
|------|------|------|
|
||||
| `Initialize` | `public override void Initialize()` | 初始化应用资源、主题、语言、设置服务 |
|
||||
| `OnFrameworkInitializationCompleted` | `public override void OnFrameworkInitializationCompleted()` | 框架初始化完成后调用,初始化 IPC、桌面壳层 |
|
||||
| `InitializeDesktopShell` | `private void InitializeDesktopShell()` | 初始化桌面壳层,包括插件运行时、托盘、主窗口 |
|
||||
| `OpenIndependentSettingsModule` | `internal void OpenIndependentSettingsModule(string source, string? pageTag)` | 打开独立设置窗口 |
|
||||
| `ActivateMainWindow` | `internal void ActivateMainWindow()` | 激活主窗口 |
|
||||
|
||||
### 4.2 插件系统
|
||||
|
||||
#### `PluginRuntimeService`(LanMountainDesktop/plugins/PluginRuntimeService.cs)
|
||||
|
||||
**职责**:插件系统的核心运行时类,负责插件的加载、卸载、管理、依赖注入、插件贡献点注册。
|
||||
|
||||
**关键属性**:
|
||||
|
||||
```csharp
|
||||
public string PluginsDirectory { get; } // 插件目录路径
|
||||
public IReadOnlyList<LoadedPlugin> LoadedPlugins { get; } // 已加载插件列表
|
||||
public IReadOnlyList<PluginLoadResult> LoadResults { get; } // 加载结果列表
|
||||
public IReadOnlyList<PluginCatalogEntry> Catalog { get; } // 插件目录
|
||||
public IReadOnlyList<PluginSettingsSectionContribution> SettingsSections { get; } // 设置页贡献
|
||||
public IReadOnlyList<PluginDesktopComponentContribution> DesktopComponents { get; } // 组件贡献
|
||||
public IReadOnlyList<PluginDesktopComponentEditorContribution> DesktopComponentEditors { get; } // 编辑器贡献
|
||||
```
|
||||
|
||||
**关键方法**:
|
||||
|
||||
| 方法 | 签名 | 说明 |
|
||||
|------|------|------|
|
||||
| `LoadInstalledPlugins` | `public void LoadInstalledPlugins()` | 加载所有已安装插件 |
|
||||
| `SetPluginEnabled` | `public bool SetPluginEnabled(string pluginId, bool isEnabled)` | 启用/禁用插件 |
|
||||
| `InstallPluginPackage` | `public PluginManifest InstallPluginPackage(string packagePath)` | 安装插件包(.laapp) |
|
||||
| `DeleteInstalledPlugin` | `public bool DeleteInstalledPlugin(string pluginId)` | 删除已安装插件 |
|
||||
|
||||
#### `IPlugin`(LanMountainDesktop.PluginSdk/IPlugin.cs)
|
||||
|
||||
**职责**:插件接口,定义了插件的基本生命周期和能力。插件必须实现此接口以被宿主识别和加载。
|
||||
|
||||
```csharp
|
||||
public interface IPlugin
|
||||
{
|
||||
void Initialize(HostBuilderContext context, IServiceCollection services);
|
||||
}
|
||||
```
|
||||
|
||||
#### `PluginBase`(LanMountainDesktop.PluginSdk/PluginBase.cs)
|
||||
|
||||
**职责**:插件基类,提供了插件开发的基础实现。
|
||||
|
||||
```csharp
|
||||
public abstract class PluginBase : IPlugin
|
||||
{
|
||||
public virtual void Initialize(HostBuilderContext context, IServiceCollection services) { }
|
||||
}
|
||||
```
|
||||
|
||||
#### `PluginManifest`(LanMountainDesktop.PluginSdk/PluginManifest.cs)
|
||||
|
||||
**职责**:插件清单信息类,包含插件的元数据。
|
||||
|
||||
```csharp
|
||||
public sealed record PluginManifest(
|
||||
string Id, // 插件唯一标识
|
||||
string Name, // 插件名称
|
||||
string EntranceAssembly, // 入口程序集
|
||||
string? Description = null, // 描述
|
||||
string? Author = null, // 作者
|
||||
string? Version = null, // 版本
|
||||
string? ApiVersion = null, // API 版本
|
||||
IReadOnlyList<PluginSharedContractReference>? SharedContracts = null,
|
||||
PluginRuntimeConfiguration? Runtime = null)
|
||||
```
|
||||
|
||||
**关键方法**:
|
||||
|
||||
| 方法 | 签名 | 说明 |
|
||||
|------|------|------|
|
||||
| `Load` | `public static PluginManifest Load(string manifestPath)` | 从文件加载插件清单 |
|
||||
| `ResolveEntranceAssemblyPath` | `public string ResolveEntranceAssemblyPath(string manifestPath)` | 解析入口程序集路径 |
|
||||
|
||||
### 4.3 设置系统
|
||||
|
||||
#### `SettingsService`(LanMountainDesktop/Services/Settings/SettingsService.cs)
|
||||
|
||||
**职责**:设置系统的核心服务,管理应用和插件的设置数据持久化、读取和保存、设置变更监听。
|
||||
|
||||
**关键属性**:
|
||||
|
||||
```csharp
|
||||
public event EventHandler<SettingsChangedEvent>? Changed; // 设置变更事件
|
||||
```
|
||||
|
||||
**关键方法**:
|
||||
|
||||
| 方法 | 签名 | 说明 |
|
||||
|------|------|------|
|
||||
| `LoadSnapshot` | `public T LoadSnapshot<T>(SettingsScope scope, string? subjectId = null, string? placementId = null)` | 加载设置快照 |
|
||||
| `SaveSnapshot` | `public void SaveSnapshot<T>(SettingsScope scope, T snapshot, ...)` | 保存设置快照 |
|
||||
| `LoadSection` | `public T LoadSection<T>(SettingsScope scope, string subjectId, string sectionId, ...)` | 加载设置节 |
|
||||
| `SaveSection` | `public void SaveSection<T>(SettingsScope scope, string subjectId, string sectionId, T section, ...)` | 保存设置节 |
|
||||
| `GetValue` | `public T? GetValue<T>(SettingsScope scope, string key, ...)` | 获取单个值 |
|
||||
| `SetValue` | `public void SetValue<T>(SettingsScope scope, string key, T value, ...)` | 设置单个值 |
|
||||
| `GetComponentAccessor` | `public IComponentSettingsAccessor GetComponentAccessor(string componentId, string? placementId)` | 获取组件设置访问器 |
|
||||
|
||||
**设置作用域(SettingsScope)**:
|
||||
|
||||
| 作用域 | 说明 |
|
||||
|--------|------|
|
||||
| `App` | 应用级设置 |
|
||||
| `Launcher` | 启动器设置 |
|
||||
| `ComponentInstance` | 组件实例设置 |
|
||||
| `Plugin` | 插件设置 |
|
||||
|
||||
### 4.4 外观主题系统
|
||||
|
||||
#### `IAppearanceThemeService`(LanMountainDesktop/Services/AppearanceThemeService.cs)
|
||||
|
||||
**职责**:外观主题服务接口,定义了主题获取、预览构建、资源应用等方法。
|
||||
|
||||
```csharp
|
||||
public interface IAppearanceThemeService
|
||||
{
|
||||
AppearanceThemeSnapshot GetCurrent();
|
||||
AppearanceThemeSnapshot BuildPreview(ThemeAppearanceSettingsState pendingState);
|
||||
event EventHandler<AppearanceThemeSnapshot>? Changed;
|
||||
void ApplyThemeResources(IResourceDictionary resources);
|
||||
AppearanceMaterialSurface GetMaterialSurface(MaterialSurfaceRole role);
|
||||
void ApplyWindowMaterial(Window window, MaterialSurfaceRole role);
|
||||
}
|
||||
```
|
||||
|
||||
#### `AppearanceThemeService`
|
||||
|
||||
**职责**:外观主题服务的实现,委托给 `MaterialColorService` 处理具体逻辑。
|
||||
|
||||
**关键方法**:
|
||||
|
||||
| 方法 | 签名 | 说明 |
|
||||
|------|------|------|
|
||||
| `GetCurrent` | `public AppearanceThemeSnapshot GetCurrent()` | 获取当前主题快照 |
|
||||
| `BuildPreview` | `public AppearanceThemeSnapshot BuildPreview(ThemeAppearanceSettingsState pendingState)` | 构建主题预览 |
|
||||
| `ApplyThemeResources` | `public void ApplyThemeResources(IResourceDictionary resources)` | 应用主题资源到资源字典 |
|
||||
| `GetMaterialSurface` | `public AppearanceMaterialSurface GetMaterialSurface(MaterialSurfaceRole role)` | 获取材质表面配置 |
|
||||
| `ApplyWindowMaterial` | `public void ApplyWindowMaterial(Window window, MaterialSurfaceRole role)` | 应用窗口材质效果 |
|
||||
|
||||
**材质表面角色(MaterialSurfaceRole)**:
|
||||
|
||||
| 角色 | 说明 |
|
||||
|------|------|
|
||||
| `WindowBackground` | 窗口背景 |
|
||||
| `SettingsWindowBackground` | 设置窗口背景 |
|
||||
| `DockBackground` | 停靠栏背景 |
|
||||
| `StatusBarBackground` | 状态栏背景 |
|
||||
| `DesktopComponentHost` | 桌面组件宿主 |
|
||||
| `StatusBarComponentHost` | 状态栏组件宿主 |
|
||||
| `OverlayPanel` | 覆盖层面板 |
|
||||
|
||||
### 4.5 桌面宿主
|
||||
|
||||
#### `DesktopBootstrap`(LanMountainDesktop.DesktopHost/DesktopBootstrap.cs)
|
||||
|
||||
**职责**:桌面启动引导,协调启动服务初始化和应用初始化。
|
||||
|
||||
```csharp
|
||||
public static class DesktopBootstrap
|
||||
{
|
||||
public static void InitializeStartupServices(
|
||||
Action initializeTelemetryIdentity,
|
||||
Action initializeCrashTelemetry,
|
||||
Action initializeUsageTelemetry,
|
||||
Action scheduleStartupCleanup);
|
||||
|
||||
public static void InitializeApplication(Application application, Action initializeShell);
|
||||
}
|
||||
```
|
||||
|
||||
### 4.6 Launcher 核心服务
|
||||
|
||||
#### `DeploymentLocator`(LanMountainDesktop.Launcher/Services/DeploymentLocator.cs)
|
||||
|
||||
**职责**:扫描和定位 `app-*` 版本目录,选择最佳版本。
|
||||
|
||||
**版本选择算法**:
|
||||
1. 扫描所有 `app-*` 目录
|
||||
2. 过滤掉带 `.destroy` 或 `.partial` 标记的目录
|
||||
3. 优先选择带 `.current` 标记的版本
|
||||
4. 如果没有 `.current`,选择版本号最高的
|
||||
|
||||
#### `UpdateEngineService`
|
||||
|
||||
**职责**:下载、验证、应用增量更新,支持原子化更新和回滚。
|
||||
|
||||
#### `LauncherFlowCoordinator`
|
||||
|
||||
**职责**:协调 OOBE → Splash → 更新 → 插件 → 启动主程序的完整流程。
|
||||
|
||||
---
|
||||
|
||||
## 5. 依赖关系
|
||||
|
||||
### 5.1 项目间依赖图
|
||||
|
||||
```
|
||||
LanMountainDesktop (主程序)
|
||||
├── LanMountainDesktop.Host.Abstractions
|
||||
├── LanMountainDesktop.Shared.Contracts
|
||||
├── LanMountainDesktop.Shared.IPC
|
||||
├── LanMountainDesktop.Settings.Core
|
||||
├── LanMountainDesktop.Appearance
|
||||
├── LanMountainDesktop.DesktopComponents.Runtime
|
||||
├── LanMountainDesktop.DesktopHost
|
||||
├── LanMountainDesktop.PluginSdk
|
||||
└── ThirdParty/DotNetCampus.InkCanvas
|
||||
|
||||
LanMountainDesktop.Launcher (启动器)
|
||||
├── LanMountainDesktop.Shared.Contracts
|
||||
├── LanMountainDesktop.Shared.IPC
|
||||
└── LanMountainDesktop.Settings.Core
|
||||
|
||||
LanMountainDesktop.PluginSdk (插件SDK)
|
||||
└── (无项目引用,纯公共接口)
|
||||
|
||||
LanMountainDesktop.DesktopHost
|
||||
├── LanMountainDesktop.Host.Abstractions
|
||||
└── LanMountainDesktop.Shared.Contracts
|
||||
|
||||
LanMountainDesktop.Appearance
|
||||
├── LanMountainDesktop.Settings.Core
|
||||
└── LanMountainDesktop.Shared.Contracts
|
||||
|
||||
LanMountainDesktop.DesktopComponents.Runtime
|
||||
├── LanMountainDesktop.Host.Abstractions
|
||||
└── LanMountainDesktop.Shared.Contracts
|
||||
|
||||
LanMountainDesktop.PluginIsolation.Ipc
|
||||
├── LanMountainDesktop.PluginIsolation.Contracts
|
||||
└── LanMountainDesktop.Shared.IPC
|
||||
```
|
||||
|
||||
### 5.2 主要 NuGet 依赖
|
||||
|
||||
| 包名 | 版本 | 用途 |
|
||||
|------|------|------|
|
||||
| Avalonia | 12.0.2 | 跨平台 UI 框架 |
|
||||
| Avalonia.Controls.WebView | 12.0.0 | WebView 控件 |
|
||||
| Avalonia.Desktop | 12.0.2 | 桌面平台支持 |
|
||||
| Avalonia.Themes.Fluent | 12.0.2 | Fluent 主题 |
|
||||
| FluentAvaloniaUI | 3.0.0-preview2 | Fluent UI 控件库 |
|
||||
| Material.Avalonia | 3.16.1 | Material Design 控件 |
|
||||
| MaterialColorUtilities | 0.3.0 | Material Design 3 动态配色 |
|
||||
| CommunityToolkit.Mvvm | 8.4.2 | MVVM 工具包 |
|
||||
| Microsoft.Extensions.DependencyInjection | 11.0.0-preview | 依赖注入 |
|
||||
| Microsoft.Extensions.Hosting.Abstractions | 11.0.0-preview | 宿主抽象 |
|
||||
| Microsoft.Data.Sqlite | 11.0.0-preview | SQLite 数据库 |
|
||||
| PostHog | 2.6.0 | 使用遥测 |
|
||||
| Sentry | 6.4.1 | 崩溃遥测 |
|
||||
| Downloader | 5.4.0 | 文件下载 |
|
||||
| Lib.Harmony.Thin | 2.4.2 | 运行时方法拦截 |
|
||||
| log4net | 3.3.1 | 日志记录 |
|
||||
|
||||
---
|
||||
|
||||
## 6. 项目运行方式
|
||||
|
||||
### 6.1 环境准备
|
||||
|
||||
- 安装 **.NET SDK 10**(由 `global.json` 锁定版本 `10.0.103`)
|
||||
- 桌面端建议优先在 Windows 上开发和验证
|
||||
- 仓库主入口解决方案文件为 `LanMountainDesktop.slnx`
|
||||
|
||||
### 6.2 常用命令
|
||||
|
||||
#### 还原与构建
|
||||
|
||||
```bash
|
||||
dotnet restore
|
||||
dotnet build LanMountainDesktop.slnx -c Debug
|
||||
```
|
||||
|
||||
#### 运行桌面宿主(开发模式)
|
||||
|
||||
```bash
|
||||
# 直接运行主程序,跳过 Launcher
|
||||
dotnet run --project LanMountainDesktop/LanMountainDesktop.csproj
|
||||
```
|
||||
|
||||
#### 运行桌面宿主(生产模式)
|
||||
|
||||
```bash
|
||||
# 先构建 Launcher
|
||||
dotnet build LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj -c Debug
|
||||
|
||||
# 通过 Launcher 启动主程序
|
||||
dotnet run --project LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj -- launch
|
||||
```
|
||||
|
||||
#### Launcher 其他命令
|
||||
|
||||
```bash
|
||||
# 检查更新
|
||||
dotnet run --project LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj -- update check
|
||||
|
||||
# 安装插件
|
||||
dotnet run --project LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj -- plugin install <path-to-plugin.laapp>
|
||||
|
||||
# 版本回退
|
||||
dotnet run --project LanMountainDesktop.Launcher/LanMountainDesktop.Launcher.csproj -- update rollback
|
||||
```
|
||||
|
||||
#### 运行测试
|
||||
|
||||
```bash
|
||||
dotnet test LanMountainDesktop.slnx -c Debug
|
||||
```
|
||||
|
||||
#### 插件本地包生成
|
||||
|
||||
```powershell
|
||||
./scripts/Pack-PluginPackages.ps1
|
||||
```
|
||||
|
||||
### 6.3 Linux 录音依赖
|
||||
|
||||
如果在 Linux 上使用录音机或自习监测相关能力,需要安装音频库:
|
||||
|
||||
```bash
|
||||
# Debian/Ubuntu
|
||||
sudo apt install libportaudio2 libasound2
|
||||
|
||||
# Fedora/RHEL
|
||||
sudo dnf install portaudio-libs alsa-lib
|
||||
|
||||
# Arch Linux
|
||||
sudo pacman -S portaudio alsa-lib
|
||||
|
||||
# Alpine Linux
|
||||
sudo apk add portaudio alsa-lib
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 7. 启动流程详解
|
||||
|
||||
### 7.1 生产环境启动流程(通过 Launcher)
|
||||
|
||||
```
|
||||
用户启动 LanMountainDesktop.Launcher.exe
|
||||
│
|
||||
▼
|
||||
Launcher 扫描 app-* 目录,选择最佳版本
|
||||
(优先 .current 标记,然后按版本号降序)
|
||||
│
|
||||
▼
|
||||
首次启动?→ 显示 OOBE 引导(OobeWindow)
|
||||
│
|
||||
▼
|
||||
显示 Splash 启动动画(SplashWindow)
|
||||
│
|
||||
▼
|
||||
检查并应用待处理的更新(UpdateEngineService.ApplyPendingUpdate)
|
||||
│
|
||||
▼
|
||||
处理插件升级队列(PluginUpgradeQueueService)
|
||||
│
|
||||
▼
|
||||
启动主程序 app-{version}/LanMountainDesktop.exe
|
||||
│
|
||||
▼
|
||||
清理标记为 .destroy 的旧版本
|
||||
```
|
||||
|
||||
### 7.2 主程序启动流程(LanMountainDesktop.exe)
|
||||
|
||||
```
|
||||
Program.cs Main()
|
||||
│
|
||||
├── 初始化日志(AppLogger.Initialize)
|
||||
├── 初始化应用数据路径(AppDataPathProvider.Initialize)
|
||||
├── 解析开发插件选项(DevPluginOptions.Parse)
|
||||
├── 注册全局异常日志
|
||||
└── 获取重启父进程 ID
|
||||
│
|
||||
▼
|
||||
获取单实例锁(SingleInstanceService)
|
||||
│
|
||||
├── 非主实例?→ 通知主实例并退出
|
||||
└── 是主实例?→ 继续
|
||||
│
|
||||
▼
|
||||
初始化启动服务(DesktopBootstrap.InitializeStartupServices)
|
||||
│
|
||||
├── 初始化遥测身份(TelemetryIdentityService)
|
||||
├── 初始化崩溃遥测(SentryCrashTelemetryService)
|
||||
├── 初始化使用遥测(PostHogUsageTelemetryService)
|
||||
└── 调度白板笔记启动清理
|
||||
│
|
||||
▼
|
||||
运行启动诊断(StartupDiagnosticsService.Run)
|
||||
│
|
||||
▼
|
||||
加载配置的渲染模式(LoadConfiguredRenderMode)
|
||||
│
|
||||
▼
|
||||
构建 Avalonia AppBuilder(BuildAvaloniaApp)
|
||||
│
|
||||
▼
|
||||
进入 App.axaml.cs
|
||||
│
|
||||
├── 初始化主题(ApplyThemeFromSettings)
|
||||
├── 初始化语言(ApplyCurrentCultureFromSettings)
|
||||
├── 初始化设置窗口服务(EnsureSettingsWindowService)
|
||||
├── 初始化天气定位刷新(EnsureWeatherLocationRefreshService)
|
||||
└── 初始化通知服务(EnsureNotificationService)
|
||||
│
|
||||
▼
|
||||
框架初始化完成(OnFrameworkInitializationCompleted)
|
||||
│
|
||||
├── 初始化公共 IPC(InitializePublicIpc)
|
||||
├── 启动单实例激活监听
|
||||
├── 初始化 Launcher IPC(InitializeLauncherIpcAsync)
|
||||
└── 初始化桌面壳层(InitializeDesktopShell)
|
||||
│
|
||||
▼
|
||||
桌面壳层初始化
|
||||
│
|
||||
├── 初始化插件运行时(InitializePluginRuntime)
|
||||
├── 初始化托盘图标(InitializeTrayIcon)
|
||||
├── 创建主窗口(CreateAndAssignMainWindow)
|
||||
└── 启动天气定位刷新
|
||||
```
|
||||
|
||||
### 7.3 版本目录结构
|
||||
|
||||
```
|
||||
安装根目录/
|
||||
├── LanMountainDesktop.Launcher.exe ← 唯一入口
|
||||
├── app-1.0.0/ ← 版本目录
|
||||
│ ├── .current ← 当前版本标记
|
||||
│ ├── LanMountainDesktop.exe
|
||||
│ └── ...
|
||||
├── app-1.0.1/ ← 新版本
|
||||
│ ├── .partial ← 下载中标记
|
||||
│ └── ...
|
||||
└── .launcher/ ← Launcher 数据
|
||||
├── state/ ← OOBE 状态
|
||||
├── update/incoming/ ← 更新缓存
|
||||
└── snapshots/ ← 更新快照
|
||||
```
|
||||
|
||||
**版本标记文件**:
|
||||
- `.current` - 标记当前使用的版本
|
||||
- `.partial` - 标记下载未完成的版本(更新失败时自动清理)
|
||||
- `.destroy` - 标记待删除的旧版本(下次启动时清理)
|
||||
|
||||
---
|
||||
|
||||
## 8. 插件系统架构
|
||||
|
||||
### 8.1 插件生命周期
|
||||
|
||||
```
|
||||
插件包(.laapp)
|
||||
│
|
||||
▼
|
||||
发现阶段(DiscoverCandidates)
|
||||
│
|
||||
├── 扫描 PluginsDirectory
|
||||
├── 解析 plugin.json 清单
|
||||
└── 验证 API 版本兼容性
|
||||
│
|
||||
▼
|
||||
加载阶段(PluginLoader.LoadFromPackage / LoadFromManifest)
|
||||
│
|
||||
├── 注册共享契约
|
||||
├── 加载入口程序集
|
||||
├── 调用 IPlugin.Initialize
|
||||
└── 收集贡献点(设置页、组件、编辑器)
|
||||
│
|
||||
▼
|
||||
激活阶段
|
||||
│
|
||||
├── 注册设置页到设置窗口
|
||||
├── 注册组件到组件系统
|
||||
└── 注册编辑器到编辑器系统
|
||||
│
|
||||
▼
|
||||
运行阶段
|
||||
│
|
||||
├── 插件服务通过 DI 容器解析
|
||||
├── 插件通过 IPluginContext 访问宿主功能
|
||||
└── 插件通过 IPC 与宿主通信
|
||||
│
|
||||
▼
|
||||
卸载阶段
|
||||
│
|
||||
├── 卸载插件程序集
|
||||
├── 清理贡献点
|
||||
└── 释放资源
|
||||
```
|
||||
|
||||
### 8.2 插件运行时模式
|
||||
|
||||
| 模式 | 状态 | 说明 |
|
||||
|------|------|------|
|
||||
| `in-proc` | 当前默认 | 进程内加载,PluginLoadContext 提供程序集隔离 |
|
||||
| `isolated-background` | 预留 | 后台逻辑移至独立工作进程,Host UI 变为薄 IPC 驱动壳 |
|
||||
| `isolated-window` | 预留 | 插件 UI 离屏渲染,Host 嵌入平台窗口句柄 |
|
||||
|
||||
### 8.3 插件贡献点
|
||||
|
||||
插件可以向宿主贡献以下内容:
|
||||
|
||||
1. **设置页(Settings Sections)**:通过 `IPluginSettingsService` 注册自定义设置页
|
||||
2. **桌面组件(Desktop Components)**:通过组件贡献点注册可放置的桌面组件
|
||||
3. **组件编辑器(Component Editors)**:为组件提供自定义编辑器界面
|
||||
4. **公共服务(Public Services)**:通过 IPC 向外部提供公共服务
|
||||
|
||||
### 8.4 插件目录结构
|
||||
|
||||
```
|
||||
PluginsDirectory/
|
||||
├── PluginA/
|
||||
│ ├── plugin.json # 插件清单
|
||||
│ ├── PluginA.dll # 入口程序集
|
||||
│ └── ... # 其他资源
|
||||
├── PluginB.laapp # 打包的插件包
|
||||
└── ...
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 9. 数据流与交互模型
|
||||
|
||||
### 9.1 设置流
|
||||
|
||||
```
|
||||
Settings.Core(基础设置能力)
|
||||
│
|
||||
├── 宿主通过 SettingsFacade 读取和监听设置变化
|
||||
├── 插件通过 IPluginSettingsService 访问设置
|
||||
└── 组件通过 IComponentSettingsAccessor 访问设置
|
||||
```
|
||||
|
||||
### 9.2 外观流
|
||||
|
||||
```
|
||||
Appearance(主题和圆角资源)
|
||||
│
|
||||
├── 宿主在 App.axaml.cs 中应用到资源字典
|
||||
├── MaterialColorService 处理动态配色
|
||||
└── 主题变更通过事件通知所有订阅者
|
||||
```
|
||||
|
||||
### 9.3 组件流
|
||||
|
||||
```
|
||||
ComponentSystem(组件定义、注册、扩展接入)
|
||||
│
|
||||
├── 内置组件在 ComponentSystem/ 中定义
|
||||
├── 插件通过贡献点注册扩展组件
|
||||
└── DesktopEditing/ 处理组件放置和布局
|
||||
```
|
||||
|
||||
### 9.4 插件流
|
||||
|
||||
```
|
||||
plugins/(宿主侧插件运行时)
|
||||
│
|
||||
├── .laapp 插件包的发现、安装、替换
|
||||
├── 插件激活与共享契约装配
|
||||
└── 插件设置页注册到宿主设置窗口
|
||||
```
|
||||
|
||||
### 9.5 IPC 流
|
||||
|
||||
```
|
||||
Shared.IPC(统一 IPC 基础)
|
||||
│
|
||||
├── Host 公共服务
|
||||
├── Launcher/OOBE 启动通知
|
||||
├── 插件贡献的公共服务
|
||||
└── 外部集成(External IPC Public API)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 10. 测试体系
|
||||
|
||||
### 10.1 测试项目
|
||||
|
||||
测试项目 `LanMountainDesktop.Tests/` 覆盖以下方面:
|
||||
|
||||
| 测试类 | 覆盖内容 |
|
||||
|--------|---------|
|
||||
| `CornerRadiusScaleTests.cs` | 圆角和外观缩放 |
|
||||
| `DesktopPlacementMathTests.cs` | 桌面布局数学计算 |
|
||||
| `DesktopEditCommitMathTests.cs` | 桌面编辑提交计算 |
|
||||
| `ComponentSettingsServiceTests.cs` | 组件设置服务 |
|
||||
| `UiExceptionGuardTests.cs` | UI 异常保护 |
|
||||
| `WhiteboardNotePersistenceServiceTests.cs` | 白板笔记持久化 |
|
||||
| `MaterialColorIntegrationTests.cs` | 材质颜色集成 |
|
||||
| `OobeStateServiceTests.cs` | OOBE 状态服务 |
|
||||
| `PluginInstallerServiceTests.cs` | 插件安装服务 |
|
||||
| `PluginUpgradeQueueServiceTests.cs` | 插件升级队列 |
|
||||
| `LauncherFlowCoordinatorTests.cs` | 启动器流程协调 |
|
||||
| `LauncherBackgroundServiceTests.cs` | 启动器后台服务 |
|
||||
| `PluginIpcServerTests.cs` | 插件 IPC 服务端 |
|
||||
| `PluginIpcClientTests.cs` | 插件 IPC 客户端 |
|
||||
| `HostShutdownGateTests.cs` | 主机关闭门 |
|
||||
| `SingleInstanceServiceTests.cs` | 单实例服务 |
|
||||
|
||||
### 10.2 测试原则
|
||||
|
||||
- 涉及宿主行为、SDK 契约、布局计算或设置持久化的改动,应优先补对应测试
|
||||
- 优先扩展已有测试而不是新建无关测试入口
|
||||
|
||||
---
|
||||
|
||||
## 附录 A:快速参考
|
||||
|
||||
### A.1 关键文件速查
|
||||
|
||||
| 需求 | 优先查看文件 |
|
||||
|------|-------------|
|
||||
| 启动问题 | `LanMountainDesktop/Program.cs`, `LanMountainDesktop/App.axaml.cs` |
|
||||
| Launcher 启动问题 | `LanMountainDesktop.Launcher/Program.cs`, `Services/LauncherFlowCoordinator.cs` |
|
||||
| 版本管理问题 | `LanMountainDesktop.Launcher/Services/DeploymentLocator.cs` |
|
||||
| 更新系统问题 | `LanMountainDesktop.Launcher/Services/UpdateEngineService.cs`, `UpdateCheckService.cs` |
|
||||
| 设置窗口和设置页 | `LanMountainDesktop/Views/`, `ViewModels/`, `Services/Settings/` |
|
||||
| 插件加载与安装 | `LanMountainDesktop/plugins/PluginRuntimeService.cs` |
|
||||
| 组件元数据或放置规则 | `LanMountainDesktop/ComponentSystem/` |
|
||||
| 主题、颜色、圆角 | `LanMountainDesktop/Theme/`, `Styles/`, `LanMountainDesktop.Appearance/` |
|
||||
| 设置持久化 | `LanMountainDesktop.Settings.Core/`, `LanMountainDesktop/Services/Settings/SettingsService.cs` |
|
||||
| SDK 接口调整 | `LanMountainDesktop.PluginSdk/`, `LanMountainDesktop.Shared.Contracts/` |
|
||||
| 桌面壳层或生命周期 | `Program.cs`, `App.axaml.cs`, `LanMountainDesktop.DesktopHost/` |
|
||||
|
||||
### A.2 文档权威来源
|
||||
|
||||
| 主题 | 权威文档 |
|
||||
|------|---------|
|
||||
| 产品定位 | `docs/PRODUCT.md` |
|
||||
| 架构与模块职责 | `docs/ARCHITECTURE.md` |
|
||||
| 运行、构建、测试、打包 | `docs/DEVELOPMENT.md` |
|
||||
| 视觉规范 | `docs/VISUAL_SPEC.md` |
|
||||
| 圆角规范 | `docs/CORNER_RADIUS_SPEC.md` |
|
||||
| 生态边界 | `docs/ECOSYSTEM_BOUNDARIES.md` |
|
||||
| SDK v5 迁移 | `docs/PLUGIN_SDK_V5_MIGRATION.md` |
|
||||
| 代码地图 | `docs/ai/CODEBASE_MAP.md` |
|
||||
| AI 协作入口 | `AGENTS.md` |
|
||||
| Feature 规格 | `.trae/specs/` |
|
||||
|
||||
---
|
||||
|
||||
*本文档基于 LanMountainDesktop 仓库代码和文档自动生成,如有更新请以仓库最新代码为准。*
|
||||
@@ -1,8 +1,9 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Version>1.0.0</Version>
|
||||
<Version>0.0.0-dev</Version>
|
||||
<TargetFramework Condition="'$(TargetFramework)' == ''">net10.0</TargetFramework>
|
||||
<Nullable Condition="'$(Nullable)' == ''">enable</Nullable>
|
||||
<ImplicitUsings Condition="'$(ImplicitUsings)' == ''">enable</ImplicitUsings>
|
||||
<ServerGarbageCollection>true</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
||||
43
Directory.Packages.props
Normal file
43
Directory.Packages.props
Normal file
@@ -0,0 +1,43 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageVersion Include="Avalonia" Version="12.0.3" />
|
||||
<PackageVersion Include="Avalonia.Controls.WebView" Version="12.0.1" />
|
||||
<PackageVersion Include="Avalonia.Desktop" Version="12.0.3" />
|
||||
<PackageVersion Include="Avalonia.Fonts.Inter" Version="12.0.3" />
|
||||
<PackageVersion Include="Avalonia.Themes.Fluent" Version="12.0.3" />
|
||||
<PackageVersion Include="AvaloniaUI.DiagnosticsSupport" Version="2.2.1" />
|
||||
<PackageVersion Include="ClassIsland.Markdown.Avalonia" Version="12.0.0" />
|
||||
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.4.2" />
|
||||
<PackageVersion Include="dotnetCampus.Ipc" Version="2.0.0-alpha436" />
|
||||
<PackageVersion Include="DotNetCampus.AvaloniaInkCanvas" Version="1.0.1" />
|
||||
<PackageVersion Include="Downloader" Version="5.4.0" />
|
||||
<PackageVersion Include="FluentAvaloniaUI" Version="3.0.0-preview4" />
|
||||
<PackageVersion Include="FluentIcons.Avalonia" Version="2.1.325" />
|
||||
<PackageVersion Include="Lib.Harmony.Thin" Version="2.4.2" />
|
||||
<PackageVersion Include="Material.Avalonia" Version="3.17.0" />
|
||||
<PackageVersion Include="MaterialColorUtilities" Version="0.3.0" />
|
||||
<PackageVersion Include="Material.Icons.Avalonia" Version="3.0.3-nightly.0.2" />
|
||||
<PackageVersion Include="Microsoft.Data.Sqlite" Version="11.0.0-preview.3.26207.106" />
|
||||
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="11.0.0-preview.3.26207.106" />
|
||||
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="11.0.0-preview.3.26207.106" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="11.0.0-preview.3.26207.106" />
|
||||
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.5.1" />
|
||||
<PackageVersion Include="MudTools.OfficeInterop" Version="2.0.9" />
|
||||
<PackageVersion Include="MudTools.OfficeInterop.Excel" Version="2.0.9" />
|
||||
<PackageVersion Include="MudTools.OfficeInterop.PowerPoint" Version="2.0.9" />
|
||||
<PackageVersion Include="MudTools.OfficeInterop.Word" Version="2.0.9" />
|
||||
<PackageVersion Include="PortAudioSharp2" Version="1.0.6" />
|
||||
<PackageVersion Include="PostHog" Version="2.7.1" />
|
||||
<PackageVersion Include="Sentry" Version="6.5.0" />
|
||||
<PackageVersion Include="System.Drawing.Common" Version="11.0.0-preview.3.26207.106" />
|
||||
<PackageVersion Include="System.Runtime.WindowsRuntime" Version="5.0.0-preview.5.20278.1" />
|
||||
<PackageVersion Include="Tmds.DBus.Protocol" Version="0.92.0" />
|
||||
<PackageVersion Include="xunit" Version="2.9.3" />
|
||||
<PackageVersion Include="xunit.runner.visualstudio" Version="4.0.0-pre.4" />
|
||||
<PackageVersion Include="YamlDotNet" Version="17.1.0" />
|
||||
<PackageVersion Include="log4net" Version="3.3.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user