示例#1
0
        internal static ServerInfoPacket Instantiate(PacketReader reader)
        {
            if (!ReadHead <ServerInfoPacket>(reader))
            {
                return(null);
            }

            ServerInfoPacket packet = new ServerInfoPacket();

            packet.Active        = reader.ReadInt();
            packet.Banned        = reader.ReadInt();
            packet.Firewalled    = reader.ReadInt();
            packet.Clients       = reader.ReadInt();
            packet.Mobiles       = reader.ReadInt();
            packet.MobileScripts = reader.ReadInt();
            packet.Items         = reader.ReadInt();
            packet.ItemScripts   = reader.ReadInt();

            packet.UpSecs = reader.ReadUInt();
            packet.Memory = reader.ReadUInt();

            packet.DotNetVersion   = reader.ReadNullString();
            packet.OperatingSystem = reader.ReadNullString();

            return(packet);
        }
示例#2
0
        internal static ServerPacket Instantiate(PacketReader reader)
        {
            if (!ReadHead <AdminCompressedPacket>(reader))
            {
                return(null);
            }

            int uncompressedsize = reader.ReadUShort();

            byte[] CompData = new byte[reader.Length - reader.Position];
            for (int i = 0; i < CompData.Length; i++)
            {
                CompData[i] = reader.ReadByte();
            }

            byte[] InternalPacketOfExactLength = new byte[uncompressedsize];
            Compression.Compression.Unpack(InternalPacketOfExactLength, ref uncompressedsize, CompData, CompData.Length);

            if (InternalPacketOfExactLength.Length > 0)
            {
                switch (InternalPacketOfExactLength[0])
                {
                case 0x02: return(LoginResponsePacket.Instantiate(ConstructReaderForInternalPacket(reader.Version, InternalPacketOfExactLength)));

                case 0x03: return(ConsoleDataPacket.Instantiate(ConstructReaderForInternalPacket(reader.Version, InternalPacketOfExactLength)));

                case 0x04: return(ServerInfoPacket.Instantiate(ConstructReaderForInternalPacket(reader.Version, InternalPacketOfExactLength)));

                case 0x05: return(AccountSearchResults.Instantiate(ConstructReaderForInternalPacket(reader.Version, InternalPacketOfExactLength)));

                case 0x08: return(AdminMessageBox.Instantiate(ConstructReaderForInternalPacket(reader.Version, InternalPacketOfExactLength)));
                }
            }
            return(null);
        }