Show message box if GUI crashes

mac
Miepee 3 years ago
parent ba49e414a2
commit dbe65e0852

@ -152,35 +152,42 @@ public partial class MainForm : Form
string iconPath = RawMods.GetProperPathToBuiltinIcons(nameof(Resources.icon), userIconPath); string iconPath = RawMods.GetProperPathToBuiltinIcons(nameof(Resources.icon), userIconPath);
string splashPath = RawMods.GetProperPathToBuiltinIcons(nameof(Resources.splash), userSplashPath); string splashPath = RawMods.GetProperPathToBuiltinIcons(nameof(Resources.splash), userSplashPath);
if (checkboxLinux.Checked.Value) try
{
if (File.Exists(linuxPath))
File.Delete(linuxPath);
await Task.Run(() => RawMods.PortToLinux(modZipPath, linuxPath, iconPath, splashPath, OutputHandlerDelegate));
}
if (checkboxAndroid.Checked.Value)
{ {
if (File.Exists(androidPath)) if (checkboxLinux.Checked.Value)
File.Delete(androidPath); {
if (File.Exists(linuxPath))
File.Delete(linuxPath);
bool useCustomSave = checkboxUseCustomSave.Checked.Value; await Task.Run(() => RawMods.PortToLinux(modZipPath, linuxPath, iconPath, splashPath, OutputHandlerDelegate));
bool useInternet = checkboxAndroidRequiresInternet.Checked.Value; }
await Task.Run(() => RawMods.PortToAndroid(modZipPath, androidPath, iconPath, splashPath, useCustomSave, useInternet, OutputHandlerDelegate)); if (checkboxAndroid.Checked.Value)
{
if (File.Exists(androidPath))
File.Delete(androidPath);
bool useCustomSave = checkboxUseCustomSave.Checked.Value;
bool useInternet = checkboxAndroidRequiresInternet.Checked.Value;
await Task.Run(() => RawMods.PortToAndroid(modZipPath, androidPath, iconPath, splashPath, useCustomSave, useInternet, OutputHandlerDelegate));
}
if (checkboxMac.Checked.Value)
{
if (File.Exists(macPath))
File.Delete(macPath);
await Task.Run(() => RawMods.PortToMac(modZipPath, macPath, iconPath, splashPath, OutputHandlerDelegate));
}
labelProgress.Text = "Done!";
OpenFolder(currentDir);
} }
if (checkboxMac.Checked.Value) catch (Exception exception)
{ {
if (File.Exists(macPath)) MessageBox.Show(this, "Stack Trace: " + exception, "Error", MessageBoxType.Error);
File.Delete(macPath); throw;
string modName = checkboxUseCustomSave.Text;
await Task.Run(() => RawMods.PortToMac(modZipPath, macPath, iconPath, splashPath, OutputHandlerDelegate));
} }
labelProgress.Text = "Done!";
OpenFolder(currentDir);
SetDisableStatusOfAllElements(false); SetDisableStatusOfAllElements(false);
} }

Loading…
Cancel
Save