コード例 #1
0
ファイル: Id3v1.cs プロジェクト: mc0re/MP3Gain
        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);
        }
コード例 #2
0
ファイル: Id3v2.cs プロジェクト: mc0re/MP3Gain
 /// <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);
 }
コード例 #3
0
ファイル: Apev2.cs プロジェクト: mc0re/MP3Gain
 public static bool ReadTags(Stream strm, out GainTags tags)
 {
     tags = null;
     return false;
 }