public static void CloseApp() { TeraSniffer.Instance.Enabled = false; WindowManager.Dispose(); SaveSettings(); Environment.Exit(0); }
public static void HandleGlobalException(object sender, UnhandledExceptionEventArgs e) { var ex = (Exception)e.ExceptionObject; DumpCrashToFile(ex); //#if !DEBUG try { new Thread(() => UploadCrashDump(ex)).Start(); } catch { /*ignored*/ } //#endif TccMessageBox.Show("TCC", "An error occured and TCC will now close. Report this issue to the developer attaching crash.log from TCC folder.", MessageBoxButton.OK, MessageBoxImage.Error); App.ReleaseMutex(); ProxyInterface.Instance.Disconnect(); if (WindowManager.TrayIcon != null) { WindowManager.TrayIcon.Dispose(); } try { WindowManager.Dispose(); } catch { /* ignored*/ } try { Firebase.RegisterWebhook(SettingsHolder.WebhookUrlGuildBam, false); Firebase.RegisterWebhook(SettingsHolder.WebhookUrlFieldBoss, false); } catch { } Environment.Exit(-1); }
public static void CloseApp() { TeraSniffer.Instance.Enabled = false; SettingsManager.SaveSettings(); WindowManager.Dispose(); Proxy.CloseConnection(); Environment.Exit(0); }
public static void Close() { BaseDispatcher.Invoke(ReleaseMutex); TeraSniffer.Instance.Enabled = false; SettingsWriter.Save(); WindowManager.Dispose(); ProxyInterface.Instance.Disconnect(); //ProxyOld.CloseConnection(); UpdateManager.StopTimer(); Environment.Exit(0); }
private static void GlobalUnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs e) { var ex = (Exception)e.ExceptionObject; var sb = new StringBuilder("\r\n\r\n"); sb.AppendLine($"##### {AppVersion} - {DateTime.Now:dd/MM/yyyy HH:mm:ss} #####"); sb.Append($"Version: {PacketAnalyzer.Factory.Version}"); if (SessionManager.Server != null) { sb.Append($" - Region: {SessionManager.Server.Region}"); sb.Append($" - Server:{SessionManager.Server.ServerId}"); } sb.AppendLine(); sb.AppendLine($"{ex.Message}"); sb.AppendLine($"{ex.StackTrace}"); sb.AppendLine($"Source: {ex.Source}"); sb.AppendLine($"Data: {ex.Data}"); if (ex.InnerException != null) { sb.AppendLine($"InnerException: \n{ex.InnerException}"); } sb.AppendLine($"TargetSite: {ex.TargetSite}"); File.AppendAllText(Path.GetDirectoryName(typeof(App).Assembly.Location) + "/crash.log", sb.ToString()); try { var t = new Thread(() => UploadCrashDump(e)); t.Start(); } catch (Exception) { // ignored } TccMessageBox.Show("TCC", "An error occured and TCC will now close. Report this issue to the developer attaching crash.log from TCC folder.", MessageBoxButton.OK, MessageBoxImage.Error); if (Proxy.Proxy.IsConnected) { Proxy.Proxy.CloseConnection(); } if (WindowManager.TrayIcon != null) { WindowManager.TrayIcon.Dispose(); } try { WindowManager.Dispose(); } catch { /* ignored*/ } Environment.Exit(-1); }
private static void HandleGlobalExceptionImpl(UnhandledExceptionEventArgs e) { var ex = (Exception)e.ExceptionObject; var js = BuildJsonDump(ex); //await App.BaseDispatcher.InvokeAsync(() => BuildJsonDump(ex)); DumpCrashToFile(js, ex); switch (ex) { case COMException com when(com.HResult == 88980406 || com.Message.Contains("UCEERR_RENDERTHREADFAILURE")): { TccMessageBox.Show("TCC", SR.RenderThreadError, MessageBoxButton.OK, MessageBoxImage.Error); break; } case ClientVersionDetectionException cvde: { Log.F($"Failed to detect client version from file: {cvde}"); TccMessageBox.Show(SR.CannotDetectClientVersion(StubInterface.Instance.IsStubAvailable), MessageBoxType.Error); break; } case Win32Exception w32ex when _excludedWin32codes.Contains(w32ex.NativeErrorCode): { Log.F(w32ex.ToString()); TccMessageBox.Show("TCC", SR.FatalError, MessageBoxButton.OK, MessageBoxImage.Error); break; } default: { UploadCrashDump(js); TccMessageBox.Show("TCC", SR.FatalError, MessageBoxButton.OK, MessageBoxImage.Error); break; } } StubInterface.Instance.Disconnect(); Firebase.Dispose(); if (!(ex is DeadlockException)) { // These actions require main thread to be alive App.ReleaseMutex(); if (WindowManager.TrayIcon != null) { WindowManager.TrayIcon.Dispose(); } try { WindowManager.Dispose(); } catch { /* ignored*/ } } Environment.Exit(-1); }
public static void Close(bool releaseMutex = true, int code = 0) { _running = false; PacketAnalyzer.Sniffer.Enabled = false; Settings?.Save(); WindowManager.Dispose(); StubInterface.Instance.Disconnect(); Firebase.Dispose(); UpdateManager.StopTimer(); if (releaseMutex) { BaseDispatcher.Invoke(ReleaseMutex); } Environment.Exit(code); }
private static void GlobalUnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs e) { var ex = (Exception)e.ExceptionObject; File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + "/error.txt", "##### CRASH #####\r\n" + ex.Message + "\r\n" + ex.StackTrace + "\r\n" + ex.Source + "\r\n" + ex + "\r\n" + ex.Data + "\r\n" + ex.InnerException + "\r\n" + ex.TargetSite); try { var t = new Thread(() => UploadCrashDump(e)); t.Start(); } catch (Exception) { // ignored } TccMessageBox.Show("TCC", "An error occured and TCC will now close. Check error.txt for more info.", MessageBoxButton.OK, MessageBoxImage.Error); if (Proxy.IsConnected) { Proxy.CloseConnection(); } if (WindowManager.TrayIcon != null) { WindowManager.TrayIcon.Dispose(); } try { WindowManager.Dispose(); } catch { /* ignored*/ } Environment.Exit(-1); }