Refactor server initialization for service support

This commit is contained in:
John Gross
2017-08-24 17:30:38 -07:00
parent ddf465d8c9
commit c0be9c25da
9 changed files with 222 additions and 274 deletions

View File

@@ -144,9 +144,17 @@ namespace Torch.Server
VRage.Service.ExitListenerSTA.OnExit += delegate { MySandboxGame.Static?.Exit(); };
base.Start();
//Stops RunInternal from calling MyFileSystem.InitUserSpecific(null), we call it in InstanceManager.
// Stops RunInternal from calling MyFileSystem.InitUserSpecific(null), we call it in InstanceManager.
MySandboxGame.IsReloading = true;
_dsRunInternal.Invoke();
try
{
_dsRunInternal.Invoke();
}
catch (TargetInvocationException e)
{
// Makes log formatting a little nicer.
throw e.InnerException ?? e;
}
MySandboxGame.Log.Close();
State = ServerState.Stopped;