Add automatic versioning and server configuration XML in preparation for services

This commit is contained in:
John Gross
2017-02-05 08:26:48 -08:00
parent fa63f3d811
commit d5159dc72a
33 changed files with 501 additions and 216 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -30,7 +31,15 @@ namespace Torch.Server
protected override void OnStart(string[] args)
{
base.OnStart(args);
_server = new TorchServer("Torch");
string configName = args.Length > 0 ? args[0] : "TorchConfig.xml";
var options = new ServerConfig("Torch");
if (File.Exists(configName))
options = ServerConfig.LoadFrom(configName);
else
options.SaveTo(configName);
_server = new TorchServer(options);
_server.Init();
_server.RunArgs = args;
Task.Run(() => _server.Start());