Another restart fix and invoke tweaks

This commit is contained in:
John Gross
2017-11-23 10:46:28 -08:00
parent 25e6f27854
commit fe5dfa0ea7
5 changed files with 23 additions and 13 deletions

View File

@@ -14,6 +14,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Xml.Serialization.GeneratedAssembly;
using NLog;
using Sandbox.Engine.Analytics;
using Sandbox.Game.Multiplayer;
using Sandbox.ModAPI;
@@ -297,9 +298,11 @@ namespace Torch.Server
MySandboxGame.Static.Exit();
Log.Info("Server stopped.");
LogManager.Flush();
_stopHandle.Set();
State = ServerState.Stopped;
IsRunning = false;
Process.GetCurrentProcess().Kill();
}
/// <summary>
@@ -309,9 +312,12 @@ namespace Torch.Server
{
var exe = Assembly.GetExecutingAssembly().Location;
((TorchConfig)Config).WaitForPID = Process.GetCurrentProcess().Id.ToString();
Config.Autostart = true;
Process.Start(exe, Config.ToString());
Save(0).Wait();
Stop();
Environment.Exit(0);
LogManager.Flush();
Process.GetCurrentProcess().Kill();
}
/// <inheritdoc/>