Пример #1
0
        private int ReadTagHeader(StreamAccessor accessor, out bool unsync)
        {
            const string DIFF_VERSION = @"読み込もうとしている ID3 タグの版は 2.{0}.{1}です。 
この関数では 2.3.0 の読み取りにしか対応していません。";

            //-------------------------------------------------------

            if (accessor.ReadString(EncodingType.CC3) != "ID3")
            {
                throw new FileFormatException("読み込もうとしているバイナリストリームは ID3 タグではありません。");
            }

            byte minor    = accessor.ReadByte(EncodingType.U1);
            byte revision = accessor.ReadByte(EncodingType.U1);

            if (minor != 3 || revision != 0)
            {
                throw new FileFormatException(string.Format(DIFF_VERSION, minor, revision));
            }

            byte flags = accessor.ReadByte(EncodingType.U1);

            unsync            = (flags & 0x80) != 0;
            this.has_ext      = (flags & 0x40) != 0;
            this.experimental = (flags & 0x20) != 0;

            return(accessor.ReadInt32(EncodingType.Int28BE));
        }