This repository has been archived by the owner on May 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
1,932 additions
and
1,808 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using System; | ||
using System.IO; | ||
using System.Threading; | ||
using System.Windows.Forms; | ||
|
||
namespace EveOPreview | ||
{ | ||
// A really very primitive exception handler stuff here | ||
// No IoC, no fancy DI containers - just a plain exception stacktrace dump | ||
// If this code is called then something was gone really bad | ||
// so even the DI infrastructure might be dead already. | ||
// So this dumb and non elegant approach is used | ||
sealed class ExceptionHandler | ||
{ | ||
private const string ExceptionDumpFileName = "EVE-O Preview.log"; | ||
private const string ExceptionMessage = "EVE-O Preview has encountered a problem and needs to close. Additional information has been saved in the crash log file."; | ||
|
||
public void SetupExceptionHandlers() | ||
{ | ||
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); | ||
Application.ThreadException += delegate (Object sender, ThreadExceptionEventArgs e) | ||
{ | ||
this.ExceptionEventHandler(e.Exception); | ||
}; | ||
|
||
AppDomain.CurrentDomain.UnhandledException += delegate (Object sender, UnhandledExceptionEventArgs e) | ||
{ | ||
this.ExceptionEventHandler(e.ExceptionObject as Exception); | ||
}; | ||
} | ||
|
||
private void ExceptionEventHandler(Exception exception) | ||
{ | ||
try | ||
{ | ||
String exceptionMessage = exception.ToString(); | ||
File.WriteAllText(ExceptionHandler.ExceptionDumpFileName, exceptionMessage); | ||
|
||
MessageBox.Show(ExceptionHandler.ExceptionMessage, @"EVE-O Preview", MessageBoxButtons.OK, MessageBoxIcon.Error); | ||
} | ||
catch | ||
{ | ||
// We are in unstable state now so even this operation might fail | ||
// Still we actually don't care anymore - anyway the application has been cashed | ||
} | ||
|
||
System.Environment.Exit(1); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<Weavers> | ||
<Costura IncludeDebugSymbols="false" /> | ||
<Costura IncludeDebugSymbols="false" /> | ||
</Weavers> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.