-
-
Save lolp1/9137ebe71970900fd003e738e03f3b4a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void LoadAndRun(string file) | |
{ | |
var asm = Assembly.Load(file); | |
var DLL_MAIN = | |
asm | |
.GetTypes() | |
.SelectMany(type => type.GetMethods()) | |
.First(methodInfo => | |
{ | |
var invariant = methodInfo.Name.ToLowerInvariant(); | |
return invariant == dll_main; | |
}); | |
if (DLL_MAIN == null) | |
{ | |
throw new ArgumentNullException(nameof(DLL_MAIN)); | |
} | |
DLL_MAIN.Invoke(null, null); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[DllExport("InitializeMyApp")] | |
public static void Initialize_MyApp() | |
{ | |
Initialize(); | |
} | |
private static void Initialize() | |
{ | |
// . | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment