From 48a4efbaa25abef2f582ce51f0a2c14e3d55dfde Mon Sep 17 00:00:00 2001 From: hhhxiao <1417599491@qq.com> Date: Mon, 22 Jul 2024 21:32:29 +0800 Subject: [PATCH] Optimize feedback workflow --- MainWindow.xaml.cs | 26 +++++++++++++++++++++----- core/Translator.cs | 4 +++- core/Utils.cs | 18 ++++++++++++++++++ 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index ae3b5ee..13309a9 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -8,7 +8,6 @@ using MessageBoxImage = AdonisUI.Controls.MessageBoxImage; using System.Diagnostics; using System.Windows.Navigation; -using Org.BouncyCastle.Bcpg.Sig; using NLog.Targets; namespace SoulsModTranslator @@ -20,7 +19,7 @@ public partial class MainWindow : AdonisWindow { private static readonly string DbPath = Path.Combine(Directory.GetCurrentDirectory(), "db"); private static readonly string GlossaryPath = Path.Combine(Directory.GetCurrentDirectory(), "glossaries"); - private static readonly string SoftwareName = "魂游MOD翻译工具 v2.7"; + private static readonly string SoftwareName = "魂游MOD翻译工具 v2.8"; private static MemoryTarget MemoryTarget = new MemoryTarget { @@ -30,8 +29,6 @@ public partial class MainWindow : AdonisWindow private static void ShowTaskResult(bool success, string succMsg, string failMsg) { - // var caption = success ? "提示" : "错误"; - // var icon = success ? MessageBoxImage.Information : MessageBoxImage.Error; if (success) { AdonisUI.Controls.MessageBox.Show(success ? succMsg : failMsg, "提示", @@ -53,7 +50,25 @@ private static void ShowTaskResult(bool success, string succMsg, string failMsg) AdonisUI.Controls.MessageBoxButtons.Custom("关闭", "close"), }, }; - AdonisUI.Controls.MessageBox.Show(messageBox); + var result = AdonisUI.Controls.MessageBox.Show(messageBox); + if (messageBox.Result == AdonisUI.Controls.MessageBoxResult.Custom) + { + var prompt = "[请在这里礼貌且清晰地描述你遇到的问题。] 以下是错误消息和日志。\n"; + var text = "错误消息: " + failMsg + "\n日志:\n" + log; + if (messageBox.ButtonPressed.Id.ToString() == "github") + { + System.Windows.Clipboard.SetText(prompt + "```\n" + text + "\n```"); + Utils.OpenURL("https://github.com/hhhxiao/SoulsModTranslator/issues/new"); + } + else if (messageBox.ButtonPressed.Id.ToString() == "bilibili") + { + + System.Windows.Clipboard.SetText(prompt + text); + Utils.OpenURL("https://www.bilibili.com/video/BV17p421Q7qJ/"); + } + } + + MemoryTarget.Logs.Clear(); } private static List LoadDbFiles() @@ -105,6 +120,7 @@ public MainWindow() Logger.Info("\n\n===========================New Instance==================================="); CreateArrayLogger(); + Logger.Info(SoftwareName); InitializeComponent(); // Glossaries = new ObservableCollection(); diff --git a/core/Translator.cs b/core/Translator.cs index 3d0f231..e2317df 100644 --- a/core/Translator.cs +++ b/core/Translator.cs @@ -136,7 +136,9 @@ private static Action CreateTraverser(DB db, Action