コード例 #1
0
        public static ServerRulesResult Parse(byte[] bytes)
        {
            var result = new ServerRulesResult();
            var parser = new ResponseParser(bytes);

            parser.CurrentPosition += 7;
            while (parser.BytesLeft)
            {
                result.Add(parser.GetStringToTermination(), parser.GetStringToTermination());
            }
            return(result);
        }
コード例 #2
0
        public static ServerPlayers Parse(byte[] data)
        {
            var parser = new ResponseParser(data);

            parser.CurrentPosition += 5; //Header
            var result = new ServerPlayers();


            result.PlayerCount = parser.GetByte();

            result.Players = new PlayerInfo[result.PlayerCount];

            for (var i = 0; i < result.PlayerCount; i++)
            {
                var p = new PlayerInfo();

                p.N     = parser.GetByte();
                p.Name  = parser.GetStringToTermination();
                p.Score = parser.GetLong();
                p.Time  = TimeSpan.FromSeconds(parser.GetDouble());

                //parser.CurrentPosition+=4;

                result.Players[i] = p;


                //break;
            }


            return(result);
        }
コード例 #3
0
ファイル: ServerPlayers.cs プロジェクト: svargy/arma3beclient
        public static ServerPlayers Parse(byte[] data)
        {
            var parser = new ResponseParser(data);
            parser.CurrentPosition += 5; //Header
            var result = new ServerPlayers();

            result.PlayerCount = parser.GetByte();

            result.Players = new PlayerInfo[result.PlayerCount];

            for (var i = 0; i < result.PlayerCount; i++)
            {
                var p = new PlayerInfo();

                p.N = parser.GetByte();
                p.Name = parser.GetStringToTermination();
                p.Score = parser.GetLong();
                p.Time = TimeSpan.FromSeconds(parser.GetDouble());

                //parser.CurrentPosition+=4;

                result.Players[i] = p;

                //break;
            }

            return result;
        }
コード例 #4
0
        public static ServerInfoResult Parse(byte[] data)
        {
            var parser = new ResponseParser(data);
            parser.CurrentPosition += 5; //Header
            var result = new ServerInfoResult();
            result.Protocol = parser.GetByte();
            result.Name = parser.GetStringToTermination();
            result.Map = parser.GetStringToTermination();
            result.Folder = parser.GetStringToTermination();
            result.Game = parser.GetStringToTermination();
            result.ID = parser.GetShort();
            result.Players = parser.GetByte();
            result.MaxPlayers = parser.GetByte();
            result.Bots = parser.GetByte();
            result.ServerType = parser.GetStringOfByte();
            result.Environment = parser.GetStringOfByte();
            result.Visibility = parser.GetByte();
            result.VAC = parser.GetByte();
            result.Version = parser.GetStringToTermination();

            //get EDF
            uint edf = parser.GetByte();

            if ((edf & 0x80) != 0) //has port number
            {
                result.Port = parser.GetShort();
            }

            return result;
        }