From 878a5e924950c5d1f73d655180e6df10a798fd3b Mon Sep 17 00:00:00 2001 From: "Juster.zhu" Date: Sat, 4 Nov 2023 21:11:36 +0800 Subject: [PATCH] Fix typos --- .../GeneralClientBootstrap.cs | 6 +- .../Testament/GeneralTestamentProvider.cs | 63 ------------------- 2 files changed, 3 insertions(+), 66 deletions(-) delete mode 100644 src/c#/GeneralUpdate.Core/Testament/GeneralTestamentProvider.cs diff --git a/src/c#/GeneralUpdate.ClientCore/GeneralClientBootstrap.cs b/src/c#/GeneralUpdate.ClientCore/GeneralClientBootstrap.cs index e5b10b0d..b7c690e6 100644 --- a/src/c#/GeneralUpdate.ClientCore/GeneralClientBootstrap.cs +++ b/src/c#/GeneralUpdate.ClientCore/GeneralClientBootstrap.cs @@ -85,10 +85,10 @@ public GeneralClientBootstrap Config(string url, string appSecretKey, string app Packet.AppSecretKey = appSecretKey; //update app. Packet.AppName = appName; - string clienVersion = GetFileVersion(Path.Combine(basePath, $"{Packet.AppName}.exe")); - Packet.ClientVersion = clienVersion; + string clientVersion = GetFileVersion(Path.Combine(basePath, $"{Packet.AppName}.exe")); + Packet.ClientVersion = clientVersion; Packet.AppType = AppType.ClientApp; - Packet.UpdateUrl = $"{url}/versions/{AppType.ClientApp}/{clienVersion}/{Packet.AppSecretKey}"; + Packet.UpdateUrl = $"{url}/versions/{AppType.ClientApp}/{clientVersion}/{Packet.AppSecretKey}"; //main app. string mainAppName = Path.GetFileNameWithoutExtension(Process.GetCurrentProcess().MainModule.FileName); string mainVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(); diff --git a/src/c#/GeneralUpdate.Core/Testament/GeneralTestamentProvider.cs b/src/c#/GeneralUpdate.Core/Testament/GeneralTestamentProvider.cs deleted file mode 100644 index 2050f384..00000000 --- a/src/c#/GeneralUpdate.Core/Testament/GeneralTestamentProvider.cs +++ /dev/null @@ -1,63 +0,0 @@ -using GeneralUpdate.Core.Domain.PO; -using System; -using System.IO; -using GeneralUpdate.Core.Utils; -using System.Diagnostics; -using Microsoft.Diagnostics.NETCore.Client; -using System.Threading.Tasks; -using System.Collections.Generic; - -namespace GeneralUpdate.Core.Testament -{ - public sealed class GeneralTestamentProvider - { - private const string TESTAMENT_FILE = "testament.json"; - private const string DUMP_FILE = "generaldump.dmp"; - private string _testamentPath, _dumpPath; - private string _url; - - public GeneralTestamentProvider(string url, string path) - { - _url = url; - _testamentPath = Path.Combine(path, TESTAMENT_FILE); - _dumpPath = Path.Combine(path, DUMP_FILE); - } - - /// - /// Generate the contents of the last word, read the last word when the next program starts for backup restoration or re-update. - /// - /// - public void Build(TestamentPO testament) - { - if (testament == null) return; - - Task.Run(async () => - { - FileUtil.CreateJsonFile(_testamentPath, TESTAMENT_FILE, testament); - CreateDump(); - var parameters = new Dictionary - { - { "TrackID", testament.TrackID }, - { "Exception", testament.Exception.ToString() } - }; - await HttpUtil.PostFileTaskAsync(_url, parameters, _dumpPath); - }); - } - - /// - /// Export the dump file of the current application when an unknown exception occurs. - /// - private void CreateDump() { - try - { - var currentProcess = Process.GetCurrentProcess(); - var client = new DiagnosticsClient(currentProcess.Id); - client.WriteDump(DumpType.Full, _dumpPath); - } - catch (Exception ex) - { - Console.WriteLine($"[ERROR] Could not create dump: {ex.Message}"); - } - } - } -}