Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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);
        }