/// <summary>
            /// Equals the specified <see cref="Id3v2Header"/>.
            /// </summary>
            /// <param name="hdr">The <see cref="Id3v2Header"/>.</param>
            /// <returns>true if equal; false otherwise.</returns>
            public bool Equals(Id3v2Header hdr)
            {
                if (ReferenceEquals(null, hdr))
                    return false;

                if (ReferenceEquals(this, hdr))
                    return true;

                return (Version == hdr.Version) && (Flags == hdr.Flags) && (Size == hdr.Size);
            }
Example #2
0
        ////------------------------------------------------------------------------------------------------------------------------------
        private static void ValidateHeader(Id3v2Tag tag, Id3v2Header header, Id3v2Header footer)
        {
            #if DEBUG
            if (tag == null)
                return;

            if (header != null && footer != null)
            {
                if (header.Version != footer.Version)
                {
                    throw new InvalidDataException(
                        String.Format("The APE header version {0} does not match footer version {1}.", header.Version, footer.Version));
                }

                if (tag.PaddingSize != 0)
                    throw new InvalidDataException("Id3v2 tag can not have padding when footer is set.");
            }

            if (header != null)
            {
            }

            if (footer != null)
            {
                // If the tag is after the MPEG frames and there's no footer.
                if (!tag.UseFooter)
                    throw new InvalidDataException("Footer not found; footer is required for Id3v2 tags at the end of a stream.");
            }
            #else
            return;
            #endif
        }