Selaa lähdekoodia

chore(build): 统一版本号格式并同步至UI标题栏

将版本格式调整为 yyyy.MM.dd.HHmm,更新 Server 常量及 Client 项目配置,并在主窗口标题中动态显示客户端版本。
yangkaixiang 1 kuukausi sitten
vanhempi
commit
cbb8d2d818

+ 2 - 0
AGENTS.md

@@ -4,3 +4,5 @@
 
 - Windows 编译时,如果因进程占用导致编译失败,可以直接结束占用进程后重新编译。编译结束后重新打开程序。
 - 每次编译 server 端前,需要先修改版本号。
+- 编译win端时,需要修改主界面标题栏的版本号。
+- 版本号格式统一使用 `yyyy.MM.dd.HHmm`,例如 `2026.05.13.1446`。

+ 1 - 1
docs/08-构建与编译.md

@@ -33,7 +33,7 @@ windows\NetworkTool.Client\bin\Debug\net9.0-windows\
 
 每次修改 `server` 端代码时,必须同步更新 `server/internal/config/config.go` 中的 `ServerVersion`。
 
-版本号格式固定为当前时间:`yyyyMMddHHmmss`,例如 `20260511152102`。
+版本号格式固定为当前时间:`yyyy.MM.dd.HHmm`,例如 `2026.05.13.1446`。
 
 该版本号用于排查客户端与远端 Server 是否一致:
 

+ 1 - 1
server/internal/config/config.go

@@ -6,7 +6,7 @@ import (
 	"net"
 )
 
-const ServerVersion = "20260512145500"
+const ServerVersion = "2026.05.13.1446"
 
 type Config struct {
 	HTTPHost         string

+ 9 - 0
windows/NetworkTool.Client/MainWindow.xaml.cs

@@ -1,5 +1,6 @@
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
+using System.Reflection;
 using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Input;
@@ -28,9 +29,17 @@ public partial class MainWindow : Window
     public MainWindow()
     {
         InitializeComponent();
+        Title = $"NetworkTool {GetClientVersion()}";
         Loaded += MainWindow_OnLoaded;
     }
 
+    private static string GetClientVersion()
+    {
+        return Assembly.GetExecutingAssembly()
+            .GetCustomAttribute<AssemblyInformationalVersionAttribute>()?
+            .InformationalVersion.Split('+')[0] ?? "unknown";
+    }
+
     private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
     {
         LoadInitialState();

+ 1 - 0
windows/NetworkTool.Client/NetworkTool.Client.csproj

@@ -6,6 +6,7 @@
     <Nullable>enable</Nullable>
     <ImplicitUsings>enable</ImplicitUsings>
     <UseWPF>true</UseWPF>
+    <InformationalVersion>2026.05.13.1446</InformationalVersion>
   </PropertyGroup>
 
 </Project>