/// <summary> /// Starts the master server dll /// </summary> private static void StartMasterServerDll() { LmpDomain = AppDomain.CreateDomain("LMP.MasterServer", null, DomainSetup); LmpDomain.SetData("Arguments", Arguments); LmpDomain.SetData("Stop", false); LmpDomain.DoCallBack(async() => { //Reload the uhttpSharp dll as otherwise on linux it fails var uhttpSharpPath = Path.Combine(Directory.GetCurrentDirectory(), "uhttpsharp.dll"); AppDomain.CurrentDomain.Load(File.ReadAllBytes(uhttpSharpPath)); AppDomain.CurrentDomain.Load(File.ReadAllBytes(DllPath)); var assembly = AppDomain.CurrentDomain.Load(File.ReadAllBytes(DllPath)); var entryPoint = assembly.GetType("LMP.MasterServer.EntryPoint"); entryPoint.GetMethod("MainEntryPoint")?.Invoke(null, new[] { AppDomain.CurrentDomain.GetData("Arguments") }); while (!(bool)AppDomain.CurrentDomain.GetData("Stop")) { await Task.Delay(100); } entryPoint.GetMethod("Stop")?.Invoke(null, new object[0]); }); }
/// <summary> /// Starts the master server dll /// </summary> private static void StartMasterServerDll() { LmpDomain = AppDomain.CreateDomain("LMP.MasterServer", null, DomainSetup); LmpDomain.SetData("Arguments", Arguments); LmpDomain.SetData("Stop", false); LmpDomain.DoCallBack(async() => { var assembly = AppDomain.CurrentDomain.Load(File.ReadAllBytes(DllPath)); var entryPoint = assembly.GetType("LMP.MasterServer.EntryPoint"); entryPoint.GetMethod("MainEntryPoint")?.Invoke(null, new[] { AppDomain.CurrentDomain.GetData("Arguments") }); while (!(bool)AppDomain.CurrentDomain.GetData("Stop")) { await Task.Delay(100); } entryPoint.GetMethod("Stop")?.Invoke(null, new object[0]); }); }