Exemplo n.º 1
0
        protected override void Decode(byte[] content)
        {
            if (content.Length == 0)
            {
                throw new ID3Exception("Contentlength is zero");
            }

            var  info = Header.GetFrameInformation();
            bool url  = false;

            url = (info != null) && info.ID == NAudio.Flac.FrameID.UserURLLinkFrame;

            var      encoding0 = ID3Utils.GetEncoding(content, 0, 1);
            Encoding encoding1 = encoding0;

            if (url)
            {
                encoding1 = ID3Utils.Iso88591;
            }

            int read;

            Description = ID3Utils.ReadString(content, 1, -1, encoding0, out read);

            if (content.Length < read + 1)
            {
                throw new ID3Exception("Frame does not contain any text");
            }

            base.Decode(content, read + 1, -1, encoding1, out read);
        }
Exemplo n.º 2
0
        protected override void Decode(byte[] content)
        {
            int      read;
            Encoding encoding = ID3Utils.GetEncoding(content, 0, 4);

            Language    = ID3Utils.ReadString(content, 1, 3, ID3Utils.Iso88591);
            Description = ID3Utils.ReadString(content, 4, -1, encoding, out read);
            Text        = ID3Utils.ReadString(content, read + 4, -1, encoding);
        }
Exemplo n.º 3
0
        protected override void Decode(byte[] content)
        {
            int offset = 1;

            if (content.Length < 3)
            {
                throw new ID3Exception("Invalid contentlength id=0.");//id -> for debugging
            }
            int read;

            if (_version == ID3Version.ID3v2_2)
            {
                //MimeType = ID3Utils.ReadString(content, offset, 3, ID3Utils.Iso88591, out read);
                MimeType = ID3Utils.ReadString(content, offset, 3, ID3Utils.Iso88591, out read);
                offset  += 3;
            }
            else
            {
                MimeType = ID3Utils.ReadString(content, 1, -1, ID3Utils.Iso88591, out read);
                offset  += read;
            }

            if (content.Length < offset)
            {
                throw new ID3Exception("Invalid contentlength id=1.");
            }

            if (!Enum.IsDefined(typeof(PictureFormat), content[offset]))
            {
                throw new ID3Exception("Invalid pictureformat: 0x{0}", content[offset].ToString("x"));
            }
            Format = (PictureFormat)content[offset++];

            if (content.Length < offset)
            {
                throw new ID3Exception("Invalid contentlength id=2.");
            }
            var descenc = ID3Utils.GetEncoding(content, 0, 2);

            Description = ID3Utils.ReadString(content, offset, -1, descenc, out read);
            offset     += read;

            if (content.Length < offset)
            {
                throw new ID3Exception("Invalid contentlength id=3.");
            }
            RawData = new byte[content.Length - offset];
            Array.Copy(content, offset, RawData, 0, RawData.Length);
        }
Exemplo n.º 4
0
        protected override void Decode(byte[] content)
        {
            int offset = 1;
            int read;

            Price   = ID3Utils.ReadString(content, offset, -1, ID3Utils.Iso88591, out read);
            offset += read;

            IsValidUntil = ID3Utils.ReadString(content, offset, -1, ID3Utils.Iso88591, out read);
            offset      += read;

            ContactURL = ID3Utils.ReadString(content, offset, -1, ID3Utils.Iso88591, out read);
            offset    += read;

            ReceivedType = (ReceivedType)content[offset];
            offset++;

            var encoding = ID3Utils.GetEncoding(content, 0, offset);

            offset++;

            SellerName = ID3Utils.ReadString(content, offset, -1, encoding, out read);
            offset    += read;

            Description = ID3Utils.ReadString(content, offset, -1, encoding, out read);
            offset     += read;

            if (offset < content.Length)
            {
                //we've got a attached logo
                LogoMimeType = ID3Utils.ReadString(content, offset, -1, ID3Utils.Iso88591, out read);
                offset      += read;

                var logoData = new byte[content.Length - offset];
                Array.Copy(content, offset, logoData, 0, logoData.Length);

                Image = ID3Utils.DecodeImage(logoData, LogoMimeType);
            }
        }
Exemplo n.º 5
0
        protected override void Decode(byte[] content)
        {
            Encoding e;
            int      index = 1;

            Strings.Clear();

            e = ID3Utils.GetEncoding(content, 0, 1);
            //int read = 0;
            //e = ID3Utils.GetEncoding2(content, 0, out read);
            //index = read;
            while (index < content.Length)
            {
                int r = 0;
                Strings.Add(ID3Utils.ReadString(content, index, -1, e, out r));
                index += r;
            }

            if (Strings.Count == 0)
            {
                Strings.Add(String.Empty);
            }
        }