Ejemplo n.º 1
0
        private void HandleInformation(ReplyStream stream)
        {
            stream.ReadByte();
            string name            = stream.ReadString();
            string map             = stream.ReadString();
            string gameDirectory   = stream.ReadString();
            string gameDescription = stream.ReadString();
            short  applicationId   = stream.ReadShort();
            int    playersCount    = stream.ReadUnsignedByte();
            int    maximumPlayers  = stream.ReadUnsignedByte();
            int    botCount        = stream.ReadByte();
            String type            = "";

            switch ((int)stream.ReadByte())
            {
            case 'd': type = "Dedicated"; break;

            case 'l': type = "Listen"; break;

            case 'p': type = "TV"; break;
            }

            String os = "";

            switch ((int)stream.ReadByte())
            {
            case 'l': os = "Linux"; break;

            case 'w': os = "Windows"; break;
            }
            bool   passwordRequired = stream.ReadByte() == 1;
            bool   vacSecure        = stream.ReadByte() == 1;
            String version          = stream.ReadString();

            String overall = name + " " + playersCount + "/" + maximumPlayers + " " + map;

            NameValueCollection list = new NameValueCollection(5)
            {
                ["name"]           = name,
                ["map"]            = map,
                ["playersCount"]   = playersCount.ToString(),
                ["maximumPlayers"] = maximumPlayers.ToString(),
                ["type"]           = type,
                ["os"]             = os
            };

            _handler.HandleServerInfo(list);
        }