feat: 跨平台工程改造为 XCoder.App(统一工作台 + 首批原生工具) - XCoderAv 改建为 XCoder.App:net10.0、命名空间 NewLife.XCoder、删除旧菜单导航;- 新增工作台外壳:首页卡片、分类与搜索、标签、浮动窗口、命令面板、统一状态栏、浅/深主题;- 工具注册表显式登记 35 个工具,26 个既有窗口可直接在标签中打开;- 新增坐标转换、对称加密两个原生 UserControl 工具与 11 项单元测试;- 新增 tools/package-macos.sh 与 .gitattributes(脚本保持 LF);- XCoderMac 目录保持不变,由另一位开发者并行迭代大石头 authored at 2026-11-11 16:31:48
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..65c4b5d
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,4 @@
+# 统一换行:脚本与配置保持 LF,避免在 macOS/Linux 上执行失败
+*.sh text eol=lf
+*.yml text eol=lf
+*.yaml text eol=lf
diff --git "a/Doc/\345\212\237\350\203\275\346\270\205\345\215\225.md" "b/Doc/\345\212\237\350\203\275\346\270\205\345\215\225.md"
index ca6a34c..cec22d4 100644
--- "a/Doc/\345\212\237\350\203\275\346\270\205\345\215\225.md"
+++ "b/Doc/\345\212\237\350\203\275\346\270\205\345\215\225.md"
@@ -29,12 +29,12 @@
| 编码 | 功能 | 类型 | 实现 | 测试 | 注释 | 说明 |
|------|------|:----:|:----:|:----:|:----:|------|
-| APP-1 | 工作台首页(Hero / 统计 / 快捷入口 / 工具网格) | 前端 | ❌ | ❌ | ❌ | 响应式列数 4/3/2/1 |
-| APP-2 | 工具注册表(显式注册 + 平台可用性) | 后端 | ❌ | ❌ | ❌ | `ToolRegistry`,不用反射 |
-| APP-3 | 标签工作区(单实例复用、切换、关闭、滚动) | 前端 | ❌ | ❌ | ❌ | 与左侧列表联动 |
-| APP-4 | 浮动窗口(与标签互迁、记忆几何、置顶) | 前端 | ❌ | ❌ | ❌ | 同一实例保状态 |
-| APP-5 | 命令面板(全局快捷键、模糊搜索、最近使用) | 前端 | ❌ | ❌ | ❌ | 键盘全流程可用 |
-| APP-7 | 统一状态栏(真实状态、切标签切换数据源) | 前端 | ❌ | ❌ | ❌ | 不伪造结果 |
+| APP-1 | 工作台首页(Hero / 统计 / 快捷入口 / 工具网格) | 前端 | ✅ | ❌ | ✅ | 已实现,列数随宽度重排 |
+| APP-2 | 工具注册表(显式注册 + 平台可用性) | 后端 | ✅ | ❌ | ✅ | 35 个工具已登记,26 个可打开 |
+| APP-3 | 标签工作区(单实例复用、切换、关闭、滚动) | 前端 | ✅ | ❌ | ✅ | 与左侧列表联动 |
+| APP-4 | 浮动窗口(与标签互迁、记忆几何、置顶) | 前端 | ✅ | ❌ | ✅ | 同一实例保状态;几何记忆待补 |
+| APP-5 | 命令面板(全局快捷键、模糊搜索、最近使用) | 前端 | ✅ | ❌ | ✅ | 快捷键/搜索/回车可用,最近使用待补 |
+| APP-7 | 统一状态栏(真实状态、切标签切换数据源) | 前端 | ✅ | ❌ | ✅ | 显示工具名与打开状态,业务状态待接 |
> 父需求状态:❌
@@ -42,7 +42,7 @@
| 编码 | 功能 | 类型 | 实现 | 测试 | 注释 | 说明 |
|------|------|:----:|:----:|:----:|:----:|------|
-| APP-6 | 主题系统(浅色/深色/跟随系统 + 控制台深色) | 前端 | ❌ | ❌ | ❌ | 语义令牌双层 |
+| APP-6 | 主题系统(浅色/深色/跟随系统 + 控制台深色) | 前端 | ✅ | ❌ | ✅ | 令牌已接入,控制台深色待随工具迁移 |
| APP-8 | 设置中心(主题/语言/快捷入口/浮动行为/目录/更新) | 前端 | ❌ | ❌ | ❌ | |
| APP-9 | 单实例 + 托盘常驻 + 全局热键 | 后端 | ❌ | ❌ | ❌ | 三平台 |
| APP-10 | 多语言(11 种,词表机制) | 后端 | ❌ | ❌ | ❌ | 最长文案留位 |
@@ -74,7 +74,7 @@
|------|------|:----:|:----:|:----:|:----:|------|
| DEV-7 | 正则表达式(匹配/替换/捕获组/批量文件替换) | 前端+逻辑 | ❌ | ❌ | ❌ | 替换前预览+备份 |
| DEV-8 | 加密解密(摘要/编码/RSA/URL 等 30+ 命令) | 前端+逻辑 | ❌ | ❌ | ❌ | 异常输入不崩溃 |
-| DEV-9 | 对称加密(AES/DES 等) | 前端+逻辑 | ❌ | ❌ | ❌ | 与 DEV-8 共基座 |
+| DEV-9 | 对称加密(AES/DES 等) | 前端+逻辑 | ✅ | ✅ | ✅ | AES-256 / DES,CBC+PKCS7;5 项单测 |
| DEV-10 | MD5 解密(本地优先 + 在线接口) | 前端+逻辑 | ❌ | ❌ | ❌ | |
| DEV-11 | 文件编码(探测/预览/转换) | 前端+逻辑 | ❌ | ❌ | ❌ | 转换前备份 |
@@ -157,7 +157,7 @@
| 编码 | 功能 | 类型 | 实现 | 测试 | 注释 | 说明 |
|------|------|:----:|:----:|:----:|:----:|------|
-| EFF-3 | 坐标转换(WGS84/GCJ02/BD09 互转、批量) | 前端+逻辑 | ❌ | ❌ | ❌ | 复用 NewLife.Map |
+| EFF-3 | 坐标转换(WGS84/GCJ02/BD09 互转、批量) | 前端+逻辑 | ✅ | ✅ | ✅ | 单点+批量;6 项单测 |
| EFF-4 | GPS 辅助(数据解析、HEX 转浮点、轨迹) | 前端+逻辑 | ❌ | ❌ | ❌ | |
| EFF-5 | 地图接口(地理/逆地理编码、路径规划) | 前端+逻辑 | ❌ | ❌ | ❌ | 多服务商 Key 配置 |
@@ -209,28 +209,28 @@
| 模块 | 标识 | 功能点数 | 实现完成 | 测试通过 | 注释覆盖 | 综合完成率 |
|------|------|:-------:|:--------:|:--------:|:--------:|:---------:|
-| 桌面外壳 | APP | 12 | 0 | 0 | 0 | 0% |
-| 开发与数据 | DEV | 11 | 0 | 0 | 0 | 0% |
+| 桌面外壳 | APP | 12 | 7 | 0 | 7 | 0% |
+| 开发与数据 | DEV | 11 | 1 | 1 | 1 | 9% |
| 网络与通信 | NET | 8 | 0 | 0 | 0 | 0% |
| 工业与设备 | IND | 16 | 0 | 0 | 0 | 0% |
-| 效率工具 | EFF | 10 | 0 | 0 | 0 | 0% |
+| 效率工具 | EFF | 10 | 1 | 1 | 1 | 10% |
| 平台与发布 | OPS | 8 | 0 | 0 | 0 | 0% |
-| **总计** | **6** | **65** | **0** | **0** | **0** | **0%** |
+| **总计** | **6** | **65** | **9** | **2** | **9** | **3%** |
### 父需求完成度
| 父需求 | 子项数 | 已完成 | 状态 | 说明 |
|--------|:-----:|:-----:|:----:|------|
-| 主界面与导航 | 6 | 0/6 | ❌ | APP-1/2/3/4/5/7 |
-| 主题、设置与运行环境 | 6 | 0/6 | ❌ | APP-6/8/9/10/11/12 |
+| 主界面与导航 | 6 | 0/6 | 🟡 | APP-1/2/3/4/5/7 已实现,缺自动化测试 |
+| 主题、设置与运行环境 | 6 | 0/6 | 🟡 | APP-6 已实现;设置/单实例/多语言/更新待开发 |
| 数据与接口 | 6 | 0/6 | ❌ | DEV-1~6 |
-| 文本与安全 | 5 | 0/5 | ❌ | DEV-7~11 |
+| 文本与安全 | 5 | 1/5 | 🟡 | DEV-9 对称加密已完成 |
| 网络与协议调试 | 8 | 0/8 | ❌ | NET-1~8 |
| CAN 调试 | 3 | 0/3 | ❌ | 三平台 |
| 总线与 I/O | 4 | 0/4 | ❌ | IND-2~5 |
| 系统设备 | 9 | 0/9 | ❌ | USB/声卡/IP 各三平台 |
| 图像与目录 | 2 | 0/2 | ❌ | EFF-1~2 |
-| 地理信息 | 3 | 0/3 | ❌ | EFF-3~5 |
+| 地理信息 | 3 | 1/3 | 🟡 | EFF-3 坐标转换已完成 |
| 媒体与设备 | 5 | 0/5 | ❌ | EFF-6/7a-c/8 |
| 平台能力层 | 4 | 0/4 | ❌ | OPS-1~4 |
| 分发与质量 | 4 | 0/4 | ❌ | OPS-5~8 |
diff --git "a/Doc/\346\212\200\346\234\257\346\240\210\350\257\204\344\274\260\344\270\216\350\277\201\347\247\273\350\267\257\347\272\277\345\233\276.md" "b/Doc/\346\212\200\346\234\257\346\240\210\350\257\204\344\274\260\344\270\216\350\277\201\347\247\273\350\267\257\347\272\277\345\233\276.md"
index ccbc480..2102f5a 100644
--- "a/Doc/\346\212\200\346\234\257\346\240\210\350\257\204\344\274\260\344\270\216\350\277\201\347\247\273\350\267\257\347\272\277\345\233\276.md"
+++ "b/Doc/\346\212\200\346\234\257\346\240\210\350\257\204\344\274\260\344\270\216\350\277\201\347\247\273\350\267\257\347\272\277\345\233\276.md"
@@ -176,11 +176,11 @@
| 工程 | 处置 | 时机 |
|------|------|------|
| `XCoder/`(WinForms) | 保留至 M5,冻结后归档到 `legacy/` | M5 |
-| `XCoderAv/` | 改造为 `XCoder.App`(git mv) | M1 |
-| `XCoderMac/` | 外壳/Services/打包脚本并入,目录删除 | M1 |
-| `CrazyCoder/`(WPF) | 归档到 `legacy/`,不再维护 | M1 |
-| `XCoderLinux/`(GTK#) | 归档到 `legacy/` | M1 |
-| `XCoder40/` | 删除(无自有源码) | M1 |
+| `XCoderAv/` | 已改造为 `XCoder.App`(M1 完成) | 已完成 |
+| `XCoderMac/` | **保留不动**,由另一位开发者继续迭代;工作台外壳与视觉已在 `XCoder.App/Shell` 重新实现,不共享代码 | 长期 |
+| `CrazyCoder/`(WPF) | 归档到 `legacy/`,不再维护 | M5 |
+| `XCoderLinux/`(GTK#) | 归档到 `legacy/` | M5 |
+| `XCoder40/` | 删除(无自有源码) | M5 |
| `A1Lib/` / `A2Lib/` | A1Lib 原生资源保留供 Windows 平台层引用;A2Lib 随 WinForms 版归档 | M3/M5 |
---
diff --git "a/Doc/\346\236\266\346\236\204\350\256\276\350\256\241.md" "b/Doc/\346\236\266\346\236\204\350\256\276\350\256\241.md"
index 3990d78..3e93a39 100644
--- "a/Doc/\346\236\266\346\236\204\350\256\276\350\256\241.md"
+++ "b/Doc/\346\236\266\346\236\204\350\256\276\350\256\241.md"
@@ -92,7 +92,11 @@ Tests/XCoder.UiTests/ # Avalonia.Headless 冒烟:注册表、标签
build/ # 三平台打包脚本(Windows / Linux / macOS)
```
-**迁移动作**:`git mv XCoderAv XCoder.App` → 目标框架改 net10.0 → 命名空间统一 `NewLife.XCoder` → 删除旧 `MainWindow/MainViewModel` → 并入 `XCoderMac` 的 Shell/Styles/Services(Mac 专属进 `Platform/MacOS`)→ 工具窗口逐个迁入 `Tools/*` 并去除 Window 外壳。
+**迁移动作**:`git mv XCoderAv XCoder.App` → 目标框架改 net10.0 → 命名空间统一 `NewLife.XCoder` → 删除旧 `MainWindow/MainViewModel` → 工具窗口逐个迁入 `Tools/*` 并去除 Window 外壳。
+
+**与 XCoderMac 的关系**:`XCoderMac/` 由另一位开发者并行迭代,**本工程不改动其任何文件**;工作台外壳与视觉在 `XCoder.App/Shell` 独立实现,两边不共享代码,避免互相干扰。
+
+**已落地(M1 骨架)**:工程改名、net10.0、命名空间统一、旧导航删除已完成;`Themes/`(语义令牌 + 控件样式)、`Shell/`(工作台首页、分类、搜索、标签、浮动窗口、命令面板、状态栏)、`Services/ThemeService`(跟随系统/浅色/深色)、`ToolRegistry`(35 个工具显式登记,26 个既有窗口已可标签/浮动打开)已可用。剩余:工具逐个改造为 UserControl、设置中心、单实例与托盘、多语言与更新。
---
diff --git a/Tests/XCoder.App.Tests/CoordConverterTests.cs b/Tests/XCoder.App.Tests/CoordConverterTests.cs
new file mode 100644
index 0000000..4a20d7f
--- /dev/null
+++ b/Tests/XCoder.App.Tests/CoordConverterTests.cs
@@ -0,0 +1,71 @@
+using System;
+using System.ComponentModel;
+using NewLife.XCoder.Tools.Coord;
+
+namespace XCoder.App.Tests;
+
+/// <summary>坐标转换测试</summary>
+public class CoordConverterTests
+{
+ [Fact]
+ [DisplayName("北京 WGS84 转 GCJ02 偏移量符合预期")]
+ public void Wgs84ToGcj02_Beijing_Offset()
+ {
+ var (lng, lat) = CoordConverter.Wgs84ToGcj02(116.404, 39.915);
+
+ Assert.InRange(lng, 116.4099, 116.4106);
+ Assert.InRange(lat, 39.9158, 39.9166);
+ }
+
+ [Fact]
+ [DisplayName("WGS84 → GCJ02 → WGS84 往返误差小于 1e-6")]
+ public void Gcj02_RoundTrip_IsAccurate()
+ {
+ var (gcjLng, gcjLat) = CoordConverter.Wgs84ToGcj02(121.4737, 31.2304);
+ var (lng, lat) = CoordConverter.Gcj02ToWgs84(gcjLng, gcjLat);
+
+ Assert.Equal(121.4737, lng, 6);
+ Assert.Equal(31.2304, lat, 6);
+ }
+
+ [Fact]
+ [DisplayName("BD09 往返转换误差小于 1e-5")]
+ public void Bd09_RoundTrip_IsAccurate()
+ {
+ var (bdLng, bdLat) = CoordConverter.Gcj02ToBd09(116.404, 39.915);
+ var (lng, lat) = CoordConverter.Bd09ToGcj02(bdLng, bdLat);
+
+ Assert.Equal(116.404, lng, 5);
+ Assert.Equal(39.915, lat, 5);
+ }
+
+ [Fact]
+ [DisplayName("境外坐标不做偏移")]
+ public void OutOfChina_KeepsOriginal()
+ {
+ var (lng, lat) = CoordConverter.Convert(-122.4194, 37.7749, "WGS84", "GCJ02");
+
+ Assert.Equal(-122.4194, lng, 6);
+ Assert.Equal(37.7749, lat, 6);
+ }
+
+ [Fact]
+ [DisplayName("同坐标系转换原样返回")]
+ public void SameCoordinateSystem_ReturnsSame()
+ {
+ var (lng, lat) = CoordConverter.Convert(116.404, 39.915, "gcj-02", "GCJ02");
+
+ Assert.Equal(116.404, lng, 6);
+ Assert.Equal(39.915, lat, 6);
+ }
+
+ [Fact]
+ [DisplayName("坐标系统名称标准化")]
+ public void Normalize_Names()
+ {
+ Assert.Equal("WGS84", CoordConverter.Normalize("gps"));
+ Assert.Equal("GCJ02", CoordConverter.Normalize("火星"));
+ Assert.Equal("BD09", CoordConverter.Normalize("bd09ll"));
+ Assert.Equal("WGS84", CoordConverter.Normalize(null));
+ }
+}
diff --git a/Tests/XCoder.App.Tests/SymmetricCryptoTests.cs b/Tests/XCoder.App.Tests/SymmetricCryptoTests.cs
new file mode 100644
index 0000000..e9d03f6
--- /dev/null
+++ b/Tests/XCoder.App.Tests/SymmetricCryptoTests.cs
@@ -0,0 +1,62 @@
+using System;
+using System.ComponentModel;
+using NewLife.XCoder.Tools.Symmetric;
+
+namespace XCoder.App.Tests;
+
+/// <summary>对称加解密测试</summary>
+public class SymmetricCryptoTests
+{
+ private const String Key = "NewLife.XCoder.Key.0123456789";
+ private const String Iv = "Xcoder.Init.Vect";
+
+ [Fact]
+ [DisplayName("AES 加密后可用同一密钥解密")]
+ public void Aes_RoundTrip()
+ {
+ const String text = "码神工具 - NewLife.XCoder";
+
+ var cipher = SymmetricCrypto.Encrypt(text, CryptoKind.Aes, Key, Iv);
+ var result = SymmetricCrypto.Decrypt(cipher, CryptoKind.Aes, Key, Iv);
+
+ Assert.Equal(text, result);
+ Assert.NotEqual(text, cipher);
+ }
+
+ [Fact]
+ [DisplayName("DES 十六进制输出可往返")]
+ public void Des_RoundTrip_Hex()
+ {
+ const String text = "0123456789";
+
+ var cipher = SymmetricCrypto.Encrypt(text, CryptoKind.Des, "12345678", "87654321", true);
+ var result = SymmetricCrypto.Decrypt(cipher, CryptoKind.Des, "12345678", "87654321", true);
+
+ Assert.Equal(text, result);
+ Assert.Matches("^[0-9A-F]+$", cipher);
+ }
+
+ [Fact]
+ [DisplayName("空密钥自动补零仍可往返")]
+ public void EmptyKey_IsPadded()
+ {
+ var cipher = SymmetricCrypto.Encrypt("abc", CryptoKind.Aes, "", "");
+ var result = SymmetricCrypto.Decrypt(cipher, CryptoKind.Aes, "", "");
+
+ Assert.Equal("abc", result);
+ }
+
+ [Fact]
+ [DisplayName("密文损坏时解密抛出异常而不产生脏数据")]
+ public void InvalidCipher_Throws()
+ {
+ Assert.ThrowsAny<Exception>(() => SymmetricCrypto.Decrypt("not-base64!", CryptoKind.Aes, Key, Iv));
+ }
+
+ [Fact]
+ [DisplayName("十六进制长度必须为偶数")]
+ public void InvalidHex_Throws()
+ {
+ Assert.Throws<FormatException>(() => SymmetricCrypto.Decrypt("ABC", CryptoKind.Aes, Key, Iv, true));
+ }
+}
diff --git a/Tests/XCoder.App.Tests/XCoder.App.Tests.csproj b/Tests/XCoder.App.Tests/XCoder.App.Tests.csproj
new file mode 100644
index 0000000..af29c6e
--- /dev/null
+++ b/Tests/XCoder.App.Tests/XCoder.App.Tests.csproj
@@ -0,0 +1,25 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <TargetFramework>net10.0</TargetFramework>
+ <ImplicitUsings>enable</ImplicitUsings>
+ <Nullable>enable</Nullable>
+ <IsPackable>false</IsPackable>
+ <LangVersion>latest</LangVersion>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
+ <PackageReference Include="xunit" Version="2.9.3" />
+ <PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <ProjectReference Include="..\..\XCoder.App\XCoder.App.csproj" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Using Include="Xunit" />
+ </ItemGroup>
+
+</Project>
diff --git a/tools/package-macos.sh b/tools/package-macos.sh
new file mode 100644
index 0000000..3854a88
--- /dev/null
+++ b/tools/package-macos.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# 码神工具 macOS 打包脚本:发布自包含 .app + DMG
+# 用法:bash build/package-macos.sh [版本号]
+set -euo pipefail
+
+VERSION="${1:-0.5.0}"
+ROOT="$(cd "$(dirname "$0")/.." && pwd)"
+PROJ="$ROOT/XCoder.App/XCoder.App.csproj"
+OUT="$ROOT/XCoder.App/obj/publish/osx-arm64"
+APP="$ROOT/dist/XCoder.app"
+ICON="$ROOT/XCoder.App/Assets/XCoder.icns"
+
+if [ "$(uname -m)" != "arm64" ]; then
+ echo "当前脚本仅支持 Apple Silicon(arm64)构建" >&2
+ exit 1
+fi
+
+rm -rf "$OUT" "$APP" "$ROOT/dist/XCoder-arm64.dmg"
+dotnet publish "$PROJ" -c Release -r osx-arm64 --self-contained true -p:UseAppHost=true -o "$OUT"
+
+mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources"
+cp -R "$OUT"/* "$APP/Contents/MacOS/"
+mv "$APP/Contents/MacOS/XCoder.App" "$APP/Contents/MacOS/XCoder" 2>/dev/null || true
+[ -f "$ICON" ] && cp "$ICON" "$APP/Contents/Resources/XCoder.icns"
+rm -rf "$APP/Contents/MacOS/Config" "$APP/Contents/MacOS/Log" "$APP/Contents/MacOS/Data"
+
+cat > "$APP/Contents/Info.plist" <<PLIST
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleName</key><string>XCoder</string>
+ <key>CFBundleDisplayName</key><string>码神工具</string>
+ <key>CFBundleIdentifier</key><string>com.newlifex.xcoder</string>
+ <key>CFBundleExecutable</key><string>XCoder</string>
+ <key>CFBundleIconFile</key><string>XCoder</string>
+ <key>CFBundleShortVersionString</key><string>${VERSION}</string>
+ <key>CFBundleVersion</key><string>1</string>
+ <key>LSMinimumSystemVersion</key><string>13.0</string>
+ <key>NSHighResolutionCapable</key><true/>
+</dict>
+</plist>
+PLIST
+
+codesign --force --deep --sign - "$APP"
+hdiutil create -volname "XCoder" -srcfolder "$APP" -ov -format UDZO "$ROOT/dist/XCoder-arm64.dmg"
+echo "完成:$ROOT/dist/XCoder-arm64.dmg"
diff --git a/XCoderAv/App.axaml b/XCoder.App/App.axaml
similarity index 52%
rename from XCoderAv/App.axaml
rename to XCoder.App/App.axaml
index 72abfab..44fdf99 100644
--- a/XCoderAv/App.axaml
+++ b/XCoder.App/App.axaml
@@ -1,7 +1,16 @@
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- x:Class="XCoderAv.App">
+ x:Class="NewLife.XCoder.App"
+ RequestedThemeVariant="Default">
+ <Application.Resources>
+ <ResourceDictionary>
+ <ResourceDictionary.MergedDictionaries>
+ <ResourceInclude Source="avares://XCoder/Themes/Tokens.axaml" />
+ </ResourceDictionary.MergedDictionaries>
+ </ResourceDictionary>
+ </Application.Resources>
<Application.Styles>
<FluentTheme />
+ <StyleInclude Source="avares://XCoder/Themes/Controls.axaml" />
</Application.Styles>
</Application>
diff --git a/XCoder.App/App.axaml.cs b/XCoder.App/App.axaml.cs
new file mode 100644
index 0000000..c6e7bee
--- /dev/null
+++ b/XCoder.App/App.axaml.cs
@@ -0,0 +1,26 @@
+using Avalonia;
+using Avalonia.Controls.ApplicationLifetimes;
+using Avalonia.Markup.Xaml;
+using NewLife.XCoder.Services;
+using NewLife.XCoder.Shell;
+
+namespace NewLife.XCoder;
+
+/// <summary>码神工具应用宿主</summary>
+public partial class App : Application
+{
+ /// <summary>加载应用级样式与主题资源</summary>
+ public override void Initialize() => AvaloniaXamlLoader.Load(this);
+
+ /// <summary>创建统一工作台外壳</summary>
+ public override void OnFrameworkInitializationCompleted()
+ {
+ if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
+ {
+ ThemeService.Initialize();
+ desktop.MainWindow = new ShellWindow();
+ }
+
+ base.OnFrameworkInitializationCompleted();
+ }
+}
diff --git a/XCoder.App/Assets/XCoder.icns b/XCoder.App/Assets/XCoder.icns
new file mode 100644
index 0000000..f6f9eae
Binary files /dev/null and b/XCoder.App/Assets/XCoder.icns differ
diff --git a/XCoder.App/Assets/XCoder.png b/XCoder.App/Assets/XCoder.png
new file mode 100644
index 0000000..24d0272
Binary files /dev/null and b/XCoder.App/Assets/XCoder.png differ
diff --git a/XCoderAv/Common/XConfig.cs b/XCoder.App/Common/XConfig.cs
similarity index 96%
rename from XCoderAv/Common/XConfig.cs
rename to XCoder.App/Common/XConfig.cs
index 8d8b04d..e0548cd 100644
--- a/XCoderAv/Common/XConfig.cs
+++ b/XCoder.App/Common/XConfig.cs
@@ -2,10 +2,10 @@ using System.ComponentModel;
using NewLife;
using NewLife.Configuration;
-namespace XCoderAv;
+namespace NewLife.XCoder;
/// <summary>应用配置</summary>
-[Config("XCoderAv")]
+[Config("NewLife.XCoder")]
public class XConfig : Config<XConfig>
{
#region 属性
diff --git a/XCoderAv/Locales/ar.yml b/XCoder.App/Locales/ar.yml
similarity index 100%
rename from XCoderAv/Locales/ar.yml
rename to XCoder.App/Locales/ar.yml
diff --git a/XCoderAv/Locales/de.yml b/XCoder.App/Locales/de.yml
similarity index 100%
rename from XCoderAv/Locales/de.yml
rename to XCoder.App/Locales/de.yml
diff --git a/XCoderAv/Locales/es.yml b/XCoder.App/Locales/es.yml
similarity index 100%
rename from XCoderAv/Locales/es.yml
rename to XCoder.App/Locales/es.yml
diff --git a/XCoderAv/Locales/fr.yml b/XCoder.App/Locales/fr.yml
similarity index 100%
rename from XCoderAv/Locales/fr.yml
rename to XCoder.App/Locales/fr.yml
diff --git a/XCoderAv/Locales/ja.yml b/XCoder.App/Locales/ja.yml
similarity index 100%
rename from XCoderAv/Locales/ja.yml
rename to XCoder.App/Locales/ja.yml
diff --git a/XCoderAv/Locales/ko.yml b/XCoder.App/Locales/ko.yml
similarity index 100%
rename from XCoderAv/Locales/ko.yml
rename to XCoder.App/Locales/ko.yml
diff --git a/XCoderAv/Locales/pt.yml b/XCoder.App/Locales/pt.yml
similarity index 100%
rename from XCoderAv/Locales/pt.yml
rename to XCoder.App/Locales/pt.yml
diff --git a/XCoderAv/Locales/ru.yml b/XCoder.App/Locales/ru.yml
similarity index 100%
rename from XCoderAv/Locales/ru.yml
rename to XCoder.App/Locales/ru.yml
diff --git a/XCoderAv/Locales/zh-Hans.yml b/XCoder.App/Locales/zh-Hans.yml
similarity index 100%
rename from XCoderAv/Locales/zh-Hans.yml
rename to XCoder.App/Locales/zh-Hans.yml
diff --git a/XCoderAv/Locales/zh-Hant.yml b/XCoder.App/Locales/zh-Hant.yml
similarity index 100%
rename from XCoderAv/Locales/zh-Hant.yml
rename to XCoder.App/Locales/zh-Hant.yml
diff --git a/XCoderAv/Models/ApiServiceInfo.cs b/XCoder.App/Models/ApiServiceInfo.cs
similarity index 94%
rename from XCoderAv/Models/ApiServiceInfo.cs
rename to XCoder.App/Models/ApiServiceInfo.cs
index 810c552..4f97915 100644
--- a/XCoderAv/Models/ApiServiceInfo.cs
+++ b/XCoder.App/Models/ApiServiceInfo.cs
@@ -1,4 +1,4 @@
-namespace XCoderAv.Models;
+namespace NewLife.XCoder.Models;
/// <summary>API 服务信息</summary>
public class ApiServiceInfo
diff --git a/XCoderAv/Models/AudioDeviceInfo.cs b/XCoder.App/Models/AudioDeviceInfo.cs
similarity index 95%
rename from XCoderAv/Models/AudioDeviceInfo.cs
rename to XCoder.App/Models/AudioDeviceInfo.cs
index 70ba664..8b0ec67 100644
--- a/XCoderAv/Models/AudioDeviceInfo.cs
+++ b/XCoder.App/Models/AudioDeviceInfo.cs
@@ -1,4 +1,4 @@
-namespace XCoderAv.Models;
+namespace NewLife.XCoder.Models;
/// <summary>音频设备信息</summary>
public class AudioDeviceInfo
diff --git a/XCoderAv/Models/IconHelper.cs b/XCoder.App/Models/IconHelper.cs
similarity index 99%
rename from XCoderAv/Models/IconHelper.cs
rename to XCoder.App/Models/IconHelper.cs
index 9f8a65b..e5fa03b 100644
--- a/XCoderAv/Models/IconHelper.cs
+++ b/XCoder.App/Models/IconHelper.cs
@@ -3,7 +3,7 @@ using Avalonia.Media.Imaging;
using Avalonia.Platform;
using NewLife;
-namespace XCoderAv.Models;
+namespace NewLife.XCoder.Models;
/// <summary>ICO 图标文件辅助类(跨平台版,基于 Avalonia)</summary>
public class IconHelper
diff --git a/XCoderAv/Models/RedisConfig.cs b/XCoder.App/Models/RedisConfig.cs
similarity index 93%
rename from XCoderAv/Models/RedisConfig.cs
rename to XCoder.App/Models/RedisConfig.cs
index d963371..29bd2c1 100644
--- a/XCoderAv/Models/RedisConfig.cs
+++ b/XCoder.App/Models/RedisConfig.cs
@@ -1,4 +1,4 @@
-namespace XCoderAv.Models;
+namespace NewLife.XCoder.Models;
/// <summary>Redis 服务器节点配置</summary>
public class RedisConfig
diff --git a/XCoderAv/Models/RedisTreeNode.cs b/XCoder.App/Models/RedisTreeNode.cs
similarity index 95%
rename from XCoderAv/Models/RedisTreeNode.cs
rename to XCoder.App/Models/RedisTreeNode.cs
index f917f9d..24b8f3b 100644
--- a/XCoderAv/Models/RedisTreeNode.cs
+++ b/XCoder.App/Models/RedisTreeNode.cs
@@ -1,6 +1,6 @@
using CommunityToolkit.Mvvm.ComponentModel;
-namespace XCoderAv.Models;
+namespace NewLife.XCoder.Models;
/// <summary>Redis 树节点</summary>
public partial class RedisTreeNode : ObservableObject
diff --git a/XCoderAv/Models/RegexCaptureItem.cs b/XCoder.App/Models/RegexCaptureItem.cs
similarity index 94%
rename from XCoderAv/Models/RegexCaptureItem.cs
rename to XCoder.App/Models/RegexCaptureItem.cs
index 1bff322..a9fd9e5 100644
--- a/XCoderAv/Models/RegexCaptureItem.cs
+++ b/XCoder.App/Models/RegexCaptureItem.cs
@@ -1,6 +1,6 @@
using System.Text.RegularExpressions;
-namespace XCoderAv.Models;
+namespace NewLife.XCoder.Models;
/// <summary>正则捕获结果项</summary>
public class RegexCaptureItem
diff --git a/XCoderAv/Models/RegexGroupItem.cs b/XCoder.App/Models/RegexGroupItem.cs
similarity index 95%
rename from XCoderAv/Models/RegexGroupItem.cs
rename to XCoder.App/Models/RegexGroupItem.cs
index 90f04c4..20cf028 100644
--- a/XCoderAv/Models/RegexGroupItem.cs
+++ b/XCoder.App/Models/RegexGroupItem.cs
@@ -1,6 +1,6 @@
using System.Text.RegularExpressions;
-namespace XCoderAv.Models;
+namespace NewLife.XCoder.Models;
/// <summary>正则分组结果项</summary>
public class RegexGroupItem
diff --git a/XCoderAv/Models/RegexMatchItem.cs b/XCoder.App/Models/RegexMatchItem.cs
similarity index 95%
rename from XCoderAv/Models/RegexMatchItem.cs
rename to XCoder.App/Models/RegexMatchItem.cs
index a56019d..a5d4087 100644
--- a/XCoderAv/Models/RegexMatchItem.cs
+++ b/XCoder.App/Models/RegexMatchItem.cs
@@ -1,6 +1,6 @@
using System.Text.RegularExpressions;
-namespace XCoderAv.Models;
+namespace NewLife.XCoder.Models;
/// <summary>正则匹配结果项</summary>
public class RegexMatchItem
diff --git a/XCoderAv/Models/SyncTableModel.cs b/XCoder.App/Models/SyncTableModel.cs
similarity index 96%
rename from XCoderAv/Models/SyncTableModel.cs
rename to XCoder.App/Models/SyncTableModel.cs
index 8ded870..5a265db 100644
--- a/XCoderAv/Models/SyncTableModel.cs
+++ b/XCoder.App/Models/SyncTableModel.cs
@@ -1,6 +1,6 @@
using System.ComponentModel;
-namespace XCoderAv.Models;
+namespace NewLife.XCoder.Models;
/// <summary>同步表模型</summary>
public class SyncTableModel
diff --git a/XCoderAv/Models/UsbDeviceInfo.cs b/XCoder.App/Models/UsbDeviceInfo.cs
similarity index 94%
rename from XCoderAv/Models/UsbDeviceInfo.cs
rename to XCoder.App/Models/UsbDeviceInfo.cs
index 77a79cd..a0529d1 100644
--- a/XCoderAv/Models/UsbDeviceInfo.cs
+++ b/XCoder.App/Models/UsbDeviceInfo.cs
@@ -1,4 +1,4 @@
-namespace XCoderAv.Models;
+namespace NewLife.XCoder.Models;
/// <summary>USB 设备信息</summary>
public class UsbDeviceInfo
diff --git a/XCoderAv/nuget.config b/XCoder.App/nuget.config
similarity index 100%
rename from XCoderAv/nuget.config
rename to XCoder.App/nuget.config
diff --git a/XCoderAv/Program.cs b/XCoder.App/Program.cs
similarity index 98%
rename from XCoderAv/Program.cs
rename to XCoder.App/Program.cs
index a05ebbc..00f3bc0 100644
--- a/XCoderAv/Program.cs
+++ b/XCoder.App/Program.cs
@@ -4,7 +4,7 @@ using NewLife;
using NewLife.Log;
using Stardust;
-namespace XCoderAv;
+namespace NewLife.XCoder;
class Program
{
diff --git a/XCoderAv/Properties/PublishProfiles/FolderProfile.pubxml b/XCoder.App/Properties/PublishProfiles/FolderProfile.pubxml
similarity index 100%
rename from XCoderAv/Properties/PublishProfiles/FolderProfile.pubxml
rename to XCoder.App/Properties/PublishProfiles/FolderProfile.pubxml
diff --git a/XCoder.App/Services/ThemeService.cs b/XCoder.App/Services/ThemeService.cs
new file mode 100644
index 0000000..27811fb
--- /dev/null
+++ b/XCoder.App/Services/ThemeService.cs
@@ -0,0 +1,102 @@
+using System;
+using System.IO;
+using Avalonia;
+using Avalonia.Styling;
+using NewLife;
+using NewLife.Log;
+
+namespace NewLife.XCoder.Services;
+
+/// <summary>主题服务:跟随系统 / 浅色 / 深色,偏好写入用户目录</summary>
+public static class ThemeService
+{
+ private static readonly String _File;
+
+ static ThemeService()
+ {
+ var dir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "NewLife", "XCoder");
+ _File = Path.Combine(dir, "ui.theme");
+ }
+
+ /// <summary>当前模式:auto / light / dark</summary>
+ public static String Mode { get; private set; } = "auto";
+
+ /// <summary>模式中文名</summary>
+ public static String Label => Mode switch
+ {
+ "light" => "浅色",
+ "dark" => "深色",
+ _ => "跟随系统",
+ };
+
+ /// <summary>模式变化通知</summary>
+ public static event Action<String>? Changed;
+
+ /// <summary>启动时初始化主题</summary>
+ public static void Initialize()
+ {
+ var mode = "auto";
+ try
+ {
+ if (File.Exists(_File))
+ {
+ var text = File.ReadAllText(_File).Trim();
+ if (text is "auto" or "light" or "dark") mode = text;
+ }
+ }
+ catch (Exception ex)
+ {
+ XTrace.WriteException(ex);
+ }
+
+ Apply(mode, false);
+ }
+
+ /// <summary>按顺序切换:跟随系统 → 浅色 → 深色</summary>
+ public static void Cycle()
+ {
+ var mode = Mode switch
+ {
+ "auto" => "light",
+ "light" => "dark",
+ _ => "auto",
+ };
+
+ Apply(mode, true);
+ }
+
+ /// <summary>应用主题模式</summary>
+ /// <param name="mode">auto / light / dark</param>
+ /// <param name="save">是否保存到用户偏好</param>
+ public static void Apply(String mode, Boolean save = true)
+ {
+ if (mode is not ("auto" or "light" or "dark")) mode = "auto";
+
+ Mode = mode;
+ if (Application.Current != null)
+ {
+ Application.Current.RequestedThemeVariant = mode switch
+ {
+ "light" => ThemeVariant.Light,
+ "dark" => ThemeVariant.Dark,
+ _ => ThemeVariant.Default,
+ };
+ }
+
+ if (save)
+ {
+ try
+ {
+ var dir = Path.GetDirectoryName(_File);
+ if (!dir.IsNullOrEmpty()) Directory.CreateDirectory(dir);
+ File.WriteAllText(_File, mode);
+ }
+ catch (Exception ex)
+ {
+ XTrace.WriteException(ex);
+ }
+ }
+
+ Changed?.Invoke(mode);
+ }
+}
diff --git a/XCoder.App/Shell/CommandPaletteWindow.axaml b/XCoder.App/Shell/CommandPaletteWindow.axaml
new file mode 100644
index 0000000..25472dd
--- /dev/null
+++ b/XCoder.App/Shell/CommandPaletteWindow.axaml
@@ -0,0 +1,41 @@
+<Window xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:shell="clr-namespace:NewLife.XCoder.Shell"
+ x:Class="NewLife.XCoder.Shell.CommandPaletteWindow"
+ Title="命令面板"
+ Width="640" Height="460"
+ CanResize="False"
+ ShowInTaskbar="False"
+ WindowStartupLocation="CenterOwner"
+ Background="{DynamicResource BgSurface}">
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+
+ <Border BorderBrush="{DynamicResource BorderDefault}" BorderThickness="0,0,0,1"
+ Padding="14,8">
+ <TextBox Name="Input" Watermark="搜索工具或输入命令…"
+ FontSize="16" BorderThickness="0" Background="Transparent" />
+ </Border>
+
+ <ListBox Name="List" Grid.Row="1" Margin="8">
+ <ListBox.ItemTemplate>
+ <DataTemplate x:DataType="shell:ToolDescriptor">
+ <StackPanel Spacing="2" Margin="4,4">
+ <TextBlock Text="{Binding Title}" FontSize="13" FontWeight="SemiBold" />
+ <TextBlock Text="{Binding Description}" FontSize="10"
+ Foreground="{DynamicResource TextTertiary}"
+ TextTrimming="CharacterEllipsis" />
+ </StackPanel>
+ </DataTemplate>
+ </ListBox.ItemTemplate>
+ </ListBox>
+
+ <TextBlock Grid.Row="2" Margin="16,6" FontSize="10"
+ Foreground="{DynamicResource TextTertiary}"
+ Text="↑↓ 选择 · Enter 打开 · Esc 关闭" />
+ </Grid>
+</Window>
diff --git a/XCoder.App/Shell/CommandPaletteWindow.axaml.cs b/XCoder.App/Shell/CommandPaletteWindow.axaml.cs
new file mode 100644
index 0000000..ba0fc3b
--- /dev/null
+++ b/XCoder.App/Shell/CommandPaletteWindow.axaml.cs
@@ -0,0 +1,70 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Avalonia.Controls;
+using Avalonia.Input;
+
+namespace NewLife.XCoder.Shell;
+
+/// <summary>命令面板:输入即筛选,回车打开工具</summary>
+public partial class CommandPaletteWindow : Window
+{
+ private readonly List<ToolDescriptor> _all = [.. ToolRegistry.Tools];
+
+ /// <summary>实例化命令面板</summary>
+ public CommandPaletteWindow()
+ {
+ InitializeComponent();
+
+ Opened += (_, _) => Input.Focus();
+ Input.TextChanged += (_, _) => Refresh();
+ Input.KeyDown += OnKeyDown;
+ List.DoubleTapped += (_, _) => Accept();
+
+ Refresh();
+ }
+
+ private void Refresh()
+ {
+ var keyword = Input.Text?.Trim() ?? "";
+ var list = _all.Where(e => ToolRegistry.Match(e, keyword)).ToList();
+ List.ItemsSource = list;
+ if (list.Count > 0) List.SelectedIndex = 0;
+ }
+
+ private void OnKeyDown(Object? sender, KeyEventArgs e)
+ {
+ switch (e.Key)
+ {
+ case Key.Enter:
+ Accept();
+ e.Handled = true;
+ break;
+ case Key.Escape:
+ Close(null);
+ e.Handled = true;
+ break;
+ case Key.Down:
+ Move(1);
+ e.Handled = true;
+ break;
+ case Key.Up:
+ Move(-1);
+ e.Handled = true;
+ break;
+ }
+ }
+
+ private void Move(Int32 delta)
+ {
+ if (List.ItemCount == 0) return;
+
+ var index = Math.Clamp(List.SelectedIndex + delta, 0, List.ItemCount - 1);
+ List.SelectedIndex = index;
+ }
+
+ private void Accept()
+ {
+ if (List.SelectedItem is ToolDescriptor tool) Close(tool);
+ }
+}
diff --git a/XCoder.App/Shell/FloatingToolWindow.axaml b/XCoder.App/Shell/FloatingToolWindow.axaml
new file mode 100644
index 0000000..3334e2c
--- /dev/null
+++ b/XCoder.App/Shell/FloatingToolWindow.axaml
@@ -0,0 +1,40 @@
+<Window xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ x:Class="NewLife.XCoder.Shell.FloatingToolWindow"
+ Title="浮动窗口"
+ Width="920" Height="660"
+ MinWidth="600" MinHeight="420"
+ WindowStartupLocation="CenterOwner"
+ Background="{DynamicResource BgPage}">
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="44" />
+ <RowDefinition Height="*" />
+ </Grid.RowDefinitions>
+
+ <Border Grid.Row="0" Background="{DynamicResource BgSurface2}"
+ BorderBrush="{DynamicResource BorderDefault}" BorderThickness="0,0,0,1"
+ Padding="12,0">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+ <TextBlock Name="TitleText" Text="工具" VerticalAlignment="Center"
+ FontSize="13" FontWeight="SemiBold"
+ Foreground="{DynamicResource TextPrimary}" />
+ <StackPanel Grid.Column="2" Orientation="Horizontal" Spacing="8"
+ VerticalAlignment="Center">
+ <CheckBox Name="PinBox" Content="置顶" FontSize="11" />
+ <Button Name="ReturnButton" Classes="secondary" Content="移回标签"
+ FontSize="11" Padding="10,4" />
+ </StackPanel>
+ </Grid>
+ </Border>
+
+ <Border Grid.Row="1" Classes="panel" Margin="12">
+ <ContentControl Name="Host" />
+ </Border>
+ </Grid>
+</Window>
diff --git a/XCoder.App/Shell/FloatingToolWindow.axaml.cs b/XCoder.App/Shell/FloatingToolWindow.axaml.cs
new file mode 100644
index 0000000..670629c
--- /dev/null
+++ b/XCoder.App/Shell/FloatingToolWindow.axaml.cs
@@ -0,0 +1,36 @@
+using System;
+using Avalonia.Controls;
+
+namespace NewLife.XCoder.Shell;
+
+/// <summary>浮动工具窗口:承载与标签相同的工具实例</summary>
+public partial class FloatingToolWindow : Window
+{
+ private readonly Action? _onReturn;
+
+ /// <summary>实例化(供 XAML 设计器使用)</summary>
+ public FloatingToolWindow() => InitializeComponent();
+
+ /// <summary>按工具创建浮动窗口</summary>
+ /// <param name="tool">工具描述</param>
+ /// <param name="view">工具内容视图</param>
+ /// <param name="onReturn">移回标签时的回调</param>
+ public FloatingToolWindow(ToolDescriptor tool, Control view, Action onReturn) : this()
+ {
+ _onReturn = onReturn;
+ Title = tool.Title + " · 浮动窗口";
+ TitleText.Text = tool.Icon + " " + tool.Title;
+ Host.Content = view;
+
+ PinBox.IsCheckedChanged += (_, _) => Topmost = PinBox.IsChecked == true;
+ ReturnButton.Click += (_, _) =>
+ {
+ Host.Content = null;
+ _onReturn?.Invoke();
+ Close();
+ };
+ }
+
+ /// <summary>工具内容宿主</summary>
+ public ContentControl HostControl => Host;
+}
diff --git a/XCoder.App/Shell/ShellWindow.axaml b/XCoder.App/Shell/ShellWindow.axaml
new file mode 100644
index 0000000..2204511
--- /dev/null
+++ b/XCoder.App/Shell/ShellWindow.axaml
@@ -0,0 +1,171 @@
+<Window xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ x:Class="NewLife.XCoder.Shell.ShellWindow"
+ Title="码神工具"
+ Icon="avares://XCoder/Assets/XCoder.png"
+ Width="1100" Height="620"
+ MinWidth="860" MinHeight="560"
+ WindowStartupLocation="CenterScreen"
+ Background="{DynamicResource BgPage}">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="216" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+
+ <!-- 左侧导航 -->
+ <Border Grid.Column="0"
+ Background="{DynamicResource BgSidebar}"
+ BorderBrush="{DynamicResource BorderDefault}"
+ BorderThickness="0,0,1,0">
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="72" />
+ <RowDefinition Height="*" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+
+ <StackPanel Grid.Row="0" Orientation="Horizontal" Margin="16,0"
+ VerticalAlignment="Center" Spacing="10">
+ <Border Width="36" Height="36" CornerRadius="12" Background="{DynamicResource Accent}">
+ <TextBlock Text="X" Foreground="White" FontWeight="Bold" FontSize="17"
+ HorizontalAlignment="Center" VerticalAlignment="Center" />
+ </Border>
+ <StackPanel VerticalAlignment="Center">
+ <TextBlock Text="码神工具" FontSize="14" FontWeight="SemiBold"
+ Foreground="{DynamicResource TextPrimary}" />
+ <TextBlock Text="NEWLIFE.XCODER" FontSize="9"
+ Foreground="{DynamicResource TextTertiary}" />
+ </StackPanel>
+ </StackPanel>
+
+ <ScrollViewer Grid.Row="1">
+ <StackPanel Margin="10,4,10,10" Spacing="2">
+ <TextBlock Classes="sideLabel" Text="导航" />
+ <Button Name="NavHome" Classes="nav" Click="OnNavHome">
+ <StackPanel Orientation="Horizontal" Spacing="10">
+ <TextBlock Text="🏠" FontSize="14" />
+ <TextBlock Text="工作台" VerticalAlignment="Center" />
+ </StackPanel>
+ </Button>
+ <Button Name="NavAll" Classes="nav" Click="OnNavAll">
+ <StackPanel Orientation="Horizontal" Spacing="10">
+ <TextBlock Text="🗂" FontSize="14" />
+ <TextBlock Text="全部工具" VerticalAlignment="Center" />
+ </StackPanel>
+ </Button>
+
+ <TextBlock Classes="sideLabel" Text="工具分类" />
+ <StackPanel Name="CategoryPanel" Spacing="2" />
+
+ <TextBlock Classes="sideLabel" Name="OpenHeader" Text="已打开工具" />
+ <StackPanel Name="OpenPanel" Spacing="2" />
+ </StackPanel>
+ </ScrollViewer>
+
+ <Border Grid.Row="2" BorderBrush="{DynamicResource BorderDefault}"
+ BorderThickness="0,1,0,0" Padding="14,10">
+ <StackPanel Spacing="2">
+ <TextBlock Classes="dim" Text="版本 0.5 预览版" />
+ <TextBlock Classes="dim" Text="Windows · Linux · macOS" />
+ </StackPanel>
+ </Border>
+ </Grid>
+ </Border>
+
+ <!-- 右侧主区 -->
+ <Grid Grid.Column="1">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="72" />
+ <RowDefinition Height="*" />
+ <RowDefinition Height="32" />
+ </Grid.RowDefinitions>
+
+ <Grid Grid.Row="0" Margin="20,0">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+
+ <StackPanel VerticalAlignment="Center">
+ <TextBlock Name="PageTitle" Text="工作台" FontSize="18" FontWeight="SemiBold"
+ Foreground="{DynamicResource TextPrimary}" />
+ <TextBlock Name="PageSub" Text="全部工具 · 35 个" FontSize="10"
+ Foreground="{DynamicResource TextTertiary}" />
+ </StackPanel>
+
+ <Border Grid.Column="1" Margin="24,0" MaxWidth="380" Height="40"
+ HorizontalAlignment="Right" VerticalAlignment="Center"
+ CornerRadius="10" Padding="10,0"
+ Background="{DynamicResource BgSurface}"
+ BorderBrush="{DynamicResource BorderStrong}" BorderThickness="1">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+ <TextBlock Text="🔍" FontSize="13" VerticalAlignment="Center" Opacity="0.7" />
+ <TextBox Name="SearchBox" Grid.Column="1" Classes="search"
+ Watermark="搜索工具、功能或关键字…"
+ TextChanged="OnSearchChanged" KeyDown="OnSearchKeyDown" />
+ <Border Grid.Column="2" Background="{DynamicResource BgSubtle}"
+ CornerRadius="6" Padding="6,2" VerticalAlignment="Center">
+ <TextBlock Text="Ctrl K" FontSize="10" Foreground="{DynamicResource TextSecondary}" />
+ </Border>
+ </Grid>
+ </Border>
+
+ <Button Grid.Column="2" Name="ThemeButton" Classes="ghost" Content="🌓"
+ Click="OnThemeClick" ToolTip.Tip="切换主题(跟随系统 / 浅色 / 深色)" />
+ <Button Grid.Column="3" Classes="ghost" Content="⌘"
+ Click="OnPaletteClick" ToolTip.Tip="命令面板(Ctrl+K)" />
+ </Grid>
+
+ <Grid Grid.Row="1">
+ <ScrollViewer Name="HomeScroll">
+ <StackPanel Name="HomePanel" Margin="20,4,20,24" Spacing="18" />
+ </ScrollViewer>
+
+ <Grid Name="WorkspacePanel" IsVisible="False">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="44" />
+ <RowDefinition Height="*" />
+ </Grid.RowDefinitions>
+ <ScrollViewer Grid.Row="0" Margin="12,0"
+ HorizontalScrollBarVisibility="Auto"
+ VerticalScrollBarVisibility="Disabled">
+ <StackPanel Name="TabsPanel" Orientation="Horizontal" Spacing="4"
+ VerticalAlignment="Center" />
+ </ScrollViewer>
+ <Border Grid.Row="1" Margin="16,0,16,16" Classes="panel">
+ <ContentControl Name="ToolContent" />
+ </Border>
+ </Grid>
+ </Grid>
+
+ <Border Grid.Row="2" Background="{DynamicResource BgSurface}"
+ BorderBrush="{DynamicResource BorderDefault}" BorderThickness="0,1,0,0"
+ Padding="14,0">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+ <TextBlock Name="StatusName" Text="工作台" FontSize="11" FontWeight="SemiBold"
+ VerticalAlignment="Center" Foreground="{DynamicResource TextPrimary}" />
+ <TextBlock Name="StatusText" Grid.Column="1" Text="就绪" FontSize="11"
+ Margin="10,0,0,0" VerticalAlignment="Center"
+ Foreground="{DynamicResource TextSecondary}" />
+ <TextBlock Grid.Column="3" Name="StatusRight" Text="35 个工具 · 本地离线"
+ FontSize="10" VerticalAlignment="Center"
+ Foreground="{DynamicResource TextTertiary}" />
+ </Grid>
+ </Border>
+ </Grid>
+ </Grid>
+</Window>
diff --git a/XCoder.App/Shell/ShellWindow.axaml.cs b/XCoder.App/Shell/ShellWindow.axaml.cs
new file mode 100644
index 0000000..9c6430e
--- /dev/null
+++ b/XCoder.App/Shell/ShellWindow.axaml.cs
@@ -0,0 +1,730 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Input;
+using Avalonia.Interactivity;
+using Avalonia.Layout;
+using Avalonia.Media;
+using NewLife;
+using NewLife.Log;
+using NewLife.XCoder.Services;
+
+namespace NewLife.XCoder.Shell;
+
+/// <summary>统一工作台外壳:导航、工作台首页、标签与浮动窗口、状态栏</summary>
+public partial class ShellWindow : Window
+{
+ private readonly List<ToolSession> _sessions = [];
+ private readonly Dictionary<String, Button> _categoryButtons = [];
+ private ToolSession? _active;
+ private String _view = "home";
+ private String _category = "";
+ private String _keyword = "";
+ private Boolean _returning;
+ private Boolean _initialized;
+
+ /// <summary>实例化外壳</summary>
+ public ShellWindow()
+ {
+ InitializeComponent();
+
+ KeyDown += OnWindowKeyDown;
+ BuildCategories();
+ UpdateNav();
+ UpdateThemeUi();
+ ThemeService.Changed += _ => UpdateThemeUi();
+
+ // 主题资源需在窗口挂载后才能解析,工作台内容延迟到 Opened 构建
+ Opened += (_, _) =>
+ {
+ if (_initialized) return;
+ _initialized = true;
+ BuildHome();
+ UpdateOpenPanel();
+ ShowHome("工作台", "全部工具 · 35 个");
+
+ // 冒烟:dotnet run -- --smoke-open 打开数据建模,验证标签宿主
+ var args = Environment.GetCommandLineArgs();
+ if (args.Contains("--smoke-open")) OpenTool(ToolRegistry.Tools[0]);
+ if (args.Contains("--smoke-dark")) ThemeService.Apply("dark", false);
+ foreach (var arg in args)
+ {
+ if (!arg.StartsWith("--open=", StringComparison.OrdinalIgnoreCase)) continue;
+ var tool = ToolRegistry.Find(arg[7..]);
+ if (tool != null) OpenTool(tool);
+ }
+ };
+ }
+
+ #region 导航
+ private void BuildCategories()
+ {
+ foreach (var category in ToolRegistry.Categories)
+ {
+ var count = ToolRegistry.GetByCategory(category.Key).Count;
+ var panel = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 8 };
+ panel.Children.Add(new TextBlock { Text = category.Icon, FontSize = 14 });
+ panel.Children.Add(new TextBlock { Text = category.Title, VerticalAlignment = VerticalAlignment.Center });
+ panel.Children.Add(new TextBlock
+ {
+ Text = count.ToString(),
+ FontSize = 10,
+ Opacity = 0.6,
+ Margin = new Thickness(10, 0, 0, 0),
+ VerticalAlignment = VerticalAlignment.Center,
+ });
+
+ var button = new Button { Content = panel, Classes = { "nav" } };
+ button.Click += (_, _) =>
+ {
+ _category = category.Key;
+ _view = "home";
+ _keyword = "";
+ SearchBox.Text = "";
+ BuildHome();
+ UpdateNav();
+ };
+
+ _categoryButtons[category.Key] = button;
+ CategoryPanel.Children.Add(button);
+ }
+ }
+
+ private void UpdateNav()
+ {
+ NavHome.Classes.Set("active", _view == "home" && _category == "" && _keyword == "");
+ NavAll.Classes.Set("active", _view == "all");
+ foreach (var item in _categoryButtons)
+ {
+ item.Value.Classes.Set("active", _view == "home" && _category == item.Key && _keyword == "");
+ }
+ }
+
+ private void OnNavHome(Object? sender, RoutedEventArgs e)
+ {
+ _view = "home";
+ _category = "";
+ _keyword = "";
+ SearchBox.Text = "";
+ ShowHome("工作台", "全部工具 · 35 个");
+ BuildHome();
+ UpdateNav();
+ }
+
+ private void OnNavAll(Object? sender, RoutedEventArgs e)
+ {
+ _view = "all";
+ _category = "";
+ _keyword = "";
+ SearchBox.Text = "";
+ ShowHome("全部工具", "35 个工具 · 按分类浏览或直接搜索");
+ BuildHome();
+ UpdateNav();
+ }
+
+ private void ShowHome(String title, String sub)
+ {
+ WorkspacePanel.IsVisible = false;
+ HomeScroll.IsVisible = true;
+ PageTitle.Text = title;
+ PageSub.Text = sub;
+ SetStatus("工作台", "就绪 · 35 个工具可用");
+ }
+
+ private void ShowWorkspace()
+ {
+ WorkspacePanel.IsVisible = true;
+ HomeScroll.IsVisible = false;
+ }
+ #endregion
+
+ #region 工作台首页
+ private void BuildHome()
+ {
+ HomePanel.Children.Clear();
+
+ var isBrowse = !_keyword.IsNullOrEmpty() || _view == "all" || !_category.IsNullOrEmpty();
+ var tools = ToolRegistry.Tools
+ .Where(e => (_category.IsNullOrEmpty() || e.Category == _category) && ToolRegistry.Match(e, _keyword))
+ .ToList();
+
+ if (!isBrowse) HomePanel.Children.Add(BuildHero());
+
+ if (!isBrowse)
+ {
+ HomePanel.Children.Add(BuildSection("快捷入口", "可自定义 · 最多 8 个", QuickTools()));
+ foreach (var category in ToolRegistry.Categories)
+ {
+ HomePanel.Children.Add(BuildSection(category.Title, $"{ToolRegistry.GetByCategory(category.Key).Count} 个工具", ToolRegistry.GetByCategory(category.Key)));
+ }
+ }
+ else
+ {
+ var title = _keyword.IsNullOrEmpty() ? "全部工具" : $"搜索 “{_keyword}”";
+ HomePanel.Children.Add(BuildSection(title, $"{tools.Count} 个结果", tools));
+ if (tools.Count == 0) HomePanel.Children.Add(BuildEmpty());
+ }
+ }
+
+ private static IReadOnlyList<ToolDescriptor> QuickTools()
+ {
+ String[] keys = ["modeling", "network", "mqtt", "sql", "crypto", "redis", "serial", "folder"];
+ var list = new List<ToolDescriptor>();
+ foreach (var key in keys)
+ {
+ var tool = ToolRegistry.Find(key);
+ if (tool != null) list.Add(tool);
+ }
+
+ return list;
+ }
+
+ private Control BuildHero()
+ {
+ var text = new StackPanel
+ {
+ Orientation = Orientation.Vertical,
+ Spacing = 8,
+ VerticalAlignment = VerticalAlignment.Center,
+ HorizontalAlignment = HorizontalAlignment.Left,
+ };
+ text.Children.Add(new TextBlock
+ {
+ Text = "DEVELOPER TOOLBOX · 三平台统一",
+ FontSize = 10,
+ Opacity = 0.72,
+ Foreground = Brushes.White,
+ });
+ text.Children.Add(new TextBlock
+ {
+ Text = "开发者工具,一个入口就够了",
+ FontSize = 26,
+ FontWeight = FontWeight.Bold,
+ Foreground = Brushes.White,
+ });
+ text.Children.Add(new TextBlock
+ {
+ Text = "数据建模、网络协议、工业设备、文本与媒体小工具,35 个工具开箱即用。矢量图标与逻辑像素布局,高分屏与远程桌面下同样清晰。",
+ FontSize = 12,
+ Opacity = 0.86,
+ MaxWidth = 620,
+ TextWrapping = TextWrapping.Wrap,
+ HorizontalAlignment = HorizontalAlignment.Left,
+ Foreground = Brushes.White,
+ });
+
+ var actions = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 8, Margin = new Thickness(0, 8, 0, 0) };
+ var browse = new Button { Content = "🗂 浏览全部工具", Classes = { "secondary" } };
+ browse.Click += (_, _) =>
+ {
+ _view = "all";
+ BuildHome();
+ UpdateNav();
+ };
+ var palette = new Button { Content = "⌘ 命令面板 Ctrl K", Classes = { "ghost" }, Foreground = Brushes.White };
+ palette.Click += (_, _) => OpenPalette();
+ actions.Children.Add(browse);
+ actions.Children.Add(palette);
+ text.Children.Add(actions);
+
+ var stats = new WrapPanel { Margin = new Thickness(0, 14, 0, 0) };
+ foreach (var item in new (String Value, String Key)[] { ("35", "工具"), ("4", "分类"), ("3", "平台"), ("11", "语言") })
+ {
+ var box = new Border
+ {
+ Background = new SolidColorBrush(Color.Parse("#1AFFFFFF")),
+ BorderBrush = new SolidColorBrush(Color.Parse("#26FFFFFF")),
+ BorderThickness = new Thickness(1),
+ CornerRadius = new CornerRadius(10),
+ Padding = new Thickness(14, 8),
+ Margin = new Thickness(0, 0, 8, 8),
+ MinWidth = 84,
+ };
+ var stack = new StackPanel { Spacing = 0 };
+ stack.Children.Add(new TextBlock { Text = item.Value, FontSize = 20, FontWeight = FontWeight.Bold, Foreground = Brushes.White });
+ stack.Children.Add(new TextBlock { Text = item.Key, FontSize = 10, Opacity = 0.78, Foreground = Brushes.White });
+ box.Child = stack;
+ stats.Children.Add(box);
+ }
+ text.Children.Add(stats);
+
+ return new Border
+ {
+ CornerRadius = new CornerRadius(18),
+ Padding = new Thickness(26, 22),
+ Margin = new Thickness(0, 0, 0, 2),
+ Background = new LinearGradientBrush
+ {
+ StartPoint = new RelativePoint(0, 0, RelativeUnit.Relative),
+ EndPoint = new RelativePoint(1, 1, RelativeUnit.Relative),
+ GradientStops =
+ {
+ new GradientStop(Color.Parse("#17325C"), 0),
+ new GradientStop(Color.Parse("#235F9E"), 1),
+ },
+ },
+ Child = text,
+ };
+ }
+
+ private Control BuildSection(String title, String sub, IReadOnlyList<ToolDescriptor> tools)
+ {
+ var panel = new StackPanel { Spacing = 10 };
+
+ var header = new Grid();
+ header.ColumnDefinitions.Add(new ColumnDefinition(GridLength.Star));
+ header.ColumnDefinitions.Add(new ColumnDefinition(GridLength.Auto));
+
+ var headText = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 10, VerticalAlignment = VerticalAlignment.Center };
+ headText.Children.Add(new TextBlock { Text = title, Classes = { "sectionTitle" } });
+ headText.Children.Add(new TextBlock { Text = sub, Classes = { "dim" }, VerticalAlignment = VerticalAlignment.Center });
+ header.Children.Add(headText);
+
+ panel.Children.Add(header);
+
+ var wrap = new WrapPanel();
+ foreach (var tool in tools)
+ {
+ wrap.Children.Add(BuildCard(tool));
+ }
+ panel.Children.Add(wrap);
+
+ return panel;
+ }
+
+ private Control BuildCard(ToolDescriptor tool)
+ {
+ var migrated = tool.ViewType != null;
+ var card = new Border
+ {
+ Classes = { "card" },
+ Width = 240,
+ Height = 132,
+ Margin = new Thickness(0, 0, 12, 12),
+ Opacity = migrated ? 1 : 0.55,
+ };
+ if (migrated) card.Cursor = new Cursor(StandardCursorType.Hand);
+
+ var stack = new StackPanel { Spacing = 6 };
+
+ var iconBorder = new Border
+ {
+ Width = 42,
+ Height = 42,
+ Classes = { "tile" },
+ HorizontalAlignment = HorizontalAlignment.Left,
+ };
+ iconBorder.Child = new TextBlock
+ {
+ Text = tool.Icon,
+ FontSize = 19,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ };
+ stack.Children.Add(iconBorder);
+
+ stack.Children.Add(new TextBlock
+ {
+ Text = tool.Title,
+ Classes = { "cardTitle" },
+ });
+ stack.Children.Add(new TextBlock
+ {
+ Text = tool.Description,
+ Classes = { "cardDesc" },
+ MaxLines = 2,
+ TextWrapping = TextWrapping.Wrap,
+ TextTrimming = TextTrimming.CharacterEllipsis,
+ });
+
+ var chips = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 6 };
+ chips.Children.Add(BuildChip(CategoryName(tool.Category), false));
+ if (!migrated) chips.Children.Add(BuildChip("待迁移", true));
+ stack.Children.Add(chips);
+
+ card.Child = stack;
+ if (migrated) card.PointerPressed += (_, _) => OpenTool(tool);
+ else card.PointerPressed += (_, _) => SetStatus(tool.Title, "尚未迁移,详见 Doc/功能清单.md");
+
+ return card;
+ }
+
+ private Control BuildChip(String text, Boolean warn)
+ {
+ return new Border
+ {
+ Classes = { "chip" },
+ Child = new TextBlock { Text = text, Classes = { warn ? "chipWarn" : "chipText" } },
+ };
+ }
+
+ private Control BuildEmpty()
+ {
+ var stack = new StackPanel { Spacing = 8, Margin = new Thickness(0, 40, 0, 0) };
+ stack.Children.Add(new TextBlock
+ {
+ Text = "没有找到匹配的工具",
+ FontSize = 16,
+ FontWeight = FontWeight.SemiBold,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ });
+ stack.Children.Add(new TextBlock
+ {
+ Text = "换个关键字试试,或按 Ctrl+K 用命令面板直接搜索。",
+ Classes = { "dim" },
+ HorizontalAlignment = HorizontalAlignment.Center,
+ });
+ return stack;
+ }
+
+ private static String CategoryName(String key)
+ {
+ foreach (var item in ToolRegistry.Categories)
+ {
+ if (item.Key == key) return item.Title;
+ }
+
+ return key;
+ }
+ #endregion
+
+ #region 打开与关闭
+ private void OpenTool(ToolDescriptor tool)
+ {
+ if (tool.ViewType == null)
+ {
+ SetStatus(tool.Title, "尚未迁移,详见 Doc/功能清单.md");
+ return;
+ }
+
+ var existing = _sessions.FirstOrDefault(e => e.Descriptor.Key == tool.Key);
+ if (existing != null)
+ {
+ if (existing.FloatingWindow != null)
+ {
+ existing.FloatingWindow.Activate();
+ SetStatus(tool.Title, "已在浮动窗口中");
+ return;
+ }
+
+ Activate(existing);
+ return;
+ }
+
+ Object? instance;
+ try
+ {
+ instance = Activator.CreateInstance(tool.ViewType);
+ }
+ catch (Exception ex)
+ {
+ XTrace.WriteException(ex);
+ SetStatus(tool.Title, "打开失败:" + ex.Message);
+ return;
+ }
+
+ // 新式工具:本身就是 UserControl,直接放进标签
+ if (instance is Control direct && instance is not Window)
+ {
+ var item = new ToolSession(tool, direct, null);
+ _sessions.Add(item);
+ Activate(item);
+ return;
+ }
+
+ if (instance is not Window source)
+ {
+ SetStatus(tool.Title, "工具类型不支持:" + tool.ViewType.FullName);
+ return;
+ }
+
+ Control? view = null;
+ try
+ {
+ view = source.Content as Control;
+ if (view != null)
+ {
+ source.Content = null;
+ var dc = source.DataContext;
+ if (dc != null && (view.DataContext == null || ReferenceEquals(view.DataContext, dc))) view.DataContext = dc;
+ source.DataContext = null;
+
+ // 窗口级样式必须先脱离原窗口,才能挂到新的可视树
+ var styles = source.Styles.ToArray();
+ if (styles.Length > 0)
+ {
+ source.Styles.Clear();
+ foreach (var style in styles) view.Styles.Add(style);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ XTrace.WriteException(ex);
+ SetStatus(tool.Title, "打开失败:" + ex.Message);
+ try { source?.Close(); } catch { }
+ return;
+ }
+
+ if (view == null)
+ {
+ // 工具没有可搬运的内容,退化为独立窗口
+ try
+ {
+ source?.Show(this);
+ SetStatus(tool.Title, "已打开为独立窗口");
+ }
+ catch (Exception ex)
+ {
+ XTrace.WriteException(ex);
+ SetStatus(tool.Title, "打开失败:" + ex.Message);
+ }
+ return;
+ }
+
+ var session = new ToolSession(tool, view, source);
+ _sessions.Add(session);
+ Activate(session);
+ }
+
+ private void Activate(ToolSession session)
+ {
+ _active = session;
+ ToolContent.Content = session.View;
+ ShowWorkspace();
+ Title = "码神工具 · " + session.Descriptor.Title;
+ PageTitle.Text = session.Descriptor.Title;
+ PageSub.Text = "工作区 · 单实例标签";
+ BuildTabs();
+ UpdateOpenPanel();
+ SetStatus(session.Descriptor.Title, "已打开 · 会话保持");
+ }
+
+ private void CloseSession(ToolSession session)
+ {
+ var wasActive = session == _active;
+ _sessions.Remove(session);
+
+ if (session.FloatingWindow != null)
+ {
+ var win = session.FloatingWindow;
+ session.FloatingWindow = null;
+ try { win.Close(); } catch { }
+ }
+
+ if (ToolContent.Content == session.View) ToolContent.Content = null;
+ try { session.SourceWindow?.Close(); } catch { }
+
+ if (wasActive)
+ {
+ if (_sessions.Count > 0) Activate(_sessions[^1]);
+ else
+ {
+ _active = null;
+ ShowHome("工作台", "全部工具 · 35 个");
+ BuildHome();
+ UpdateNav();
+ }
+ }
+ else
+ {
+ BuildTabs();
+ UpdateOpenPanel();
+ }
+ }
+
+ private void BuildTabs()
+ {
+ TabsPanel.Children.Clear();
+
+ foreach (var session in _sessions)
+ {
+ var button = new Button
+ {
+ Content = session.Descriptor.Icon + " " + session.Descriptor.Title,
+ Classes = { "tab" },
+ };
+ if (session == _active) button.Classes.Add("active");
+ button.Click += (_, _) => Activate(session);
+
+ var close = new Button
+ {
+ Content = "✕",
+ Classes = { "ghost" },
+ FontSize = 11,
+ Padding = new Thickness(4, 2),
+ };
+ close.Click += (_, _) => CloseSession(session);
+
+ TabsPanel.Children.Add(button);
+ TabsPanel.Children.Add(close);
+ }
+
+ if (_active != null)
+ {
+ var pop = new Button
+ {
+ Content = "⧉ 弹出为浮动窗口",
+ Classes = { "ghost" },
+ FontSize = 11,
+ Margin = new Thickness(8, 0, 0, 0),
+ };
+ pop.Click += (_, _) => PopoutActive();
+ TabsPanel.Children.Add(pop);
+ }
+ }
+
+ private void UpdateOpenPanel()
+ {
+ OpenPanel.Children.Clear();
+ OpenHeader.Text = _sessions.Count > 0 ? $"已打开工具 · {_sessions.Count}" : "已打开工具";
+
+ if (_sessions.Count == 0)
+ {
+ OpenPanel.Children.Add(new TextBlock
+ {
+ Text = "暂无打开的工具",
+ Classes = { "dim" },
+ Margin = new Thickness(10, 4),
+ });
+ return;
+ }
+
+ foreach (var session in _sessions)
+ {
+ var text = session.Descriptor.Icon + " " + session.Descriptor.Title;
+ if (session.FloatingWindow != null) text += " ⧉";
+
+ var button = new Button { Content = text, Classes = { "nav" }, FontSize = 12 };
+ if (session == _active) button.Classes.Add("active");
+ button.Click += (_, _) =>
+ {
+ if (session.FloatingWindow != null) session.FloatingWindow.Activate();
+ else Activate(session);
+ };
+ OpenPanel.Children.Add(button);
+ }
+ }
+
+ private void PopoutActive()
+ {
+ if (_active == null) return;
+
+ var session = _active;
+ ToolContent.Content = null;
+
+ var win = new FloatingToolWindow(session.Descriptor, session.View, () => ReturnToTab(session));
+ session.FloatingWindow = win;
+ win.Closed += (_, _) =>
+ {
+ if (session.FloatingWindow == win) session.FloatingWindow = null;
+ if (win.HostControl.Content != null)
+ {
+ win.HostControl.Content = null;
+ ReturnToTab(session);
+ }
+ };
+ win.Show(this);
+
+ BuildTabs();
+ SetStatus(session.Descriptor.Title, "已弹出为浮动窗口 · 会话保持");
+ }
+
+ private void ReturnToTab(ToolSession session)
+ {
+ if (_returning || !_sessions.Contains(session)) return;
+
+ _returning = true;
+ try
+ {
+ if (session.FloatingWindow != null)
+ {
+ var win = session.FloatingWindow;
+ session.FloatingWindow = null;
+ try { win.Close(); } catch { }
+ }
+
+ if (session.View.Parent is ContentControl host) host.Content = null;
+ Activate(session);
+ }
+ finally
+ {
+ _returning = false;
+ }
+ }
+ #endregion
+
+ #region 搜索与命令
+ private void OnSearchChanged(Object? sender, TextChangedEventArgs e)
+ {
+ _keyword = SearchBox.Text?.Trim() ?? "";
+ if (_keyword.Length == 0) return;
+
+ _view = "home";
+ _category = "";
+ ShowHome("搜索", $"关键字 “{_keyword}”");
+ BuildHome();
+ UpdateNav();
+ }
+
+ private void OnSearchKeyDown(Object? sender, KeyEventArgs e)
+ {
+ if (e.Key != Key.Enter) return;
+
+ var first = ToolRegistry.Tools.FirstOrDefault(t => ToolRegistry.Match(t, _keyword));
+ if (first != null)
+ {
+ OpenTool(first);
+ e.Handled = true;
+ }
+ }
+
+ private async void OnPaletteClick(Object? sender, RoutedEventArgs e) => await OpenPaletteAsync();
+
+ private void OpenPalette() => _ = OpenPaletteAsync();
+
+ private async System.Threading.Tasks.Task OpenPaletteAsync()
+ {
+ var dialog = new CommandPaletteWindow();
+ var tool = await dialog.ShowDialog<ToolDescriptor?>(this);
+ if (tool != null) OpenTool(tool);
+ }
+
+ private void OnWindowKeyDown(Object? sender, KeyEventArgs e)
+ {
+ if (e.KeyModifiers == KeyModifiers.Control && e.Key == Key.K)
+ {
+ OpenPalette();
+ e.Handled = true;
+ }
+ else if (e.KeyModifiers == KeyModifiers.Control && e.Key == Key.W && _active != null)
+ {
+ CloseSession(_active);
+ e.Handled = true;
+ }
+ }
+ #endregion
+
+ #region 主题与状态
+ private void OnThemeClick(Object? sender, RoutedEventArgs e) => ThemeService.Cycle();
+
+ private void UpdateThemeUi()
+ {
+ ThemeButton.Content = ThemeService.Mode switch
+ {
+ "light" => "☀",
+ "dark" => "🌙",
+ _ => "🌓",
+ };
+ StatusRight.Text = $"35 个工具 · 主题:{ThemeService.Label}";
+ }
+
+ private void SetStatus(String name, String text)
+ {
+ StatusName.Text = name;
+ StatusText.Text = text;
+ }
+ #endregion
+}
diff --git a/XCoder.App/Shell/ToolDescriptor.cs b/XCoder.App/Shell/ToolDescriptor.cs
new file mode 100644
index 0000000..183a899
--- /dev/null
+++ b/XCoder.App/Shell/ToolDescriptor.cs
@@ -0,0 +1,50 @@
+using System;
+
+namespace NewLife.XCoder.Shell;
+
+/// <summary>工具分类</summary>
+/// <param name="Key">分类标识</param>
+/// <param name="Title">分类名称</param>
+/// <param name="Icon">图标字形</param>
+public sealed record ToolCategory(String Key, String Title, String Icon);
+
+/// <summary>工具描述:工作台卡片与命令面板的唯一数据来源</summary>
+/// <param name="Key">唯一标识</param>
+/// <param name="Title">工具名称</param>
+/// <param name="Description">一句话说明</param>
+/// <param name="Category">所属分类</param>
+/// <param name="Icon">图标字形</param>
+/// <param name="ViewType">工具窗口类型;为空表示尚未迁移</param>
+/// <param name="Keywords">搜索关键字</param>
+public sealed record ToolDescriptor(
+ String Key,
+ String Title,
+ String Description,
+ String Category,
+ String Icon,
+ Type? ViewType = null,
+ String[]? Keywords = null);
+
+/// <summary>已打开的工具实例;标签与浮动窗口共享同一实例</summary>
+public sealed class ToolSession
+{
+ /// <summary>实例化</summary>
+ public ToolSession(ToolDescriptor descriptor, Avalonia.Controls.Control view, Avalonia.Controls.Window? source)
+ {
+ Descriptor = descriptor;
+ View = view;
+ SourceWindow = source;
+ }
+
+ /// <summary>工具描述</summary>
+ public ToolDescriptor Descriptor { get; }
+
+ /// <summary>工具内容视图</summary>
+ public Avalonia.Controls.Control View { get; }
+
+ /// <summary>来源窗口;仅用于维持其生命周期,不显示</summary>
+ public Avalonia.Controls.Window? SourceWindow { get; }
+
+ /// <summary>浮动窗口宿主;为空表示在标签中</summary>
+ public Avalonia.Controls.Window? FloatingWindow { get; set; }
+}
diff --git a/XCoder.App/Shell/ToolRegistry.cs b/XCoder.App/Shell/ToolRegistry.cs
new file mode 100644
index 0000000..e5ce60e
--- /dev/null
+++ b/XCoder.App/Shell/ToolRegistry.cs
@@ -0,0 +1,112 @@
+using System;
+using System.Collections.Generic;
+using NewLife;
+using NewLife.XCoder.Tools.Coord;
+using NewLife.XCoder.Tools.Symmetric;
+using NewLife.XCoder.Views;
+
+namespace NewLife.XCoder.Shell;
+
+/// <summary>工具注册表:显式登记全部工具,不用反射扫描</summary>
+public static class ToolRegistry
+{
+ /// <summary>分类</summary>
+ public static IReadOnlyList<ToolCategory> Categories { get; } =
+ [
+ new("dev", "开发与数据", "🗄"),
+ new("net", "网络与通信", "🌐"),
+ new("ind", "工业与设备", "⚙"),
+ new("eff", "效率工具", "✦"),
+ ];
+
+ /// <summary>全部工具(35 个);ViewType 为空的表示尚未迁移</summary>
+ public static IReadOnlyList<ToolDescriptor> Tools { get; } =
+ [
+ // 开发与数据
+ new("modeling", "数据建模", "连接数据库或导入模型,生成实体代码与建表 SQL", "dev", "🗄", typeof(DataModelingWindow), ["数据库", "实体", "代码生成", "DDL"]),
+ new("sync", "数据同步", "跨库结构与数据同步,支持差异预览与执行", "dev", "🔄", typeof(DataSyncWindow), ["同步", "迁移", "备份"]),
+ new("sql", "SQL 工作台", "架构树浏览、SQL 编辑执行、结果表格与导出", "dev", "🖥", null, ["SQL", "查询", "执行"]),
+ new("api", "API 调试", "NewLife.Remoting RPC 连接、Action 调用与交互日志", "dev", "🔗", typeof(ApiDebugWindow), ["RPC", "接口", "远程"]),
+ new("discover", "API 发现", "局域网 ApiServer 扫描与接口信息查看", "dev", "🔎", typeof(ApiDiscoverWindow), ["扫描", "服务"]),
+ new("redis", "Redis 管理", "连接、键值浏览、值编辑与命令执行", "dev", "🧱", typeof(RedisManagerWindow), ["缓存", "键值"]),
+ new("regex", "正则表达式", "匹配、替换、捕获组分析与批量文件替换", "dev", "🔍", typeof(RegexWindow), ["正则", "替换"]),
+ new("crypto", "加密解密", "摘要、Hex/Base64、URL、RSA 等 30+ 安全命令", "dev", "🔒", typeof(SecurityWindow), ["AES", "RSA", "Base64", "摘要"]),
+ new("symmetric", "对称加密", "AES/DES 等对称算法加解密与参数配置", "dev", "🔑", typeof(SymmetricToolView), ["AES", "DES"]),
+ new("md5", "MD5 解密", "MD5 查询与在线解密,本地优先", "dev", "#️⃣", null, ["MD5", "哈希"]),
+ new("filecode", "文件编码", "文件字符集探测、预览与批量转换", "dev", "📄", typeof(FileEncodingWindow), ["编码", "字符集", "GBK"]),
+
+ // 网络与通信
+ new("network", "网络调试", "TCP/UDP 客户端与服务端调试,收发日志", "net", "🌐", typeof(NetworkWindow), ["TCP", "UDP", "端口"]),
+ new("message", "消息调试", "消息协议组装、收发与解析", "net", "💬", typeof(MessageDebugWindow), ["报文", "协议"]),
+ new("mqtt", "MQTT 客户端", "Broker 连接、发布订阅、主题树与消息日志", "net", "📡", typeof(MqttWindow), ["MQTT", "Broker", "订阅"]),
+ new("ssh", "SSH 工具", "远程终端与命令执行,密钥/密码认证", "net", "🖥", typeof(SshWindow), ["SSH", "终端"]),
+ new("modbustcp", "Modbus TCP", "主站读写、寄存器表与周期轮询", "net", "🔀", typeof(ModbusTcpWindow), ["Modbus", "寄存器"]),
+ new("modbusrtu", "Modbus RTU", "串口主站读写、CRC 校验与报文日志", "net", "🔀", typeof(ModbusRtuWindow), ["Modbus", "串口"]),
+ new("serial", "串口调试", "串口枚举、参数配置、收发与 HEX 视图", "net", "🔌", typeof(SerialPortWindow), ["串口", "COM", "波特率"]),
+ new("voicecast", "网络语音播报", "向指定终端下发语音播报消息", "net", "🔊", null, ["语音", "播报"]),
+
+ // 工业与设备
+ new("can", "CAN 调试", "CAN 报文收发、周期发送与过滤,需硬件通道", "ind", "🚌", null, ["CAN", "报文"]),
+ new("dbc", "CAN DBC 查看器", "DBC 解析、信号解码与 J1939 支持", "ind", "📄", null, ["DBC", "J1939"]),
+ new("mbmaster", "Modbus Master", "批量寄存器读写与设备模板", "ind", "🔧", null, ["Modbus", "主站"]),
+ new("mbslave", "Modbus Slave", "从站模拟,供上位机联调", "ind", "🔧", null, ["Modbus", "从站"]),
+ new("io", "I/O 控制", "Modbus I/O 模块读写与状态监控", "ind", "⚡", typeof(IoControlWindow), ["IO", "继电器"]),
+ new("usb", "USB 设备", "USB 设备与 HUB 拓扑枚举,VID/PID/速率", "ind", "🔌", typeof(UsbDeviceWindow), ["USB", "HUB"]),
+ new("audio", "声卡测试", "音频设备枚举、录音与回放测试", "ind", "🎵", typeof(AudioDeviceWindow), ["声卡", "录音"]),
+ new("ip", "IP 设置", "网卡状态查看与地址配置,变更可回滚", "ind", "🌍", typeof(IpConfigWindow), ["网卡", "地址", "网关"]),
+
+ // 效率工具
+ new("icon", "图标水印", "批量图标处理、水印、尺寸与格式转换", "eff", "🎨", typeof(IconToolWindow), ["图标", "水印", "ICO"]),
+ new("folder", "文件夹统计", "目录大小、文件数量与类型分布导出", "eff", "📁", typeof(FolderStatWindow), ["目录", "统计", "大小"]),
+ new("coord", "坐标转换", "WGS84/GCJ02/BD09 互转与批量转换", "eff", "🧭", typeof(CoordToolView), ["坐标", "转换"]),
+ new("gps", "GPS 辅助", "定位数据解析、HEX 转浮点与轨迹查看", "eff", "📍", typeof(GpsWindow), ["GPS", "定位"]),
+ new("map", "地图接口", "地理编码、逆编码与路径规划调试", "eff", "🗺", typeof(MapWindow), ["地图", "地理编码"]),
+ new("backup", "手机备份", "通过 adb 备份与整理设备文件", "eff", "📱", typeof(BackupWindow), ["手机", "adb", "备份"]),
+ new("speech", "语音助手", "文本转语音播报与音频导出", "eff", "🗣", typeof(SpeechWindow), ["语音", "合成", "TTS"]),
+ new("mel", "梅尔频谱", "音频采集、梅尔频谱计算与可视化", "eff", "🎶", typeof(MelSpectrumWindow), ["频谱", "音频"]),
+ ];
+
+ /// <summary>按分类取工具</summary>
+ /// <param name="category">分类标识</param>
+ public static IReadOnlyList<ToolDescriptor> GetByCategory(String category)
+ {
+ var list = new List<ToolDescriptor>();
+ foreach (var item in Tools)
+ {
+ if (item.Category == category) list.Add(item);
+ }
+
+ return list;
+ }
+
+ /// <summary>关键字匹配(名称 / 说明 / 关键字)</summary>
+ /// <param name="tool">工具</param>
+ /// <param name="keyword">关键字</param>
+ public static Boolean Match(ToolDescriptor tool, String keyword)
+ {
+ if (keyword.IsNullOrEmpty()) return true;
+ if (tool.Title.Contains(keyword, StringComparison.OrdinalIgnoreCase)) return true;
+ if (tool.Description.Contains(keyword, StringComparison.OrdinalIgnoreCase)) return true;
+ if (tool.Keywords != null)
+ {
+ foreach (var item in tool.Keywords)
+ {
+ if (item.Contains(keyword, StringComparison.OrdinalIgnoreCase)) return true;
+ }
+ }
+
+ return false;
+ }
+
+ /// <summary>按标识取工具</summary>
+ /// <param name="key">标识</param>
+ public static ToolDescriptor? Find(String key)
+ {
+ foreach (var item in Tools)
+ {
+ if (item.Key == key) return item;
+ }
+
+ return null;
+ }
+}
diff --git a/XCoder.App/Themes/Controls.axaml b/XCoder.App/Themes/Controls.axaml
new file mode 100644
index 0000000..9a8dfeb
--- /dev/null
+++ b/XCoder.App/Themes/Controls.axaml
@@ -0,0 +1,167 @@
+<Styles xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+ <!-- 工作台外壳的控件样式;工具窗口内部的既有样式不受影响 -->
+
+ <Style Selector="TextBlock.sideLabel">
+ <Setter Property="FontSize" Value="10" />
+ <Setter Property="Foreground" Value="{DynamicResource TextTertiary}" />
+ <Setter Property="Margin" Value="10,12,10,4" />
+ <Setter Property="FontWeight" Value="SemiBold" />
+ </Style>
+
+ <Style Selector="TextBlock.muted">
+ <Setter Property="Foreground" Value="{DynamicResource TextSecondary}" />
+ </Style>
+
+ <Style Selector="TextBlock.dim">
+ <Setter Property="Foreground" Value="{DynamicResource TextTertiary}" />
+ <Setter Property="FontSize" Value="11" />
+ </Style>
+
+ <Style Selector="Button.nav">
+ <Setter Property="Background" Value="Transparent" />
+ <Setter Property="BorderThickness" Value="0" />
+ <Setter Property="CornerRadius" Value="10" />
+ <Setter Property="Padding" Value="10,8" />
+ <Setter Property="HorizontalAlignment" Value="Stretch" />
+ <Setter Property="HorizontalContentAlignment" Value="Left" />
+ <Setter Property="Foreground" Value="{DynamicResource TextSecondary}" />
+ <Setter Property="FontSize" Value="13" />
+ </Style>
+ <Style Selector="Button.nav:pointerover">
+ <Setter Property="Background" Value="{DynamicResource BgHover}" />
+ <Setter Property="Foreground" Value="{DynamicResource TextPrimary}" />
+ </Style>
+ <Style Selector="Button.nav.active">
+ <Setter Property="Background" Value="{DynamicResource BgSidebarActive}" />
+ <Setter Property="Foreground" Value="{DynamicResource Accent}" />
+ <Setter Property="FontWeight" Value="SemiBold" />
+ </Style>
+
+ <Style Selector="Button.ghost">
+ <Setter Property="Background" Value="Transparent" />
+ <Setter Property="BorderThickness" Value="0" />
+ <Setter Property="CornerRadius" Value="8" />
+ <Setter Property="Padding" Value="8" />
+ <Setter Property="Foreground" Value="{DynamicResource TextSecondary}" />
+ <Setter Property="FontSize" Value="15" />
+ </Style>
+ <Style Selector="Button.ghost:pointerover">
+ <Setter Property="Background" Value="{DynamicResource BgHover}" />
+ <Setter Property="Foreground" Value="{DynamicResource TextPrimary}" />
+ </Style>
+
+ <Style Selector="Button.primary">
+ <Setter Property="Background" Value="{DynamicResource Accent}" />
+ <Setter Property="Foreground" Value="{DynamicResource OnAccent}" />
+ <Setter Property="BorderThickness" Value="0" />
+ <Setter Property="CornerRadius" Value="8" />
+ <Setter Property="Padding" Value="14,8" />
+ <Setter Property="FontSize" Value="13" />
+ </Style>
+ <Style Selector="Button.primary:pointerover">
+ <Setter Property="Background" Value="{DynamicResource AccentHover}" />
+ </Style>
+
+ <Style Selector="Button.secondary">
+ <Setter Property="Background" Value="{DynamicResource BgSurface}" />
+ <Setter Property="Foreground" Value="{DynamicResource TextPrimary}" />
+ <Setter Property="BorderBrush" Value="{DynamicResource BorderStrong}" />
+ <Setter Property="BorderThickness" Value="1" />
+ <Setter Property="CornerRadius" Value="8" />
+ <Setter Property="Padding" Value="14,8" />
+ <Setter Property="FontSize" Value="13" />
+ </Style>
+ <Style Selector="Button.secondary:pointerover">
+ <Setter Property="Background" Value="{DynamicResource BgHover}" />
+ </Style>
+
+ <Style Selector="Button.tab">
+ <Setter Property="Background" Value="Transparent" />
+ <Setter Property="BorderThickness" Value="1" />
+ <Setter Property="BorderBrush" Value="Transparent" />
+ <Setter Property="CornerRadius" Value="8" />
+ <Setter Property="Padding" Value="10,5" />
+ <Setter Property="FontSize" Value="12" />
+ <Setter Property="Foreground" Value="{DynamicResource TextSecondary}" />
+ </Style>
+ <Style Selector="Button.tab:pointerover">
+ <Setter Property="Background" Value="{DynamicResource BgHover}" />
+ </Style>
+ <Style Selector="Button.tab.active">
+ <Setter Property="Background" Value="{DynamicResource BgSurface}" />
+ <Setter Property="BorderBrush" Value="{DynamicResource BorderDefault}" />
+ <Setter Property="Foreground" Value="{DynamicResource Accent}" />
+ <Setter Property="FontWeight" Value="SemiBold" />
+ </Style>
+
+ <Style Selector="Border.card">
+ <Setter Property="Background" Value="{DynamicResource BgSurface}" />
+ <Setter Property="BorderBrush" Value="{DynamicResource BorderDefault}" />
+ <Setter Property="BorderThickness" Value="1" />
+ <Setter Property="CornerRadius" Value="14" />
+ <Setter Property="Padding" Value="14" />
+ <Setter Property="Cursor" Value="Hand" />
+ </Style>
+
+ <Style Selector="Border.panel">
+ <Setter Property="Background" Value="{DynamicResource BgSurface}" />
+ <Setter Property="BorderBrush" Value="{DynamicResource BorderDefault}" />
+ <Setter Property="BorderThickness" Value="1" />
+ <Setter Property="CornerRadius" Value="14" />
+ </Style>
+
+ <Style Selector="TextBox.search">
+ <Setter Property="Background" Value="Transparent" />
+ <Setter Property="BorderThickness" Value="0" />
+ <Setter Property="FontSize" Value="13" />
+ <Setter Property="VerticalContentAlignment" Value="Center" />
+ </Style>
+
+ <!-- 工作台卡片内部元素 -->
+ <Style Selector="Border.tile">
+ <Setter Property="Background" Value="{DynamicResource AccentSoft}" />
+ <Setter Property="CornerRadius" Value="12" />
+ </Style>
+
+ <Style Selector="Border.chip">
+ <Setter Property="Background" Value="{DynamicResource BgSubtle}" />
+ <Setter Property="CornerRadius" Value="10" />
+ <Setter Property="Padding" Value="8,1" />
+ </Style>
+
+ <Style Selector="TextBlock.cardTitle">
+ <Setter Property="FontSize" Value="14" />
+ <Setter Property="FontWeight" Value="SemiBold" />
+ <Setter Property="Foreground" Value="{DynamicResource TextPrimary}" />
+ </Style>
+
+ <Style Selector="TextBlock.cardDesc">
+ <Setter Property="FontSize" Value="11" />
+ <Setter Property="Foreground" Value="{DynamicResource TextSecondary}" />
+ </Style>
+
+ <Style Selector="TextBlock.chipText">
+ <Setter Property="FontSize" Value="10" />
+ <Setter Property="Foreground" Value="{DynamicResource TextSecondary}" />
+ </Style>
+
+ <Style Selector="TextBlock.chipWarn">
+ <Setter Property="FontSize" Value="10" />
+ <Setter Property="Foreground" Value="{DynamicResource Warning}" />
+ </Style>
+
+ <Style Selector="TextBlock.sectionTitle">
+ <Setter Property="FontSize" Value="18" />
+ <Setter Property="FontWeight" Value="SemiBold" />
+ <Setter Property="Foreground" Value="{DynamicResource TextPrimary}" />
+ </Style>
+
+ <Style Selector="TextBlock.error">
+ <Setter Property="Foreground" Value="{DynamicResource Danger}" />
+ </Style>
+
+ <Style Selector="TextBlock.ok">
+ <Setter Property="Foreground" Value="{DynamicResource Success}" />
+ </Style>
+</Styles>
diff --git a/XCoder.App/Themes/Tokens.axaml b/XCoder.App/Themes/Tokens.axaml
new file mode 100644
index 0000000..e69c01e
--- /dev/null
+++ b/XCoder.App/Themes/Tokens.axaml
@@ -0,0 +1,67 @@
+<ResourceDictionary xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+ <!-- 语义颜色令牌:浅色/深色两套值,界面只允许引用键名 -->
+ <ResourceDictionary.ThemeDictionaries>
+ <ResourceDictionary x:Key="Light">
+ <SolidColorBrush x:Key="BgPage" Color="#F4F7FB" />
+ <SolidColorBrush x:Key="BgSurface" Color="#FFFFFF" />
+ <SolidColorBrush x:Key="BgSurface2" Color="#F8FAFD" />
+ <SolidColorBrush x:Key="BgSubtle" Color="#EDF2F9" />
+ <SolidColorBrush x:Key="BgSidebar" Color="#F0F3F8" />
+ <SolidColorBrush x:Key="BgSidebarActive" Color="#E5EFFD" />
+ <SolidColorBrush x:Key="BgHover" Color="#EEF4FC" />
+ <SolidColorBrush x:Key="BgPressed" Color="#E2ECFA" />
+ <SolidColorBrush x:Key="BorderDefault" Color="#E1E9F4" />
+ <SolidColorBrush x:Key="BorderStrong" Color="#CFDCEC" />
+ <SolidColorBrush x:Key="TextPrimary" Color="#16283F" />
+ <SolidColorBrush x:Key="TextSecondary" Color="#5A6E86" />
+ <SolidColorBrush x:Key="TextTertiary" Color="#8294A8" />
+ <SolidColorBrush x:Key="Accent" Color="#0B72D9" />
+ <SolidColorBrush x:Key="AccentHover" Color="#0964BE" />
+ <SolidColorBrush x:Key="AccentSoft" Color="#E5F0FC" />
+ <SolidColorBrush x:Key="HeroFrom" Color="#17325C" />
+ <SolidColorBrush x:Key="HeroTo" Color="#235F9E" />
+ <SolidColorBrush x:Key="Success" Color="#1F9D63" />
+ <SolidColorBrush x:Key="Warning" Color="#B97407" />
+ <SolidColorBrush x:Key="Danger" Color="#D64545" />
+ <SolidColorBrush x:Key="OnAccent" Color="#FFFFFF" />
+ <SolidColorBrush x:Key="HeroText" Color="#FFFFFF" />
+ <SolidColorBrush x:Key="Scrim" Color="#61202F45" />
+ </ResourceDictionary>
+ <ResourceDictionary x:Key="Dark">
+ <SolidColorBrush x:Key="BgPage" Color="#0E1520" />
+ <SolidColorBrush x:Key="BgSurface" Color="#151E2B" />
+ <SolidColorBrush x:Key="BgSurface2" Color="#121A26" />
+ <SolidColorBrush x:Key="BgSubtle" Color="#1B2636" />
+ <SolidColorBrush x:Key="BgSidebar" Color="#0B1119" />
+ <SolidColorBrush x:Key="BgSidebarActive" Color="#16304C" />
+ <SolidColorBrush x:Key="BgHover" Color="#1A2637" />
+ <SolidColorBrush x:Key="BgPressed" Color="#223148" />
+ <SolidColorBrush x:Key="BorderDefault" Color="#243244" />
+ <SolidColorBrush x:Key="BorderStrong" Color="#33455C" />
+ <SolidColorBrush x:Key="TextPrimary" Color="#E6EDF7" />
+ <SolidColorBrush x:Key="TextSecondary" Color="#9FB0C4" />
+ <SolidColorBrush x:Key="TextTertiary" Color="#6E8098" />
+ <SolidColorBrush x:Key="Accent" Color="#3D9BF0" />
+ <SolidColorBrush x:Key="AccentHover" Color="#5AACF4" />
+ <SolidColorBrush x:Key="AccentSoft" Color="#16304C" />
+ <SolidColorBrush x:Key="HeroFrom" Color="#122340" />
+ <SolidColorBrush x:Key="HeroTo" Color="#1B3A63" />
+ <SolidColorBrush x:Key="Success" Color="#3FC984" />
+ <SolidColorBrush x:Key="Warning" Color="#E0A13A" />
+ <SolidColorBrush x:Key="Danger" Color="#EF6B6B" />
+ <SolidColorBrush x:Key="OnAccent" Color="#FFFFFF" />
+ <SolidColorBrush x:Key="HeroText" Color="#EAF2FF" />
+ <SolidColorBrush x:Key="Scrim" Color="#99000000" />
+ </ResourceDictionary>
+ </ResourceDictionary.ThemeDictionaries>
+
+ <!-- 尺寸令牌(与主题无关) -->
+ <x:Double x:Key="SidebarWidth">216</x:Double>
+ <x:Double x:Key="TopbarHeight">72</x:Double>
+ <x:Double x:Key="StatusHeight">32</x:Double>
+ <CornerRadius x:Key="RadiusSm">8</CornerRadius>
+ <CornerRadius x:Key="RadiusMd">10</CornerRadius>
+ <CornerRadius x:Key="RadiusLg">14</CornerRadius>
+ <CornerRadius x:Key="RadiusXl">18</CornerRadius>
+</ResourceDictionary>
diff --git a/XCoder.App/Tools/Coord/CoordConverter.cs b/XCoder.App/Tools/Coord/CoordConverter.cs
new file mode 100644
index 0000000..4191a9b
--- /dev/null
+++ b/XCoder.App/Tools/Coord/CoordConverter.cs
@@ -0,0 +1,143 @@
+using System;
+using NewLife;
+
+namespace NewLife.XCoder.Tools.Coord;
+
+/// <summary>坐标系转换:WGS84 / GCJ02(火星) / BD09(百度)</summary>
+public static class CoordConverter
+{
+ private const Double Pi = 3.1415926535897932384626;
+ private const Double A = 6378245.0;
+ private const Double Ee = 0.00669342162296594323;
+
+ /// <summary>判断是否在中国境外(境外不做偏移)</summary>
+ /// <param name="lng">经度</param>
+ /// <param name="lat">纬度</param>
+ public static Boolean OutOfChina(Double lng, Double lat) => lng < 72.004 || lng > 137.8347 || lat < 0.8293 || lat > 55.8271;
+
+ /// <summary>WGS84 转 GCJ02</summary>
+ /// <param name="lng">经度</param>
+ /// <param name="lat">纬度</param>
+ public static (Double Lng, Double Lat) Wgs84ToGcj02(Double lng, Double lat)
+ {
+ if (OutOfChina(lng, lat)) return (lng, lat);
+
+ var dLat = TransformLat(lng - 105.0, lat - 35.0);
+ var dLng = TransformLng(lng - 105.0, lat - 35.0);
+
+ var radLat = lat / 180.0 * Pi;
+ var magic = Math.Sin(radLat);
+ magic = 1 - Ee * magic * magic;
+ var sqrtMagic = Math.Sqrt(magic);
+
+ dLat = dLat * 180.0 / ((A * (1 - Ee)) / (magic * sqrtMagic) * Pi);
+ dLng = dLng * 180.0 / (A / sqrtMagic * Math.Cos(radLat) * Pi);
+
+ return (lng + dLng, lat + dLat);
+ }
+
+ /// <summary>GCJ02 转 WGS84(迭代逼近)</summary>
+ /// <param name="lng">经度</param>
+ /// <param name="lat">纬度</param>
+ public static (Double Lng, Double Lat) Gcj02ToWgs84(Double lng, Double lat)
+ {
+ if (OutOfChina(lng, lat)) return (lng, lat);
+
+ var wgsLng = lng;
+ var wgsLat = lat;
+ for (var i = 0; i < 3; i++)
+ {
+ var gcj = Wgs84ToGcj02(wgsLng, wgsLat);
+ wgsLng += lng - gcj.Lng;
+ wgsLat += lat - gcj.Lat;
+ }
+
+ return (wgsLng, wgsLat);
+ }
+
+ /// <summary>GCJ02 转 BD09</summary>
+ /// <param name="lng">经度</param>
+ /// <param name="lat">纬度</param>
+ public static (Double Lng, Double Lat) Gcj02ToBd09(Double lng, Double lat)
+ {
+ var z = Math.Sqrt(lng * lng + lat * lat) + 0.00002 * Math.Sin(lat * Pi * 3000.0 / 180.0);
+ var theta = Math.Atan2(lat, lng) + 0.000003 * Math.Cos(lng * Pi * 3000.0 / 180.0);
+
+ return (z * Math.Cos(theta) + 0.0065, z * Math.Sin(theta) + 0.006);
+ }
+
+ /// <summary>BD09 转 GCJ02</summary>
+ /// <param name="lng">经度</param>
+ /// <param name="lat">纬度</param>
+ public static (Double Lng, Double Lat) Bd09ToGcj02(Double lng, Double lat)
+ {
+ var x = lng - 0.0065;
+ var y = lat - 0.006;
+ var z = Math.Sqrt(x * x + y * y) - 0.00002 * Math.Sin(y * Pi * 3000.0 / 180.0);
+ var theta = Math.Atan2(y, x) - 0.000003 * Math.Cos(x * Pi * 3000.0 / 180.0);
+
+ return (z * Math.Cos(theta), z * Math.Sin(theta));
+ }
+
+ /// <summary>任意两种坐标系之间转换</summary>
+ /// <param name="lng">经度</param>
+ /// <param name="lat">纬度</param>
+ /// <param name="from">源坐标系:WGS84 / GCJ02 / BD09</param>
+ /// <param name="to">目标坐标系:WGS84 / GCJ02 / BD09</param>
+ public static (Double Lng, Double Lat) Convert(Double lng, Double lat, String from, String to)
+ {
+ from = Normalize(from);
+ to = Normalize(to);
+ if (from == to) return (lng, lat);
+
+ // 统一先转到 GCJ02,再转到目标
+ var (gcjLng, gcjLat) = from switch
+ {
+ "WGS84" => Wgs84ToGcj02(lng, lat),
+ "BD09" => Bd09ToGcj02(lng, lat),
+ _ => (lng, lat),
+ };
+
+ return to switch
+ {
+ "WGS84" => Gcj02ToWgs84(gcjLng, gcjLat),
+ "BD09" => Gcj02ToBd09(gcjLng, gcjLat),
+ _ => (gcjLng, gcjLat),
+ };
+ }
+
+ /// <summary>标准化坐标系名称</summary>
+ /// <param name="name">名称</param>
+ public static String Normalize(String name)
+ {
+ if (name.IsNullOrEmpty()) return "WGS84";
+
+ return name.Trim().ToUpperInvariant() switch
+ {
+ "WGS84" or "WGS-84" or "GPS" => "WGS84",
+ "GCJ02" or "GCJ-02" or "火星" or "AMAP" => "GCJ02",
+ "BD09" or "BD-09" or "BAIDU" or "BD09LL" => "BD09",
+ _ => "WGS84",
+ };
+ }
+
+ private static Double TransformLat(Double x, Double y)
+ {
+ var ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.Sqrt(Math.Abs(x));
+ ret += (20.0 * Math.Sin(6.0 * x * Pi) + 20.0 * Math.Sin(2.0 * x * Pi)) * 2.0 / 3.0;
+ ret += (20.0 * Math.Sin(y * Pi) + 40.0 * Math.Sin(y / 3.0 * Pi)) * 2.0 / 3.0;
+ ret += (160.0 * Math.Sin(y / 12.0 * Pi) + 320 * Math.Sin(y * Pi / 30.0)) * 2.0 / 3.0;
+
+ return ret;
+ }
+
+ private static Double TransformLng(Double x, Double y)
+ {
+ var ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.Sqrt(Math.Abs(x));
+ ret += (20.0 * Math.Sin(6.0 * x * Pi) + 20.0 * Math.Sin(2.0 * x * Pi)) * 2.0 / 3.0;
+ ret += (20.0 * Math.Sin(x * Pi) + 40.0 * Math.Sin(x / 3.0 * Pi)) * 2.0 / 3.0;
+ ret += (150.0 * Math.Sin(x / 12.0 * Pi) + 300.0 * Math.Sin(x / 30.0 * Pi)) * 2.0 / 3.0;
+
+ return ret;
+ }
+}
diff --git a/XCoder.App/Tools/Coord/CoordToolView.axaml b/XCoder.App/Tools/Coord/CoordToolView.axaml
new file mode 100644
index 0000000..93a940e
--- /dev/null
+++ b/XCoder.App/Tools/Coord/CoordToolView.axaml
@@ -0,0 +1,55 @@
+<UserControl xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ x:Class="NewLife.XCoder.Tools.Coord.CoordToolView">
+ <ScrollViewer>
+ <StackPanel Margin="20" Spacing="12" MaxWidth="920" HorizontalAlignment="Left">
+ <TextBlock Text="坐标转换" Classes="sectionTitle" />
+ <TextBlock Text="WGS84 / GCJ02 / BD09 互转;境外坐标不做偏移。"
+ Classes="dim" />
+
+ <Border Classes="panel" Padding="16">
+ <StackPanel Spacing="10">
+ <StackPanel Orientation="Horizontal" Spacing="10">
+ <TextBlock Text="源坐标" Classes="dim" VerticalAlignment="Center" />
+ <ComboBox Name="FromBox" Width="140" SelectedIndex="0">
+ <ComboBoxItem Content="WGS84" />
+ <ComboBoxItem Content="GCJ02" />
+ <ComboBoxItem Content="BD09" />
+ </ComboBox>
+ <TextBlock Text="目标" Classes="dim" VerticalAlignment="Center" Margin="8,0,0,0" />
+ <ComboBox Name="ToBox" Width="140" SelectedIndex="1">
+ <ComboBoxItem Content="WGS84" />
+ <ComboBoxItem Content="GCJ02" />
+ <ComboBoxItem Content="BD09" />
+ </ComboBox>
+ </StackPanel>
+
+ <StackPanel Orientation="Horizontal" Spacing="10">
+ <TextBox Name="LngBox" Width="190" Watermark="经度,如 116.404" />
+ <TextBox Name="LatBox" Width="190" Watermark="纬度,如 39.915" />
+ <Button Name="ConvertButton" Classes="primary" Content="转换" />
+ </StackPanel>
+
+ <TextBlock Name="ResultText" Text="结果:—" FontSize="13" TextWrapping="Wrap" />
+ </StackPanel>
+ </Border>
+
+ <Border Classes="panel" Padding="16">
+ <StackPanel Spacing="10">
+ <TextBlock Text="批量转换" FontWeight="SemiBold" />
+ <TextBlock Text="每行一个坐标:经度,纬度;输出按相同顺序。" Classes="dim" />
+ <Grid ColumnDefinitions="*,*" Height="170">
+ <TextBox Name="BatchInput" AcceptsReturn="True" TextWrapping="NoWrap"
+ Watermark="116.404,39.915" Margin="0,0,8,0" />
+ <TextBox Name="BatchOutput" Grid.Column="1" AcceptsReturn="True"
+ TextWrapping="NoWrap" IsReadOnly="True" Margin="8,0,0,0" />
+ </Grid>
+ <StackPanel Orientation="Horizontal" Spacing="8">
+ <Button Name="BatchButton" Classes="primary" Content="批量转换" />
+ <TextBlock Name="BatchStatus" Classes="dim" VerticalAlignment="Center" />
+ </StackPanel>
+ </StackPanel>
+ </Border>
+ </StackPanel>
+ </ScrollViewer>
+</UserControl>
diff --git a/XCoder.App/Tools/Coord/CoordToolView.axaml.cs b/XCoder.App/Tools/Coord/CoordToolView.axaml.cs
new file mode 100644
index 0000000..b32c52c
--- /dev/null
+++ b/XCoder.App/Tools/Coord/CoordToolView.axaml.cs
@@ -0,0 +1,77 @@
+using System;
+using System.Globalization;
+using System.Text;
+using Avalonia.Controls;
+using Avalonia.Interactivity;
+
+namespace NewLife.XCoder.Tools.Coord;
+
+/// <summary>坐标转换工具</summary>
+public partial class CoordToolView : UserControl
+{
+ /// <summary>实例化</summary>
+ public CoordToolView()
+ {
+ InitializeComponent();
+
+ ConvertButton.Click += OnConvert;
+ BatchButton.Click += OnBatch;
+ }
+
+ private String From => (FromBox.SelectedItem as ComboBoxItem)?.Content?.ToString() ?? "WGS84";
+ private String To => (ToBox.SelectedItem as ComboBoxItem)?.Content?.ToString() ?? "GCJ02";
+
+ private void OnConvert(Object? sender, RoutedEventArgs e)
+ {
+ if (!TryParse(LngBox.Text, out var lng) || !TryParse(LatBox.Text, out var lat))
+ {
+ SetResult("请输入有效的经纬度数字", true);
+ return;
+ }
+
+ var (x, y) = CoordConverter.Convert(lng, lat, From, To);
+ SetResult($"结果:{x:F6}, {y:F6}({CoordConverter.Normalize(From)} → {CoordConverter.Normalize(To)})", false);
+ }
+
+ private void OnBatch(Object? sender, RoutedEventArgs e)
+ {
+ var text = BatchInput.Text ?? "";
+ var lines = text.Replace("\r\n", "\n").Split('\n');
+ var sb = new StringBuilder();
+ var ok = 0;
+ var fail = 0;
+
+ foreach (var line in lines)
+ {
+ var item = line.Trim();
+ if (item.Length == 0) continue;
+
+ var parts = item.Split([',', ',', ' ', '\t'], StringSplitOptions.RemoveEmptyEntries);
+ if (parts.Length < 2 || !TryParse(parts[0], out var lng) || !TryParse(parts[1], out var lat))
+ {
+ sb.AppendLine("解析失败:" + item);
+ fail++;
+ continue;
+ }
+
+ var (x, y) = CoordConverter.Convert(lng, lat, From, To);
+ sb.AppendLine($"{x:F6},{y:F6}");
+ ok++;
+ }
+
+ BatchOutput.Text = sb.ToString().TrimEnd();
+ BatchStatus.Text = $"成功 {ok} 条,失败 {fail} 条";
+ BatchStatus.Classes.Set("error", fail > 0);
+ BatchStatus.Classes.Set("ok", fail == 0 && ok > 0);
+ }
+
+ private void SetResult(String text, Boolean error)
+ {
+ ResultText.Text = text;
+ ResultText.Classes.Set("error", error);
+ ResultText.Classes.Set("ok", !error);
+ }
+
+ private static Boolean TryParse(String? text, out Double value)
+ => Double.TryParse(text?.Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out value);
+}
diff --git a/XCoder.App/Tools/Symmetric/SymmetricCrypto.cs b/XCoder.App/Tools/Symmetric/SymmetricCrypto.cs
new file mode 100644
index 0000000..74550ed
--- /dev/null
+++ b/XCoder.App/Tools/Symmetric/SymmetricCrypto.cs
@@ -0,0 +1,108 @@
+using System;
+using System.Security.Cryptography;
+using System.Text;
+using NewLife;
+
+namespace NewLife.XCoder.Tools.Symmetric;
+
+/// <summary>对称加密算法类型</summary>
+public enum CryptoKind
+{
+ /// <summary>AES-256-CBC</summary>
+ Aes,
+
+ /// <summary>DES-CBC</summary>
+ Des,
+}
+
+/// <summary>对称加解密:AES / DES,CBC + PKCS7,输出 Base64 或 Hex</summary>
+public static class SymmetricCrypto
+{
+ /// <summary>加密</summary>
+ /// <param name="plain">明文</param>
+ /// <param name="kind">算法</param>
+ /// <param name="key">密钥(不足自动补零,超出截断)</param>
+ /// <param name="iv">向量(不足自动补零,超出截断)</param>
+ /// <param name="hex">true 输出十六进制,否则 Base64</param>
+ public static String Encrypt(String plain, CryptoKind kind, String key, String iv, Boolean hex = false)
+ {
+ if (plain == null) throw new ArgumentNullException(nameof(plain));
+
+ using var algorithm = Create(kind, key, iv);
+ using var encryptor = algorithm.CreateEncryptor();
+ var data = Encoding.UTF8.GetBytes(plain);
+ var result = encryptor.TransformFinalBlock(data, 0, data.Length);
+
+ return hex ? result.ToHex() : Convert.ToBase64String(result);
+ }
+
+ /// <summary>解密</summary>
+ /// <param name="cipher">密文(Base64 或 Hex)</param>
+ /// <param name="kind">算法</param>
+ /// <param name="key">密钥</param>
+ /// <param name="iv">向量</param>
+ /// <param name="hex">密文是否为十六进制</param>
+ public static String Decrypt(String cipher, CryptoKind kind, String key, String iv, Boolean hex = false)
+ {
+ if (cipher == null) throw new ArgumentNullException(nameof(cipher));
+
+ var data = hex ? cipher.ToHexBytes() : Convert.FromBase64String(cipher.Trim());
+ using var algorithm = Create(kind, key, iv);
+ using var decryptor = algorithm.CreateDecryptor();
+ var result = decryptor.TransformFinalBlock(data, 0, data.Length);
+
+ return Encoding.UTF8.GetString(result);
+ }
+
+ /// <summary>密钥所需字节数</summary>
+ /// <param name="kind">算法</param>
+ public static Int32 KeySize(CryptoKind kind) => kind == CryptoKind.Aes ? 32 : 8;
+
+ /// <summary>向量所需字节数</summary>
+ /// <param name="kind">算法</param>
+ public static Int32 IvSize(CryptoKind kind) => kind == CryptoKind.Aes ? 16 : 8;
+
+ private static SymmetricAlgorithm Create(CryptoKind kind, String key, String iv)
+ {
+ SymmetricAlgorithm algorithm = kind == CryptoKind.Aes ? Aes.Create() : DES.Create();
+ algorithm.Mode = CipherMode.CBC;
+ algorithm.Padding = PaddingMode.PKCS7;
+ algorithm.Key = Fit(key, KeySize(kind));
+ algorithm.IV = Fit(iv, IvSize(kind));
+
+ return algorithm;
+ }
+
+ private static Byte[] Fit(String text, Int32 length)
+ {
+ var buffer = new Byte[length];
+ if (text.IsNullOrEmpty()) return buffer;
+
+ var bytes = Encoding.UTF8.GetBytes(text);
+ Array.Copy(bytes, buffer, Math.Min(bytes.Length, length));
+
+ return buffer;
+ }
+
+ private static String ToHex(this Byte[] data)
+ {
+ var sb = new StringBuilder(data.Length * 2);
+ foreach (var item in data) sb.Append(item.ToString("X2"));
+
+ return sb.ToString();
+ }
+
+ private static Byte[] ToHexBytes(this String text)
+ {
+ var value = text.Trim().Replace(" ", "").Replace("-", "");
+ if (value.Length % 2 != 0) throw new FormatException("十六进制长度必须为偶数");
+
+ var data = new Byte[value.Length / 2];
+ for (var i = 0; i < data.Length; i++)
+ {
+ data[i] = System.Convert.ToByte(value.Substring(i * 2, 2), 16);
+ }
+
+ return data;
+ }
+}
diff --git a/XCoder.App/Tools/Symmetric/SymmetricToolView.axaml b/XCoder.App/Tools/Symmetric/SymmetricToolView.axaml
new file mode 100644
index 0000000..6f45818
--- /dev/null
+++ b/XCoder.App/Tools/Symmetric/SymmetricToolView.axaml
@@ -0,0 +1,57 @@
+<UserControl xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ x:Class="NewLife.XCoder.Tools.Symmetric.SymmetricToolView">
+ <ScrollViewer>
+ <StackPanel Margin="20" Spacing="12" MaxWidth="920" HorizontalAlignment="Left">
+ <TextBlock Text="对称加密" Classes="sectionTitle" />
+ <TextBlock Text="AES-256 / DES,CBC 模式 + PKCS7 填充;密钥与向量不足自动补零。"
+ Classes="dim" />
+
+ <Border Classes="panel" Padding="16">
+ <StackPanel Spacing="10">
+ <StackPanel Orientation="Horizontal" Spacing="10">
+ <TextBlock Text="算法" Classes="dim" VerticalAlignment="Center" />
+ <ComboBox Name="AlgorithmBox" Width="120" SelectedIndex="0">
+ <ComboBoxItem Content="AES" />
+ <ComboBoxItem Content="DES" />
+ </ComboBox>
+ <CheckBox Name="HexBox" Content="使用十六进制" FontSize="12" />
+ <Button Name="EncryptButton" Classes="primary" Content="加密" Margin="12,0,0,0" />
+ <Button Name="DecryptButton" Classes="secondary" Content="解密" />
+ <Button Name="ClearButton" Classes="secondary" Content="清空" />
+ </StackPanel>
+
+ <Grid ColumnDefinitions="*,*" ColumnSpacing="12">
+ <StackPanel Spacing="6">
+ <TextBlock Text="密钥" Classes="dim" />
+ <TextBox Name="KeyBox" Watermark="AES 建议 32 字节,DES 建议 8 字节" />
+ </StackPanel>
+ <StackPanel Grid.Column="1" Spacing="6">
+ <TextBlock Text="向量 IV" Classes="dim" />
+ <TextBox Name="IvBox" Watermark="AES 16 字节,DES 8 字节" />
+ </StackPanel>
+ </Grid>
+ </StackPanel>
+ </Border>
+
+ <Grid ColumnDefinitions="*,*" ColumnSpacing="12">
+ <Border Classes="panel" Padding="16">
+ <StackPanel Spacing="6">
+ <TextBlock Text="输入" FontWeight="SemiBold" />
+ <TextBox Name="InputBox" AcceptsReturn="True" Height="220"
+ TextWrapping="Wrap" Watermark="明文或密文" />
+ </StackPanel>
+ </Border>
+ <Border Grid.Column="1" Classes="panel" Padding="16">
+ <StackPanel Spacing="6">
+ <TextBlock Text="输出" FontWeight="SemiBold" />
+ <TextBox Name="OutputBox" AcceptsReturn="True" Height="220"
+ TextWrapping="Wrap" IsReadOnly="True" />
+ </StackPanel>
+ </Border>
+ </Grid>
+
+ <TextBlock Name="StatusText" Classes="dim" Text="等待操作" />
+ </StackPanel>
+ </ScrollViewer>
+</UserControl>
diff --git a/XCoder.App/Tools/Symmetric/SymmetricToolView.axaml.cs b/XCoder.App/Tools/Symmetric/SymmetricToolView.axaml.cs
new file mode 100644
index 0000000..eaac78f
--- /dev/null
+++ b/XCoder.App/Tools/Symmetric/SymmetricToolView.axaml.cs
@@ -0,0 +1,59 @@
+using System;
+using Avalonia.Controls;
+using Avalonia.Interactivity;
+
+namespace NewLife.XCoder.Tools.Symmetric;
+
+/// <summary>对称加密工具</summary>
+public partial class SymmetricToolView : UserControl
+{
+ /// <summary>实例化</summary>
+ public SymmetricToolView()
+ {
+ InitializeComponent();
+
+ EncryptButton.Click += (_, _) => Run(true);
+ DecryptButton.Click += (_, _) => Run(false);
+ ClearButton.Click += (_, _) =>
+ {
+ InputBox.Text = "";
+ OutputBox.Text = "";
+ StatusText.Text = "等待操作";
+ StatusText.Classes.Set("error", false);
+ StatusText.Classes.Set("ok", false);
+ };
+ }
+
+ private CryptoKind Kind => (AlgorithmBox.SelectedItem as ComboBoxItem)?.Content?.ToString() == "DES" ? CryptoKind.Des : CryptoKind.Aes;
+
+ private void Run(Boolean encrypt)
+ {
+ var input = InputBox.Text ?? "";
+ if (input.Length == 0)
+ {
+ SetStatus("请输入内容", true);
+ return;
+ }
+
+ try
+ {
+ var hex = HexBox.IsChecked == true;
+ OutputBox.Text = encrypt
+ ? SymmetricCrypto.Encrypt(input, Kind, KeyBox.Text ?? "", IvBox.Text ?? "", hex)
+ : SymmetricCrypto.Decrypt(input, Kind, KeyBox.Text ?? "", IvBox.Text ?? "", hex);
+ SetStatus(encrypt ? "加密完成" : "解密完成", false);
+ }
+ catch (Exception ex)
+ {
+ OutputBox.Text = "";
+ SetStatus((encrypt ? "加密失败:" : "解密失败:") + ex.Message, true);
+ }
+ }
+
+ private void SetStatus(String text, Boolean error)
+ {
+ StatusText.Text = text;
+ StatusText.Classes.Set("error", error);
+ StatusText.Classes.Set("ok", !error);
+ }
+}
diff --git a/XCoderAv/ViewModels/ApiDebugViewModel.cs b/XCoder.App/ViewModels/ApiDebugViewModel.cs
similarity index 99%
rename from XCoderAv/ViewModels/ApiDebugViewModel.cs
rename to XCoder.App/ViewModels/ApiDebugViewModel.cs
index b07211e..b1bb927 100644
--- a/XCoderAv/ViewModels/ApiDebugViewModel.cs
+++ b/XCoder.App/ViewModels/ApiDebugViewModel.cs
@@ -8,7 +8,7 @@ using NewLife.Net;
using NewLife.Remoting;
using NewLife.Threading;
-namespace XCoderAv.ViewModels;
+namespace NewLife.XCoder.ViewModels;
/// <summary>API 调试工具 ViewModel</summary>
public partial class ApiDebugViewModel : ObservableObject
diff --git a/XCoderAv/ViewModels/ApiDiscoverViewModel.cs b/XCoder.App/ViewModels/ApiDiscoverViewModel.cs
similarity index 98%
rename from XCoderAv/ViewModels/ApiDiscoverViewModel.cs
rename to XCoder.App/ViewModels/ApiDiscoverViewModel.cs
index 6e820c6..0fca70b 100644
--- a/XCoderAv/ViewModels/ApiDiscoverViewModel.cs
+++ b/XCoder.App/ViewModels/ApiDiscoverViewModel.cs
@@ -7,9 +7,9 @@ using NewLife.Log;
using NewLife.Net;
using NewLife.Remoting;
using NewLife.Serialization;
-using XCoderAv.Models;
+using NewLife.XCoder.Models;
-namespace XCoderAv.ViewModels;
+namespace NewLife.XCoder.ViewModels;
/// <summary>API 服务发现 ViewModel</summary>
public partial class ApiDiscoverViewModel : ObservableObject
diff --git a/XCoderAv/ViewModels/AudioDeviceViewModel.cs b/XCoder.App/ViewModels/AudioDeviceViewModel.cs
similarity index 97%
rename from XCoderAv/ViewModels/AudioDeviceViewModel.cs
rename to XCoder.App/ViewModels/AudioDeviceViewModel.cs
index 719b2d7..a5b2820 100644
--- a/XCoderAv/ViewModels/AudioDeviceViewModel.cs
+++ b/XCoder.App/ViewModels/AudioDeviceViewModel.cs
@@ -3,9 +3,9 @@ using System.Text;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using NewLife;
-using XCoderAv.Models;
+using NewLife.XCoder.Models;
-namespace XCoderAv.ViewModels;
+namespace NewLife.XCoder.ViewModels;
/// <summary>声卡选择器 ViewModel</summary>
public partial class AudioDeviceViewModel : ObservableObject
diff --git a/XCoderAv/ViewModels/BackupViewModel.cs b/XCoder.App/ViewModels/BackupViewModel.cs
similarity index 99%
rename from XCoderAv/ViewModels/BackupViewModel.cs
rename to XCoder.App/ViewModels/BackupViewModel.cs
index 900d9ab..8860dca 100644
--- a/XCoderAv/ViewModels/BackupViewModel.cs
+++ b/XCoder.App/ViewModels/BackupViewModel.cs
@@ -3,7 +3,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using NewLife;
-namespace XCoderAv.ViewModels;
+namespace NewLife.XCoder.ViewModels;
/// <summary>手机备份 ViewModel</summary>
public partial class BackupViewModel : ObservableObject
diff --git a/XCoderAv/ViewModels/DataModelingViewModel.cs b/XCoder.App/ViewModels/DataModelingViewModel.cs
similarity index 99%
rename from XCoderAv/ViewModels/DataModelingViewModel.cs
rename to XCoder.App/ViewModels/DataModelingViewModel.cs
index 909ae6d..b89a6b6 100644
--- a/XCoderAv/ViewModels/DataModelingViewModel.cs
+++ b/XCoder.App/ViewModels/DataModelingViewModel.cs
@@ -9,7 +9,7 @@ using XCode;
using XCode.Code;
using XCode.DataAccessLayer;
-namespace XCoderAv.ViewModels;
+namespace NewLife.XCoder.ViewModels;
/// <summary>数据建模/代码生成器 ViewModel</summary>
public partial class DataModelingViewModel : ObservableObject
diff --git a/XCoderAv/ViewModels/DataSyncViewModel.cs b/XCoder.App/ViewModels/DataSyncViewModel.cs
similarity index 98%
rename from XCoderAv/ViewModels/DataSyncViewModel.cs
rename to XCoder.App/ViewModels/DataSyncViewModel.cs
index 27985d8..f2bbe49 100644
--- a/XCoderAv/ViewModels/DataSyncViewModel.cs
+++ b/XCoder.App/ViewModels/DataSyncViewModel.cs
@@ -6,9 +6,9 @@ using NewLife;
using NewLife.Log;
using XCode;
using XCode.DataAccessLayer;
-using XCoderAv.Models;
+using NewLife.XCoder.Models;
-namespace XCoderAv.ViewModels;
+namespace NewLife.XCoder.ViewModels;
/// <summary>跨库数据同步 ViewModel</summary>
public partial class DataSyncViewModel : ObservableObject
diff --git a/XCoderAv/ViewModels/FileEncodingViewModel.cs b/XCoder.App/ViewModels/FileEncodingViewModel.cs
similarity index 99%
rename from XCoderAv/ViewModels/FileEncodingViewModel.cs
rename to XCoder.App/ViewModels/FileEncodingViewModel.cs
index 2885c8c..3eb855b 100644
--- a/XCoderAv/ViewModels/FileEncodingViewModel.cs
+++ b/XCoder.App/ViewModels/FileEncodingViewModel.cs
@@ -4,7 +4,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using NewLife;
-namespace XCoderAv.ViewModels;
+namespace NewLife.XCoder.ViewModels;
/// <summary>文件编码转换 ViewModel</summary>
public partial class FileEncodingViewModel : ObservableObject
diff --git a/XCoderAv/ViewModels/FolderStatViewModel.cs b/XCoder.App/ViewModels/FolderStatViewModel.cs
similarity index 99%
rename from XCoderAv/ViewModels/FolderStatViewModel.cs
rename to XCoder.App/ViewModels/FolderStatViewModel.cs
index 9accb8c..1af659d 100644
--- a/XCoderAv/ViewModels/FolderStatViewModel.cs
+++ b/XCoder.App/ViewModels/FolderStatViewModel.cs
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel;
using NewLife.Caching;
-namespace XCoderAv.ViewModels;
+namespace NewLife.XCoder.ViewModels;
/// <summary>文件夹大小统计 ViewModel</summary>
public partial class FolderStatViewModel : ObservableObject
diff --git a/XCoderAv/ViewModels/GpsViewModel.cs b/XCoder.App/ViewModels/GpsViewModel.cs
similarity index 98%
rename from XCoderAv/ViewModels/GpsViewModel.cs
rename to XCoder.App/ViewModels/GpsViewModel.cs
index 3e3025c..55d12ba 100644
--- a/XCoderAv/ViewModels/GpsViewModel.cs
+++ b/XCoder.App/ViewModels/GpsViewModel.cs
@@ -2,7 +2,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using NewLife;
-namespace XCoderAv.ViewModels;
+namespace NewLife.XCoder.ViewModels;
/// <summary>GPS 辅助工具 ViewModel</summary>
public partial class GpsViewModel : ObservableObject
diff --git a/XCoderAv/ViewModels/IconToolViewModel.cs b/XCoder.App/ViewModels/IconToolViewModel.cs
similarity index 96%
rename from XCoderAv/ViewModels/IconToolViewModel.cs
rename to XCoder.App/ViewModels/IconToolViewModel.cs
index aad23dc..e5ec5f5 100644
--- a/XCoderAv/ViewModels/IconToolViewModel.cs
+++ b/XCoder.App/ViewModels/IconToolViewModel.cs
@@ -13,9 +13,9 @@ using Avalonia.Platform.Storage;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using NewLife;
-using XCoderAv.Models;
+using NewLife.XCoder.Models;
-namespace XCoderAv.ViewModels;
+namespace NewLife.XCoder.ViewModels;
/// <summary>图标水印处理工具 ViewModel(跨平台版,基于 Avalonia + Skia)</summary>
public partial class IconToolViewModel : ObservableObject
diff --git a/XCoderAv/ViewModels/IoControlViewModel.cs b/XCoder.App/ViewModels/IoControlViewModel.cs
similarity index 99%
rename from XCoderAv/ViewModels/IoControlViewModel.cs
rename to XCoder.App/ViewModels/IoControlViewModel.cs
index 86545e1..ad7d441 100644
--- a/XCoderAv/ViewModels/IoControlViewModel.cs
+++ b/XCoder.App/ViewModels/IoControlViewModel.cs
@@ -7,7 +7,7 @@ using NewLife;
using NewLife.Log;
using NewLife.Serial.Protocols;
-namespace XCoderAv.ViewModels;
+namespace NewLife.XCoder.ViewModels;
/// <summary>I/O 控制面板 ViewModel</summary>
public partial class IoControlViewModel : ObservableObject, IDisposable
diff --git a/XCoderAv/ViewModels/IpConfigViewModel.cs b/XCoder.App/ViewModels/IpConfigViewModel.cs
similarity index 99%
rename from XCoderAv/ViewModels/IpConfigViewModel.cs
rename to XCoder.App/ViewModels/IpConfigViewModel.cs
index 8532506..c195ddc 100644
--- a/XCoderAv/ViewModels/IpConfigViewModel.cs
+++ b/XCoder.App/ViewModels/IpConfigViewModel.cs
@@ -5,7 +5,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using NewLife;
-namespace XCoderAv.ViewModels;
+namespace NewLife.XCoder.ViewModels;
/// <summary>IP 设置工具 ViewModel</summary>
public partial class IpConfigViewModel : ObservableObject
diff --git a/XCoderAv/ViewModels/MapViewModel.cs b/XCoder.App/ViewModels/MapViewModel.cs
similarity index 96%
rename from XCoderAv/ViewModels/MapViewModel.cs
rename to XCoder.App/ViewModels/MapViewModel.cs
index f160f45..5c6bdca 100644
--- a/XCoderAv/ViewModels/MapViewModel.cs
+++ b/XCoder.App/ViewModels/MapViewModel.cs
@@ -9,7 +9,7 @@ using NewLife.Model;
using NewLife.Reflection;
using NewLife.Serialization;
-namespace XCoderAv.ViewModels;
+namespace NewLife.XCoder.ViewModels;
/// <summary>地图接口 ViewModel</summary>
public partial class MapViewModel : ObservableObject
@@ -60,7 +60,7 @@ public partial class MapViewModel : ObservableObject
[ObservableProperty]
private Boolean _formatAddress;
- private Dictionary<String, Map> _cache = [];
+ private Dictionary<String, NewLife.Map.Map> _cache = [];
#endregion
#region 构造
@@ -117,8 +117,8 @@ public partial class MapViewModel : ObservableObject
{
var provider = ObjectContainer.Provider;
map = type.GetConstructor(new[] { typeof(IServiceProvider) }) != null
- ? type.CreateInstance(provider) as Map
- : type.CreateInstance() as Map;
+ ? type.CreateInstance(provider) as NewLife.Map.Map
+ : type.CreateInstance() as NewLife.Map.Map;
if (map != null) map.Log = XTrace.Log;
if (map != null) _cache[typeName] = map;
}
diff --git a/XCoderAv/ViewModels/MelSpectrumViewModel.cs b/XCoder.App/ViewModels/MelSpectrumViewModel.cs
similarity index 98%
rename from XCoderAv/ViewModels/MelSpectrumViewModel.cs
rename to XCoder.App/ViewModels/MelSpectrumViewModel.cs
index 913e153..1a8c8da 100644
--- a/XCoderAv/ViewModels/MelSpectrumViewModel.cs
+++ b/XCoder.App/ViewModels/MelSpectrumViewModel.cs
@@ -4,7 +4,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using NewLife;
-namespace XCoderAv.ViewModels;
+namespace NewLife.XCoder.ViewModels;
/// <summary>音频梅尔频谱 ViewModel</summary>
public partial class MelSpectrumViewModel : ObservableObject
diff --git a/XCoderAv/ViewModels/MessageDebugViewModel.cs b/XCoder.App/ViewModels/MessageDebugViewModel.cs
similarity index 99%
rename from XCoderAv/ViewModels/MessageDebugViewModel.cs
rename to XCoder.App/ViewModels/MessageDebugViewModel.cs
index 831ca3c..a235c71 100644
--- a/XCoderAv/ViewModels/MessageDebugViewModel.cs
+++ b/XCoder.App/ViewModels/MessageDebugViewModel.cs
@@ -7,7 +7,7 @@ using NewLife.Log;
using NewLife.Net;
using NewLife.Threading;
-namespace XCoderAv.ViewModels;
+namespace NewLife.XCoder.ViewModels;
/// <summary>消息调试工具 ViewModel</summary>
public partial class MessageDebugViewModel : ObservableObject
diff --git a/XCoderAv/ViewModels/ModbusRtuViewModel.cs b/XCoder.App/ViewModels/ModbusRtuViewModel.cs
similarity index 99%
rename from XCoderAv/ViewModels/ModbusRtuViewModel.cs
rename to XCoder.App/ViewModels/ModbusRtuViewModel.cs
index 330c035..13831cb 100644
--- a/XCoderAv/ViewModels/ModbusRtuViewModel.cs
+++ b/XCoder.App/ViewModels/ModbusRtuViewModel.cs
@@ -7,7 +7,7 @@ using NewLife;
using NewLife.Log;
using NewLife.Serial.Protocols;
-namespace XCoderAv.ViewModels;
+namespace NewLife.XCoder.ViewModels;
/// <summary>Modbus RTU 工具 ViewModel</summary>
public partial class ModbusRtuViewModel : ObservableObject, IDisposable
diff --git a/XCoderAv/ViewModels/ModbusTcpViewModel.cs b/XCoder.App/ViewModels/ModbusTcpViewModel.cs
similarity index 99%
rename from XCoderAv/ViewModels/ModbusTcpViewModel.cs
rename to XCoder.App/ViewModels/ModbusTcpViewModel.cs
index 4c7cd22..50174c4 100644
--- a/XCoderAv/ViewModels/ModbusTcpViewModel.cs
+++ b/XCoder.App/ViewModels/ModbusTcpViewModel.cs
@@ -10,7 +10,7 @@ using NewLife.Net;
using NewLife.Security;
using NewLife.Threading;
-namespace XCoderAv.ViewModels;
+namespace NewLife.XCoder.ViewModels;
/// <summary>Modbus TCP 主站/从站模式</summary>
public enum ModbusTcpMode
diff --git a/XCoderAv/ViewModels/MqttViewModel.cs b/XCoder.App/ViewModels/MqttViewModel.cs
similarity index 99%
rename from XCoderAv/ViewModels/MqttViewModel.cs
rename to XCoder.App/ViewModels/MqttViewModel.cs
index 5342d03..095d0f5 100644
--- a/XCoderAv/ViewModels/MqttViewModel.cs
+++ b/XCoder.App/ViewModels/MqttViewModel.cs
@@ -8,7 +8,7 @@ using NewLife.MQTT;
using NewLife.MQTT.Messaging;
using NewLife.Net;
-namespace XCoderAv.ViewModels;
+namespace NewLife.XCoder.ViewModels;
/// <summary>MQTT 客户端 ViewModel</summary>
public partial class MqttViewModel : ObservableObject, IDisposable
diff --git a/XCoderAv/ViewModels/NetworkViewModel.cs b/XCoder.App/ViewModels/NetworkViewModel.cs
similarity index 99%
rename from XCoderAv/ViewModels/NetworkViewModel.cs
rename to XCoder.App/ViewModels/NetworkViewModel.cs
index f58f91c..5b2d893 100644
--- a/XCoderAv/ViewModels/NetworkViewModel.cs
+++ b/XCoder.App/ViewModels/NetworkViewModel.cs
@@ -13,7 +13,7 @@ using NewLife.Log;
using NewLife.Net;
using NewLife.Threading;
-namespace XCoderAv.ViewModels;
+namespace NewLife.XCoder.ViewModels;
/// <summary>网络调试工具工作模式</summary>
public enum NetworkWorkMode
diff --git a/XCoderAv/ViewModels/RedisManagerViewModel.cs b/XCoder.App/ViewModels/RedisManagerViewModel.cs
similarity index 98%
rename from XCoderAv/ViewModels/RedisManagerViewModel.cs
rename to XCoder.App/ViewModels/RedisManagerViewModel.cs
index 9010d01..ac146c4 100644
--- a/XCoderAv/ViewModels/RedisManagerViewModel.cs
+++ b/XCoder.App/ViewModels/RedisManagerViewModel.cs
@@ -6,9 +6,9 @@ using NewLife;
using NewLife.Caching;
using NewLife.Log;
using NewLife.Serialization;
-using XCoderAv.Models;
+using NewLife.XCoder.Models;
-namespace XCoderAv.ViewModels;
+namespace NewLife.XCoder.ViewModels;
/// <summary>Redis 管理器 ViewModel</summary>
public partial class RedisManagerViewModel : ObservableObject
diff --git a/XCoderAv/ViewModels/RegexViewModel.cs b/XCoder.App/ViewModels/RegexViewModel.cs
similarity index 98%
rename from XCoderAv/ViewModels/RegexViewModel.cs
rename to XCoder.App/ViewModels/RegexViewModel.cs
index 312ecdf..b4fc8cb 100644
--- a/XCoderAv/ViewModels/RegexViewModel.cs
+++ b/XCoder.App/ViewModels/RegexViewModel.cs
@@ -7,9 +7,9 @@ using System.Threading.Tasks;
using Avalonia.Threading;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
-using XCoderAv.Models;
+using NewLife.XCoder.Models;
-namespace XCoderAv.ViewModels;
+namespace NewLife.XCoder.ViewModels;
/// <summary>正则表达式工具 ViewModel</summary>
public partial class RegexViewModel : ObservableObject
diff --git a/XCoderAv/ViewModels/SecurityViewModel.cs b/XCoder.App/ViewModels/SecurityViewModel.cs
similarity index 100%
rename from XCoderAv/ViewModels/SecurityViewModel.cs
rename to XCoder.App/ViewModels/SecurityViewModel.cs
index efdbf5a..199ad11 100644
--- a/XCoderAv/ViewModels/SecurityViewModel.cs
+++ b/XCoder.App/ViewModels/SecurityViewModel.cs
@@ -15,7 +15,7 @@ using NewLife.Security;
using NewLife.Serialization;
using NewLife.Web;
-namespace XCoderAv.ViewModels;
+namespace NewLife.XCoder.ViewModels;
/// <summary>加密解密工具 ViewModel</summary>
public partial class SecurityViewModel : ObservableObject
diff --git a/XCoderAv/ViewModels/SerialPortViewModel.cs b/XCoder.App/ViewModels/SerialPortViewModel.cs
similarity index 99%
rename from XCoderAv/ViewModels/SerialPortViewModel.cs
rename to XCoder.App/ViewModels/SerialPortViewModel.cs
index 27a8d6e..6fa981e 100644
--- a/XCoderAv/ViewModels/SerialPortViewModel.cs
+++ b/XCoder.App/ViewModels/SerialPortViewModel.cs
@@ -6,7 +6,7 @@ using CommunityToolkit.Mvvm.Input;
using NewLife;
using NewLife.Threading;
-namespace XCoderAv.ViewModels;
+namespace NewLife.XCoder.ViewModels;
/// <summary>串口调试工具 ViewModel</summary>
public partial class SerialPortViewModel : ObservableObject, IDisposable
diff --git a/XCoderAv/ViewModels/SimpleLog.cs b/XCoder.App/ViewModels/SimpleLog.cs
similarity index 95%
rename from XCoderAv/ViewModels/SimpleLog.cs
rename to XCoder.App/ViewModels/SimpleLog.cs
index 5ab7162..8632a8e 100644
--- a/XCoderAv/ViewModels/SimpleLog.cs
+++ b/XCoder.App/ViewModels/SimpleLog.cs
@@ -1,6 +1,6 @@
using NewLife.Log;
-namespace XCoderAv.ViewModels;
+namespace NewLife.XCoder.ViewModels;
/// <summary>文本日志输出</summary>
internal class SimpleLog : Logger
diff --git a/XCoderAv/ViewModels/SpeechViewModel.cs b/XCoder.App/ViewModels/SpeechViewModel.cs
similarity index 99%
rename from XCoderAv/ViewModels/SpeechViewModel.cs
rename to XCoder.App/ViewModels/SpeechViewModel.cs
index d61ba11..2ebca51 100644
--- a/XCoderAv/ViewModels/SpeechViewModel.cs
+++ b/XCoder.App/ViewModels/SpeechViewModel.cs
@@ -4,7 +4,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using NewLife;
-namespace XCoderAv.ViewModels;
+namespace NewLife.XCoder.ViewModels;
/// <summary>语音助手 (TTS) ViewModel(跨平台版)</summary>
public partial class SpeechViewModel : ObservableObject
diff --git a/XCoderAv/ViewModels/SshViewModel.cs b/XCoder.App/ViewModels/SshViewModel.cs
similarity index 99%
rename from XCoderAv/ViewModels/SshViewModel.cs
rename to XCoder.App/ViewModels/SshViewModel.cs
index f8bde46..526abf5 100644
--- a/XCoderAv/ViewModels/SshViewModel.cs
+++ b/XCoder.App/ViewModels/SshViewModel.cs
@@ -4,7 +4,7 @@ using NewLife;
using NewLife.Net;
using Renci.SshNet;
-namespace XCoderAv.ViewModels;
+namespace NewLife.XCoder.ViewModels;
/// <summary>SSH 工具 ViewModel</summary>
public partial class SshViewModel : ObservableObject
diff --git a/XCoderAv/ViewModels/UsbDeviceViewModel.cs b/XCoder.App/ViewModels/UsbDeviceViewModel.cs
similarity index 97%
rename from XCoderAv/ViewModels/UsbDeviceViewModel.cs
rename to XCoder.App/ViewModels/UsbDeviceViewModel.cs
index d37ca60..02e9a04 100644
--- a/XCoderAv/ViewModels/UsbDeviceViewModel.cs
+++ b/XCoder.App/ViewModels/UsbDeviceViewModel.cs
@@ -3,9 +3,9 @@ using System.Text;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using NewLife;
-using XCoderAv.Models;
+using NewLife.XCoder.Models;
-namespace XCoderAv.ViewModels;
+namespace NewLife.XCoder.ViewModels;
/// <summary>USB 设备检测 ViewModel</summary>
public partial class UsbDeviceViewModel : ObservableObject
diff --git a/XCoderAv/Views/ApiDebugWindow.axaml b/XCoder.App/Views/ApiDebugWindow.axaml
similarity index 97%
rename from XCoderAv/Views/ApiDebugWindow.axaml
rename to XCoder.App/Views/ApiDebugWindow.axaml
index 8cd3ffd..2121baa 100644
--- a/XCoderAv/Views/ApiDebugWindow.axaml
+++ b/XCoder.App/Views/ApiDebugWindow.axaml
@@ -2,9 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="clr-namespace:XCoderAv.ViewModels"
+ xmlns:vm="clr-namespace:NewLife.XCoder.ViewModels"
mc:Ignorable="d" d:DesignWidth="1000" d:DesignHeight="750"
- x:Class="XCoderAv.Views.ApiDebugWindow"
+ x:Class="NewLife.XCoder.Views.ApiDebugWindow"
x:DataType="vm:ApiDebugViewModel"
Title="API 调试" Width="1000" Height="750"
WindowStartupLocation="CenterOwner">
diff --git a/XCoderAv/Views/ApiDebugWindow.axaml.cs b/XCoder.App/Views/ApiDebugWindow.axaml.cs
similarity index 84%
rename from XCoderAv/Views/ApiDebugWindow.axaml.cs
rename to XCoder.App/Views/ApiDebugWindow.axaml.cs
index 418820e..0c3f59a 100644
--- a/XCoderAv/Views/ApiDebugWindow.axaml.cs
+++ b/XCoder.App/Views/ApiDebugWindow.axaml.cs
@@ -1,7 +1,7 @@
using Avalonia.Controls;
-using XCoderAv.ViewModels;
+using NewLife.XCoder.ViewModels;
-namespace XCoderAv.Views;
+namespace NewLife.XCoder.Views;
/// <summary>API 调试工具窗口</summary>
public partial class ApiDebugWindow : Window
diff --git a/XCoderAv/Views/ApiDiscoverWindow.axaml b/XCoder.App/Views/ApiDiscoverWindow.axaml
similarity index 97%
rename from XCoderAv/Views/ApiDiscoverWindow.axaml
rename to XCoder.App/Views/ApiDiscoverWindow.axaml
index 7a42153..0569904 100644
--- a/XCoderAv/Views/ApiDiscoverWindow.axaml
+++ b/XCoder.App/Views/ApiDiscoverWindow.axaml
@@ -2,9 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="clr-namespace:XCoderAv.ViewModels"
+ xmlns:vm="clr-namespace:NewLife.XCoder.ViewModels"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="600"
- x:Class="XCoderAv.Views.ApiDiscoverWindow"
+ x:Class="NewLife.XCoder.Views.ApiDiscoverWindow"
x:DataType="vm:ApiDiscoverViewModel"
Title="API 服务发现" Width="800" Height="600"
WindowStartupLocation="CenterOwner">
diff --git a/XCoderAv/Views/ApiDiscoverWindow.axaml.cs b/XCoder.App/Views/ApiDiscoverWindow.axaml.cs
similarity index 84%
rename from XCoderAv/Views/ApiDiscoverWindow.axaml.cs
rename to XCoder.App/Views/ApiDiscoverWindow.axaml.cs
index 57a9994..8f8c104 100644
--- a/XCoderAv/Views/ApiDiscoverWindow.axaml.cs
+++ b/XCoder.App/Views/ApiDiscoverWindow.axaml.cs
@@ -1,7 +1,7 @@
using Avalonia.Controls;
-using XCoderAv.ViewModels;
+using NewLife.XCoder.ViewModels;
-namespace XCoderAv.Views;
+namespace NewLife.XCoder.Views;
/// <summary>API 服务发现窗口</summary>
public partial class ApiDiscoverWindow : Window
diff --git a/XCoderAv/Views/AudioDeviceWindow.axaml b/XCoder.App/Views/AudioDeviceWindow.axaml
similarity index 97%
rename from XCoderAv/Views/AudioDeviceWindow.axaml
rename to XCoder.App/Views/AudioDeviceWindow.axaml
index bfb321c..b7521cf 100644
--- a/XCoderAv/Views/AudioDeviceWindow.axaml
+++ b/XCoder.App/Views/AudioDeviceWindow.axaml
@@ -2,9 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="clr-namespace:XCoderAv.ViewModels"
+ xmlns:vm="clr-namespace:NewLife.XCoder.ViewModels"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="600"
- x:Class="XCoderAv.Views.AudioDeviceWindow"
+ x:Class="NewLife.XCoder.Views.AudioDeviceWindow"
x:DataType="vm:AudioDeviceViewModel"
Title="声卡选择器" Width="800" Height="600"
WindowStartupLocation="CenterOwner">
diff --git a/XCoderAv/Views/AudioDeviceWindow.axaml.cs b/XCoder.App/Views/AudioDeviceWindow.axaml.cs
similarity index 84%
rename from XCoderAv/Views/AudioDeviceWindow.axaml.cs
rename to XCoder.App/Views/AudioDeviceWindow.axaml.cs
index 8024fe9..bd57882 100644
--- a/XCoderAv/Views/AudioDeviceWindow.axaml.cs
+++ b/XCoder.App/Views/AudioDeviceWindow.axaml.cs
@@ -1,7 +1,7 @@
using Avalonia.Controls;
-using XCoderAv.ViewModels;
+using NewLife.XCoder.ViewModels;
-namespace XCoderAv.Views;
+namespace NewLife.XCoder.Views;
/// <summary>声卡选择器窗口</summary>
public partial class AudioDeviceWindow : Window
diff --git a/XCoderAv/Views/BackupWindow.axaml b/XCoder.App/Views/BackupWindow.axaml
similarity index 97%
rename from XCoderAv/Views/BackupWindow.axaml
rename to XCoder.App/Views/BackupWindow.axaml
index bdfd978..0225ddb 100644
--- a/XCoderAv/Views/BackupWindow.axaml
+++ b/XCoder.App/Views/BackupWindow.axaml
@@ -2,9 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="clr-namespace:XCoderAv.ViewModels"
+ xmlns:vm="clr-namespace:NewLife.XCoder.ViewModels"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="650"
- x:Class="XCoderAv.Views.BackupWindow"
+ x:Class="NewLife.XCoder.Views.BackupWindow"
x:DataType="vm:BackupViewModel"
Title="手机备份" Width="800" Height="650"
WindowStartupLocation="CenterOwner">
diff --git a/XCoderAv/Views/BackupWindow.axaml.cs b/XCoder.App/Views/BackupWindow.axaml.cs
similarity index 84%
rename from XCoderAv/Views/BackupWindow.axaml.cs
rename to XCoder.App/Views/BackupWindow.axaml.cs
index 23c98ae..061d705 100644
--- a/XCoderAv/Views/BackupWindow.axaml.cs
+++ b/XCoder.App/Views/BackupWindow.axaml.cs
@@ -1,7 +1,7 @@
using Avalonia.Controls;
-using XCoderAv.ViewModels;
+using NewLife.XCoder.ViewModels;
-namespace XCoderAv.Views;
+namespace NewLife.XCoder.Views;
/// <summary>手机备份窗口</summary>
public partial class BackupWindow : Window
diff --git a/XCoderAv/Views/DataModelingWindow.axaml b/XCoder.App/Views/DataModelingWindow.axaml
similarity index 98%
rename from XCoderAv/Views/DataModelingWindow.axaml
rename to XCoder.App/Views/DataModelingWindow.axaml
index e46c1e4..1ae117f 100644
--- a/XCoderAv/Views/DataModelingWindow.axaml
+++ b/XCoder.App/Views/DataModelingWindow.axaml
@@ -2,9 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="clr-namespace:XCoderAv.ViewModels"
+ xmlns:vm="clr-namespace:NewLife.XCoder.ViewModels"
mc:Ignorable="d" d:DesignWidth="1000" d:DesignHeight="750"
- x:Class="XCoderAv.Views.DataModelingWindow"
+ x:Class="NewLife.XCoder.Views.DataModelingWindow"
x:DataType="vm:DataModelingViewModel"
Title="代码生成器" Width="1000" Height="750"
WindowStartupLocation="CenterOwner">
diff --git a/XCoderAv/Views/DataModelingWindow.axaml.cs b/XCoder.App/Views/DataModelingWindow.axaml.cs
similarity index 84%
rename from XCoderAv/Views/DataModelingWindow.axaml.cs
rename to XCoder.App/Views/DataModelingWindow.axaml.cs
index 439fa56..abd05da 100644
--- a/XCoderAv/Views/DataModelingWindow.axaml.cs
+++ b/XCoder.App/Views/DataModelingWindow.axaml.cs
@@ -1,7 +1,7 @@
using Avalonia.Controls;
-using XCoderAv.ViewModels;
+using NewLife.XCoder.ViewModels;
-namespace XCoderAv.Views;
+namespace NewLife.XCoder.Views;
/// <summary>代码生成器窗口</summary>
public partial class DataModelingWindow : Window
diff --git a/XCoderAv/Views/DataSyncWindow.axaml b/XCoder.App/Views/DataSyncWindow.axaml
similarity index 98%
rename from XCoderAv/Views/DataSyncWindow.axaml
rename to XCoder.App/Views/DataSyncWindow.axaml
index 82e85df..808cace 100644
--- a/XCoderAv/Views/DataSyncWindow.axaml
+++ b/XCoder.App/Views/DataSyncWindow.axaml
@@ -2,9 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="clr-namespace:XCoderAv.ViewModels"
+ xmlns:vm="clr-namespace:NewLife.XCoder.ViewModels"
mc:Ignorable="d" d:DesignWidth="1000" d:DesignHeight="750"
- x:Class="XCoderAv.Views.DataSyncWindow"
+ x:Class="NewLife.XCoder.Views.DataSyncWindow"
x:DataType="vm:DataSyncViewModel"
Title="数据同步" Width="1000" Height="750"
WindowStartupLocation="CenterOwner">
diff --git a/XCoderAv/Views/DataSyncWindow.axaml.cs b/XCoder.App/Views/DataSyncWindow.axaml.cs
similarity index 84%
rename from XCoderAv/Views/DataSyncWindow.axaml.cs
rename to XCoder.App/Views/DataSyncWindow.axaml.cs
index baced8a..5519227 100644
--- a/XCoderAv/Views/DataSyncWindow.axaml.cs
+++ b/XCoder.App/Views/DataSyncWindow.axaml.cs
@@ -1,7 +1,7 @@
using Avalonia.Controls;
-using XCoderAv.ViewModels;
+using NewLife.XCoder.ViewModels;
-namespace XCoderAv.Views;
+namespace NewLife.XCoder.Views;
/// <summary>数据同步窗口</summary>
public partial class DataSyncWindow : Window
diff --git a/XCoderAv/Views/FileEncodingWindow.axaml b/XCoder.App/Views/FileEncodingWindow.axaml
similarity index 97%
rename from XCoderAv/Views/FileEncodingWindow.axaml
rename to XCoder.App/Views/FileEncodingWindow.axaml
index 37ad2c8..bb8d6e6 100644
--- a/XCoderAv/Views/FileEncodingWindow.axaml
+++ b/XCoder.App/Views/FileEncodingWindow.axaml
@@ -2,9 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="clr-namespace:XCoderAv.ViewModels"
+ xmlns:vm="clr-namespace:NewLife.XCoder.ViewModels"
mc:Ignorable="d" d:DesignWidth="900" d:DesignHeight="700"
- x:Class="XCoderAv.Views.FileEncodingWindow"
+ x:Class="NewLife.XCoder.Views.FileEncodingWindow"
x:DataType="vm:FileEncodingViewModel"
Title="文件编码转换" Width="900" Height="700"
WindowStartupLocation="CenterOwner">
diff --git a/XCoderAv/Views/FileEncodingWindow.axaml.cs b/XCoder.App/Views/FileEncodingWindow.axaml.cs
similarity index 84%
rename from XCoderAv/Views/FileEncodingWindow.axaml.cs
rename to XCoder.App/Views/FileEncodingWindow.axaml.cs
index 868bce1..3f8598c 100644
--- a/XCoderAv/Views/FileEncodingWindow.axaml.cs
+++ b/XCoder.App/Views/FileEncodingWindow.axaml.cs
@@ -1,7 +1,7 @@
using Avalonia.Controls;
-using XCoderAv.ViewModels;
+using NewLife.XCoder.ViewModels;
-namespace XCoderAv.Views;
+namespace NewLife.XCoder.Views;
/// <summary>文件编码转换窗口</summary>
public partial class FileEncodingWindow : Window
diff --git a/XCoderAv/Views/FolderStatWindow.axaml b/XCoder.App/Views/FolderStatWindow.axaml
similarity index 95%
rename from XCoderAv/Views/FolderStatWindow.axaml
rename to XCoder.App/Views/FolderStatWindow.axaml
index 429b2d7..825c424 100644
--- a/XCoderAv/Views/FolderStatWindow.axaml
+++ b/XCoder.App/Views/FolderStatWindow.axaml
@@ -2,9 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="clr-namespace:XCoderAv.ViewModels"
+ xmlns:vm="clr-namespace:NewLife.XCoder.ViewModels"
mc:Ignorable="d" d:DesignWidth="1000" d:DesignHeight="700"
- x:Class="XCoderAv.Views.FolderStatWindow"
+ x:Class="NewLife.XCoder.Views.FolderStatWindow"
x:DataType="vm:FolderStatViewModel"
Title="文件夹大小统计" Width="1000" Height="700"
WindowStartupLocation="CenterOwner">
diff --git a/XCoderAv/Views/FolderStatWindow.axaml.cs b/XCoder.App/Views/FolderStatWindow.axaml.cs
similarity index 95%
rename from XCoderAv/Views/FolderStatWindow.axaml.cs
rename to XCoder.App/Views/FolderStatWindow.axaml.cs
index 87bdcd8..732c9aa 100644
--- a/XCoderAv/Views/FolderStatWindow.axaml.cs
+++ b/XCoder.App/Views/FolderStatWindow.axaml.cs
@@ -1,9 +1,9 @@
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Threading;
-using XCoderAv.ViewModels;
+using NewLife.XCoder.ViewModels;
-namespace XCoderAv.Views;
+namespace NewLife.XCoder.Views;
/// <summary>文件夹大小统计工具窗口</summary>
public partial class FolderStatWindow : Window
diff --git a/XCoderAv/Views/GpsWindow.axaml b/XCoder.App/Views/GpsWindow.axaml
similarity index 98%
rename from XCoderAv/Views/GpsWindow.axaml
rename to XCoder.App/Views/GpsWindow.axaml
index f2ed176..145a042 100644
--- a/XCoderAv/Views/GpsWindow.axaml
+++ b/XCoder.App/Views/GpsWindow.axaml
@@ -2,9 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="clr-namespace:XCoderAv.ViewModels"
+ xmlns:vm="clr-namespace:NewLife.XCoder.ViewModels"
mc:Ignorable="d" d:DesignWidth="600" d:DesignHeight="450"
- x:Class="XCoderAv.Views.GpsWindow"
+ x:Class="NewLife.XCoder.Views.GpsWindow"
x:DataType="vm:GpsViewModel"
Title="GPS 辅助工具" Width="600" Height="450"
WindowStartupLocation="CenterOwner">
diff --git a/XCoderAv/Views/GpsWindow.axaml.cs b/XCoder.App/Views/GpsWindow.axaml.cs
similarity index 84%
rename from XCoderAv/Views/GpsWindow.axaml.cs
rename to XCoder.App/Views/GpsWindow.axaml.cs
index 5839433..91d3cc6 100644
--- a/XCoderAv/Views/GpsWindow.axaml.cs
+++ b/XCoder.App/Views/GpsWindow.axaml.cs
@@ -1,7 +1,7 @@
using Avalonia.Controls;
-using XCoderAv.ViewModels;
+using NewLife.XCoder.ViewModels;
-namespace XCoderAv.Views;
+namespace NewLife.XCoder.Views;
/// <summary>GPS 辅助工具窗口</summary>
public partial class GpsWindow : Window
diff --git a/XCoderAv/Views/IconToolWindow.axaml b/XCoder.App/Views/IconToolWindow.axaml
similarity index 98%
rename from XCoderAv/Views/IconToolWindow.axaml
rename to XCoder.App/Views/IconToolWindow.axaml
index ac3b857..bdf767d 100644
--- a/XCoderAv/Views/IconToolWindow.axaml
+++ b/XCoder.App/Views/IconToolWindow.axaml
@@ -2,9 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="clr-namespace:XCoderAv.ViewModels"
+ xmlns:vm="clr-namespace:NewLife.XCoder.ViewModels"
mc:Ignorable="d" d:DesignWidth="1100" d:DesignHeight="750"
- x:Class="XCoderAv.Views.IconToolWindow"
+ x:Class="NewLife.XCoder.Views.IconToolWindow"
x:DataType="vm:IconToolViewModel"
Title="图标水印处理工具" Width="1100" Height="750"
WindowStartupLocation="CenterOwner">
diff --git a/XCoderAv/Views/IconToolWindow.axaml.cs b/XCoder.App/Views/IconToolWindow.axaml.cs
similarity index 84%
rename from XCoderAv/Views/IconToolWindow.axaml.cs
rename to XCoder.App/Views/IconToolWindow.axaml.cs
index ca6af81..10dd9a5 100644
--- a/XCoderAv/Views/IconToolWindow.axaml.cs
+++ b/XCoder.App/Views/IconToolWindow.axaml.cs
@@ -1,7 +1,7 @@
using Avalonia.Controls;
-using XCoderAv.ViewModels;
+using NewLife.XCoder.ViewModels;
-namespace XCoderAv.Views;
+namespace NewLife.XCoder.Views;
/// <summary>图标水印处理工具窗口</summary>
public partial class IconToolWindow : Window
diff --git a/XCoderAv/Views/IoControlWindow.axaml b/XCoder.App/Views/IoControlWindow.axaml
similarity index 98%
rename from XCoderAv/Views/IoControlWindow.axaml
rename to XCoder.App/Views/IoControlWindow.axaml
index a2d28b3..c87beb8 100644
--- a/XCoderAv/Views/IoControlWindow.axaml
+++ b/XCoder.App/Views/IoControlWindow.axaml
@@ -2,9 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="clr-namespace:XCoderAv.ViewModels"
+ xmlns:vm="clr-namespace:NewLife.XCoder.ViewModels"
mc:Ignorable="d" d:DesignWidth="900" d:DesignHeight="700"
- x:Class="XCoderAv.Views.IoControlWindow"
+ x:Class="NewLife.XCoder.Views.IoControlWindow"
x:DataType="vm:IoControlViewModel"
Title="I/O 控制面板" Width="900" Height="700"
WindowStartupLocation="CenterOwner">
diff --git a/XCoderAv/Views/IoControlWindow.axaml.cs b/XCoder.App/Views/IoControlWindow.axaml.cs
similarity index 84%
rename from XCoderAv/Views/IoControlWindow.axaml.cs
rename to XCoder.App/Views/IoControlWindow.axaml.cs
index d11b03c..61fb802 100644
--- a/XCoderAv/Views/IoControlWindow.axaml.cs
+++ b/XCoder.App/Views/IoControlWindow.axaml.cs
@@ -1,7 +1,7 @@
using Avalonia.Controls;
-using XCoderAv.ViewModels;
+using NewLife.XCoder.ViewModels;
-namespace XCoderAv.Views;
+namespace NewLife.XCoder.Views;
/// <summary>I/O 控制面板窗口</summary>
public partial class IoControlWindow : Window
diff --git a/XCoderAv/Views/IpConfigWindow.axaml b/XCoder.App/Views/IpConfigWindow.axaml
similarity index 97%
rename from XCoderAv/Views/IpConfigWindow.axaml
rename to XCoder.App/Views/IpConfigWindow.axaml
index a76e923..64a64a8 100644
--- a/XCoderAv/Views/IpConfigWindow.axaml
+++ b/XCoder.App/Views/IpConfigWindow.axaml
@@ -2,9 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="clr-namespace:XCoderAv.ViewModels"
+ xmlns:vm="clr-namespace:NewLife.XCoder.ViewModels"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="700"
- x:Class="XCoderAv.Views.IpConfigWindow"
+ x:Class="NewLife.XCoder.Views.IpConfigWindow"
x:DataType="vm:IpConfigViewModel"
Title="IP 设置" Width="800" Height="700"
WindowStartupLocation="CenterOwner">
diff --git a/XCoderAv/Views/IpConfigWindow.axaml.cs b/XCoder.App/Views/IpConfigWindow.axaml.cs
similarity index 84%
rename from XCoderAv/Views/IpConfigWindow.axaml.cs
rename to XCoder.App/Views/IpConfigWindow.axaml.cs
index 355d1c0..258dafb 100644
--- a/XCoderAv/Views/IpConfigWindow.axaml.cs
+++ b/XCoder.App/Views/IpConfigWindow.axaml.cs
@@ -1,7 +1,7 @@
using Avalonia.Controls;
-using XCoderAv.ViewModels;
+using NewLife.XCoder.ViewModels;
-namespace XCoderAv.Views;
+namespace NewLife.XCoder.Views;
/// <summary>IP 设置工具窗口</summary>
public partial class IpConfigWindow : Window
diff --git a/XCoderAv/Views/MapWindow.axaml b/XCoder.App/Views/MapWindow.axaml
similarity index 97%
rename from XCoderAv/Views/MapWindow.axaml
rename to XCoder.App/Views/MapWindow.axaml
index 9785b16..ad8fd4b 100644
--- a/XCoderAv/Views/MapWindow.axaml
+++ b/XCoder.App/Views/MapWindow.axaml
@@ -2,9 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="clr-namespace:XCoderAv.ViewModels"
+ xmlns:vm="clr-namespace:NewLife.XCoder.ViewModels"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="700"
- x:Class="XCoderAv.Views.MapWindow"
+ x:Class="NewLife.XCoder.Views.MapWindow"
x:DataType="vm:MapViewModel"
Title="地图接口" Width="800" Height="700"
WindowStartupLocation="CenterOwner">
diff --git a/XCoderAv/Views/MapWindow.axaml.cs b/XCoder.App/Views/MapWindow.axaml.cs
similarity index 84%
rename from XCoderAv/Views/MapWindow.axaml.cs
rename to XCoder.App/Views/MapWindow.axaml.cs
index 9889201..c8e9744 100644
--- a/XCoderAv/Views/MapWindow.axaml.cs
+++ b/XCoder.App/Views/MapWindow.axaml.cs
@@ -1,7 +1,7 @@
using Avalonia.Controls;
-using XCoderAv.ViewModels;
+using NewLife.XCoder.ViewModels;
-namespace XCoderAv.Views;
+namespace NewLife.XCoder.Views;
/// <summary>地图接口窗口</summary>
public partial class MapWindow : Window
diff --git a/XCoderAv/Views/MelSpectrumWindow.axaml b/XCoder.App/Views/MelSpectrumWindow.axaml
similarity index 97%
rename from XCoderAv/Views/MelSpectrumWindow.axaml
rename to XCoder.App/Views/MelSpectrumWindow.axaml
index e7eed07..59801bd 100644
--- a/XCoderAv/Views/MelSpectrumWindow.axaml
+++ b/XCoder.App/Views/MelSpectrumWindow.axaml
@@ -2,9 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="clr-namespace:XCoderAv.ViewModels"
+ xmlns:vm="clr-namespace:NewLife.XCoder.ViewModels"
mc:Ignorable="d" d:DesignWidth="900" d:DesignHeight="700"
- x:Class="XCoderAv.Views.MelSpectrumWindow"
+ x:Class="NewLife.XCoder.Views.MelSpectrumWindow"
x:DataType="vm:MelSpectrumViewModel"
Title="音频梅尔频谱" Width="900" Height="700"
WindowStartupLocation="CenterOwner">
diff --git a/XCoderAv/Views/MelSpectrumWindow.axaml.cs b/XCoder.App/Views/MelSpectrumWindow.axaml.cs
similarity index 84%
rename from XCoderAv/Views/MelSpectrumWindow.axaml.cs
rename to XCoder.App/Views/MelSpectrumWindow.axaml.cs
index f4cd6b8..8aaf60d 100644
--- a/XCoderAv/Views/MelSpectrumWindow.axaml.cs
+++ b/XCoder.App/Views/MelSpectrumWindow.axaml.cs
@@ -1,7 +1,7 @@
using Avalonia.Controls;
-using XCoderAv.ViewModels;
+using NewLife.XCoder.ViewModels;
-namespace XCoderAv.Views;
+namespace NewLife.XCoder.Views;
/// <summary>音频梅尔频谱窗口</summary>
public partial class MelSpectrumWindow : Window
diff --git a/XCoderAv/Views/MessageDebugWindow.axaml b/XCoder.App/Views/MessageDebugWindow.axaml
similarity index 97%
rename from XCoderAv/Views/MessageDebugWindow.axaml
rename to XCoder.App/Views/MessageDebugWindow.axaml
index ceec5ed..dc0db6c 100644
--- a/XCoderAv/Views/MessageDebugWindow.axaml
+++ b/XCoder.App/Views/MessageDebugWindow.axaml
@@ -2,9 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="clr-namespace:XCoderAv.ViewModels"
+ xmlns:vm="clr-namespace:NewLife.XCoder.ViewModels"
mc:Ignorable="d" d:DesignWidth="1000" d:DesignHeight="750"
- x:Class="XCoderAv.Views.MessageDebugWindow"
+ x:Class="NewLife.XCoder.Views.MessageDebugWindow"
x:DataType="vm:MessageDebugViewModel"
Title="消息调试" Width="1000" Height="750"
WindowStartupLocation="CenterOwner">
diff --git a/XCoderAv/Views/MessageDebugWindow.axaml.cs b/XCoder.App/Views/MessageDebugWindow.axaml.cs
similarity index 84%
rename from XCoderAv/Views/MessageDebugWindow.axaml.cs
rename to XCoder.App/Views/MessageDebugWindow.axaml.cs
index d417d3c..5b13609 100644
--- a/XCoderAv/Views/MessageDebugWindow.axaml.cs
+++ b/XCoder.App/Views/MessageDebugWindow.axaml.cs
@@ -1,7 +1,7 @@
using Avalonia.Controls;
-using XCoderAv.ViewModels;
+using NewLife.XCoder.ViewModels;
-namespace XCoderAv.Views;
+namespace NewLife.XCoder.Views;
/// <summary>消息调试工具窗口</summary>
public partial class MessageDebugWindow : Window
diff --git a/XCoderAv/Views/ModbusRtuWindow.axaml b/XCoder.App/Views/ModbusRtuWindow.axaml
similarity index 98%
rename from XCoderAv/Views/ModbusRtuWindow.axaml
rename to XCoder.App/Views/ModbusRtuWindow.axaml
index 03d939d..fbfb839 100644
--- a/XCoderAv/Views/ModbusRtuWindow.axaml
+++ b/XCoder.App/Views/ModbusRtuWindow.axaml
@@ -2,9 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="clr-namespace:XCoderAv.ViewModels"
+ xmlns:vm="clr-namespace:NewLife.XCoder.ViewModels"
mc:Ignorable="d" d:DesignWidth="900" d:DesignHeight="700"
- x:Class="XCoderAv.Views.ModbusRtuWindow"
+ x:Class="NewLife.XCoder.Views.ModbusRtuWindow"
x:DataType="vm:ModbusRtuViewModel"
Title="Modbus RTU 调试" Width="900" Height="700"
WindowStartupLocation="CenterOwner">
diff --git a/XCoderAv/Views/ModbusRtuWindow.axaml.cs b/XCoder.App/Views/ModbusRtuWindow.axaml.cs
similarity index 84%
rename from XCoderAv/Views/ModbusRtuWindow.axaml.cs
rename to XCoder.App/Views/ModbusRtuWindow.axaml.cs
index 6cb23b2..f75860a 100644
--- a/XCoderAv/Views/ModbusRtuWindow.axaml.cs
+++ b/XCoder.App/Views/ModbusRtuWindow.axaml.cs
@@ -1,7 +1,7 @@
using Avalonia.Controls;
-using XCoderAv.ViewModels;
+using NewLife.XCoder.ViewModels;
-namespace XCoderAv.Views;
+namespace NewLife.XCoder.Views;
/// <summary>Modbus RTU 调试窗口</summary>
public partial class ModbusRtuWindow : Window
diff --git a/XCoderAv/Views/ModbusTcpWindow.axaml b/XCoder.App/Views/ModbusTcpWindow.axaml
similarity index 98%
rename from XCoderAv/Views/ModbusTcpWindow.axaml
rename to XCoder.App/Views/ModbusTcpWindow.axaml
index 22af9a7..cf1cd32 100644
--- a/XCoderAv/Views/ModbusTcpWindow.axaml
+++ b/XCoder.App/Views/ModbusTcpWindow.axaml
@@ -2,9 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="clr-namespace:XCoderAv.ViewModels"
+ xmlns:vm="clr-namespace:NewLife.XCoder.ViewModels"
mc:Ignorable="d" d:DesignWidth="1000" d:DesignHeight="750"
- x:Class="XCoderAv.Views.ModbusTcpWindow"
+ x:Class="NewLife.XCoder.Views.ModbusTcpWindow"
x:DataType="vm:ModbusTcpViewModel"
Title="Modbus TCP 调试" Width="1000" Height="750"
WindowStartupLocation="CenterOwner">
diff --git a/XCoderAv/Views/ModbusTcpWindow.axaml.cs b/XCoder.App/Views/ModbusTcpWindow.axaml.cs
similarity index 84%
rename from XCoderAv/Views/ModbusTcpWindow.axaml.cs
rename to XCoder.App/Views/ModbusTcpWindow.axaml.cs
index b7d6150..977e286 100644
--- a/XCoderAv/Views/ModbusTcpWindow.axaml.cs
+++ b/XCoder.App/Views/ModbusTcpWindow.axaml.cs
@@ -1,7 +1,7 @@
using Avalonia.Controls;
-using XCoderAv.ViewModels;
+using NewLife.XCoder.ViewModels;
-namespace XCoderAv.Views;
+namespace NewLife.XCoder.Views;
/// <summary>Modbus TCP 调试窗口</summary>
public partial class ModbusTcpWindow : Window
diff --git a/XCoderAv/Views/MqttWindow.axaml b/XCoder.App/Views/MqttWindow.axaml
similarity index 98%
rename from XCoderAv/Views/MqttWindow.axaml
rename to XCoder.App/Views/MqttWindow.axaml
index 8e08a9b..2ffb6ba 100644
--- a/XCoderAv/Views/MqttWindow.axaml
+++ b/XCoder.App/Views/MqttWindow.axaml
@@ -2,9 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="clr-namespace:XCoderAv.ViewModels"
+ xmlns:vm="clr-namespace:NewLife.XCoder.ViewModels"
mc:Ignorable="d" d:DesignWidth="1100" d:DesignHeight="750"
- x:Class="XCoderAv.Views.MqttWindow"
+ x:Class="NewLife.XCoder.Views.MqttWindow"
x:DataType="vm:MqttViewModel"
Title="MQTT 客户端" Width="1100" Height="750"
WindowStartupLocation="CenterOwner">
diff --git a/XCoderAv/Views/MqttWindow.axaml.cs b/XCoder.App/Views/MqttWindow.axaml.cs
similarity index 93%
rename from XCoderAv/Views/MqttWindow.axaml.cs
rename to XCoder.App/Views/MqttWindow.axaml.cs
index 74f1e54..3160894 100644
--- a/XCoderAv/Views/MqttWindow.axaml.cs
+++ b/XCoder.App/Views/MqttWindow.axaml.cs
@@ -1,8 +1,8 @@
using Avalonia.Controls;
using Avalonia.Threading;
-using XCoderAv.ViewModels;
+using NewLife.XCoder.ViewModels;
-namespace XCoderAv.Views;
+namespace NewLife.XCoder.Views;
/// <summary>MQTT 客户端窗口</summary>
public partial class MqttWindow : Window
diff --git a/XCoderAv/Views/NetworkWindow.axaml b/XCoder.App/Views/NetworkWindow.axaml
similarity index 98%
rename from XCoderAv/Views/NetworkWindow.axaml
rename to XCoder.App/Views/NetworkWindow.axaml
index 3d2908a..e57772b 100644
--- a/XCoderAv/Views/NetworkWindow.axaml
+++ b/XCoder.App/Views/NetworkWindow.axaml
@@ -2,9 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="clr-namespace:XCoderAv.ViewModels"
+ xmlns:vm="clr-namespace:NewLife.XCoder.ViewModels"
mc:Ignorable="d" d:DesignWidth="1100" d:DesignHeight="750"
- x:Class="XCoderAv.Views.NetworkWindow"
+ x:Class="NewLife.XCoder.Views.NetworkWindow"
x:DataType="vm:NetworkViewModel"
Title="网络调试工具" Width="1100" Height="750"
WindowStartupLocation="CenterOwner">
diff --git a/XCoderAv/Views/NetworkWindow.axaml.cs b/XCoder.App/Views/NetworkWindow.axaml.cs
similarity index 93%
rename from XCoderAv/Views/NetworkWindow.axaml.cs
rename to XCoder.App/Views/NetworkWindow.axaml.cs
index 5f5b421..6a85832 100644
--- a/XCoderAv/Views/NetworkWindow.axaml.cs
+++ b/XCoder.App/Views/NetworkWindow.axaml.cs
@@ -1,8 +1,8 @@
using Avalonia.Controls;
using Avalonia.Threading;
-using XCoderAv.ViewModels;
+using NewLife.XCoder.ViewModels;
-namespace XCoderAv.Views;
+namespace NewLife.XCoder.Views;
/// <summary>网络调试工具窗口</summary>
public partial class NetworkWindow : Window
diff --git a/XCoderAv/Views/RedisManagerWindow.axaml b/XCoder.App/Views/RedisManagerWindow.axaml
similarity index 97%
rename from XCoderAv/Views/RedisManagerWindow.axaml
rename to XCoder.App/Views/RedisManagerWindow.axaml
index 67cafe5..ce9d0b9 100644
--- a/XCoderAv/Views/RedisManagerWindow.axaml
+++ b/XCoder.App/Views/RedisManagerWindow.axaml
@@ -2,9 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="clr-namespace:XCoderAv.ViewModels"
+ xmlns:vm="clr-namespace:NewLife.XCoder.ViewModels"
mc:Ignorable="d" d:DesignWidth="1000" d:DesignHeight="750"
- x:Class="XCoderAv.Views.RedisManagerWindow"
+ x:Class="NewLife.XCoder.Views.RedisManagerWindow"
x:DataType="vm:RedisManagerViewModel"
Title="Redis 管理器" Width="1000" Height="750"
WindowStartupLocation="CenterOwner">
diff --git a/XCoderAv/Views/RedisManagerWindow.axaml.cs b/XCoder.App/Views/RedisManagerWindow.axaml.cs
similarity index 84%
rename from XCoderAv/Views/RedisManagerWindow.axaml.cs
rename to XCoder.App/Views/RedisManagerWindow.axaml.cs
index bdcf80b..d55e008 100644
--- a/XCoderAv/Views/RedisManagerWindow.axaml.cs
+++ b/XCoder.App/Views/RedisManagerWindow.axaml.cs
@@ -1,7 +1,7 @@
using Avalonia.Controls;
-using XCoderAv.ViewModels;
+using NewLife.XCoder.ViewModels;
-namespace XCoderAv.Views;
+namespace NewLife.XCoder.Views;
/// <summary>Redis 管理器窗口</summary>
public partial class RedisManagerWindow : Window
diff --git a/XCoderAv/Views/RegexWindow.axaml b/XCoder.App/Views/RegexWindow.axaml
similarity index 98%
rename from XCoderAv/Views/RegexWindow.axaml
rename to XCoder.App/Views/RegexWindow.axaml
index 8139f27..79762e5 100644
--- a/XCoderAv/Views/RegexWindow.axaml
+++ b/XCoder.App/Views/RegexWindow.axaml
@@ -2,10 +2,10 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="clr-namespace:XCoderAv.ViewModels"
- xmlns:models="clr-namespace:XCoderAv.Models"
+ xmlns:vm="clr-namespace:NewLife.XCoder.ViewModels"
+ xmlns:models="clr-namespace:NewLife.XCoder.Models"
mc:Ignorable="d" d:DesignWidth="1100" d:DesignHeight="700"
- x:Class="XCoderAv.Views.RegexWindow"
+ x:Class="NewLife.XCoder.Views.RegexWindow"
x:DataType="vm:RegexViewModel"
Title="正则表达式" Width="1100" Height="700"
WindowStartupLocation="CenterOwner">
diff --git a/XCoderAv/Views/RegexWindow.axaml.cs b/XCoder.App/Views/RegexWindow.axaml.cs
similarity index 84%
rename from XCoderAv/Views/RegexWindow.axaml.cs
rename to XCoder.App/Views/RegexWindow.axaml.cs
index 42c2e12..b7f8825 100644
--- a/XCoderAv/Views/RegexWindow.axaml.cs
+++ b/XCoder.App/Views/RegexWindow.axaml.cs
@@ -1,7 +1,7 @@
using Avalonia.Controls;
-using XCoderAv.ViewModels;
+using NewLife.XCoder.ViewModels;
-namespace XCoderAv.Views;
+namespace NewLife.XCoder.Views;
/// <summary>正则表达式工具窗口</summary>
public partial class RegexWindow : Window
diff --git a/XCoderAv/Views/SecurityWindow.axaml b/XCoder.App/Views/SecurityWindow.axaml
similarity index 98%
rename from XCoderAv/Views/SecurityWindow.axaml
rename to XCoder.App/Views/SecurityWindow.axaml
index ee0236b..e0d5380 100644
--- a/XCoderAv/Views/SecurityWindow.axaml
+++ b/XCoder.App/Views/SecurityWindow.axaml
@@ -2,9 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="clr-namespace:XCoderAv.ViewModels"
+ xmlns:vm="clr-namespace:NewLife.XCoder.ViewModels"
mc:Ignorable="d" d:DesignWidth="1100" d:DesignHeight="750"
- x:Class="XCoderAv.Views.SecurityWindow"
+ x:Class="NewLife.XCoder.Views.SecurityWindow"
x:DataType="vm:SecurityViewModel"
Title="加密解密" Width="1100" Height="750"
WindowStartupLocation="CenterOwner">
diff --git a/XCoderAv/Views/SecurityWindow.axaml.cs b/XCoder.App/Views/SecurityWindow.axaml.cs
similarity index 84%
rename from XCoderAv/Views/SecurityWindow.axaml.cs
rename to XCoder.App/Views/SecurityWindow.axaml.cs
index 39a9acc..298c237 100644
--- a/XCoderAv/Views/SecurityWindow.axaml.cs
+++ b/XCoder.App/Views/SecurityWindow.axaml.cs
@@ -1,7 +1,7 @@
using Avalonia.Controls;
-using XCoderAv.ViewModels;
+using NewLife.XCoder.ViewModels;
-namespace XCoderAv.Views;
+namespace NewLife.XCoder.Views;
/// <summary>加密解密工具窗口</summary>
public partial class SecurityWindow : Window
diff --git a/XCoderAv/Views/SerialPortWindow.axaml b/XCoder.App/Views/SerialPortWindow.axaml
similarity index 98%
rename from XCoderAv/Views/SerialPortWindow.axaml
rename to XCoder.App/Views/SerialPortWindow.axaml
index 2f8421d..1c3e6fa 100644
--- a/XCoderAv/Views/SerialPortWindow.axaml
+++ b/XCoder.App/Views/SerialPortWindow.axaml
@@ -2,9 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="clr-namespace:XCoderAv.ViewModels"
+ xmlns:vm="clr-namespace:NewLife.XCoder.ViewModels"
mc:Ignorable="d" d:DesignWidth="900" d:DesignHeight="650"
- x:Class="XCoderAv.Views.SerialPortWindow"
+ x:Class="NewLife.XCoder.Views.SerialPortWindow"
x:DataType="vm:SerialPortViewModel"
Title="串口调试工具" Width="900" Height="650"
WindowStartupLocation="CenterOwner">
diff --git a/XCoderAv/Views/SerialPortWindow.axaml.cs b/XCoder.App/Views/SerialPortWindow.axaml.cs
similarity index 89%
rename from XCoderAv/Views/SerialPortWindow.axaml.cs
rename to XCoder.App/Views/SerialPortWindow.axaml.cs
index c32dc55..432f761 100644
--- a/XCoderAv/Views/SerialPortWindow.axaml.cs
+++ b/XCoder.App/Views/SerialPortWindow.axaml.cs
@@ -1,7 +1,7 @@
using Avalonia.Controls;
-using XCoderAv.ViewModels;
+using NewLife.XCoder.ViewModels;
-namespace XCoderAv.Views;
+namespace NewLife.XCoder.Views;
/// <summary>串口调试工具窗口</summary>
public partial class SerialPortWindow : Window
diff --git a/XCoderAv/Views/SpeechWindow.axaml b/XCoder.App/Views/SpeechWindow.axaml
similarity index 98%
rename from XCoderAv/Views/SpeechWindow.axaml
rename to XCoder.App/Views/SpeechWindow.axaml
index 594eddd..c206891 100644
--- a/XCoderAv/Views/SpeechWindow.axaml
+++ b/XCoder.App/Views/SpeechWindow.axaml
@@ -2,9 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="clr-namespace:XCoderAv.ViewModels"
+ xmlns:vm="clr-namespace:NewLife.XCoder.ViewModels"
mc:Ignorable="d" d:DesignWidth="700" d:DesignHeight="500"
- x:Class="XCoderAv.Views.SpeechWindow"
+ x:Class="NewLife.XCoder.Views.SpeechWindow"
x:DataType="vm:SpeechViewModel"
Title="语音助手" Width="700" Height="500"
WindowStartupLocation="CenterOwner">
diff --git a/XCoderAv/Views/SpeechWindow.axaml.cs b/XCoder.App/Views/SpeechWindow.axaml.cs
similarity index 84%
rename from XCoderAv/Views/SpeechWindow.axaml.cs
rename to XCoder.App/Views/SpeechWindow.axaml.cs
index 1c0a235..66a619f 100644
--- a/XCoderAv/Views/SpeechWindow.axaml.cs
+++ b/XCoder.App/Views/SpeechWindow.axaml.cs
@@ -1,7 +1,7 @@
using Avalonia.Controls;
-using XCoderAv.ViewModels;
+using NewLife.XCoder.ViewModels;
-namespace XCoderAv.Views;
+namespace NewLife.XCoder.Views;
/// <summary>语音助手窗口</summary>
public partial class SpeechWindow : Window
diff --git a/XCoderAv/Views/SshWindow.axaml b/XCoder.App/Views/SshWindow.axaml
similarity index 97%
rename from XCoderAv/Views/SshWindow.axaml
rename to XCoder.App/Views/SshWindow.axaml
index 2e6106b..46739db 100644
--- a/XCoderAv/Views/SshWindow.axaml
+++ b/XCoder.App/Views/SshWindow.axaml
@@ -2,9 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="clr-namespace:XCoderAv.ViewModels"
+ xmlns:vm="clr-namespace:NewLife.XCoder.ViewModels"
mc:Ignorable="d" d:DesignWidth="900" d:DesignHeight="700"
- x:Class="XCoderAv.Views.SshWindow"
+ x:Class="NewLife.XCoder.Views.SshWindow"
x:DataType="vm:SshViewModel"
Title="SSH 工具" Width="900" Height="700"
WindowStartupLocation="CenterOwner">
diff --git a/XCoderAv/Views/SshWindow.axaml.cs b/XCoder.App/Views/SshWindow.axaml.cs
similarity index 84%
rename from XCoderAv/Views/SshWindow.axaml.cs
rename to XCoder.App/Views/SshWindow.axaml.cs
index dda030f..e58d5a9 100644
--- a/XCoderAv/Views/SshWindow.axaml.cs
+++ b/XCoder.App/Views/SshWindow.axaml.cs
@@ -1,7 +1,7 @@
using Avalonia.Controls;
-using XCoderAv.ViewModels;
+using NewLife.XCoder.ViewModels;
-namespace XCoderAv.Views;
+namespace NewLife.XCoder.Views;
/// <summary>SSH 工具窗口</summary>
public partial class SshWindow : Window
diff --git a/XCoderAv/Views/UsbDeviceWindow.axaml b/XCoder.App/Views/UsbDeviceWindow.axaml
similarity index 96%
rename from XCoderAv/Views/UsbDeviceWindow.axaml
rename to XCoder.App/Views/UsbDeviceWindow.axaml
index 160fc0a..6055028 100644
--- a/XCoderAv/Views/UsbDeviceWindow.axaml
+++ b/XCoder.App/Views/UsbDeviceWindow.axaml
@@ -2,9 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="clr-namespace:XCoderAv.ViewModels"
+ xmlns:vm="clr-namespace:NewLife.XCoder.ViewModels"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="600"
- x:Class="XCoderAv.Views.UsbDeviceWindow"
+ x:Class="NewLife.XCoder.Views.UsbDeviceWindow"
x:DataType="vm:UsbDeviceViewModel"
Title="USB 设备检测" Width="800" Height="600"
WindowStartupLocation="CenterOwner">
diff --git a/XCoderAv/Views/UsbDeviceWindow.axaml.cs b/XCoder.App/Views/UsbDeviceWindow.axaml.cs
similarity index 84%
rename from XCoderAv/Views/UsbDeviceWindow.axaml.cs
rename to XCoder.App/Views/UsbDeviceWindow.axaml.cs
index 8111ef7..c775c49 100644
--- a/XCoderAv/Views/UsbDeviceWindow.axaml.cs
+++ b/XCoder.App/Views/UsbDeviceWindow.axaml.cs
@@ -1,7 +1,7 @@
using Avalonia.Controls;
-using XCoderAv.ViewModels;
+using NewLife.XCoder.ViewModels;
-namespace XCoderAv.Views;
+namespace NewLife.XCoder.Views;
/// <summary>USB 设备检测窗口</summary>
public partial class UsbDeviceWindow : Window
diff --git a/XCoderAv/XCoderAv.csproj b/XCoder.App/XCoder.App.csproj
similarity index 80%
rename from XCoderAv/XCoderAv.csproj
rename to XCoder.App/XCoder.App.csproj
index ed37414..be5e069 100644
--- a/XCoderAv/XCoderAv.csproj
+++ b/XCoder.App/XCoder.App.csproj
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <OutputType>Exe</OutputType>
- <TargetFramework>net8.0</TargetFramework>
- <RootNamespace>XCoderAv</RootNamespace>
- <AssemblyName>XCoderAv</AssemblyName>
- <AssemblyTitle>新生命码神工具(跨平台)</AssemblyTitle>
- <Description>码神工具。代码生成、网络工具、API工具、串口工具、正则工具、图标工具、加解密工具、地图接口</Description>
+ <OutputType>WinExe</OutputType>
+ <TargetFramework>net10.0</TargetFramework>
+ <RootNamespace>NewLife.XCoder</RootNamespace>
+ <AssemblyName>XCoder</AssemblyName>
+ <AssemblyTitle>码神工具</AssemblyTitle>
+ <Description>码神工具。数据建模、网络调试、工业设备、加解密、正则与效率小工具,统一工作台与标签窗口。</Description>
<Company>新生命开发团队</Company>
<Copyright>©2002-2026 新生命开发团队</Copyright>
<VersionPrefix>8.2</VersionPrefix>
@@ -17,11 +17,14 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latest</LangVersion>
- <OutputPath>..\Bin\XCoderAv</OutputPath>
+ <OutputPath>..\Bin\XCoder</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<ItemGroup>
+ <AvaloniaResource Include="Assets\XCoder.png" />
+ </ItemGroup>
+ <ItemGroup>
<PackageReference Include="Avalonia" Version="12.1.1" />
<PackageReference Include="Avalonia.Desktop" Version="12.1.1" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="12.1.1" />
@@ -43,5 +46,4 @@
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
<IsAotCompatible>true</IsAotCompatible>
</PropertyGroup>
-
</Project>
diff --git "a/\347\240\201\347\245\236\345\267\245\345\205\267.slnx" "b/\347\240\201\347\245\236\345\267\245\345\205\267.slnx"
index 781471f..1d47f26 100644
--- "a/\347\240\201\347\245\236\345\267\245\345\205\267.slnx"
+++ "b/\347\240\201\347\245\236\345\267\245\345\205\267.slnx"
@@ -16,9 +16,9 @@
<Project Path="A2Lib/A2Lib.csproj" />
<Project Path="CrazyCoder/CoderWpf.csproj" />
<Project Path="XCoder/CrazyCoder.csproj" />
- <Project Path="XCoderAv/XCoderAv.csproj" />
+ <Project Path="XCoder.App/XCoder.App.csproj" />
<Project Path="XCoderLinux/XCoderLinux.csproj" />
- <Project Path="XCoderMac/XCoderMac.csproj" />
<Project Path="Tests/XCoder.Tests/XCoder.Tests.csproj" />
+ <Project Path="Tests/XCoder.App.Tests/XCoder.App.Tests.csproj" />
<Project Path="xDesktopInfo/xDesktopInfo.csproj" />
</Solution>