Many more things use the new reflection system

Project for Torch.Server tests.
Refactoring some of the torch utility classes into a different namespace.
This commit is contained in:
Westin Miller
2017-08-20 23:46:19 -07:00
parent 64eef6cd8e
commit 8d101c4c11
21 changed files with 549 additions and 213 deletions

View File

@@ -19,6 +19,7 @@ using SteamSDK;
using Torch.API;
using Torch.Managers;
using Torch.Server.Managers;
using Torch.Utils;
using VRage.Dedicated;
using VRage.FileSystem;
using VRage.Game;
@@ -121,6 +122,9 @@ namespace Torch.Server
MySandboxGame.Config.Load();
}
[ReflectedStaticMethod(Type = typeof(DedicatedServer), Name = "RunInternal")]
private static Action _dsRunInternal;
/// <inheritdoc />
public override void Start()
{
@@ -134,8 +138,6 @@ namespace Torch.Server
State = ServerState.Starting;
Log.Info("Starting server.");
var runInternal = typeof(DedicatedServer).GetMethod("RunInternal", BindingFlags.Static | BindingFlags.NonPublic);
MySandboxGame.IsDedicated = true;
Environment.SetEnvironmentVariable("SteamAppId", MyPerServerSettings.AppId.ToString());
@@ -144,7 +146,7 @@ namespace Torch.Server
base.Start();
//Stops RunInternal from calling MyFileSystem.InitUserSpecific(null), we call it in InstanceManager.
MySandboxGame.IsReloading = true;
runInternal.Invoke(null, null);
_dsRunInternal.Invoke();
MySandboxGame.Log.Close();
State = ServerState.Stopped;