Exemple #1
0
        private static void RunServer()
        {
            Console.Write(" 1 - Ark \t 2 - Arma3\n 3 - CS\t 4 - CSGO\n 5 - CSS\t 6 - Dod\n 7 - Gmod\t 8 - L4D\n 9 - L4D2\t 10 - Minecraft\n" +
                          " 11 - TF2\t 12 - Bmdm\n 13 - Cscz\t 14 - Cure\n 15 - Insurgency\t 16 - JustCause2\n 17 - Rust\t 18 - Dods\n" +
                          " 19 - Dst\t 20 - DoubleAction\n 21 - FistfulofFrags\t 22 - Hurtworld\n 23 - KillingFloor\t 24 - NS2\n" +
                          " 25 - Nmrih\t 26 - Opfor\n 27 - Pvkii\t 28 - Quake Live\n Выберите игру: ");
            var key = Console.ReadLine();

            _connectparam = GetLinuxConnect(key);
            if (_connectparam == null)
            {
                return;
            }
            _server = GameServerFactory.Instance.Get(_connectparam);
            var res = _server.Connect();

            _gameparam = new CreateParam
            {
                Slots        = 2,
                GamePort     = 27020,
                GameServerId = _connectparam.GameServerId,
                GamePassword = "",
            };
            res = _server.Create(_gameparam);
            if (!res.Succes)
            {
                Console.WriteLine($"{res.ErrorMessage}");
            }
            var param = GetChangeStatusParam();

            param.TypeStatus = GameHostTypeStatus.Enable;
            res = _server.ChangeStatus(param);
            if (!res.Succes)
            {
                Console.WriteLine($"{res.ErrorMessage}");
            }
            //_server.DataReceived += _server_DataReceived;
            //var res = _server.On(_gameparam);
            //if (res.ServerStates == null) return;
            //foreach (var param in res.ServerStates)
            //    Console.WriteLine($"{param.ParameterName}: {param.ParameterValue}");
        }