Exemplo n.º 1
0
        private void PacketHandler_0x7B_RequestMetafile(Object obj, ClientPacket packet)
        {
            var user = (User) obj;
            var all = packet.ReadBoolean();

            if (all)
            {
                var x6F = new ServerPacket(0x6F);
                x6F.WriteBoolean(all);
                x6F.WriteUInt16((ushort) Metafiles.Count);
                foreach (var metafile in Metafiles.Values)
                {
                    x6F.WriteString8(metafile.Name);
                    x6F.WriteUInt32(metafile.Checksum);
                }
                user.Enqueue(x6F);
            }
            else
            {
                var name = packet.ReadString8();
                if (Metafiles.ContainsKey(name))
                {
                    var file = Metafiles[name];

                    var x6F = new ServerPacket(0x6F);
                    x6F.WriteBoolean(all);
                    x6F.WriteString8(file.Name);
                    x6F.WriteUInt32(file.Checksum);
                    x6F.WriteUInt16((ushort) file.Data.Length);
                    x6F.Write(file.Data);
                    user.Enqueue(x6F);
                }
            }
        }