Make proper crash screens show up, fix consecutive gui crash

mac
Miepee 3 years ago
parent d2df45fed8
commit c112393f31

@ -8,6 +8,24 @@ static class Program
[STAThread] [STAThread]
public static void Main(string[] args) public static void Main(string[] args)
{ {
new Application(Eto.Platforms.Gtk).Run(new MainForm()); var app = new Application(Eto.Platforms.Gtk);
try
{
app.UnhandledException += ApplicationOnUnhandledException;
app.Run(new MainForm());
}
catch (Exception e)
{
Console.WriteLine($"Unhandled Exception!\n*****Stack Trace*****\n\n{e}");
}
}
private static void ApplicationOnUnhandledException(object sender, Eto.UnhandledExceptionEventArgs e)
{
Application.Instance.Invoke(() =>
{
MessageBox.Show($"Unhandled Exception!\n*****Stack Trace*****\n\n{e.ExceptionObject}", "GTK", MessageBoxType.Error);
});
} }
} }

@ -8,6 +8,24 @@ static class Program
[STAThread] [STAThread]
public static void Main(string[] args) public static void Main(string[] args)
{ {
new Application(Eto.Platforms.Mac64).Run(new MainForm()); var app = new Application(Eto.Platforms.macOS);
try
{
app.UnhandledException += ApplicationOnUnhandledException;
app.Run(new MainForm());
}
catch (Exception e)
{
Console.WriteLine($"Unhandled Exception!\n*****Stack Trace*****\n\n{e}");
}
}
private static void ApplicationOnUnhandledException(object sender, Eto.UnhandledExceptionEventArgs e)
{
Application.Instance.Invoke(() =>
{
MessageBox.Show($"Unhandled Exception!\n*****Stack Trace*****\n\n{e.ExceptionObject}", "Mac", MessageBoxType.Error);
});
} }
} }

@ -8,6 +8,24 @@ static class Program
[STAThread] [STAThread]
public static void Main(string[] args) public static void Main(string[] args)
{ {
new Application(Eto.Platforms.Wpf).Run(new MainForm()); var app = new Application(Eto.Platforms.Wpf);
try
{
app.UnhandledException += ApplicationOnUnhandledException;
app.Run(new MainForm());
}
catch (Exception e)
{
Console.WriteLine($"Unhandled Exception!\n*****Stack Trace*****\n\n{e}");
}
}
private static void ApplicationOnUnhandledException(object sender, Eto.UnhandledExceptionEventArgs e)
{
Application.Instance.Invoke(() =>
{
MessageBox.Show($"Unhandled Exception!\n*****Stack Trace*****\n\n{e.ExceptionObject}", "WPF", MessageBoxType.Error);
});
} }
} }

@ -4,13 +4,13 @@ public static class Core
{ {
private static string ReturnAndCreateConfigDir() private static string ReturnAndCreateConfigDir()
{ {
string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData, Environment.SpecialFolderOption.Create) + "/PortHelper/"; string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData, Environment.SpecialFolderOption.Create) + "/GlennPortHelper/";
Directory.CreateDirectory(path); Directory.CreateDirectory(path);
return path; return path;
} }
/// <summary> /// <summary>
/// The full path to the PortHelper's place in Configuration Application Data. /// The full path to the tools's place in Configuration Application Data.
/// </summary> /// </summary>
public static readonly string ConfigDir = ReturnAndCreateConfigDir(); public static readonly string ConfigDir = ReturnAndCreateConfigDir();

@ -14,7 +14,14 @@ public abstract class ModsBase
/// <summary> /// <summary>
/// A temporary directory /// A temporary directory
/// </summary> /// </summary>
protected static readonly string TempDir = Path.GetTempPath() + "/PortHelper/"; protected static string TempDir => CreateAndReturnTempPath();
private static string CreateAndReturnTempPath()
{
string path = Path.GetTempPath() + "/GlennPortHelper/";
Directory.CreateDirectory(path);
return path;
}
/// <summary> /// <summary>
/// The current directory of the program. /// The current directory of the program.

@ -9,7 +9,7 @@ namespace GlennLibTests;
public class RawModsTests : IDisposable public class RawModsTests : IDisposable
{ {
private readonly string testTempDir; private readonly string testTempDir;
private readonly string libTempDir = Path.GetTempPath() + "/PortHelper/"; private readonly string libTempDir = Path.GetTempPath() + "/GlennPortHelper/";
private readonly ITestOutputHelper output; private readonly ITestOutputHelper output;
public RawModsTests(ITestOutputHelper output) public RawModsTests(ITestOutputHelper output)

Loading…
Cancel
Save