Esempio n. 1
0
        public SharedItem(AresTCPPacketReader packet)
        {
            this.Mime = (Mime)packet.ReadByte();
            this.Size = packet.ReadUInt32();
            ushort len = packet.ReadUInt16();
            this.SearchWords = Encoding.UTF8.GetString(packet.ReadBytes(len)).ToUpper();
            this.Data = packet.ReadBytes();
            this.FileName = null;
            this.Title = null;

            packet = new AresTCPPacketReader(this.Data);
            packet.SkipBytes(18); // 16 guid + 2 detail len

            switch (this.Mime)
            {
                case Mime.ARES_MIME_MP3:
                    packet.SkipBytes(4);
                    break;

                case Mime.ARES_MIME_VIDEO:
                    packet.SkipBytes(6);
                    break;

                case Mime.ARES_MIME_IMAGE:
                    packet.SkipBytes(5);
                    break;
            }

            while (packet.Remaining > 2)
            {
                byte size = packet.ReadByte();
                byte type = packet.ReadByte();

                if (packet.Remaining < size)
                    break;

                byte[] data = packet.ReadBytes(size);

                switch (type)
                {
                    case 1:
                        this.Title = Encoding.UTF8.GetString(data);
                        break;

                    case 15:
                        this.FileName = Encoding.UTF8.GetString(data);
                        break;
                }
            }

            if (this.FileName != null)
                if (this.Title == null)
                    this.Title = this.FileName;
        }
Esempio n. 2
0
        private static void ProcessCustomEmoteUpload(UserObject userobj, AresTCPPacketReader packet)
        {
            if (!Settings.CanCustomEmotes)
                return;

            ProcessSupportsCustomEmotes(userobj);

            CustomEmoticon emoticon = new CustomEmoticon
            {
                Shortcut = packet.ReadString(),
                Size = packet.ReadByte(),
                Image = packet.ReadBytes()
            };

            userobj.CustomEmoticons.Add(emoticon);

            if (userobj.CustomEmoticons.Count > 16)
                throw new Exception("exceeded custom emoticon maximum");

            byte[] buf = CustomPackets.CustomEmoteItem(userobj, emoticon);

            UserPool.Users.ForEach(x =>
            {
                if (x.LoggedIn && x.Vroom == userobj.Vroom)
                    if (x.SupportsCustomEmoticons)
                        x.SendPacket(buf);
            });
        }
Esempio n. 3
0
 private static void ProcessVCSupported(UserObject userobj, AresTCPPacketReader packet)
 {
     if (Settings.CanVoiceChat)
     {
         userobj.CanVCPublic = packet.ReadByte() == 1;
         userobj.CanVCPrivate = packet.ReadByte() == 1;
         UserPool.BroadcastToVroom(userobj.Vroom, CustomPackets.VoiceChatUserSupport(userobj));
     }
 }
Esempio n. 4
0
 private static void ProcessCustomFont(UserObject userobj, AresTCPPacketReader packet)
 {
     if (packet.Remaining == 2)
     {
         userobj.Font = null;
         UserPool.BroadcastToVroom(userobj.Vroom, CustomPackets.CustomFontDefault(userobj));
     }
     else
     {
         userobj.Font = new Font(packet.ReadByte(), packet.ReadString(), packet.ReadByte(), packet.ReadByte());
         UserPool.BroadcastToVroom(userobj.Vroom, CustomPackets.CustomFont(userobj));
     }
 }
Esempio n. 5
0
 public void PopulateCredentials(AresTCPPacketReader packet)
 {
     this.Guid = packet.ReadGuid();
     this.FileCount = packet.ReadUInt16();
     packet.SkipByte(); // not used
     this.Port = packet.ReadUInt16();
     this.NodeIP = packet.ReadIP();
     this.NodePort = packet.ReadUInt16();
     packet.SkipBytes(4); // line speed
     this.OrgName = packet.ReadString();
     this.OrgName = UserPool.PrepareUserName(this);
     this.name = this.OrgName;
     this.Version = packet.ReadString();
     this.LocalIP = packet.ReadIP();
     packet.SkipBytes(4); // external ip
     this.CanBrowse = packet.ReadByte() >= 3;
     this.FileCount = this.CanBrowse ? this.FileCount : (ushort)0;
     this.CurrentUploads = packet.ReadByte();
     this.MaxUploads = packet.ReadByte();
     this.CurrentQueued = packet.ReadByte();
     this.Age = packet.ReadByte();
     this.Sex = packet.ReadByte();
     this.Country = packet.ReadByte();
     this.Location = packet.ReadString();
     this.Muzzled = Muzzles.IsMuzzled(this);
 }