コード例 #1
0
ファイル: ID3v2Builder.cs プロジェクト: elfen20/cave-media
        /// <summary>Retrieves the tag as byte array.</summary>
        /// <returns></returns>
        public byte[] ToArray()
        {
            var buffer             = new FifoBuffer();
            ID3v2HeaderFlags flags = ID3v2HeaderFlags.None;

            /* we do not like extended headers so we won't write them
             * if (m_ExtendedHeader != null)
             * {
             *  buffer.Enqueue(m_ExtendedHeader.Data);
             *  flags |= ID3v2HeaderFlags.ExtendedHeader;
             * }
             */
            foreach (ID3v2Frame frame in frames)
            {
                buffer.Enqueue(frame.RawData);
            }
            int bodySize = buffer.Length;

            // no one likes footers so we won't write them
            var header = new ID3v2Header(Header.Version, Header.Revision, flags, bodySize);

            buffer.Prepend(header.Data);
            return(buffer.ToArray());
        }