Rename to Torch, add command system
This commit is contained in:
49
Torch.Server/Program.cs
Normal file
49
Torch.Server/Program.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
using Torch;
|
||||
|
||||
namespace Torch.Server
|
||||
{
|
||||
public static class Program
|
||||
{
|
||||
private static TorchServer _server = new TorchServer();
|
||||
|
||||
[STAThread]
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
_server.Init();
|
||||
_server.Server.RunArgs = new[] { "-console" };
|
||||
|
||||
if (args.Contains("-nogui"))
|
||||
_server.Server.StartServer();
|
||||
else
|
||||
StartUI();
|
||||
|
||||
if (args.Contains("-autostart") && !_server.Server.IsRunning)
|
||||
_server.Server.StartServerThread();
|
||||
|
||||
Dispatcher.Run();
|
||||
}
|
||||
|
||||
public static void StartUI()
|
||||
{
|
||||
Thread.CurrentThread.Name = "UI Thread";
|
||||
_server.UI.Show();
|
||||
}
|
||||
|
||||
public static void FullRestart()
|
||||
{
|
||||
_server.Server.StopServer();
|
||||
Process.Start("TorchServer.exe", "-autostart");
|
||||
Environment.Exit(1);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user