mirror of
https://github.com/AdAstra-LD/DS-Pokemon-Rom-Editor.git
synced 2026-05-18 18:44:09 -05:00
Merge pull request #37 from Mixone-FinallyHere/dev-kuha
optimized crash report & remove calls to windows report handler
This commit is contained in:
commit
6de292e2de
|
|
@ -24,23 +24,7 @@ namespace DSPRE
|
|||
|
||||
private static void HandleUnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
var exception = e.ExceptionObject as Exception;
|
||||
|
||||
string crashReport = BuildCrashReport(exception);
|
||||
string filePath = GetCrashReportFilePath();
|
||||
|
||||
try
|
||||
{
|
||||
File.WriteAllText(filePath, crashReport, Encoding.UTF8);
|
||||
}
|
||||
catch
|
||||
{
|
||||
try
|
||||
{
|
||||
EventLog.WriteEntry("Application", crashReport, EventLogEntryType.Error);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
WriteCrashReport(e.ExceptionObject as Exception);
|
||||
}
|
||||
|
||||
private static void HandleThreadException(object sender, ThreadExceptionEventArgs e)
|
||||
|
|
@ -65,34 +49,22 @@ namespace DSPRE
|
|||
}
|
||||
catch
|
||||
{
|
||||
try
|
||||
{
|
||||
EventLog.WriteEntry("Application", crashReport, EventLogEntryType.Error);
|
||||
}
|
||||
catch { }
|
||||
|
||||
}
|
||||
|
||||
try
|
||||
DialogResult result = MessageBox.Show(
|
||||
$"An unexpected error occurred and the application crashed.\n\nA crash report was saved here:\n{filePath}\n\nClick OK to open the folder.",
|
||||
"Application Error",
|
||||
MessageBoxButtons.OKCancel,
|
||||
MessageBoxIcon.Error
|
||||
);
|
||||
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
DialogResult result = MessageBox.Show(
|
||||
$"An unexpected error occurred and the application crashed.\n\nA crash report was saved here:\n{filePath}\n\nClick OK to open the folder.",
|
||||
"Application Error",
|
||||
MessageBoxButtons.OKCancel,
|
||||
MessageBoxIcon.Error
|
||||
);
|
||||
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
// Open Explorer and select the crash report
|
||||
Process.Start("explorer.exe", $"/select,\"{filePath}\"");
|
||||
}
|
||||
Helpers.ExplorerSelect(filePath);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private static string BuildCrashReport(Exception ex)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user