v4.1.5.1
- Fixed some harmless installation/uninstallation inconsistencies - Fixed harmless Paradox Launcher repair inconsistencies - Improved exception handling output
This commit is contained in:
parent
43a1c8d248
commit
e4eca9fb0d
7 changed files with 64 additions and 70 deletions
|
@ -5,7 +5,7 @@
|
||||||
<UseWindowsForms>True</UseWindowsForms>
|
<UseWindowsForms>True</UseWindowsForms>
|
||||||
<ApplicationIcon>Resources\ini.ico</ApplicationIcon>
|
<ApplicationIcon>Resources\ini.ico</ApplicationIcon>
|
||||||
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
|
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
|
||||||
<Version>4.1.5.0</Version>
|
<Version>4.1.5.1</Version>
|
||||||
<PackageIcon>Resources\ini.ico</PackageIcon>
|
<PackageIcon>Resources\ini.ico</PackageIcon>
|
||||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||||
<Copyright>2021, pointfeev (https://github.com/pointfeev)</Copyright>
|
<Copyright>2021, pointfeev (https://github.com/pointfeev)</Copyright>
|
||||||
|
|
|
@ -106,14 +106,10 @@ internal partial class InstallForm : CustomForm
|
||||||
foreach (string directory in selection.DllDirectories)
|
foreach (string directory in selection.DllDirectories)
|
||||||
{
|
{
|
||||||
if (Program.Canceled) throw new CustomMessageException("The operation was canceled.");
|
if (Program.Canceled) throw new CustomMessageException("The operation was canceled.");
|
||||||
if (selection.Platform is Platform.Steam or Platform.Paradox
|
if (selection.Platform is Platform.Steam or Platform.Paradox)
|
||||||
&& (selection.SelectedDlc.Any(d => d.Value.type is DlcType.Steam or DlcType.SteamHidden)
|
|
||||||
|| selection.ExtraSelectedDlc.Any(item => item.dlc.Any(dlc => dlc.Value.type is DlcType.Steam or DlcType.SteamHidden))))
|
|
||||||
{
|
{
|
||||||
directory.GetSmokeApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out string config, out string cache);
|
directory.GetSmokeApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out string config, out string cache);
|
||||||
if (!uninstallProxy && (File.Exists(api32) || File.Exists(api64))
|
if (uninstallProxy ? File.Exists(api32_o) || File.Exists(api64_o) || File.Exists(config) || File.Exists(cache) : File.Exists(api32) || File.Exists(api64))
|
||||||
|| uninstallProxy && (File.Exists(api32_o) || File.Exists(api64_o)
|
|
||||||
|| !selection.Koaloader && (File.Exists(config) || File.Exists(cache))))
|
|
||||||
{
|
{
|
||||||
UpdateUser($"{(uninstallProxy ? "Uninstalling" : "Installing")} SmokeAPI" +
|
UpdateUser($"{(uninstallProxy ? "Uninstalling" : "Installing")} SmokeAPI" +
|
||||||
$" {(uninstallProxy ? "from" : "for")} " + selection.Name + $" in directory \"{directory}\" . . . ", LogTextBox.Operation);
|
$" {(uninstallProxy ? "from" : "for")} " + selection.Name + $" in directory \"{directory}\" . . . ", LogTextBox.Operation);
|
||||||
|
@ -123,14 +119,10 @@ internal partial class InstallForm : CustomForm
|
||||||
await SmokeAPI.Install(directory, selection, this);
|
await SmokeAPI.Install(directory, selection, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (selection.Platform is Platform.Epic or Platform.Paradox
|
if (selection.Platform is Platform.Epic or Platform.Paradox)
|
||||||
&& (selection.SelectedDlc.Any(d => d.Value.type is DlcType.EpicCatalogItem or DlcType.EpicEntitlement)
|
|
||||||
|| selection.ExtraSelectedDlc.Any(item => item.dlc.Any(dlc => dlc.Value.type is DlcType.EpicCatalogItem or DlcType.EpicEntitlement))))
|
|
||||||
{
|
{
|
||||||
directory.GetScreamApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out string config);
|
directory.GetScreamApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out string config);
|
||||||
if (!uninstallProxy && (File.Exists(api32) || File.Exists(api64))
|
if (uninstallProxy ? File.Exists(api32_o) || File.Exists(api64_o) || File.Exists(config) : File.Exists(api32) || File.Exists(api64))
|
||||||
|| uninstallProxy && (File.Exists(api32_o) || File.Exists(api64_o)
|
|
||||||
|| !selection.Koaloader && File.Exists(config)))
|
|
||||||
{
|
{
|
||||||
UpdateUser($"{(uninstallProxy ? "Uninstalling" : "Installing")} ScreamAPI" +
|
UpdateUser($"{(uninstallProxy ? "Uninstalling" : "Installing")} ScreamAPI" +
|
||||||
$" {(uninstallProxy ? "from" : "for")} " + selection.Name + $" in directory \"{directory}\" . . . ", LogTextBox.Operation);
|
$" {(uninstallProxy ? "from" : "for")} " + selection.Name + $" in directory \"{directory}\" . . . ", LogTextBox.Operation);
|
||||||
|
@ -143,9 +135,7 @@ internal partial class InstallForm : CustomForm
|
||||||
if (selection.Platform is Platform.Ubisoft)
|
if (selection.Platform is Platform.Ubisoft)
|
||||||
{
|
{
|
||||||
directory.GetUplayR1Components(out string api32, out string api32_o, out string api64, out string api64_o, out string config);
|
directory.GetUplayR1Components(out string api32, out string api32_o, out string api64, out string api64_o, out string config);
|
||||||
if (!uninstallProxy && (File.Exists(api32) || File.Exists(api64))
|
if (uninstallProxy ? File.Exists(api32_o) || File.Exists(api64_o) || File.Exists(config) : File.Exists(api32) || File.Exists(api64))
|
||||||
|| uninstallProxy && (File.Exists(api32_o) || File.Exists(api64_o)
|
|
||||||
|| !selection.Koaloader && File.Exists(config)))
|
|
||||||
{
|
{
|
||||||
UpdateUser($"{(uninstallProxy ? "Uninstalling" : "Installing")} Uplay R1 Unlocker" +
|
UpdateUser($"{(uninstallProxy ? "Uninstalling" : "Installing")} Uplay R1 Unlocker" +
|
||||||
$" {(uninstallProxy ? "from" : "for")} " + selection.Name + $" in directory \"{directory}\" . . . ", LogTextBox.Operation);
|
$" {(uninstallProxy ? "from" : "for")} " + selection.Name + $" in directory \"{directory}\" . . . ", LogTextBox.Operation);
|
||||||
|
@ -155,9 +145,7 @@ internal partial class InstallForm : CustomForm
|
||||||
await UplayR1.Install(directory, selection, this);
|
await UplayR1.Install(directory, selection, this);
|
||||||
}
|
}
|
||||||
directory.GetUplayR2Components(out string old_api32, out string old_api64, out api32, out api32_o, out api64, out api64_o, out config);
|
directory.GetUplayR2Components(out string old_api32, out string old_api64, out api32, out api32_o, out api64, out api64_o, out config);
|
||||||
if (!uninstallProxy && (File.Exists(old_api32) || File.Exists(old_api64) || File.Exists(api32) || File.Exists(api64))
|
if (uninstallProxy ? File.Exists(api32_o) || File.Exists(api64_o) || File.Exists(config) : File.Exists(old_api32) || File.Exists(old_api64) || File.Exists(api32) || File.Exists(api64))
|
||||||
|| uninstallProxy && (File.Exists(api32_o) || File.Exists(api64_o)
|
|
||||||
|| !selection.Koaloader && File.Exists(config)))
|
|
||||||
{
|
{
|
||||||
UpdateUser($"{(uninstallProxy ? "Uninstalling" : "Installing")} Uplay R2 Unlocker" +
|
UpdateUser($"{(uninstallProxy ? "Uninstalling" : "Installing")} Uplay R2 Unlocker" +
|
||||||
$" {(uninstallProxy ? "from" : "for")} " + selection.Name + $" in directory \"{directory}\" . . . ", LogTextBox.Operation);
|
$" {(uninstallProxy ? "from" : "for")} " + selection.Name + $" in directory \"{directory}\" . . . ", LogTextBox.Operation);
|
||||||
|
|
|
@ -750,7 +750,7 @@ internal partial class SelectForm : CustomForm
|
||||||
{
|
{
|
||||||
directory.GetScreamApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out string config);
|
directory.GetScreamApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out string config);
|
||||||
if (File.Exists(api32) || File.Exists(api32_o) || File.Exists(api64) || File.Exists(api64_o) || File.Exists(config))
|
if (File.Exists(api32) || File.Exists(api32_o) || File.Exists(api64) || File.Exists(api64_o) || File.Exists(config))
|
||||||
items.Add(new ContextMenuItem($"Open Epic Online Services Directory #{++epic}", "File Explorer",
|
items.Add(new ContextMenuItem($"Open EOS Directory #{++epic}", "File Explorer",
|
||||||
new EventHandler((sender, e) => Diagnostics.OpenDirectoryInFileExplorer(directory))));
|
new EventHandler((sender, e) => Diagnostics.OpenDirectoryInFileExplorer(directory))));
|
||||||
}
|
}
|
||||||
if (selection.Platform is Platform.Ubisoft)
|
if (selection.Platform is Platform.Ubisoft)
|
||||||
|
|
|
@ -85,24 +85,29 @@ internal static class ParadoxLauncher
|
||||||
if (!Program.IsProgramRunningDialog(form, selection))
|
if (!Program.IsProgramRunningDialog(form, selection))
|
||||||
return form is InstallForm ? throw new CustomMessageException("Repair failed! The launcher is currently running!")
|
return form is InstallForm ? throw new CustomMessageException("Repair failed! The launcher is currently running!")
|
||||||
: RepairResult.ProgramRunning;
|
: RepairResult.ProgramRunning;
|
||||||
bool smokeConfig = false;
|
bool smokeInstalled = false;
|
||||||
byte[] steamOriginalSdk32 = null;
|
byte[] steamOriginalSdk32 = null;
|
||||||
byte[] steamOriginalSdk64 = null;
|
byte[] steamOriginalSdk64 = null;
|
||||||
bool screamConfig = false;
|
bool screamInstalled = false;
|
||||||
byte[] epicOriginalSdk32 = null;
|
byte[] epicOriginalSdk32 = null;
|
||||||
byte[] epicOriginalSdk64 = null;
|
byte[] epicOriginalSdk64 = null;
|
||||||
foreach (string directory in selection.DllDirectories)
|
foreach (string directory in selection.DllDirectories)
|
||||||
{
|
{
|
||||||
directory.GetSmokeApiComponents(out string api32, out _, out string api64, out _, out string config, out _);
|
directory.GetSmokeApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out string config, out _);
|
||||||
smokeConfig = smokeConfig || File.Exists(config);
|
smokeInstalled = smokeInstalled
|
||||||
|
|| File.Exists(api32_o) || File.Exists(api64_o) || File.Exists(config)
|
||||||
|
|| File.Exists(api32) && api32.IsResourceFile(ResourceIdentifier.Steamworks32)
|
||||||
|
|| File.Exists(api64) && api64.IsResourceFile(ResourceIdentifier.Steamworks64);
|
||||||
await SmokeAPI.Uninstall(directory, deleteConfig: false);
|
await SmokeAPI.Uninstall(directory, deleteConfig: false);
|
||||||
if (steamOriginalSdk32 is null && File.Exists(api32) && !api32.IsResourceFile(ResourceIdentifier.Steamworks32))
|
if (steamOriginalSdk32 is null && File.Exists(api32) && !api32.IsResourceFile(ResourceIdentifier.Steamworks32))
|
||||||
steamOriginalSdk32 = File.ReadAllBytes(api32);
|
steamOriginalSdk32 = File.ReadAllBytes(api32);
|
||||||
if (steamOriginalSdk64 is null && File.Exists(api64) && !api64.IsResourceFile(ResourceIdentifier.Steamworks64))
|
if (steamOriginalSdk64 is null && File.Exists(api64) && !api64.IsResourceFile(ResourceIdentifier.Steamworks64))
|
||||||
steamOriginalSdk64 = File.ReadAllBytes(api64);
|
steamOriginalSdk64 = File.ReadAllBytes(api64);
|
||||||
|
directory.GetScreamApiComponents(out api32, out api32_o, out api64, out api64_o, out config);
|
||||||
directory.GetScreamApiComponents(out api32, out _, out api64, out _, out config);
|
screamInstalled = screamInstalled
|
||||||
screamConfig = screamConfig || File.Exists(config);
|
|| File.Exists(api32_o) || File.Exists(api64_o) || File.Exists(config)
|
||||||
|
|| File.Exists(api32) && api32.IsResourceFile(ResourceIdentifier.EpicOnlineServices32)
|
||||||
|
|| File.Exists(api64) && api64.IsResourceFile(ResourceIdentifier.EpicOnlineServices64);
|
||||||
await ScreamAPI.Uninstall(directory, deleteConfig: false);
|
await ScreamAPI.Uninstall(directory, deleteConfig: false);
|
||||||
if (epicOriginalSdk32 is null && File.Exists(api32) && !api32.IsResourceFile(ResourceIdentifier.EpicOnlineServices32))
|
if (epicOriginalSdk32 is null && File.Exists(api32) && !api32.IsResourceFile(ResourceIdentifier.EpicOnlineServices32))
|
||||||
epicOriginalSdk32 = File.ReadAllBytes(api32);
|
epicOriginalSdk32 = File.ReadAllBytes(api32);
|
||||||
|
@ -130,9 +135,8 @@ internal static class ParadoxLauncher
|
||||||
installForm.UpdateUser("Corrected Steamworks: " + api64, LogTextBox.Action);
|
installForm.UpdateUser("Corrected Steamworks: " + api64, LogTextBox.Action);
|
||||||
neededRepair = true;
|
neededRepair = true;
|
||||||
}
|
}
|
||||||
if (!selection.Koaloader && smokeConfig)
|
if (smokeInstalled)
|
||||||
await SmokeAPI.Install(directory, selection, generateConfig: false);
|
await SmokeAPI.Install(directory, selection, generateConfig: false);
|
||||||
|
|
||||||
directory.GetScreamApiComponents(out api32, out _, out api64, out _, out _);
|
directory.GetScreamApiComponents(out api32, out _, out api64, out _, out _);
|
||||||
if (epicOriginalSdk32 is not null && api32.IsResourceFile(ResourceIdentifier.EpicOnlineServices32))
|
if (epicOriginalSdk32 is not null && api32.IsResourceFile(ResourceIdentifier.EpicOnlineServices32))
|
||||||
{
|
{
|
||||||
|
@ -148,7 +152,7 @@ internal static class ParadoxLauncher
|
||||||
installForm.UpdateUser("Corrected Epic Online Services: " + api64, LogTextBox.Action);
|
installForm.UpdateUser("Corrected Epic Online Services: " + api64, LogTextBox.Action);
|
||||||
neededRepair = true;
|
neededRepair = true;
|
||||||
}
|
}
|
||||||
if (!selection.Koaloader && screamConfig)
|
if (screamInstalled)
|
||||||
await ScreamAPI.Install(directory, selection, generateConfig: false);
|
await ScreamAPI.Install(directory, selection, generateConfig: false);
|
||||||
}
|
}
|
||||||
if (neededRepair)
|
if (neededRepair)
|
||||||
|
|
|
@ -117,7 +117,7 @@ internal static class ScreamAPI
|
||||||
}
|
}
|
||||||
File.Move(api32_o, api32);
|
File.Move(api32_o, api32);
|
||||||
if (installForm is not null)
|
if (installForm is not null)
|
||||||
installForm.UpdateUser($"Restored Epic Online Services: {Path.GetFileName(api32_o)} -> {Path.GetFileName(api32)}", LogTextBox.Action, info: false);
|
installForm.UpdateUser($"Restored EOS: {Path.GetFileName(api32_o)} -> {Path.GetFileName(api32)}", LogTextBox.Action, info: false);
|
||||||
}
|
}
|
||||||
if (File.Exists(api64_o))
|
if (File.Exists(api64_o))
|
||||||
{
|
{
|
||||||
|
@ -129,7 +129,7 @@ internal static class ScreamAPI
|
||||||
}
|
}
|
||||||
File.Move(api64_o, api64);
|
File.Move(api64_o, api64);
|
||||||
if (installForm is not null)
|
if (installForm is not null)
|
||||||
installForm.UpdateUser($"Restored Epic Online Services: {Path.GetFileName(api64_o)} -> {Path.GetFileName(api64)}", LogTextBox.Action, info: false);
|
installForm.UpdateUser($"Restored EOS: {Path.GetFileName(api64_o)} -> {Path.GetFileName(api64)}", LogTextBox.Action, info: false);
|
||||||
}
|
}
|
||||||
if (deleteConfig && File.Exists(config))
|
if (deleteConfig && File.Exists(config))
|
||||||
{
|
{
|
||||||
|
@ -146,7 +146,7 @@ internal static class ScreamAPI
|
||||||
{
|
{
|
||||||
File.Move(api32, api32_o);
|
File.Move(api32, api32_o);
|
||||||
if (installForm is not null)
|
if (installForm is not null)
|
||||||
installForm.UpdateUser($"Renamed Epic Online Services: {Path.GetFileName(api32)} -> {Path.GetFileName(api32_o)}", LogTextBox.Action, info: false);
|
installForm.UpdateUser($"Renamed EOS: {Path.GetFileName(api32)} -> {Path.GetFileName(api32_o)}", LogTextBox.Action, info: false);
|
||||||
}
|
}
|
||||||
if (File.Exists(api32_o))
|
if (File.Exists(api32_o))
|
||||||
{
|
{
|
||||||
|
@ -158,7 +158,7 @@ internal static class ScreamAPI
|
||||||
{
|
{
|
||||||
File.Move(api64, api64_o);
|
File.Move(api64, api64_o);
|
||||||
if (installForm is not null)
|
if (installForm is not null)
|
||||||
installForm.UpdateUser($"Renamed Epic Online Services: {Path.GetFileName(api64)} -> {Path.GetFileName(api64_o)}", LogTextBox.Action, info: false);
|
installForm.UpdateUser($"Renamed EOS: {Path.GetFileName(api64)} -> {Path.GetFileName(api64_o)}", LogTextBox.Action, info: false);
|
||||||
}
|
}
|
||||||
if (File.Exists(api64_o))
|
if (File.Exists(api64_o))
|
||||||
{
|
{
|
||||||
|
|
|
@ -107,6 +107,13 @@ internal static class SmokeAPI
|
||||||
|
|
||||||
internal static async Task Uninstall(string directory, InstallForm installForm = null, bool deleteConfig = true) => await Task.Run(() =>
|
internal static async Task Uninstall(string directory, InstallForm installForm = null, bool deleteConfig = true) => await Task.Run(() =>
|
||||||
{
|
{
|
||||||
|
directory.GetCreamApiComponents(out _, out _, out _, out _, out string oldConfig);
|
||||||
|
if (File.Exists(oldConfig))
|
||||||
|
{
|
||||||
|
File.Delete(oldConfig);
|
||||||
|
if (installForm is not null)
|
||||||
|
installForm.UpdateUser($"Deleted old CreamAPI configuration: {Path.GetFileName(oldConfig)}", LogTextBox.Action, info: false);
|
||||||
|
}
|
||||||
directory.GetSmokeApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out string config, out string cache);
|
directory.GetSmokeApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out string config, out string cache);
|
||||||
if (File.Exists(api32_o))
|
if (File.Exists(api32_o))
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,44 +9,39 @@ internal static class ExceptionHandler
|
||||||
{
|
{
|
||||||
internal static bool HandleException(this Exception e, Form form = null, string caption = null, string acceptButtonText = "Retry", string cancelButtonText = "Cancel")
|
internal static bool HandleException(this Exception e, Form form = null, string caption = null, string acceptButtonText = "Retry", string cancelButtonText = "Cancel")
|
||||||
{
|
{
|
||||||
caption ??= Program.Name + " encountered a fatal exception";
|
caption ??= Program.Name + " encountered an exception";
|
||||||
while (e.InnerException is not null) // we usually don't need the outer exceptions
|
|
||||||
e = e.InnerException;
|
|
||||||
StringBuilder output = new();
|
StringBuilder output = new();
|
||||||
string[] stackTrace = e.StackTrace?.Split('\n');
|
int stackDepth = 0;
|
||||||
if (stackTrace is not null && stackTrace.Length > 0)
|
while (e is not null)
|
||||||
{
|
|
||||||
_ = output.Append("STACK TRACE\n");
|
|
||||||
for (int i = 0; i < Math.Min(stackTrace.Length, 3); i++)
|
|
||||||
{
|
|
||||||
string line = stackTrace[i];
|
|
||||||
int atNum = line.IndexOf("at ");
|
|
||||||
int inNum = line.IndexOf("in ");
|
|
||||||
int ciNum = line.LastIndexOf(@"CreamInstaller\");
|
|
||||||
int lineNum = line.LastIndexOf(":line ");
|
|
||||||
if (line is not null && atNum != -1)
|
|
||||||
_ = output.Append("\n " + (inNum != -1 ? line[atNum..(inNum - 1)] : line[atNum..])
|
|
||||||
+ (inNum != -1 ? ("\n "
|
|
||||||
+ (ciNum != -1 ? ("in "
|
|
||||||
+ (lineNum != -1 ? line[ciNum..lineNum]
|
|
||||||
+ "\n on " + line[(lineNum + 1)..]
|
|
||||||
: line[ciNum..]))
|
|
||||||
: line[inNum..]))
|
|
||||||
: null));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
string[] messageLines = e.Message?.Split('\n');
|
|
||||||
if (messageLines is not null && messageLines.Length > 0)
|
|
||||||
{
|
{
|
||||||
|
if (stackDepth > 10)
|
||||||
|
break;
|
||||||
if (output.Length > 0)
|
if (output.Length > 0)
|
||||||
_ = output.Append("\n\n");
|
_ = output.Append("\n\n");
|
||||||
_ = output.Append("MESSAGE\n");
|
string[] stackTrace = e.StackTrace?.Split('\n');
|
||||||
for (int i = 0; i < messageLines.Length; i++)
|
if (stackTrace is not null && stackTrace.Length > 0)
|
||||||
{
|
{
|
||||||
string line = messageLines[i];
|
_ = output.Append(e.GetType() + (e.Message is not null ? (": " + e.Message) : ""));
|
||||||
if (line is not null)
|
for (int i = 0; i < stackTrace.Length; i++)
|
||||||
_ = output.Append("\n " + line);
|
{
|
||||||
|
string line = stackTrace[i];
|
||||||
|
int atNum = line.IndexOf("at ");
|
||||||
|
int inNum = line.IndexOf("in ");
|
||||||
|
int ciNum = line.LastIndexOf(@"CreamInstaller\");
|
||||||
|
int lineNum = line.LastIndexOf(":line ");
|
||||||
|
if (line is not null && atNum != -1)
|
||||||
|
_ = output.Append("\n " + (inNum != -1 ? line[atNum..(inNum - 1)] : line[atNum..])
|
||||||
|
+ (inNum != -1 ? ("\n "
|
||||||
|
+ (ciNum != -1 ? ("in "
|
||||||
|
+ (lineNum != -1 ? line[ciNum..lineNum]
|
||||||
|
+ "\n on " + line[(lineNum + 1)..]
|
||||||
|
: line[ciNum..]))
|
||||||
|
: line[inNum..]))
|
||||||
|
: null));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
e = e.InnerException;
|
||||||
|
stackDepth++;
|
||||||
}
|
}
|
||||||
using DialogForm dialogForm = new(form ?? Form.ActiveForm);
|
using DialogForm dialogForm = new(form ?? Form.ActiveForm);
|
||||||
return dialogForm.Show(SystemIcons.Error, output.ToString(), acceptButtonText, cancelButtonText, customFormText: caption) == DialogResult.OK;
|
return dialogForm.Show(SystemIcons.Error, output.ToString(), acceptButtonText, cancelButtonText, customFormText: caption) == DialogResult.OK;
|
||||||
|
@ -54,7 +49,7 @@ internal static class ExceptionHandler
|
||||||
|
|
||||||
internal static void HandleFatalException(this Exception e)
|
internal static void HandleFatalException(this Exception e)
|
||||||
{
|
{
|
||||||
bool? restart = e?.HandleException(acceptButtonText: "Restart");
|
bool? restart = e?.HandleException(caption: Program.Name + " encountered a fatal exception", acceptButtonText: "Restart");
|
||||||
if (restart.HasValue && restart.Value)
|
if (restart.HasValue && restart.Value)
|
||||||
Application.Restart();
|
Application.Restart();
|
||||||
Application.Exit();
|
Application.Exit();
|
||||||
|
@ -68,9 +63,9 @@ public class CustomMessageException : Exception
|
||||||
|
|
||||||
public override string ToString() => Message;
|
public override string ToString() => Message;
|
||||||
|
|
||||||
public CustomMessageException() => message = "CustomMessageException";
|
public CustomMessageException() : base() => message = "CustomMessageException";
|
||||||
|
|
||||||
public CustomMessageException(string message) => this.message = message;
|
public CustomMessageException(string message) : base(message) => this.message = message;
|
||||||
|
|
||||||
public CustomMessageException(string message, Exception _) => this.message = message;
|
public CustomMessageException(string message, Exception e) : base(message, e) => this.message = message;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue