diff --git a/Torch.Server/Initializer.cs b/Torch.Server/Initializer.cs index 3a7e11e..f8a7468 100644 --- a/Torch.Server/Initializer.cs +++ b/Torch.Server/Initializer.cs @@ -111,8 +111,15 @@ quit"; init.ContinueWith(x => _server.Start()); Log.Info("Showing UI"); - Console.SetOut(TextWriter.Null); - NativeMethods.FreeConsole(); + +#if !DEBUG + if (!_config.IndependentConsole) + { + Console.SetOut(TextWriter.Null); + NativeMethods.FreeConsole(); + } +#endif + new TorchUI(_server).ShowDialog(); } else diff --git a/Torch.Server/TorchConfig.cs b/Torch.Server/TorchConfig.cs index 0b9fdad..2c90848 100644 --- a/Torch.Server/TorchConfig.cs +++ b/Torch.Server/TorchConfig.cs @@ -72,10 +72,13 @@ namespace Torch.Server [Obsolete("Use vanilla reserved slot config")] public HashSet ReservedPlayers { get; set; } = new HashSet(); - //Prevent reserved players being written to disk, but allow it to bre read + //Prevent reserved players being written to disk, but allow it to be read //remove this when ReservedPlayers is removed private bool ShouldSerializeReservedPlayers() => false; + [Arg("console", "Keeps a separate console window open after the main UI loads.")] + public bool IndependentConsole { get; set; } = false; + [XmlIgnore] private string _path; diff --git a/Torch.Server/TorchServer.cs b/Torch.Server/TorchServer.cs index 4832c9c..c4070cd 100644 --- a/Torch.Server/TorchServer.cs +++ b/Torch.Server/TorchServer.cs @@ -195,8 +195,7 @@ namespace Torch.Server public override void Init(object gameInstance) { base.Init(gameInstance); - var game = gameInstance as MySandboxGame; - if (game != null && MySession.Static != null) + if (gameInstance is MySandboxGame && MySession.Static != null) State = ServerState.Running; else State = ServerState.Stopped; diff --git a/Torch/VRageGame.cs b/Torch/VRageGame.cs index e470878..1065f49 100644 --- a/Torch/VRageGame.cs +++ b/Torch/VRageGame.cs @@ -273,8 +273,7 @@ namespace Torch MySessionLoader.LoadSingleplayerSession(sessionPath); return; } - ulong checkpointSize; - MyObjectBuilder_Checkpoint checkpoint = MyLocalCache.LoadCheckpoint(sessionPath, out checkpointSize); + MyObjectBuilder_Checkpoint checkpoint = MyLocalCache.LoadCheckpoint(sessionPath, out ulong checkpointSize); if (MySession.IsCompatibleVersion(checkpoint)) { if (MyWorkshop.DownloadWorldModsBlocking(checkpoint.Mods, null).Success)