internal UserAttributeSubpacket(
     UserAttributeSubpacketTag type,
     byte[]         data)
 {
     this.type = type;
     this.data = data;
 }
		internal UserAttributeSubpacket(
            UserAttributeSubpacketTag	type,
            byte[]						data)
        {
            this.type = type;
            this.data = data;
        }
 public IEnumerable<IUserAttributeSubpacket> GetSubpackets(UserAttributeSubpacketTag type)
 {
     for (var i = 0; i != _packets.Length; i++)
     {
         if (_packets[i].SubpacketType == type)
             yield return _packets[i];
     }
 }
 public ExperimentalAttribute(UserAttributeSubpacketTag tag, byte[] data)
     : base(tag, data)
 {
     if (tag < UserAttributeSubpacketTag.Experimental_1 || tag > UserAttributeSubpacketTag.Experimental_11)
     {
         throw new ArgumentException(@"tag must be one of the experimental tags.", "tag");
     }
 }
 public IEnumerable <IUserAttributeSubpacket> GetSubpackets(UserAttributeSubpacketTag type)
 {
     for (var i = 0; i != _packets.Length; i++)
     {
         if (_packets[i].SubpacketType == type)
         {
             yield return(_packets[i]);
         }
     }
 }
Exemplo n.º 6
0
 public UserAttributeSubpacket GetSubpacket(UserAttributeSubpacketTag type)
 {
     for (int i = 0; i != packets.Length; i++)
     {
         if (packets[i].SubpacketType == type)
         {
             return(packets[i]);
         }
     }
     return(null);
 }
        public virtual UserAttributeSubpacket ReadPacket()
        {
            int l = input.ReadByte();

            if (l < 0)
            {
                return(null);
            }

            int  bodyLen    = 0;
            bool longLength = false;

            if (l < 192)
            {
                bodyLen = l;
            }
            else if (l <= 223)
            {
                bodyLen = ((l - 192) << 8) + (input.ReadByte()) + 192;
            }
            else if (l == 255)
            {
                bodyLen = (input.ReadByte() << 24) | (input.ReadByte() << 16)
                          | (input.ReadByte() << 8) | input.ReadByte();
                longLength = true;
            }
            else
            {
                throw new IOException("unrecognised length reading user attribute sub packet");
            }

            int tag = input.ReadByte();

            if (tag < 0)
            {
                throw new EndOfStreamException("unexpected EOF reading user attribute sub packet");
            }

            byte[] data = new byte[bodyLen - 1];
            if (Streams.ReadFully(input, data) < data.Length)
            {
                throw new EndOfStreamException();
            }

            UserAttributeSubpacketTag type = (UserAttributeSubpacketTag)tag;

            switch (type)
            {
            case UserAttributeSubpacketTag.ImageAttribute:
                return(new ImageAttrib(longLength, data));
            }
            return(new UserAttributeSubpacket(type, longLength, data));
        }
		public UserAttributeSubpacket GetSubpacket(
            UserAttributeSubpacketTag type)
        {
            for (int i = 0; i != packets.Length; i++)
            {
                if (packets[i].SubpacketType == type)
                {
                    return packets[i];
                }
            }

			return null;
        }
