Ejemplo n.º 1
0
 public void Save(string path)
 {
     using (FileStream stream1 = File.Open(path, FileMode.Open, FileAccess.ReadWrite, FileShare.None))
     {
         byte[] buffer6;
         stream1.Seek((long)-ID3v1Helper.GetTagSize(stream1), SeekOrigin.End);
         byte[] buffer1 = Encoding.ASCII.GetBytes("TAG");
         byte[] buffer2 = IdSharp.Tagging.ID3v1.ID3v1.SafeGetBytes(this.m_Title);
         byte[] buffer3 = IdSharp.Tagging.ID3v1.ID3v1.SafeGetBytes(this.m_Artist);
         byte[] buffer4 = IdSharp.Tagging.ID3v1.ID3v1.SafeGetBytes(this.m_Album);
         byte[] buffer5 = IdSharp.Tagging.ID3v1.ID3v1.SafeGetBytes(this.m_Year);
         stream1.Write(buffer1, 0, 3);
         IdSharp.Tagging.ID3v1.ID3v1.WriteBytesPadded(stream1, buffer2, 30);
         IdSharp.Tagging.ID3v1.ID3v1.WriteBytesPadded(stream1, buffer3, 30);
         IdSharp.Tagging.ID3v1.ID3v1.WriteBytesPadded(stream1, buffer4, 30);
         IdSharp.Tagging.ID3v1.ID3v1.WriteBytesPadded(stream1, buffer5, 4);
         if (this.m_TagVersion == ID3v1TagVersion.ID3v11)
         {
             buffer6 = IdSharp.Tagging.ID3v1.ID3v1.SafeGetBytes(this.m_Comment);
             IdSharp.Tagging.ID3v1.ID3v1.WriteBytesPadded(stream1, buffer6, 0x1c);
             stream1.WriteByte(0);
             stream1.WriteByte((byte)this.m_TrackNumber);
         }
         else
         {
             buffer6 = IdSharp.Tagging.ID3v1.ID3v1.SafeGetBytes(this.m_Comment);
             IdSharp.Tagging.ID3v1.ID3v1.WriteBytesPadded(stream1, buffer6, 30);
         }
         stream1.WriteByte((byte)this.m_GenreIndex);
     }
 }
Ejemplo n.º 2
0
 public static int GetTagSize(string path)
 {
     Guard.ArgumentNotNullOrEmptyString(path, "path");
     using (FileStream stream1 = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read))
     {
         return(ID3v1Helper.GetTagSize(stream1));
     }
 }
Ejemplo n.º 3
0
 public static bool RemoveTag(string path)
 {
     Guard.ArgumentNotNull(path, "path");
     using (FileStream stream1 = File.Open(path, FileMode.Open, FileAccess.ReadWrite, FileShare.None))
     {
         if (!ID3v1Helper.DoesTagExist(stream1))
         {
             return(false);
         }
         stream1.SetLength(stream1.Length - 0x80);
     }
     return(true);
 }
Ejemplo n.º 4
0
 public static bool DoesTagExist(string path)
 {
     Guard.ArgumentNotNull(path, "path");
     return(ID3v1Helper.GetTagSize(path) != 0);
 }
Ejemplo n.º 5
0
 public static bool DoesTagExist(Stream stream)
 {
     Guard.ArgumentNotNull(stream, "stream");
     return(ID3v1Helper.GetTagSize(stream) != 0);
 }