static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { if (primaryForm != null) { Exception ex = (Exception)e.ExceptionObject; string log = "Texture Editor: New log entry on " + DateTime.Now.ToString("G") + System.Environment.NewLine + "Build date:" + File.GetLastWriteTime(Application.ExecutablePath).ToString(System.Globalization.CultureInfo.InvariantCulture) + System.Environment.NewLine + ex.ToString(); string errDesc = "Texture Editor has crashed with the following error:\n" + ex.GetType().Name + ".\n\n" + "If you wish to report a bug, please include the following in your report:"; SAModel.SAEditorCommon.ErrorDialog report = new SAModel.SAEditorCommon.ErrorDialog("Texture Editor", errDesc, log); DialogResult dgresult = report.ShowDialog(primaryForm); switch (dgresult) { case DialogResult.Abort: case DialogResult.OK: Application.Exit(); break; } } else { string logPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "SA Tools", "TextureEditor.log"); if (!Directory.Exists(Path.GetDirectoryName(logPath))) { Directory.CreateDirectory(Path.GetDirectoryName(logPath)); } File.WriteAllText(logPath, e.ExceptionObject.ToString()); MessageBox.Show("Unhandled Exception " + e.ExceptionObject.GetType().Name + "\nLog file has been saved to:\n" + logPath + ".", "Texture Editor Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { if (mainForm != null) { Exception ex = (Exception)e.ExceptionObject; string errDesc = "SA Tools Hub has crashed with the following error:\n" + ex.GetType().Name + ".\n\n" + "If you wish to report a bug, please include the following in your report:"; SAModel.SAEditorCommon.ErrorDialog report = new SAModel.SAEditorCommon.ErrorDialog("SA Tools Hub", errDesc, ex.ToString()); DialogResult dgresult = report.ShowDialog(mainForm); switch (dgresult) { case DialogResult.Abort: case DialogResult.OK: Application.Exit(); break; } } else { string logPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "SA Tools", "SAToolsHub.log"); if (!Directory.Exists(Path.GetDirectoryName(logPath))) { Directory.CreateDirectory(Path.GetDirectoryName(logPath)); } File.WriteAllText(logPath, e.ExceptionObject.ToString()); MessageBox.Show("Unhandled Exception " + e.ExceptionObject.GetType().Name + "\nLog file has been saved to:\n" + logPath + ".", "SA Tools Hub Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void bugReportToolStripMenuItem_Click(object sender, EventArgs e) { string errDesc = "You can submit a new issue on SA Tools GitHub issue tracker.\n\nPlease make sure the problem is reproducible on the latest version of SA Tools.\n\nIf you wish to report a bug, please include the following in your report:"; SAModel.SAEditorCommon.ErrorDialog report = new SAModel.SAEditorCommon.ErrorDialog("SADXTweaker2", errDesc, null); DialogResult dgresult = report.ShowDialog(); switch (dgresult) { case DialogResult.Abort: case DialogResult.OK: Application.Exit(); break; } }
public static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) { string errDesc = "VMS Editor has crashed with the following error:\n" + e.Exception.GetType().Name + ".\n\n" + "If you wish to report a bug, please include the following in your report:"; SAModel.SAEditorCommon.ErrorDialog report = new SAModel.SAEditorCommon.ErrorDialog("VMS Editor", errDesc, e.Exception.ToString()); DialogResult dgresult = report.ShowDialog(); switch (dgresult) { case DialogResult.Abort: case DialogResult.OK: Application.Exit(); break; } }