Exemplo n.º 9
0
        public virtual UserAttributeSubpacket ReadPacket()
        {
            //IL_0091: Unknown result type (might be due to invalid IL or missing references)
            //IL_00ac: Unknown result type (might be due to invalid IL or missing references)
            //IL_00cf: Unknown result type (might be due to invalid IL or missing references)
            int num = input.ReadByte();

            if (num < 0)
            {
                return(null);
            }
            int  num2            = 0;
            bool forceLongLength = false;

            if (num < 192)
            {
                num2 = num;
            }
            else if (num <= 223)
            {
                num2 = (num - 192 << 8) + input.ReadByte() + 192;
            }
            else
            {
                if (num != 255)
                {
                    throw new IOException("unrecognised length reading user attribute sub packet");
                }
                num2            = (input.ReadByte() << 24) | (input.ReadByte() << 16) | (input.ReadByte() << 8) | input.ReadByte();
                forceLongLength = true;
            }
            int num3 = input.ReadByte();

            if (num3 < 0)
            {
                throw new EndOfStreamException("unexpected EOF reading user attribute sub packet");
            }
            byte[] array = new byte[num2 - 1];
            if (Streams.ReadFully(input, array) < array.Length)
            {
                throw new EndOfStreamException();
            }
            UserAttributeSubpacketTag userAttributeSubpacketTag  = (UserAttributeSubpacketTag)num3;
            UserAttributeSubpacketTag userAttributeSubpacketTag2 = userAttributeSubpacketTag;

            if (userAttributeSubpacketTag2 == UserAttributeSubpacketTag.ImageAttribute)
            {
                return(new ImageAttrib(forceLongLength, array));
            }
            return(new UserAttributeSubpacket(userAttributeSubpacketTag, forceLongLength, array));
        }
        public virtual UserAttributeSubpacket ReadPacket()
        {
            int num = this.input.ReadByte();

            if (num < 0)
            {
                return(null);
            }
            bool forceLongLength = false;
            int  num2;

            if (num < 192)
            {
                num2 = num;
            }
            else if (num <= 223)
            {
                num2 = (num - 192 << 8) + this.input.ReadByte() + 192;
            }
            else
            {
                if (num != 255)
                {
                    throw new IOException("unrecognised length reading user attribute sub packet");
                }
                num2            = (this.input.ReadByte() << 24 | this.input.ReadByte() << 16 | this.input.ReadByte() << 8 | this.input.ReadByte());
                forceLongLength = true;
            }
            int num3 = this.input.ReadByte();

            if (num3 < 0)
            {
                throw new EndOfStreamException("unexpected EOF reading user attribute sub packet");
            }
            byte[] array = new byte[num2 - 1];
            if (Streams.ReadFully(this.input, array) < array.Length)
            {
                throw new EndOfStreamException();
            }
            UserAttributeSubpacketTag userAttributeSubpacketTag  = (UserAttributeSubpacketTag)num3;
            UserAttributeSubpacketTag userAttributeSubpacketTag2 = userAttributeSubpacketTag;

            if (userAttributeSubpacketTag2 == UserAttributeSubpacketTag.ImageAttribute)
            {
                return(new ImageAttrib(forceLongLength, array));
            }
            return(new UserAttributeSubpacket(userAttributeSubpacketTag, forceLongLength, array));
        }
        public UserAttributeSubpacket ReadPacket()
        {
            int l = input.ReadByte();

            if (l < 0)
            {
                return(null);
            }
            int bodyLen = 0;

            if (l < 192)
            {
                bodyLen = l;
            }
            else if (l < 223)
            {
                bodyLen = ((l - 192) << 8) + (input.ReadByte()) + 192;
            }
            else if (l == 255)
            {
                bodyLen = (input.ReadByte() << 24) | (input.ReadByte() << 16)
                          | (input.ReadByte() << 8) | input.ReadByte();
            }
            int tag = input.ReadByte();

            if (tag < 0)
            {
                throw new EndOfStreamException("unexpected EOF reading user attribute sub packet");
            }
            byte[] data = new byte[bodyLen - 1];
            this.ReadFully(data, 0, data.Length);
            UserAttributeSubpacketTag type = (UserAttributeSubpacketTag)tag;

            switch (type)
            {
            case UserAttributeSubpacketTag.ImageAttribute:
                return(new ImageAttrib(data));
            }
            return(new UserAttributeSubpacket(type, data));
        }
Exemplo n.º 12
0
 public static void Register <T>(UserAttributeSubpacketTag tag) where T : UserAttributeSubpacket
 {
     _userPackets[tag] = typeof(T);
 }
 public ExperimentalAttribute(UserAttributeSubpacketTag tag, byte[] data)
     : base(tag, data)
 {
     if(tag < UserAttributeSubpacketTag.Experimental_1 || tag > UserAttributeSubpacketTag.Experimental_11)
         throw new ArgumentException(@"tag must be one of the experimental tags.", "tag");
 }
 public IUserAttributeSubpacket GetSubpacket(UserAttributeSubpacketTag type)
 {
     return(this.GetSubpackets(type).FirstOrDefault());
 }
 protected internal UserAttributeSubpacket(UserAttributeSubpacketTag type, bool forceLongLength, byte[] data)
 {
     this.type = type;
     this.longLength = forceLongLength;
     this.data = data;
 }
 protected internal UserAttributeSubpacket(UserAttributeSubpacketTag type, byte[] data)
     : this(type, false, data)
 {
 }
Exemplo n.º 17
0
 public UserAttributeSubpacket(UserAttributeSubpacketTag type, byte[] data)
 {
     _type = type;
     _data = data;
 }
 public IUserAttributeSubpacket GetSubpacket(UserAttributeSubpacketTag type)
 {
     return this.GetSubpackets(type).FirstOrDefault();
 }
Exemplo n.º 19
0
 protected internal UserAttributeSubpacket(UserAttributeSubpacketTag type, bool forceLongLength, byte[] data)
 {
     this.type       = type;
     this.longLength = forceLongLength;
     this.data       = data;
 }
Exemplo n.º 20
0
 protected internal UserAttributeSubpacket(UserAttributeSubpacketTag type, byte[] data)
     : this(type, false, data)
 {
 }
 public UserAttributeSubpacket(UserAttributeSubpacketTag type, byte[] data)
 {
     _type = type;
     _data = data;
 }