public static int PassInfo(string[] configPath, int[] fPtrs)
{
Console.Write(configPath[0]);
EventWaitHandle result;
EventWaitHandle.TryOpenExisting(@"Global\FinishedLoading",
EventWaitHandleRights.Synchronize | EventWaitHandleRights.Modify, out result);
if (result != null)
{
eHandle = result;
}
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
AppDomain.CurrentDomain.DomainUnload += CurrentDomain_DomainUnload;
ConfigPath = Path.GetDirectoryName(Path.GetDirectoryName(configPath[0])) + "\\Resources";
var count = 0;
foreach (var f in typeof(Funcs).GetFields())
{
f.SetValue(null, Marshal.GetDelegateForFunctionPointer((IntPtr)fPtrs[count], f.FieldType));
count++;
}
new Thread(new ThreadStart(delegate
{
pHandle =
AppDomain.CurrentDomain.GetAssemblies()
.First(ass => ass.GetTypes().Any((t => t.Name == "PluginMain")))
.GetTypes().First(t => t.Name == "PluginMain")
.GetConstructors()
.First()
.Invoke(null);
pHandle.GetType().GetMethod("Start").Invoke(pHandle, null);
})) { ApartmentState = ApartmentState.STA }.Start();
return 1;
}