feat: make exception popup a yesno, exit process after choosing

This commit is contained in:
goat 2021-08-19 23:44:02 +02:00
parent 35aadbe575
commit 8d269926c2
No known key found for this signature in database
GPG key ID: F18F057873895461

View file

@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
@ -11,6 +12,7 @@ using Dalamud.Logging.Internal;
using Dalamud.Utility;
using HarmonyLib;
using Newtonsoft.Json;
using PInvoke;
using Serilog;
using Serilog.Core;
using Serilog.Events;
@ -202,11 +204,20 @@ namespace Dalamud
$"{ex.TargetSite.DeclaringType.Assembly.GetName().Name}, {ex.TargetSite.DeclaringType.FullName}::{ex.TargetSite.Name}";
}
Util.Fatal(
const MessageBoxType flags = NativeFunctions.MessageBoxType.YesNo | NativeFunctions.MessageBoxType.IconError | NativeFunctions.MessageBoxType.SystemModal;
var result = MessageBoxW(
Process.GetCurrentProcess().MainWindowHandle,
$"An internal error in a Dalamud plugin occurred.\nThe game must close.\n\nType: {ex.GetType().Name}\n{info}\n\nMore information has been recorded separately, please contact us in our Discord or on GitHub.\n\nDo you want to disable all plugins the next time you start the game?",
"Dalamud");
"Dalamud",
flags);
// TODO Plugin disabling
if (result == (int)User32.MessageBoxResult.IDYES)
{
Log.Information("User chose to disable plugins on next launch...");
// TODO When services are in
}
Environment.Exit(-1);
break;
default: