Beispiel #1
0
 static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     if (primaryForm != null)
     {
         Exception ex      = (Exception)e.ExceptionObject;
         string    errDesc = "SALVL 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:";
         SAEditorCommon.ErrorDialog report = new SAEditorCommon.ErrorDialog("SALVL", errDesc, ex.ToString());
         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", "SALVL.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 + ".", "SALVL Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Beispiel #2
0
 static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     if (primaryForm != null)
     {
         Exception ex      = (Exception)e.ExceptionObject;
         string    errDesc = "SAMDL 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:";
         SAEditorCommon.ErrorDialog report = new SAEditorCommon.ErrorDialog("SAMDL", errDesc, ex.ToString());
         DialogResult dgresult             = report.ShowDialog(primaryForm);
         switch (dgresult)
         {
         case DialogResult.Abort:
         case DialogResult.OK:
             Application.Exit();
             break;
         }
     }
     else
     {
         string logPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\SAMDL.log";
         System.IO.File.WriteAllText(logPath, e.ExceptionObject.ToString());
         MessageBox.Show("Unhandled Exception " + e.ExceptionObject.GetType().Name + "\nLog file has been saved to:\n" + logPath + ".", "SAMDL Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }