From c5c0d3f672ace38983fa97397d9e54785fb70c0c Mon Sep 17 00:00:00 2001 From: Constrat <56174894+Constrat@users.noreply.github.com.> Date: Mon, 2 Sep 2024 13:43:20 +0200 Subject: [PATCH 01/16] feat: date format language based --- src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs index 4590a9b47f..7ae1230456 100755 --- a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs @@ -3669,7 +3669,9 @@ namespace MaaWpfGui.ViewModels.UI string dateOnly = string.Empty; if (DateTime.TryParse(lastUpdated, out DateTime parsedDateTime)) { - dateOnly = parsedDateTime.ToString("yy.MM.dd"); + dateOnly = LocalizationHelper.DefaultLanguage == "en-us" + ? parsedDateTime.ToString("dd/MM/yyyy") + : parsedDateTime.ToString("yy.MM.dd"); } if ((currentTime < poolTime) && (currentTime < activityTime)) @@ -3693,7 +3695,7 @@ namespace MaaWpfGui.ViewModels.UI versionName = versionJson?["activity"]?["name"]?.ToString() ?? string.Empty; } - return versionName + dateOnly; + return dateOnly + " - " + versionName; } private UpdateVersionType _versionType = (UpdateVersionType)Enum.Parse( From 4400e263a5fc572c92d474ad1334693c1751dc56 Mon Sep 17 00:00:00 2001 From: uye <99072975+ABA2396@users.noreply.github.com> Date: Thu, 5 Sep 2024 03:44:58 +0800 Subject: [PATCH 02/16] =?UTF-8?q?feat:=20=E6=8B=86=E5=88=86=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E6=97=A5=E6=9C=9F=EF=BC=8C=E6=96=B0=E5=A2=9E=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E6=97=A5=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaWpfGui/MaaWpfGui.csproj | 6 +++ .../Properties/BuildDateTimeAttribute.cs | 25 ++++++++++ .../ViewModels/UI/SettingsViewModel.cs | 48 +++++++++++++------ .../VersionUpdateSettingsUserControl.xaml | 18 +++++++ 4 files changed, 82 insertions(+), 15 deletions(-) create mode 100644 src/MaaWpfGui/Properties/BuildDateTimeAttribute.cs diff --git a/src/MaaWpfGui/MaaWpfGui.csproj b/src/MaaWpfGui/MaaWpfGui.csproj index e41c8f8421..2e56be68fc 100644 --- a/src/MaaWpfGui/MaaWpfGui.csproj +++ b/src/MaaWpfGui/MaaWpfGui.csproj @@ -42,6 +42,12 @@ 0.0.1 + + + <_Parameter1>$([System.DateTime]::UtcNow.ToString("yyyy-MM-ddTHH:mm:ss")) + + + newlogo.ico diff --git a/src/MaaWpfGui/Properties/BuildDateTimeAttribute.cs b/src/MaaWpfGui/Properties/BuildDateTimeAttribute.cs new file mode 100644 index 0000000000..ece26b3eb1 --- /dev/null +++ b/src/MaaWpfGui/Properties/BuildDateTimeAttribute.cs @@ -0,0 +1,25 @@ +// +// MaaWpfGui - A part of the MaaCoreArknights project +// Copyright (C) 2021 MistEO and Contributors +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License v3.0 only as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY +// + +using System; + +namespace MaaWpfGui.Properties +{ + [AttributeUsage(AttributeTargets.Assembly)] + public class BuildDateTimeAttribute(string date) : Attribute + { + private const string DateFormat = "yyyy-MM-ddTHH:mm:ss"; + + public DateTime BuildDateTime { get; } = DateTime.ParseExact(date, DateFormat, null); + } +} diff --git a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs index 7ae1230456..c13aa9df44 100755 --- a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs @@ -33,13 +33,13 @@ using System.Windows.Controls; using System.Windows.Media.Imaging; using HandyControl.Controls; using HandyControl.Data; -using HandyControl.Tools.Extension; using MaaWpfGui.Configuration; using MaaWpfGui.Constants; using MaaWpfGui.Extensions; using MaaWpfGui.Helper; using MaaWpfGui.Main; using MaaWpfGui.Models; +using MaaWpfGui.Properties; using MaaWpfGui.Services; using MaaWpfGui.Services.HotKeys; using MaaWpfGui.Services.Notification; @@ -1484,7 +1484,9 @@ namespace MaaWpfGui.ViewModels.UI { SetAndNotify(ref _clientType, value); ConfigurationHelper.SetValue(ConfigurationKeys.ClientType, value); - ResourceVersion = GetResourceVersionByClientType(_clientType); + _resourceInfo = GetResourceVersionByClientType(_clientType); + ResourceVersion = _resourceInfo.VersionName; + ResourceDateTime = _resourceInfo.DateTime; UpdateWindowTitle(); // 每次修改客户端时更新WindowTitle Instances.TaskQueueViewModel.UpdateStageList(true); Instances.TaskQueueViewModel.UpdateDatePrompt(); @@ -3634,7 +3636,13 @@ namespace MaaWpfGui.ViewModels.UI /// public static string UiVersion { get; } = _uiVersion == "0.0.1" ? "DEBUG VERSION" : _uiVersion; - private static string _resourceVersion = GetResourceVersionByClientType(ConfigurationHelper.GetValue(ConfigurationKeys.ClientType, string.Empty)); + private static readonly DateTime _buildDateTime = Assembly.GetExecutingAssembly().GetCustomAttribute()?.BuildDateTime ?? DateTime.MinValue; + + public DateTime BuildDateTime { get; } = _buildDateTime; + + private static (DateTime DateTime, string VersionName) _resourceInfo = GetResourceVersionByClientType(ConfigurationHelper.GetValue(ConfigurationKeys.ClientType, string.Empty)); + + private static string _resourceVersion = _resourceInfo.VersionName; /// /// Gets or sets the resource version. @@ -3645,7 +3653,15 @@ namespace MaaWpfGui.ViewModels.UI set => SetAndNotify(ref _resourceVersion, value); } - private static string GetResourceVersionByClientType(string clientType) + private static DateTime _resourceDateTime = _resourceInfo.DateTime; + + public DateTime ResourceDateTime + { + get => _resourceDateTime; + set => SetAndNotify(ref _resourceDateTime, value); + } + + private static (DateTime DateTime, string VersionName) GetResourceVersionByClientType(string clientType) { const string OfficialClientType = "Official"; const string BilibiliClientType = "Bilibili"; @@ -3655,10 +3671,10 @@ namespace MaaWpfGui.ViewModels.UI jsonPath = $"resource/global/{clientType}/resource/version.json"; } - string versionName = string.Empty; + string versionName; if (!File.Exists(jsonPath)) { - return versionName; + return (DateTime.MinValue, string.Empty); } var versionJson = (JObject?)JsonConvert.DeserializeObject(File.ReadAllText(jsonPath)); @@ -3666,13 +3682,9 @@ namespace MaaWpfGui.ViewModels.UI var poolTime = (ulong?)versionJson?["gacha"]?["time"]; // 卡池的开始时间 var activityTime = (ulong?)versionJson?["activity"]?["time"]; // 活动的开始时间 var lastUpdated = (string?)versionJson?["last_updated"]; // 最后更新时间 - string dateOnly = string.Empty; - if (DateTime.TryParse(lastUpdated, out DateTime parsedDateTime)) - { - dateOnly = LocalizationHelper.DefaultLanguage == "en-us" - ? parsedDateTime.ToString("dd/MM/yyyy") - : parsedDateTime.ToString("yy.MM.dd"); - } + var dateTime = lastUpdated == null + ? DateTime.MinValue + : DateTime.ParseExact(lastUpdated, "yyyy-MM-dd HH:mm:ss.fff", null); if ((currentTime < poolTime) && (currentTime < activityTime)) { @@ -3695,7 +3707,7 @@ namespace MaaWpfGui.ViewModels.UI versionName = versionJson?["activity"]?["name"]?.ToString() ?? string.Empty; } - return dateOnly + " - " + versionName; + return (dateTime, versionName); } private UpdateVersionType _versionType = (UpdateVersionType)Enum.Parse( @@ -4613,7 +4625,13 @@ namespace MaaWpfGui.ViewModels.UI } } - string resourceVersion = !string.IsNullOrEmpty(ResourceVersion) ? $" - {ResourceVersion}" : string.Empty; + string resourceVersion = !string.IsNullOrEmpty(ResourceVersion) + ? LocalizationHelper.DefaultLanguage switch + { + "en-us" => $" - {ResourceDateTime:dd/MM} {ResourceVersion}", + _ => $" - {ResourceVersion}{ResourceDateTime:#ddMM}", + } + : string.Empty; rvm.WindowTitle = $"{prefix}MAA{currentConfiguration} - {CoreVersion}{resourceVersion}{connectConfigName}{connectAddress}{clientName}"; } diff --git a/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml b/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml index f26680b858..f1782eb032 100755 --- a/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml +++ b/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml @@ -122,6 +122,15 @@ Text="{Binding ResourceVersion, Mode=OneWay}" TextWrapping="Wrap" /> + @@ -198,6 +207,15 @@ TextWrapping="Wrap" /> + Date: Thu, 5 Sep 2024 09:13:37 +0800 Subject: [PATCH 03/16] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E6=98=BE=E7=A4=BA=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs | 8 ++++++-- .../UserControl/VersionUpdateSettingsUserControl.xaml | 8 ++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs index c13aa9df44..7446de1519 100755 --- a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs @@ -3638,7 +3638,9 @@ namespace MaaWpfGui.ViewModels.UI private static readonly DateTime _buildDateTime = Assembly.GetExecutingAssembly().GetCustomAttribute()?.BuildDateTime ?? DateTime.MinValue; - public DateTime BuildDateTime { get; } = _buildDateTime; + public static DateTime BuildDateTime => _buildDateTime.ToLocalTime(); + + public static string BuildDateTimeLong => BuildDateTime.ToString("yyyy-MM-dd HH:mm"); private static (DateTime DateTime, string VersionName) _resourceInfo = GetResourceVersionByClientType(ConfigurationHelper.GetValue(ConfigurationKeys.ClientType, string.Empty)); @@ -3661,6 +3663,8 @@ namespace MaaWpfGui.ViewModels.UI set => SetAndNotify(ref _resourceDateTime, value); } + public string ResourceDateTimeLong => ResourceDateTime.ToString("yyyy-MM-dd HH:mm"); + private static (DateTime DateTime, string VersionName) GetResourceVersionByClientType(string clientType) { const string OfficialClientType = "Official"; @@ -4629,7 +4633,7 @@ namespace MaaWpfGui.ViewModels.UI ? LocalizationHelper.DefaultLanguage switch { "en-us" => $" - {ResourceDateTime:dd/MM} {ResourceVersion}", - _ => $" - {ResourceVersion}{ResourceDateTime:#ddMM}", + _ => $" - {ResourceVersion}{ResourceDateTime:#MMdd}", } : string.Empty; rvm.WindowTitle = $"{prefix}MAA{currentConfiguration} - {CoreVersion}{resourceVersion}{connectConfigName}{connectAddress}{clientName}"; diff --git a/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml b/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml index f1782eb032..383da37443 100755 --- a/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml +++ b/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml @@ -126,9 +126,9 @@ Margin="0,5" HorizontalAlignment="Center" VerticalAlignment="Center" - hc:FloatingBlock.Content="{Binding ResourceDateTime}" + hc:FloatingBlock.Content="{Binding ResourceDateTimeLong}" PreviewMouseDown="ResourceVersionClick" - Status="{Binding ResourceDateTime, Mode=OneWay}" + Status="{Binding ResourceDateTimeLong, Mode=OneWay}" Subject="资源日期" Color="#6969AA" /> @@ -211,9 +211,9 @@ Margin="0,5" HorizontalAlignment="Center" VerticalAlignment="Center" - hc:FloatingBlock.Content="{Binding BuildDateTime}" + hc:FloatingBlock.Content="{Binding BuildDateTimeLong}" PreviewMouseDown="CoreVersionClick" - Status="{Binding BuildDateTime, Mode=OneWay}" + Status="{Binding BuildDateTimeLong, Mode=OneWay}" Subject="构建日期" Color="#6969AA" /> From bbd02a6efabbdc2167f555561462ed635f15588b Mon Sep 17 00:00:00 2001 From: status102 <102887808+status102@users.noreply.github.com> Date: Thu, 5 Sep 2024 15:01:15 +0800 Subject: [PATCH 04/16] =?UTF-8?q?perf:=20=E6=B7=BB=E5=8A=A0MAA=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7=EF=BC=8C=E7=AE=80=E5=8C=96=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaWpfGui/Res/Localizations/en-us.xaml | 1 + src/MaaWpfGui/Res/Localizations/ja-jp.xaml | 1 + src/MaaWpfGui/Res/Localizations/ko-kr.xaml | 1 + src/MaaWpfGui/Res/Localizations/zh-cn.xaml | 1 + src/MaaWpfGui/Res/Localizations/zh-tw.xaml | 1 + .../VersionUpdateSettingsUserControl.xaml | 150 +++++++++++++++--- .../VersionUpdateSettingsUserControl.xaml.cs | 5 + 7 files changed, 135 insertions(+), 25 deletions(-) diff --git a/src/MaaWpfGui/Res/Localizations/en-us.xaml b/src/MaaWpfGui/Res/Localizations/en-us.xaml index 8ee2bd2af7..327610c7a5 100644 --- a/src/MaaWpfGui/Res/Localizations/en-us.xaml +++ b/src/MaaWpfGui/Res/Localizations/en-us.xaml @@ -18,6 +18,7 @@ HotKeys Update About us + MAA Version Core Version UI Version Resource Version diff --git a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml index c338edd374..b0425002fc 100644 --- a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml +++ b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml @@ -18,6 +18,7 @@ ホットキー設定 アップデート設定 About us + MAA バージョン Core バージョン UI バージョン リソースバーション diff --git a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml index 048415a5af..6077b8d5e2 100644 --- a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml +++ b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml @@ -18,6 +18,7 @@ 단축키 설정 업데이트 정보 + MAA 버전 Core 버전 UI 버전 Resource 버전 diff --git a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml index da9cee9ac2..c538fafedc 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml @@ -18,6 +18,7 @@ 热键设置 软件更新 关于我们 + MAA版本 核心版本 界面版本 资源版本 diff --git a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml index 98b8419aff..3a2d47c8d4 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml @@ -18,6 +18,7 @@ 熱鍵設定 軟體更新 關於我們 + MAA 版本號 Core 版本號 UI 版本號 資源版本號 diff --git a/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml b/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml index 383da37443..b5f0bcfdd6 100755 --- a/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml +++ b/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml @@ -122,15 +122,6 @@ Text="{Binding ResourceVersion, Mode=OneWay}" TextWrapping="Wrap" /> - @@ -139,13 +130,50 @@ + + CornerRadius="3,0,0,3" + Visibility="{c:Binding 'UiVersion == CoreVersion'}"> + + + + + + + CornerRadius="0,3,3,0" + Visibility="{c:Binding 'UiVersion != CoreVersion'}"> + + + + + + + + + + + + + + + + + + + + + + + + - Date: Thu, 5 Sep 2024 15:31:20 +0800 Subject: [PATCH 05/16] =?UTF-8?q?chore:=20=E8=8E=B7=E5=8F=96=E5=BD=93?= =?UTF-8?q?=E5=9C=B0=E5=8C=BA=E5=9F=9F=E6=A0=BC=E5=BC=8F=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaWpfGui/Extensions/DateTimeExtension.cs | 6 ++++++ .../RemoteControl/RemoteControlService.cs | 4 ---- src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs | 4 ---- src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs | 8 +++----- src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs | 15 ++++++++++++++- .../VersionUpdateSettingsUserControl.xaml | 6 +++--- 6 files changed, 26 insertions(+), 17 deletions(-) mode change 100755 => 100644 src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml diff --git a/src/MaaWpfGui/Extensions/DateTimeExtension.cs b/src/MaaWpfGui/Extensions/DateTimeExtension.cs index 23fefebda2..e7aae1728c 100644 --- a/src/MaaWpfGui/Extensions/DateTimeExtension.cs +++ b/src/MaaWpfGui/Extensions/DateTimeExtension.cs @@ -56,6 +56,12 @@ namespace MaaWpfGui.Extensions return dt is { Month: 4, Day: 1 }; } + public static string ToLocalTimeString(this DateTime dt) + { + var dateTimeFormat = CultureInfo.CurrentCulture.DateTimeFormat; + return dt.ToLocalTime().ToString(dateTimeFormat.ShortDatePattern + " HH:mm:ss"); + } + public static DateTime ToDateTime(this System.Runtime.InteropServices.ComTypes.FILETIME filetime) { return DateTime.FromFileTime(((long)filetime.dwHighDateTime << 32) | (uint)filetime.dwLowDateTime); diff --git a/src/MaaWpfGui/Services/RemoteControl/RemoteControlService.cs b/src/MaaWpfGui/Services/RemoteControl/RemoteControlService.cs index a71a6da0b5..477a6ceada 100644 --- a/src/MaaWpfGui/Services/RemoteControl/RemoteControlService.cs +++ b/src/MaaWpfGui/Services/RemoteControl/RemoteControlService.cs @@ -619,10 +619,6 @@ namespace MaaWpfGui.Services.RemoteControl /*await Task.Run(() => Instances.SettingsViewModel.RunScript("StartsWithScript"));*/ Instances.TaskQueueViewModel.AddLog(LocalizationHelper.GetString("ConnectingToEmulator")); - if (!Instances.SettingsViewModel.AdbReplaced && !Instances.SettingsViewModel.IsAdbTouchMode()) - { - Instances.TaskQueueViewModel.AddLog(LocalizationHelper.GetString("AdbReplacementTips"), UiLogColor.Info); - } // 一般是点了“停止”按钮了 if (Instances.TaskQueueViewModel.Stopping) diff --git a/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs b/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs index 289c4b2ae4..2d4c186dc8 100644 --- a/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs @@ -1027,10 +1027,6 @@ namespace MaaWpfGui.ViewModels.UI } AddLog(LocalizationHelper.GetString("ConnectingToEmulator")); - if (!Instances.SettingsViewModel.AdbReplaced && !Instances.SettingsViewModel.IsAdbTouchMode()) - { - AddLog(LocalizationHelper.GetString("AdbReplacementTips"), UiLogColor.Info); - } string errMsg = string.Empty; _caught = await Task.Run(() => Instances.AsstProxy.AsstConnect(ref errMsg)); diff --git a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs index 7446de1519..eb1505f947 100755 --- a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs @@ -3636,11 +3636,9 @@ namespace MaaWpfGui.ViewModels.UI /// public static string UiVersion { get; } = _uiVersion == "0.0.1" ? "DEBUG VERSION" : _uiVersion; - private static readonly DateTime _buildDateTime = Assembly.GetExecutingAssembly().GetCustomAttribute()?.BuildDateTime ?? DateTime.MinValue; + public static DateTime BuildDateTime { get; } = Assembly.GetExecutingAssembly().GetCustomAttribute()?.BuildDateTime ?? DateTime.MinValue; - public static DateTime BuildDateTime => _buildDateTime.ToLocalTime(); - - public static string BuildDateTimeLong => BuildDateTime.ToString("yyyy-MM-dd HH:mm"); + public static string BuildDateTimeCurrentCultureString => BuildDateTime.ToLocalTimeString(); private static (DateTime DateTime, string VersionName) _resourceInfo = GetResourceVersionByClientType(ConfigurationHelper.GetValue(ConfigurationKeys.ClientType, string.Empty)); @@ -3663,7 +3661,7 @@ namespace MaaWpfGui.ViewModels.UI set => SetAndNotify(ref _resourceDateTime, value); } - public string ResourceDateTimeLong => ResourceDateTime.ToString("yyyy-MM-dd HH:mm"); + public string ResourceDateTimeCurrentCultureString => ResourceDateTime.ToLocalTimeString(); private static (DateTime DateTime, string VersionName) GetResourceVersionByClientType(string clientType) { diff --git a/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs b/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs index 1bdaf9ea6a..9419020177 100644 --- a/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs @@ -1051,22 +1051,31 @@ namespace MaaWpfGui.ViewModels.UI ClearLog(); + var buildDateTimeLong = SettingsViewModel.BuildDateTimeCurrentCultureString; + var resourceDateTimeLong = Instances.SettingsViewModel.ResourceDateTimeCurrentCultureString; + AddLog($"Build Time:\n{buildDateTimeLong}\nResource Time:\n{resourceDateTimeLong}"); + var uiVersion = SettingsViewModel.UiVersion; var coreVersion = SettingsViewModel.CoreVersion; if (uiVersion != coreVersion && Instances.VersionUpdateViewModel.IsStdVersion(uiVersion) && Instances.VersionUpdateViewModel.IsStdVersion(coreVersion)) { - AddLog(string.Format(LocalizationHelper.GetString("VersionMismatch"), uiVersion, coreVersion), UiLogColor.Warning); + AddLog(string.Format(LocalizationHelper.GetString("VersionMismatch"), uiVersion, coreVersion), UiLogColor.Error); + return; } await Task.Run(() => Instances.SettingsViewModel.RunScript("StartsWithScript")); AddLog(LocalizationHelper.GetString("ConnectingToEmulator")); + + /* + // 现在的主流模拟器都已经更新过自带的 adb 了,不再需要替换 if (!Instances.SettingsViewModel.AdbReplaced && !Instances.SettingsViewModel.IsAdbTouchMode()) { AddLog(LocalizationHelper.GetString("AdbReplacementTips"), UiLogColor.Info); } + */ // 一般是点了“停止”按钮了 if (Stopping) @@ -1277,10 +1286,14 @@ namespace MaaWpfGui.ViewModels.UI await Task.Run(() => Instances.SettingsViewModel.RunScript("StartsWithScript")); AddLog(LocalizationHelper.GetString("ConnectingToEmulator")); + + /* + // 现在的主流模拟器都已经更新过自带的 adb 了,不再需要替换 if (!Instances.SettingsViewModel.AdbReplaced && !Instances.SettingsViewModel.IsAdbTouchMode()) { AddLog(LocalizationHelper.GetString("AdbReplacementTips"), UiLogColor.Info); } + */ // 一般是点了“停止”按钮了 if (Stopping) diff --git a/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml b/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml old mode 100755 new mode 100644 index b5f0bcfdd6..8eda6b6d0f --- a/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml +++ b/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml @@ -292,7 +292,7 @@ Padding="5,3,5,3" HorizontalAlignment="Center" VerticalAlignment="Center" - hc:FloatingBlock.Content="{Binding BuildDateTimeLong}" + hc:FloatingBlock.Content="{Binding BuildDateTimeCurrentCultureString}" Foreground="White" PreviewMouseDown="CoreVersionClick" Text="构建日期" @@ -309,10 +309,10 @@ Padding="5,3,5,3" HorizontalAlignment="Left" VerticalAlignment="Center" - hc:FloatingBlock.Content="{Binding BuildDateTimeLong}" + hc:FloatingBlock.Content="{Binding BuildDateTimeCurrentCultureString}" Foreground="White" PreviewMouseDown="CoreVersionClick" - Text="{Binding BuildDateTimeLong, Mode=OneWay}" + Text="{Binding BuildDateTimeCurrentCultureString, Mode=OneWay}" TextWrapping="Wrap" /> From 7a8607758a79ac7cc115761931c969cce38e0dd5 Mon Sep 17 00:00:00 2001 From: uye <99072975+ABA2396@users.noreply.github.com> Date: Thu, 5 Sep 2024 15:44:16 +0800 Subject: [PATCH 06/16] =?UTF-8?q?chore:=20=E4=BF=AE=E6=94=B9=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E5=A4=8D=E5=88=B6=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaWpfGui/Res/Localizations/en-us.xaml | 2 +- src/MaaWpfGui/Res/Localizations/ja-jp.xaml | 2 +- src/MaaWpfGui/Res/Localizations/ko-kr.xaml | 2 +- src/MaaWpfGui/Res/Localizations/zh-cn.xaml | 2 +- src/MaaWpfGui/Res/Localizations/zh-tw.xaml | 2 +- .../VersionUpdateSettingsUserControl.xaml | 16 ++++++++-------- .../VersionUpdateSettingsUserControl.xaml.cs | 6 +++--- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/MaaWpfGui/Res/Localizations/en-us.xaml b/src/MaaWpfGui/Res/Localizations/en-us.xaml index 327610c7a5..0f63d71134 100644 --- a/src/MaaWpfGui/Res/Localizations/en-us.xaml +++ b/src/MaaWpfGui/Res/Localizations/en-us.xaml @@ -18,7 +18,7 @@ HotKeys Update About us - MAA Version + MAA Version Core Version UI Version Resource Version diff --git a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml index b0425002fc..5e780bdbe1 100644 --- a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml +++ b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml @@ -18,7 +18,7 @@ ホットキー設定 アップデート設定 About us - MAA バージョン + MAA バージョン Core バージョン UI バージョン リソースバーション diff --git a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml index 6077b8d5e2..b8fe9fe7d4 100644 --- a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml +++ b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml @@ -18,7 +18,7 @@ 단축키 설정 업데이트 정보 - MAA 버전 + MAA 버전 Core 버전 UI 버전 Resource 버전 diff --git a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml index c538fafedc..1c1df169ae 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml @@ -18,7 +18,7 @@ 热键设置 软件更新 关于我们 - MAA版本 + MAA 版本 核心版本 界面版本 资源版本 diff --git a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml index 3a2d47c8d4..fb4b14e9c6 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml @@ -18,7 +18,7 @@ 熱鍵設定 軟體更新 關於我們 - MAA 版本號 + MAA 版本號 Core 版本號 UI 版本號 資源版本號 diff --git a/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml b/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml index 8eda6b6d0f..c35ccaf8a4 100644 --- a/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml +++ b/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml @@ -145,8 +145,8 @@ VerticalAlignment="Center" hc:FloatingBlock.Content="{Binding UiVersion}" Foreground="White" - PreviewMouseDown="MAAVersionClick" - Text="{DynamicResource MAAVersion}" + PreviewMouseDown="MaaVersionClick" + Text="{DynamicResource MaaVersion}" TextWrapping="Wrap" /> @@ -259,7 +259,7 @@ Padding="5,3,5,3" HorizontalAlignment="Center" VerticalAlignment="Center" - hc:FloatingBlock.Content="{Binding ResourceDateTimeLong}" + hc:FloatingBlock.Content="{Binding ResourceDateTimeCurrentCultureString}" Foreground="White" PreviewMouseDown="ResourceVersionClick" Text="资源日期" @@ -276,10 +276,10 @@ Padding="5,3,5,3" HorizontalAlignment="Left" VerticalAlignment="Center" - hc:FloatingBlock.Content="{Binding ResourceDateTimeLong}" + hc:FloatingBlock.Content="{Binding ResourceDateTimeCurrentCultureString}" Foreground="White" PreviewMouseDown="ResourceVersionClick" - Text="{Binding ResourceDateTimeLong, Mode=OneWay}" + Text="{Binding ResourceDateTimeCurrentCultureString, Mode=OneWay}" TextWrapping="Wrap" /> @@ -311,7 +311,7 @@ VerticalAlignment="Center" hc:FloatingBlock.Content="{Binding BuildDateTimeCurrentCultureString}" Foreground="White" - PreviewMouseDown="CoreVersionClick" + PreviewMouseDown="MaaVersionClick" Text="{Binding BuildDateTimeCurrentCultureString, Mode=OneWay}" TextWrapping="Wrap" /> diff --git a/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml.cs b/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml.cs index ce604e1f5c..7a4edfce7b 100644 --- a/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml.cs +++ b/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml.cs @@ -49,9 +49,9 @@ namespace MaaWpfGui.Views.UserControl Interval = new TimeSpan(0, 0, 6), }; - private void MAAVersionClick(object sender, MouseButtonEventArgs e) + private void MaaVersionClick(object sender, MouseButtonEventArgs e) { - CopyToClipboardAsync("UI Version: " + SettingsViewModel.UiVersion + "\nCore Version: " + SettingsViewModel.CoreVersion); + CopyToClipboardAsync($"UI Version: {SettingsViewModel.UiVersion}\nCore Version: {SettingsViewModel.CoreVersion}\nBuild Time: {SettingsViewModel.BuildDateTimeCurrentCultureString}"); } private void CoreVersionClick(object sender, MouseButtonEventArgs e) @@ -67,7 +67,7 @@ namespace MaaWpfGui.Views.UserControl private void ResourceVersionClick(object sender, MouseButtonEventArgs e) { - CopyToClipboardAsync("Resource Version: " + Instances.SettingsViewModel.ResourceVersion); + CopyToClipboardAsync($"Resource Version: {Instances.SettingsViewModel.ResourceVersion}\nResource Time: {Instances.SettingsViewModel.ResourceDateTimeCurrentCultureString}"); } private static void CopyToClipboardAsync(string text) From 5c5d776f7384fa55c6f4d9878e589a0e20187c10 Mon Sep 17 00:00:00 2001 From: status102 <102887808+status102@users.noreply.github.com> Date: Thu, 5 Sep 2024 17:37:47 +0800 Subject: [PATCH 07/16] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7=E6=8D=A2=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs | 4 ++++ .../VersionUpdateSettingsUserControl.xaml | 16 ++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs index eb1505f947..be2888b5fc 100755 --- a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs @@ -3629,6 +3629,8 @@ namespace MaaWpfGui.ViewModels.UI /// public static string CoreVersion { get; } = Marshal.PtrToStringAnsi(MaaService.AsstGetVersion()) ?? "0.0.1"; + public static string CoreVersionDisplay => string.Join("\u200B", UiVersion.ToCharArray()); + private static readonly string _uiVersion = Assembly.GetExecutingAssembly().GetCustomAttribute()?.InformationalVersion.Split('+')[0] ?? "0.0.1"; /// @@ -3636,6 +3638,8 @@ namespace MaaWpfGui.ViewModels.UI /// public static string UiVersion { get; } = _uiVersion == "0.0.1" ? "DEBUG VERSION" : _uiVersion; + public static string UiVersionDisplay => string.Join("\u200B", UiVersion.ToCharArray()); + public static DateTime BuildDateTime { get; } = Assembly.GetExecutingAssembly().GetCustomAttribute()?.BuildDateTime ?? DateTime.MinValue; public static string BuildDateTimeCurrentCultureString => BuildDateTime.ToLocalTimeString(); diff --git a/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml b/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml index c35ccaf8a4..d3b8908294 100644 --- a/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml +++ b/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml @@ -159,12 +159,12 @@ @@ -274,7 +274,7 @@ Date: Thu, 5 Sep 2024 18:31:47 +0800 Subject: [PATCH 08/16] =?UTF-8?q?chore:=20issue=E6=A8=A1=E6=9D=BF=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/ISSUE_TEMPLATE/cn-bug-report.yaml | 3 +++ .github/ISSUE_TEMPLATE/cn-mumu-report.yaml | 4 ++++ .github/ISSUE_TEMPLATE/en-bug-report.yaml | 3 +++ 3 files changed, 10 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/cn-bug-report.yaml b/.github/ISSUE_TEMPLATE/cn-bug-report.yaml index 4cfc777a38..3fd1c71977 100644 --- a/.github/ISSUE_TEMPLATE/cn-bug-report.yaml +++ b/.github/ISSUE_TEMPLATE/cn-bug-report.yaml @@ -32,6 +32,9 @@ body: Resource Version: UI Version: Core Version: + 或 + Resource Version: + MAA Version: validations: required: true - type: textarea diff --git a/.github/ISSUE_TEMPLATE/cn-mumu-report.yaml b/.github/ISSUE_TEMPLATE/cn-mumu-report.yaml index 2c8f07235f..f8b30a5f33 100644 --- a/.github/ISSUE_TEMPLATE/cn-mumu-report.yaml +++ b/.github/ISSUE_TEMPLATE/cn-mumu-report.yaml @@ -38,6 +38,10 @@ body: UI Version: Core Version: MuMu 版本号: + 或 + Resource Version: + MAA Version: + MuMu 版本号: validations: required: true - type: textarea diff --git a/.github/ISSUE_TEMPLATE/en-bug-report.yaml b/.github/ISSUE_TEMPLATE/en-bug-report.yaml index ef26f71001..f3e5754e2d 100644 --- a/.github/ISSUE_TEMPLATE/en-bug-report.yaml +++ b/.github/ISSUE_TEMPLATE/en-bug-report.yaml @@ -45,6 +45,9 @@ body: Resource Version: UI Version: Core Version: + OR + Resource Version: + MAA Version: validations: required: true - type: textarea From 7b41ab511c30cf262d8d6ed961388e89e87188f1 Mon Sep 17 00:00:00 2001 From: uye <99072975+ABA2396@users.noreply.github.com> Date: Thu, 5 Sep 2024 20:23:39 +0800 Subject: [PATCH 09/16] =?UTF-8?q?chore:=20=E8=B0=83=E6=95=B4=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E5=8C=96=E5=AD=97=E7=AC=A6=E4=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MAA.sln.DotSettings | 1 + src/MaaWpfGui/Extensions/DateTimeExtension.cs | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/MAA.sln.DotSettings b/MAA.sln.DotSettings index 3e53fc188c..57ad328c91 100644 --- a/MAA.sln.DotSettings +++ b/MAA.sln.DotSettings @@ -52,6 +52,7 @@ True True True + True True True True diff --git a/src/MaaWpfGui/Extensions/DateTimeExtension.cs b/src/MaaWpfGui/Extensions/DateTimeExtension.cs index e7aae1728c..4e6497c44f 100644 --- a/src/MaaWpfGui/Extensions/DateTimeExtension.cs +++ b/src/MaaWpfGui/Extensions/DateTimeExtension.cs @@ -11,6 +11,7 @@ // but WITHOUT ANY WARRANTY // +#nullable enable using System; using System.Collections.Generic; using System.Globalization; @@ -25,7 +26,7 @@ namespace MaaWpfGui.Extensions private static string ClientType => ConfigurationHelper.GetValue(ConfigurationKeys.ClientType, string.Empty); - private static readonly Dictionary _clientTypeTimezone = new Dictionary + private static readonly Dictionary _clientTypeTimezone = new() { { string.Empty, 8 }, { "Official", 8 }, @@ -56,10 +57,9 @@ namespace MaaWpfGui.Extensions return dt is { Month: 4, Day: 1 }; } - public static string ToLocalTimeString(this DateTime dt) + public static string ToLocalTimeString(this DateTime dt, string? format = null, string? shortDatePattern = null, string? longTimePattern = "HH:mm:ss") { - var dateTimeFormat = CultureInfo.CurrentCulture.DateTimeFormat; - return dt.ToLocalTime().ToString(dateTimeFormat.ShortDatePattern + " HH:mm:ss"); + return dt.ToLocalTime().ToString(format ?? $"{shortDatePattern ?? CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern} {longTimePattern}", CultureInfo.CurrentCulture); } public static DateTime ToDateTime(this System.Runtime.InteropServices.ComTypes.FILETIME filetime) From ac05f73d5af6679a854c04a0755b831acaeec3ef Mon Sep 17 00:00:00 2001 From: status102 <102887808+status102@users.noreply.github.com> Date: Thu, 5 Sep 2024 20:59:31 +0800 Subject: [PATCH 10/16] fix: wrong var --- src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs index be2888b5fc..b8dcaacde6 100755 --- a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs @@ -3629,7 +3629,7 @@ namespace MaaWpfGui.ViewModels.UI /// public static string CoreVersion { get; } = Marshal.PtrToStringAnsi(MaaService.AsstGetVersion()) ?? "0.0.1"; - public static string CoreVersionDisplay => string.Join("\u200B", UiVersion.ToCharArray()); + public static string CoreVersionDisplay => string.Join("\u200B", CoreVersion.ToCharArray()); private static readonly string _uiVersion = Assembly.GetExecutingAssembly().GetCustomAttribute()?.InformationalVersion.Split('+')[0] ?? "0.0.1"; From 5608ea4fe6b087b86de40a6820d162b6e8cb4704 Mon Sep 17 00:00:00 2001 From: uye <99072975+ABA2396@users.noreply.github.com> Date: Thu, 5 Sep 2024 21:00:34 +0800 Subject: [PATCH 11/16] =?UTF-8?q?chore:=20=E6=B7=BB=E5=8A=A0=E7=BF=BB?= =?UTF-8?q?=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaWpfGui/Res/Localizations/en-us.xaml | 2 ++ src/MaaWpfGui/Res/Localizations/ja-jp.xaml | 2 ++ src/MaaWpfGui/Res/Localizations/ko-kr.xaml | 2 ++ src/MaaWpfGui/Res/Localizations/zh-cn.xaml | 2 ++ src/MaaWpfGui/Res/Localizations/zh-tw.xaml | 10 ++++++---- src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs | 2 +- .../UserControl/VersionUpdateSettingsUserControl.xaml | 7 ++++--- 7 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/MaaWpfGui/Res/Localizations/en-us.xaml b/src/MaaWpfGui/Res/Localizations/en-us.xaml index 0f63d71134..b78f7572ba 100644 --- a/src/MaaWpfGui/Res/Localizations/en-us.xaml +++ b/src/MaaWpfGui/Res/Localizations/en-us.xaml @@ -19,9 +19,11 @@ Update About us MAA Version + Build Date Core Version UI Version Resource Version + Resource Date Off Please note: The external notification feature currently only sends 「All tasks completed」 notifications. External notifications diff --git a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml index 5e780bdbe1..584bd19e83 100644 --- a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml +++ b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml @@ -19,9 +19,11 @@ アップデート設定 About us MAA バージョン + ビルド日付 Core バージョン UI バージョン リソースバーション + リソース日付 シャットダウン 注:外部通知機能は現在、「すべてのタスクが完了しました」という通知のみを送信します。 外部通知 diff --git a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml index b8fe9fe7d4..7006492666 100644 --- a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml +++ b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml @@ -19,9 +19,11 @@ 업데이트 정보 MAA 버전 + 빌드 날짜 Core 버전 UI 버전 Resource 버전 + 자원 날짜 끄기 팁: 외부 알림 기능은 현재 「모든 작업 완료」 알림만 보냅니다. 외부 알림 diff --git a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml index 1c1df169ae..1a98517265 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml @@ -19,9 +19,11 @@ 软件更新 关于我们 MAA 版本 + 构建日期 核心版本 界面版本 资源版本 + 资源日期 关闭 请注意:外部通知功能目前仅会发送“所有任务完成”的通知。 外部通知 diff --git a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml index fb4b14e9c6..fa3b852bb9 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml @@ -18,10 +18,12 @@ 熱鍵設定 軟體更新 關於我們 - MAA 版本號 - Core 版本號 - UI 版本號 - 資源版本號 + MAA 版本 + 構建日期 + Core 版本 + UI 版本 + 資源版本 + 資源日期 關閉 請注意:外部通知功能目前僅會發送「所有任務完成」 的通知。 外部通知 diff --git a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs index b8dcaacde6..ffe378de1e 100755 --- a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs @@ -3636,7 +3636,7 @@ namespace MaaWpfGui.ViewModels.UI /// /// Gets the UI version. /// - public static string UiVersion { get; } = _uiVersion == "0.0.1" ? "DEBUG VERSION" : _uiVersion; + public static string UiVersion { get; } = _uiVersion == "0.0.1" ? "v5.6.0-beta.2.d035.g773a5ceff" : _uiVersion; public static string UiVersionDisplay => string.Join("\u200B", UiVersion.ToCharArray()); diff --git a/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml b/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml index d3b8908294..8740ceb088 100644 --- a/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml +++ b/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml @@ -14,7 +14,6 @@ xmlns:viewModels="clr-namespace:MaaWpfGui.ViewModels" xmlns:vm="clr-namespace:MaaWpfGui" d:DataContext="{d:DesignInstance {x:Type ui:SettingsViewModel}}" - d:DesignHeight="300" d:DesignWidth="550" mc:Ignorable="d"> @@ -118,6 +117,7 @@ @@ -158,6 +158,7 @@ Visibility="{c:Binding 'UiVersion == CoreVersion'}"> Date: Thu, 5 Sep 2024 21:16:36 +0800 Subject: [PATCH 12/16] perf: UI --- .../UserControl/VersionUpdateSettingsUserControl.xaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml b/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml index 8740ceb088..e08ab280d6 100644 --- a/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml +++ b/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml @@ -124,8 +124,8 @@ - - + + @@ -242,8 +242,8 @@ - - + + From 18103f5701be3b8387c91d7bd1fdac63d8688f6e Mon Sep 17 00:00:00 2001 From: uye <99072975+ABA2396@users.noreply.github.com> Date: Thu, 5 Sep 2024 21:30:26 +0800 Subject: [PATCH 13/16] perf: UI --- src/MaaWpfGui/Res/Localizations/ja-jp.xaml | 2 +- .../ViewModels/UI/SettingsViewModel.cs | 2 +- .../VersionUpdateSettingsUserControl.xaml | 25 ++++++++----------- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml index 584bd19e83..105d7a1c98 100644 --- a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml +++ b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml @@ -222,7 +222,7 @@ 4. 内部テスト版の更新方法を非開発ユーザーに共有しないでください。不要な混乱とリスクを避けるためです。 設定 - About us - フィードバックのリンクをクリックして、このポップアップをキャンセルできます。ご理解とご協力をお願いいたします! - Update version + 更新バージョン aria2を使う アップデートを確認する 変更履歴 diff --git a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs index ffe378de1e..b8dcaacde6 100755 --- a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs @@ -3636,7 +3636,7 @@ namespace MaaWpfGui.ViewModels.UI /// /// Gets the UI version. /// - public static string UiVersion { get; } = _uiVersion == "0.0.1" ? "v5.6.0-beta.2.d035.g773a5ceff" : _uiVersion; + public static string UiVersion { get; } = _uiVersion == "0.0.1" ? "DEBUG VERSION" : _uiVersion; public static string UiVersionDisplay => string.Join("\u200B", UiVersion.ToCharArray()); diff --git a/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml b/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml index e08ab280d6..f9976b7dd0 100644 --- a/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml +++ b/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml @@ -25,7 +25,7 @@ TextAlignment="Center" /> - + @@ -59,19 +59,16 @@ VerticalAlignment="Center" Content="{DynamicResource AutoInstallUpdatePackage}" IsChecked="{Binding AutoInstallUpdatePackage}" /> - - - - + Date: Thu, 5 Sep 2024 22:27:22 +0800 Subject: [PATCH 14/16] =?UTF-8?q?feat:=20=E5=85=81=E8=AE=B8=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E6=97=B6=E9=97=B4=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaWpfGui/Constants/ConfigurationKeys.cs | 2 ++ src/MaaWpfGui/Extensions/DateTimeExtension.cs | 28 +++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/MaaWpfGui/Constants/ConfigurationKeys.cs b/src/MaaWpfGui/Constants/ConfigurationKeys.cs index e3163b7458..571632e2fa 100755 --- a/src/MaaWpfGui/Constants/ConfigurationKeys.cs +++ b/src/MaaWpfGui/Constants/ConfigurationKeys.cs @@ -52,6 +52,8 @@ namespace MaaWpfGui.Constants public const string Cheers = "GUI.Cheers"; public const string Hangover = "GUI.Hangover"; public const string LastBuyWineTime = "GUI.LastBuyWineTime"; + public const string DateTimeShortDatePattern = "GUI.DateTimeShortDatePattern"; + public const string DateTimeLongTimePattern = "GUI.DateTimeLongTimePattern"; public const string AddressHistory = "Connect.AddressHistory"; public const string AutoDetect = "Connect.AutoDetect"; diff --git a/src/MaaWpfGui/Extensions/DateTimeExtension.cs b/src/MaaWpfGui/Extensions/DateTimeExtension.cs index 4e6497c44f..e6f4c636e0 100644 --- a/src/MaaWpfGui/Extensions/DateTimeExtension.cs +++ b/src/MaaWpfGui/Extensions/DateTimeExtension.cs @@ -57,9 +57,33 @@ namespace MaaWpfGui.Extensions return dt is { Month: 4, Day: 1 }; } - public static string ToLocalTimeString(this DateTime dt, string? format = null, string? shortDatePattern = null, string? longTimePattern = "HH:mm:ss") + public static string DateTimeShortDatePattern => ConfigurationHelper.GetGlobalValue(ConfigurationKeys.DateTimeShortDatePattern, string.Empty); + + public static string DateTimeLongTimePattern => ConfigurationHelper.GetGlobalValue(ConfigurationKeys.DateTimeLongTimePattern, string.Empty); + + public static string ToLocalTimeString(this DateTime dt, string? format = null, string? shortDatePattern = null, string? longTimePattern = null) { - return dt.ToLocalTime().ToString(format ?? $"{shortDatePattern ?? CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern} {longTimePattern}", CultureInfo.CurrentCulture); + if (!string.IsNullOrEmpty(format)) + { + return dt.ToLocalTime().ToString(format, CultureInfo.CurrentCulture); + } + + if (string.IsNullOrEmpty(shortDatePattern)) + { + shortDatePattern = !string.IsNullOrEmpty(DateTimeShortDatePattern) + ? DateTimeShortDatePattern + : CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern; + } + + if (string.IsNullOrEmpty(longTimePattern)) + { + longTimePattern = !string.IsNullOrEmpty(DateTimeLongTimePattern) + ? DateTimeLongTimePattern + : "HH:mm:ss"; + } + + format = $"{shortDatePattern} {longTimePattern}"; + return dt.ToLocalTime().ToString(format, CultureInfo.CurrentCulture); } public static DateTime ToDateTime(this System.Runtime.InteropServices.ComTypes.FILETIME filetime) From c3793e9e8cb06782661aff29f050a0e31ed3acab Mon Sep 17 00:00:00 2001 From: uye <99072975+ABA2396@users.noreply.github.com> Date: Thu, 5 Sep 2024 22:55:52 +0800 Subject: [PATCH 15/16] =?UTF-8?q?chore:=20=E4=BF=AE=E6=94=B9=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E5=8C=96=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaWpfGui/Constants/ConfigurationKeys.cs | 3 +- src/MaaWpfGui/Extensions/DateTimeExtension.cs | 40 +++++++++---------- 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/src/MaaWpfGui/Constants/ConfigurationKeys.cs b/src/MaaWpfGui/Constants/ConfigurationKeys.cs index 571632e2fa..a44df19c86 100755 --- a/src/MaaWpfGui/Constants/ConfigurationKeys.cs +++ b/src/MaaWpfGui/Constants/ConfigurationKeys.cs @@ -52,8 +52,7 @@ namespace MaaWpfGui.Constants public const string Cheers = "GUI.Cheers"; public const string Hangover = "GUI.Hangover"; public const string LastBuyWineTime = "GUI.LastBuyWineTime"; - public const string DateTimeShortDatePattern = "GUI.DateTimeShortDatePattern"; - public const string DateTimeLongTimePattern = "GUI.DateTimeLongTimePattern"; + public const string CustomCulture = "GUI.CustomCulture"; public const string AddressHistory = "Connect.AddressHistory"; public const string AutoDetect = "Connect.AutoDetect"; diff --git a/src/MaaWpfGui/Extensions/DateTimeExtension.cs b/src/MaaWpfGui/Extensions/DateTimeExtension.cs index e6f4c636e0..7f76406887 100644 --- a/src/MaaWpfGui/Extensions/DateTimeExtension.cs +++ b/src/MaaWpfGui/Extensions/DateTimeExtension.cs @@ -15,6 +15,7 @@ using System; using System.Collections.Generic; using System.Globalization; +using System.Linq; using MaaWpfGui.Constants; using MaaWpfGui.Helper; @@ -57,33 +58,28 @@ namespace MaaWpfGui.Extensions return dt is { Month: 4, Day: 1 }; } - public static string DateTimeShortDatePattern => ConfigurationHelper.GetGlobalValue(ConfigurationKeys.DateTimeShortDatePattern, string.Empty); - - public static string DateTimeLongTimePattern => ConfigurationHelper.GetGlobalValue(ConfigurationKeys.DateTimeLongTimePattern, string.Empty); - - public static string ToLocalTimeString(this DateTime dt, string? format = null, string? shortDatePattern = null, string? longTimePattern = null) + public static CultureInfo CustomCulture { - if (!string.IsNullOrEmpty(format)) + get { - return dt.ToLocalTime().ToString(format, CultureInfo.CurrentCulture); - } + string cultureName = ConfigurationHelper.GetGlobalValue(ConfigurationKeys.CustomCulture, string.Empty); + if (string.IsNullOrEmpty(cultureName)) + { + return CultureInfo.CurrentCulture; + } - if (string.IsNullOrEmpty(shortDatePattern)) - { - shortDatePattern = !string.IsNullOrEmpty(DateTimeShortDatePattern) - ? DateTimeShortDatePattern - : CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern; + return CultureInfo.GetCultures(CultureTypes.AllCultures) + .Any(c => c.Name.Equals(cultureName, StringComparison.OrdinalIgnoreCase)) + ? new CultureInfo(cultureName) + : CultureInfo.CurrentCulture; } + } - if (string.IsNullOrEmpty(longTimePattern)) - { - longTimePattern = !string.IsNullOrEmpty(DateTimeLongTimePattern) - ? DateTimeLongTimePattern - : "HH:mm:ss"; - } - - format = $"{shortDatePattern} {longTimePattern}"; - return dt.ToLocalTime().ToString(format, CultureInfo.CurrentCulture); + public static string ToLocalTimeString(this DateTime dt, string? format = null) + { + return string.IsNullOrEmpty(format) + ? dt.ToLocalTime().ToString(CustomCulture) + : dt.ToLocalTime().ToString(format, CustomCulture); } public static DateTime ToDateTime(this System.Runtime.InteropServices.ComTypes.FILETIME filetime) From 4f9c98eb7a37dda841d3e7c98385b7a8a66329fb Mon Sep 17 00:00:00 2001 From: uye <99072975+ABA2396@users.noreply.github.com> Date: Fri, 6 Sep 2024 00:04:19 +0800 Subject: [PATCH 16/16] =?UTF-8?q?chore:=20=E9=82=AA=E9=81=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaWpfGui/Extensions/DateTimeExtension.cs | 21 +++--------------- src/MaaWpfGui/Helper/LocalizationHelper.cs | 22 ++++++++++++++++++- .../ViewModels/UI/SettingsViewModel.cs | 7 +++--- 3 files changed, 28 insertions(+), 22 deletions(-) diff --git a/src/MaaWpfGui/Extensions/DateTimeExtension.cs b/src/MaaWpfGui/Extensions/DateTimeExtension.cs index 7f76406887..c8a7dfea88 100644 --- a/src/MaaWpfGui/Extensions/DateTimeExtension.cs +++ b/src/MaaWpfGui/Extensions/DateTimeExtension.cs @@ -58,28 +58,13 @@ namespace MaaWpfGui.Extensions return dt is { Month: 4, Day: 1 }; } - public static CultureInfo CustomCulture - { - get - { - string cultureName = ConfigurationHelper.GetGlobalValue(ConfigurationKeys.CustomCulture, string.Empty); - if (string.IsNullOrEmpty(cultureName)) - { - return CultureInfo.CurrentCulture; - } - - return CultureInfo.GetCultures(CultureTypes.AllCultures) - .Any(c => c.Name.Equals(cultureName, StringComparison.OrdinalIgnoreCase)) - ? new CultureInfo(cultureName) - : CultureInfo.CurrentCulture; - } - } + public static CultureInfo CustomCultureInfo => LocalizationHelper.CustomCultureInfo; public static string ToLocalTimeString(this DateTime dt, string? format = null) { return string.IsNullOrEmpty(format) - ? dt.ToLocalTime().ToString(CustomCulture) - : dt.ToLocalTime().ToString(format, CustomCulture); + ? dt.ToLocalTime().ToString($"{CustomCultureInfo.DateTimeFormat.ShortDatePattern} HH:mm:ss", CustomCultureInfo) + : dt.ToLocalTime().ToString(format, CustomCultureInfo); } public static DateTime ToDateTime(this System.Runtime.InteropServices.ComTypes.FILETIME filetime) diff --git a/src/MaaWpfGui/Helper/LocalizationHelper.cs b/src/MaaWpfGui/Helper/LocalizationHelper.cs index 123236e122..9a0fd1bc1a 100644 --- a/src/MaaWpfGui/Helper/LocalizationHelper.cs +++ b/src/MaaWpfGui/Helper/LocalizationHelper.cs @@ -70,6 +70,24 @@ namespace MaaWpfGui.Helper private static readonly string _culture = ConfigurationHelper.GetValue(ConfigurationKeys.Localization, DefaultLanguage); + private static readonly string _customCulture = ConfigurationHelper.GetGlobalValue(ConfigurationKeys.CustomCulture, string.Empty); + + public static CultureInfo CustomCultureInfo + { + get + { + if (string.IsNullOrEmpty(_customCulture)) + { + return CultureInfo.CurrentCulture; + } + + return CultureInfo.GetCultures(CultureTypes.AllCultures) + .Any(c => c.Name.Equals(_customCulture, StringComparison.OrdinalIgnoreCase)) + ? new CultureInfo(_customCulture) + : CultureInfo.CurrentCulture; + } + } + /// /// Loads localizations. /// @@ -114,7 +132,9 @@ namespace MaaWpfGui.Helper try { - Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo(_culture); + Thread.CurrentThread.CurrentCulture = !string.IsNullOrEmpty(_customCulture) + ? CustomCultureInfo + : CultureInfo.GetCultureInfo(_culture); FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(Thread.CurrentThread.CurrentCulture.Name))); } catch diff --git a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs index b8dcaacde6..39de7e4b3e 100755 --- a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs @@ -4632,10 +4632,11 @@ namespace MaaWpfGui.ViewModels.UI } string resourceVersion = !string.IsNullOrEmpty(ResourceVersion) - ? LocalizationHelper.DefaultLanguage switch + ? LocalizationHelper.CustomCultureInfo.Name.ToLowerInvariant() switch { - "en-us" => $" - {ResourceDateTime:dd/MM} {ResourceVersion}", - _ => $" - {ResourceVersion}{ResourceDateTime:#MMdd}", + "zh-cn" => $" - {ResourceVersion}{ResourceDateTime:#MMdd}", + "zh-tw" => $" - {ResourceVersion}{ResourceDateTime:#MMdd}", + _ => $" - {ResourceDateTime.ToString(LocalizationHelper.CustomCultureInfo.DateTimeFormat.ShortDatePattern.Replace("yyyy", string.Empty).Trim('/', '.'))} {ResourceVersion}", } : string.Empty; rvm.WindowTitle = $"{prefix}MAA{currentConfiguration} - {CoreVersion}{resourceVersion}{connectConfigName}{connectAddress}{clientName}";