Refactor instance management, assorted bugfixes/tweaks

This commit is contained in:
John Gross
2017-07-22 23:11:16 -07:00
parent 3ece4baba6
commit 1fcfe6fb5f
18 changed files with 238 additions and 257 deletions

View File

@@ -19,6 +19,7 @@ using System.Windows.Navigation;
using System.Windows.Shapes;
using Sandbox;
using Torch.API;
using Torch.Server.Managers;
using Timer = System.Timers.Timer;
namespace Torch.Server
@@ -58,7 +59,6 @@ namespace Torch.Server
_config = config;
Dispatcher.Invoke(() =>
{
ConfigControl.LoadDedicatedConfig(config);
InstancePathBox.Text = config.InstancePath;
});
}
@@ -66,7 +66,6 @@ namespace Torch.Server
private void BtnStart_Click(object sender, RoutedEventArgs e)
{
_config.Save();
ConfigControl.SaveConfig();
new Thread(_server.Start).Start();
}
@@ -92,13 +91,15 @@ namespace Torch.Server
//MySandboxGame.Static.Invoke(MySandboxGame.ReloadDedicatedServerSession); use i
}
private void InstancePathBox_OnTextChanged(object sender, TextChangedEventArgs e)
private void InstancePathBox_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
{
var name = ((TextBox)sender).Text;
_config.InstancePath = name;
if (!Directory.Exists(name))
return;
LoadConfig(_config);
_config.InstancePath = name;
_server.GetManager<InstanceManager>().LoadInstance(_config.InstancePath);
}
}
}