Example #1
0
        public void Run()
        {
            _server = new TorchServer(_config);

            if (_config.NoGui)
            {
                _server.Init();
                _server.Start();
            }
            else
            {
#if !DEBUG
                if (!_config.IndependentConsole)
                {
                    Console.SetOut(TextWriter.Null);
                    NativeMethods.FreeConsole();
                }
#endif

                var gameThread = new Thread(() =>
                {
                    _server.Init();

                    if (_config.Autostart)
                    {
                        _server.Start();
                    }
                });

                gameThread.Start();

                var ui = new TorchUI(_server);
                ui.ShowDialog();
            }
        }
Example #2
0
        public void Run()
        {
            _server = new TorchServer(_config);
            var init = Task.Run(() => _server.Init()).ContinueWith(x =>
            {
                if (!x.IsFaulted)
                {
                    return;
                }

                Log.Error("Error initializing server.");
                LogException(x.Exception);
            });

            if (!_config.NoGui)
            {
                if (_config.Autostart)
                {
                    init.ContinueWith(x => _server.Start());
                }

                Log.Info("Showing UI");
                Console.SetOut(TextWriter.Null);
                NativeMethods.FreeConsole();
                new TorchUI(_server).ShowDialog();
            }
            else
            {
                init.Wait();
                _server.Start();
            }
        }
Example #3
0
        /// <inheritdoc />
        protected override void OnStart(string[] args)
        {
            base.OnStart(args);

            string configName = args.Length > 0 ? args[0] : "Torch.cfg";
            var    options    = new TorchConfig("Torch");

            if (File.Exists(configName))
            {
                options = TorchConfig.LoadFrom(configName);
            }
            else
            {
                options.Save(configName);
            }

            _server = new TorchServer(options);
            _server.Init();
            _server.RunArgs = args;
            Task.Run(() => _server.Start());
        }
Example #4
0
        public void Run()
        {
            _server = new TorchServer(_config);
            _server.Init();

            if (!_config.NoGui)
            {
                var ui = new TorchUI(_server);
                if (_config.Autostart)
                {
                    new Thread(_server.Start).Start();
                }
                ui.ShowDialog();
            }
            else
            {
                _server.Start();
            }

            _resolver?.Dispose();
        }
Example #5
0
 private void BtnStart_Click(object sender, RoutedEventArgs e)
 {
     _server.DedicatedInstance.SaveConfig();
     Task.Run(() => _server.Start());
 }
Example #6
0
 private void BtnStart_Click(object sender, RoutedEventArgs e)
 {
     Task.Run(() => _server.Start());
 }