コード例 #1
0
        public static ServerInfo Parse(byte[] serverInfo)
        {
            var si  = new ServerInfo();
            var sbr = new SourceByteReader(serverInfo);

            sbr.ReadByte();
            sbr.ReadByte();
            sbr.ReadByte();
            sbr.ReadByte();
            sbr.ReadByte();
            sbr.ReadByte();

            si.ServerName = sbr.ReadString();
            si.Map        = sbr.ReadString();
            si.Mod        = sbr.ReadString();
            si.GameName   = sbr.ReadString();

            sbr.ReadByte();
            sbr.ReadByte();

            si.PlayerCount = sbr.ReadByte();
            sbr.ReadByte();
            si.Bots = sbr.ReadByte();

            return(si);
        }
コード例 #2
0
ファイル: ChallengeInfo.cs プロジェクト: micshr/Arma3Console
        public static ChallengeInfo Parse(byte[] challengeInfo)
        {
            var ci = new ChallengeInfo();

            var sbr = new SourceByteReader(challengeInfo);

            sbr.ReadBytes(5);

            byte[] result = new byte[5 + 4];
            Array.Copy(Request.A2S_SERVERQUERY_GETCHALLENGE_REQUEST, 0, result, 0, 5);

            Array.Copy(sbr.ReadBytes(4), 0, result, 5, 4);

            ci.Challenge = result;

            return(ci);
        }
コード例 #3
0
        public static List <PlayerInfo> Parse(byte[] playerInfo)
        {
            var players = new List <PlayerInfo>();
            var sbr     = new SourceByteReader(playerInfo);

            sbr.ReadBytes(5);

            byte playerCount = sbr.ReadByte();

            for (byte i = 0; i < playerCount; i++)
            {
                sbr.ReadByte();
                var pi = new PlayerInfo();
                pi.Name     = sbr.ReadString();
                pi.Score    = sbr.ReadInt32();
                pi.Playtime = sbr.ReadFloat();
                players.Add(pi);
            }


            return(players);
        }