internal static void RunMain(string instanceName, string customPath, bool isService, bool showConsole = true) { var tmp = (isService) ? Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), MyPerServerSettings.GameDSName, instanceName) : Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), MyPerServerSettings.GameDSName); var userDataPath = string.IsNullOrEmpty(customPath) ? tmp : customPath; if (showConsole && Environment.UserInteractive) { MySandboxGame.IsConsoleVisible = true; VRage.Win32.WinApi.AllocConsole(); consoleHandler += new VRage.Win32.WinApi.ConsoleEventHandler(Handler); VRage.Win32.WinApi.SetConsoleCtrlHandler(consoleHandler, true); } VRage.Service.ExitListenerSTA.OnExit += delegate { if (MySandboxGame.Static != null) { MySandboxGame.Static.Exit(); } }; Console.WriteLine(MyPerServerSettings.GameName + " " + MyFinalBuildConstants.APP_VERSION_STRING); Console.WriteLine(String.Format("Is official: {0} {1}", MyFinalBuildConstants.IS_OFFICIAL, (MyObfuscation.Enabled ? "[O]" : "[NO]"))); Console.WriteLine("Environment.Is64BitProcess: " + Environment.Is64BitProcess); MyInitializer.InvokeBeforeRun( MyPerServerSettings.AppId, MyPerServerSettings.GameDSName, userDataPath, DedicatedServer.AddDateToLog); do { RunInternal(); } while (MySandboxGame.IsReloading); MyInitializer.InvokeAfterRun(); }
internal static void RunMain(string instanceName, string customPath, bool isService, bool showConsole = true) { var tmp = (isService) ? Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "SpaceEngineersDedicated", instanceName) : Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "SpaceEngineersDedicated"); var userDataPath = string.IsNullOrEmpty(customPath) ? tmp : customPath; if (showConsole && Environment.UserInteractive) { MySandboxGame.IsConsoleVisible = true; VRage.Win32.WinApi.AllocConsole(); consoleHandler += new VRage.Win32.WinApi.ConsoleEventHandler(Handler); VRage.Win32.WinApi.SetConsoleCtrlHandler(consoleHandler, true); } VRage.Service.ExitListenerSTA.OnExit += delegate { if (MySandboxGame.Static != null) MySandboxGame.Static.Exit(); }; Console.WriteLine("Space engineers " + MyFinalBuildConstants.APP_VERSION_STRING); Console.WriteLine(String.Format("Is official: {0} {1}", MyFinalBuildConstants.IS_OFFICIAL, (MyObfuscation.Enabled ? "[O]" : "[NO]"))); Console.WriteLine("Environment.Is64BitProcess: " + Environment.Is64BitProcess); MyInitializer.InvokeBeforeRun( AppId, "SpaceEngineersDedicated", userDataPath, DedicatedServer.AddDateToLog); RunInternal(); MyInitializer.InvokeAfterRun(); }