mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-04-22 23:41:36 -05:00
Add check for old PKHeX.Core.dll (#2662)
This commit is contained in:
parent
a3e9649f09
commit
4ef48a4e79
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.Reflection;
|
||||
#if !DEBUG
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
|
|
@ -61,7 +62,11 @@ private static void CurrentDomain_UnhandledException(object sender, UnhandledExc
|
|||
var ex = e.ExceptionObject as Exception;
|
||||
try
|
||||
{
|
||||
if (ex != null)
|
||||
if (IsOldPkhexCorePresent(ex))
|
||||
{
|
||||
Error("You have upgraded PKHeX incorrectly. Please delete PKHeX.Core.dll.");
|
||||
}
|
||||
else if (ex != null)
|
||||
{
|
||||
ErrorWindow.ShowErrorDialog("An unhandled exception has occurred.\nPKHeX must now close.", ex, false);
|
||||
}
|
||||
|
|
@ -114,6 +119,13 @@ private static bool EmergencyErrorLog(Exception originalException, Exception err
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool IsOldPkhexCorePresent(Exception ex)
|
||||
{
|
||||
return ex is MissingMethodException
|
||||
&& File.Exists("PKHeX.Core.dll")
|
||||
&& AssemblyName.GetAssemblyName("PKHeX.Core.dll").Version < Assembly.GetExecutingAssembly().GetName().Version;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user