From 6f99b218a02ba3de6bf23c208c60ed8aa145ad2f Mon Sep 17 00:00:00 2001 From: BoiHanny <114599052+BoiHanny@users.noreply.github.com> Date: Thu, 2 May 2024 00:40:52 +0200 Subject: [PATCH 1/2] `Enhanced exception handling and logging mechanisms` ` ` `Modified the `CurrentDomain_UnhandledException` method to include a try-catch block for logging exceptions, preventing potential crashes during the logging process. Added a new method `App_DispatcherUnhandledException` to handle and log exceptions thrown by the application's dispatcher, displaying a message box and exiting the application upon occurrence.` --- vrcosc-magicchatbox/App.xaml.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/vrcosc-magicchatbox/App.xaml.cs b/vrcosc-magicchatbox/App.xaml.cs index ae9c93c8..137d35f3 100644 --- a/vrcosc-magicchatbox/App.xaml.cs +++ b/vrcosc-magicchatbox/App.xaml.cs @@ -120,6 +120,8 @@ void CurrentDomain_FirstChanceException(object? sender, FirstChanceExceptionEven Logging.WriteInfo(e.Exception.Message + Environment.NewLine + e.Exception.StackTrace); } + + private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { Logging.WriteException(e.Exception, MSGBox: true, exitapp:true); @@ -127,7 +129,14 @@ private void App_DispatcherUnhandledException(object sender, System.Windows.Thre private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { - Logging.WriteException(ex: e.ExceptionObject as Exception, MSGBox: true, exitapp: true); + try + { + Logging.WriteException(e.ExceptionObject as Exception, MSGBox: true, exitapp: true); + } + catch (Exception ex) + { + Logging.ShowMSGBox("Fatal error in AppDomain.CurrentDomain_UnhandledException. The application will now exit.", "Fatal Error", Logging.MsgBoxType.Error); + } } } } From dd1e0ff6c72aac13f06b2d7879641a4fdfd2ac76 Mon Sep 17 00:00:00 2001 From: BoiHanny <114599052+BoiHanny@users.noreply.github.com> Date: Fri, 31 May 2024 13:58:04 +0200 Subject: [PATCH 2/2] Update time separator in smallNumbersContent string The commit updates the formatting of the `smallNumbersContent` string in the `OSCController.cs` file, under the `vrcosc_magicchatbox.Classes.DataAndSecurity` namespace. The change involves replacing the colon (":") that separated `currentTime` and `fullTime` values with a vertical bar ("l"). This alteration affects the visual representation of the time span in the `smallNumbersContent` string, but does not impact the functionality of the code. --- vrcosc-magicchatbox/Classes/DataAndSecurity/OSCController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vrcosc-magicchatbox/Classes/DataAndSecurity/OSCController.cs b/vrcosc-magicchatbox/Classes/DataAndSecurity/OSCController.cs index d440703c..de12c196 100644 --- a/vrcosc-magicchatbox/Classes/DataAndSecurity/OSCController.cs +++ b/vrcosc-magicchatbox/Classes/DataAndSecurity/OSCController.cs @@ -204,7 +204,7 @@ private static string CreateTimeStamp(string x, MediaSessionInfo mediaSession, M break; case MediaLinkTimeSeekbar.SmallNumbers: - string smallNumbersContent = $"{DataController.TransformToSuperscript(FormatTimeSpan(currentTime) + " : " + FormatTimeSpan(fullTime))}"; + string smallNumbersContent = $"{DataController.TransformToSuperscript(FormatTimeSpan(currentTime) + " l " + FormatTimeSpan(fullTime))}"; if (CalculateOSCMsgLength(uncomplete, x + smallNumbersContent) <= 140) { return x + " " + smallNumbersContent;