コード例 #1
0
        private void GetStat()
        {
            var iphost = _ipService.GetIpAddress(Host);
            var server = new Arma3BEClient.Steam.Server(new IPEndPoint(IPAddress.Parse(iphost), Port));

            var settings = new GetServerInfoSettings();
            var rules    = server.GetServerRulesSync(settings);

            ServerRules =
                rules.Select(
                    x =>
                    new Tuple <string, string>(x.Key,
                                               x.Value)).ToList();

            var serverInfoR =
                server.GetServerInfoSync(settings);

            var props = serverInfoR.GetType().GetProperties();

            ServerInfo =
                props.Select(
                    x =>
                    new Tuple <string, string>(x.Name,
                                               x.GetValue(serverInfoR)
                                               .ToString())).ToList();

            ServerPlayers =
                server.GetServerChallengeSync(settings);


            OnPropertyChanged(nameof(ServerRules));
            OnPropertyChanged(nameof(ServerInfo));
            OnPropertyChanged(nameof(ServerPlayers));
        }
コード例 #2
0
        public ServerMonitorSteamQueryViewModel(string host, int port, ILog log)
        {
            _log = log;
            Host = host;
            Port = port + 1;

            RaisePropertyChanged("Host");
            RaisePropertyChanged("Port");

            ExcecuteCommand = new ActionCommand(() => Task.Run(() =>
            {
                var iphost = IPHelper.GetIPAddress(Host);
                var server = new Server(new IPEndPoint(IPAddress.Parse(iphost), Port));

                var settings = new GetServerInfoSettings();
                var rules = server.GetServerRulesSync(settings);
                _serverRules =
                    rules.Select(
                        x =>
                            new Tuple<string, string>(x.Key,
                                x.Value)).ToList();

                var serverInfo =
                    server.GetServerInfoSync(settings);

                var props = serverInfo.GetType().GetProperties();

                _serverInfo =
                    props.Select(
                        x =>
                            new Tuple<string, string>(x.Name,
                                x.GetValue(serverInfo)
                                    .ToString())).ToList();

                _serverPlayers =
                    server.GetServerChallengeSync(settings);

                RaisePropertyChanged("ServerRules");
                RaisePropertyChanged("ServerInfo");
                RaisePropertyChanged("ServerPlayers");

            }),
                () =>
                {
                    var iphost = IPHelper.GetIPAddress(Host);

                    if (string.IsNullOrEmpty(iphost))
                    {
                        return false;
                    }
                    return true;
                });
        }
コード例 #3
0
        private void CheckServer(ServerInfoDto serverInfo)
        {
            var iphost = _ipService.GetIpAddress(serverInfo.Host);
            var server = new Arma3BEClient.Steam.Server(new IPEndPoint(IPAddress.Parse(iphost), serverInfo.SteamPort));

            var settings = new GetServerInfoSettings();
            var rules    = server.GetServerInfoSync(settings);

            if (string.Compare(rules.Environment, "w", StringComparison.Ordinal) != 0)
            {
                ShowWarning = true;
            }
        }