Minor cleanup to improve readability
This commit is contained in:
parent
ce0ccd0cfa
commit
9cafddb1e0
|
@ -632,32 +632,36 @@ namespace BizHawk.Client.EmuHawk
|
|||
// Hard stuff as we need a proxy object that inherit from MarshalByRefObject.
|
||||
if (toolType == typeof(IExternalToolForm))
|
||||
{
|
||||
if (skipExtToolWarning || MessageBox.Show(
|
||||
"Are you sure want to load this external tool?\r\nAccept ONLY if you trust the source and if you know what you're doing. In any other case, choose no.",
|
||||
"Confirm loading", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
if (!skipExtToolWarning)
|
||||
{
|
||||
try
|
||||
if (MessageBox.Show(
|
||||
"Are you sure want to load this external tool?\r\nAccept ONLY if you trust the source and if you know what you're doing. In any other case, choose no.",
|
||||
"Confirm loading",
|
||||
MessageBoxButtons.YesNo,
|
||||
MessageBoxIcon.Question)
|
||||
!= DialogResult.Yes)
|
||||
{
|
||||
tool = Activator.CreateInstanceFrom(dllPath, toolTypeName ?? "BizHawk.Client.EmuHawk.CustomMainForm").Unwrap() as IExternalToolForm;
|
||||
if (tool == null)
|
||||
{
|
||||
MessageBox.Show($"It seems that the object CustomMainForm does not implement {nameof(IExternalToolForm)}. Please review the code.", "No, no, no. Wrong Way !", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (MissingMethodException)
|
||||
{
|
||||
MessageBox.Show("It seems that the object CustomMainForm does not have a public default constructor. Please review the code.", "No, no, no. Wrong Way !", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
return null;
|
||||
}
|
||||
catch (TypeLoadException)
|
||||
{
|
||||
MessageBox.Show("It seems that the object CustomMainForm does not exists. Please review the code.", "No, no, no. Wrong Way !", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
try
|
||||
{
|
||||
tool = Activator.CreateInstanceFrom(dllPath, toolTypeName ?? "BizHawk.Client.EmuHawk.CustomMainForm").Unwrap() as IExternalToolForm;
|
||||
if (tool == null)
|
||||
{
|
||||
MessageBox.Show($"It seems that the object CustomMainForm does not implement {nameof(IExternalToolForm)}. Please review the code.", "No, no, no. Wrong Way !", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (MissingMethodException)
|
||||
{
|
||||
MessageBox.Show("It seems that the object CustomMainForm does not have a public default constructor. Please review the code.", "No, no, no. Wrong Way !", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
return null;
|
||||
}
|
||||
catch (TypeLoadException)
|
||||
{
|
||||
MessageBox.Show("It seems that the object CustomMainForm does not exists. Please review the code.", "No, no, no. Wrong Way !", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue