internal static void HideArbiterProcess() { if (Environment.OSVersion.Platform.Equals(PlatformID.Win32NT)) { Task.Run(async() => { do { ArbiterWhiteWindowHider.FocusRimworld(); ArbiterWhiteWindowHider.HideArbiter(); await Task.Delay(1); }while (Multiplayer.session?.arbiter != null && !Multiplayer.session.ArbiterPlaying); }); } }
private static void StartArbiter() { Multiplayer.session.AddMsg("The Arbiter instance is starting...", false); Multiplayer.LocalServer.SetupArbiterConnection(); string args = $"-batchmode -nographics -arbiter -logfile arbiter_log.txt -connect=127.0.0.1:{Multiplayer.LocalServer.ArbiterPort}"; if (GenCommandLine.TryGetCommandLineArg("savedatafolder", out string saveDataFolder)) { args += $" -savedatafolder=\"{saveDataFolder}\""; } string arbiterInstancePath; if (Application.platform == RuntimePlatform.OSXPlayer) { arbiterInstancePath = Application.dataPath + "/MacOS/" + Process.GetCurrentProcess().MainModule.ModuleName; } else { arbiterInstancePath = Process.GetCurrentProcess().MainModule.FileName; } try { Multiplayer.session.arbiter = Process.Start( arbiterInstancePath, args ); ArbiterWhiteWindowHider.HideArbiterProcess(); } catch (Exception ex) { Multiplayer.session.AddMsg("Arbiter failed to start.", false); Log.Error("Arbiter failed to start.", false); Log.Error(ex.ToString()); if (ex.InnerException is Win32Exception) { Log.Error("Win32 Error Code: " + ((Win32Exception)ex).NativeErrorCode.ToString()); } } }