Ejemplo n.º 1
0
        public static bool ReadTags(Stream strm, out GainTags tags)
        {
            tags = null;

            strm.Seek(0, SeekOrigin.End);
            if (strm.Position < Id3V1Size)
            {
                return(false);
            }

            strm.Seek(-Id3V1Size, SeekOrigin.End);
            var offset   = strm.Position;
            var tagBytes = new byte[Id3V1Size];

            if (strm.Read(tagBytes, 0, Id3V1Size) != Id3V1Size)
            {
                // As we've checked the size before, this might mean reading error.
                return(false);
            }

            var magic = Encoding.ASCII.GetString(tagBytes, 0, Id3V1Magic.Length);

            if (magic != Id3V1Magic)
            {
                return(false);
            }

            tags = new GainTags(TagTypes.Id3v1, 0, offset, tagBytes);
            return(true);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Id3v2 tags start with "ID3" at the current position.
 /// </summary>
 /// <param name="strm">Input stream</param>
 /// <returns>Whether the tags were found</returns>
 public static bool ReadTags(Stream strm, out GainTags tags)
 {
     tags = ReadTagsHeader(strm);
     return(tags != null);
 }
Ejemplo n.º 3
0
 public static bool ReadTags(Stream strm, out GainTags tags)
 {
     tags = null;
     return false;
 }