Refactor and stuff
This commit is contained in:
@@ -9,26 +9,29 @@ using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
using Torch;
|
||||
using Torch.API;
|
||||
|
||||
namespace Torch.Server
|
||||
{
|
||||
public static class Program
|
||||
{
|
||||
private static TorchServer _server = new TorchServer();
|
||||
private static readonly ITorchServer _server = new TorchServer();
|
||||
private static TorchUI _ui;
|
||||
|
||||
[STAThread]
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
_server.Init();
|
||||
_server.Server.RunArgs = new[] { "-console" };
|
||||
_server.RunArgs = new[] { "-console" };
|
||||
_ui = new TorchUI(_server);
|
||||
|
||||
if (args.Contains("-nogui"))
|
||||
_server.Server.StartServer();
|
||||
_server.Start();
|
||||
else
|
||||
StartUI();
|
||||
|
||||
if (args.Contains("-autostart") && !_server.Server.IsRunning)
|
||||
_server.Server.StartServerThread();
|
||||
if (args.Contains("-autostart") && !_server.IsRunning)
|
||||
new Thread(() => _server.Start()).Start();
|
||||
|
||||
Dispatcher.Run();
|
||||
}
|
||||
@@ -36,12 +39,12 @@ namespace Torch.Server
|
||||
public static void StartUI()
|
||||
{
|
||||
Thread.CurrentThread.Name = "UI Thread";
|
||||
_server.UI.Show();
|
||||
_ui.Show();
|
||||
}
|
||||
|
||||
public static void FullRestart()
|
||||
{
|
||||
_server.Server.StopServer();
|
||||
_server.Stop();
|
||||
Process.Start("TorchServer.exe", "-autostart");
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user