From ed239929f396fd6203a0f8a265a0c5a676f6bf77 Mon Sep 17 00:00:00 2001 From: CJKmkp <2564608840@qq.com> Date: Fri, 13 Feb 2026 00:09:38 +0800 Subject: [PATCH] =?UTF-8?q?improve:Dlass=E9=81=A5=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ink Canvas/App.xaml.cs | 15 ++++++++ Ink Canvas/Helpers/DeviceIdentifier.cs | 36 ++++++++++++++++--- .../SettingsViews/AboutPanel.xaml.cs | 8 ++--- 3 files changed, 51 insertions(+), 8 deletions(-) diff --git a/Ink Canvas/App.xaml.cs b/Ink Canvas/App.xaml.cs index fbb53b9c..f74024af 100644 --- a/Ink Canvas/App.xaml.cs +++ b/Ink Canvas/App.xaml.cs @@ -749,6 +749,21 @@ namespace Ink_Canvas await Task.Delay(500); } DeviceIdentifier.RecordAppLaunch(); + try + { + var systemVersion = DeviceIdentifier.GetSystemVersion(); + if (!string.IsNullOrWhiteSpace(systemVersion)) + { + SentrySdk.ConfigureScope(scope => + { + scope.SetTag("system_version", systemVersion); + }); + } + } + catch (Exception ex) + { + LogHelper.WriteLogToFile($"App | 初始化系统版本遥测标签失败: {ex.Message}", LogHelper.LogType.Warning); + } LogHelper.WriteLogToFile($"App | 设备ID: {DeviceIdentifier.GetDeviceId()}"); LogHelper.WriteLogToFile($"App | 使用频率: {DeviceIdentifier.GetUsageFrequency()}"); LogHelper.WriteLogToFile($"App | 更新优先级: {DeviceIdentifier.GetUpdatePriority()}"); diff --git a/Ink Canvas/Helpers/DeviceIdentifier.cs b/Ink Canvas/Helpers/DeviceIdentifier.cs index 8778457c..f0821d4d 100644 --- a/Ink Canvas/Helpers/DeviceIdentifier.cs +++ b/Ink Canvas/Helpers/DeviceIdentifier.cs @@ -1,4 +1,5 @@ using Newtonsoft.Json; +using OSVersionExtension; using System; using System.Collections.Generic; using System.IO; @@ -405,7 +406,9 @@ namespace Ink_Canvas.Helpers [JsonProperty("launchCount")] public int LaunchCount { get; set; } - // 新的秒级精度字段 + [JsonProperty("systemVersion")] + public string SystemVersion { get; set; } + [JsonProperty("totalUsageSeconds")] public long TotalUsageSeconds { get; set; } @@ -567,6 +570,20 @@ namespace Ink_Canvas.Helpers // 记录每周启动次数 stats.RecordWeeklyLaunch(); + try + { + var osName = OSVersion.GetOperatingSystem(); + var osVersion = OSVersion.GetOSVersion(); + string versionText = osVersion != null + ? $"{osName} {osVersion.Version}" + : osName.ToString(); + stats.SystemVersion = versionText; + } + catch (Exception ex) + { + LogHelper.WriteLogToFile($"DeviceIdentifier | 刷新系统版本信息失败: {ex.Message}", LogHelper.LogType.Warning); + } + // 计算使用频率 CalculateUsageFrequency(stats); @@ -602,8 +619,6 @@ namespace Ink_Canvas.Helpers // 更新秒级精度数据 stats.TotalUsageSeconds += sessionSeconds; - - // 记录每周使用时长(秒级精度) stats.RecordWeeklyUsage(sessionSeconds); @@ -611,7 +626,6 @@ namespace Ink_Canvas.Helpers if (stats.LaunchCount > 0) { stats.AverageSessionSeconds = (double)stats.TotalUsageSeconds / stats.LaunchCount; - } } @@ -631,6 +645,20 @@ namespace Ink_Canvas.Helpers } } + public static string GetSystemVersion() + { + try + { + var stats = LoadUsageStats(); + return stats.SystemVersion; + } + catch (Exception ex) + { + LogHelper.WriteLogToFile($"DeviceIdentifier | 获取系统版本失败: {ex.Message}", LogHelper.LogType.Error); + return null; + } + } + /// /// 计算使用频率和更新优先级(基于真实的每周统计数据) /// 通过多维度评分系统确定用户类型:高频(≥80分)、中频(40-79分)、低频(<40分) diff --git a/Ink Canvas/Windows/SettingsViews/SettingsViews/AboutPanel.xaml.cs b/Ink Canvas/Windows/SettingsViews/SettingsViews/AboutPanel.xaml.cs index 1a94ce6f..80496e64 100644 --- a/Ink Canvas/Windows/SettingsViews/SettingsViews/AboutPanel.xaml.cs +++ b/Ink Canvas/Windows/SettingsViews/SettingsViews/AboutPanel.xaml.cs @@ -78,14 +78,14 @@ namespace Ink_Canvas.Windows.SettingsViews } else { - AboutCopyright.Text = "© Copyright 2024 Dubi906w 所有"; - AboutBottomCopyright.Text = "© Copyright 2024 Dubi906w(Doubx690i/kriastans) 所有"; + AboutCopyright.Text = "© Copyright 2025-2026 CJK_mkp 所有"; + AboutBottomCopyright.Text = "© Copyright 2025-2026 CJK_mkp 所有"; } } catch (Exception ex) { - AboutCopyright.Text = "© Copyright 2024 Dubi906w 所有"; - AboutBottomCopyright.Text = "© Copyright 2024 Dubi906w(Doubx690i/kriastans) 所有"; + AboutCopyright.Text = "© Copyright 2025-2026 CJK_mkp 所有"; + AboutBottomCopyright.Text = "© Copyright 2025-2026 CJK_mkp 所有"; System.Diagnostics.Debug.WriteLine($"获取版权信息失败: {ex.Message}"); }