From 892cd408959cfe8fc1de6d4ad8e8109b3fa14e79 Mon Sep 17 00:00:00 2001 From: WeeXnes Date: Thu, 8 Jun 2023 16:55:41 +0200 Subject: [PATCH] added exception handler/dumper --- WeeXnes/App.xaml.cs | 15 +++++++++++++++ WeeXnes/Core/Global.cs | 2 +- WeeXnes/WeeXnes.csproj | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/WeeXnes/App.xaml.cs b/WeeXnes/App.xaml.cs index cf4f9e9..f9095c1 100644 --- a/WeeXnes/App.xaml.cs +++ b/WeeXnes/App.xaml.cs @@ -17,9 +17,24 @@ namespace WeeXnes /// public partial class App { + private void SetExceptionHandler() + { + AppDomain currentDomain = default(AppDomain); + currentDomain = AppDomain.CurrentDomain; + currentDomain.UnhandledException += GlobalUnhandledExceptionHandler; + } + private static void GlobalUnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs e) + { + Exception ex = (Exception)e.ExceptionObject; + using (StreamWriter writer = new StreamWriter("error_log.txt")) + { + writer.WriteLine(ex.ToString()); + } + } private void App_OnStartup(object sender, StartupEventArgs e) { Environment.CurrentDirectory = Application.StartupPath; + SetExceptionHandler(); CheckForDebugMode(); CheckUpdatedFiles(); CheckForFolder(); diff --git a/WeeXnes/Core/Global.cs b/WeeXnes/Core/Global.cs index 0bc0467..dae1799 100644 --- a/WeeXnes/Core/Global.cs +++ b/WeeXnes/Core/Global.cs @@ -8,7 +8,7 @@ namespace WeeXnes.Core { public class Information { - public const string Version = "4.3.1"; + public const string Version = "4.3.2"; public const string EncryptionHash = "8zf5#RdyQ]$4x4_"; public const string ApiUrl = "https://api.github.com/repos/weexnes/weexnessuite/releases/latest"; } diff --git a/WeeXnes/WeeXnes.csproj b/WeeXnes/WeeXnes.csproj index 021d188..db500fa 100644 --- a/WeeXnes/WeeXnes.csproj +++ b/WeeXnes/WeeXnes.csproj @@ -4,7 +4,7 @@ Debug AnyCPU - 4.3.1 + 4.3.2 {4B33CEE7-C74D-43B9-B99A-8B273D5195BC} WinExe WeeXnes