Move BeaEngine.dll to /bin/ Make sure BeaEngine.dll is loaded when the working directory is different Disable file deobfuscation exception handler Don't remove LZMA methods by default Trim version read from ConfuserAttribute Minor refactoring
51 lines
1.4 KiB
C#
51 lines
1.4 KiB
C#
using System.IO;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace de4dot.Bea
|
|
{
|
|
public static class BeaEngine
|
|
{
|
|
// 'de4dot\bin\de4dot.blocks.dll' -> 'de4dot\bin\'
|
|
private static string _executingPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
|
|
|
|
static BeaEngine()
|
|
{
|
|
if (!File.Exists(Path.Combine(_executingPath, "BeaEngine.dll")))
|
|
{
|
|
throw new FileNotFoundException("BeaEngine.dll missing!");
|
|
}
|
|
|
|
//TODO: Better handle native DLL discovery
|
|
SetDllDirectory(_executingPath);
|
|
}
|
|
|
|
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
|
private static extern bool SetDllDirectory(string lpPathName);
|
|
|
|
[DllImport("BeaEngine.dll")]
|
|
public static extern int Disasm([In, Out, MarshalAs(UnmanagedType.LPStruct)] Disasm disasm);
|
|
|
|
[DllImport("BeaEngine.dll")]
|
|
private static extern string BeaEngineVersion();
|
|
|
|
[DllImport("BeaEngine.dll")]
|
|
private static extern string BeaEngineRevision();
|
|
|
|
public static string Version
|
|
{
|
|
get
|
|
{
|
|
return BeaEngineVersion();
|
|
}
|
|
}
|
|
|
|
public static string Revision
|
|
{
|
|
get
|
|
{
|
|
return BeaEngineRevision();
|
|
}
|
|
}
|
|
}
|
|
}
|