Files
Torch/Torch.Server/Program.cs
2016-12-17 01:59:03 -08:00

50 lines
1.2 KiB
C#

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);
}
}
}