コード例 #1
0
 public static PopularimeterFrame Get(TagLib.Id3v2.Tag tag, string user, bool create)
 {
     PopularimeterFrame frame;
     IEnumerator<Frame> enumerator = tag.GetEnumerator();
     try
     {
         while (enumerator.MoveNext())
         {
             Frame current = enumerator.Current;
             frame = current as PopularimeterFrame;
             if ((frame != null) && frame.user.Equals(user))
             {
                 return frame;
             }
         }
     }
     finally
     {
         if (enumerator == null)
         {
         }
         enumerator.Dispose();
     }
     if (!create)
     {
         return null;
     }
     frame = new PopularimeterFrame(user);
     tag.AddFrame(frame);
     return frame;
 }
コード例 #2
0
 public static MusicCdIdentifierFrame Get(TagLib.Id3v2.Tag tag, bool create)
 {
     MusicCdIdentifierFrame frame;
     IEnumerator<Frame> enumerator = tag.GetEnumerator();
     try
     {
         while (enumerator.MoveNext())
         {
             Frame current = enumerator.Current;
             frame = current as MusicCdIdentifierFrame;
             if (frame != null)
             {
                 return frame;
             }
         }
     }
     finally
     {
         if (enumerator == null)
         {
         }
         enumerator.Dispose();
     }
     if (!create)
     {
         return null;
     }
     frame = new MusicCdIdentifierFrame();
     tag.AddFrame(frame);
     return frame;
 }
コード例 #3
0
 public static UnsynchronisedLyricsFrame Get(TagLib.Id3v2.Tag tag, string description, string language, bool create)
 {
     UnsynchronisedLyricsFrame frame;
     IEnumerator<Frame> enumerator = tag.GetFrames(FrameType.USLT).GetEnumerator();
     try
     {
         while (enumerator.MoveNext())
         {
             Frame current = enumerator.Current;
             frame = current as UnsynchronisedLyricsFrame;
             if (((frame != null) && (frame.Description == description)) && ((language == null) || (language == frame.Language)))
             {
                 return frame;
             }
         }
     }
     finally
     {
         if (enumerator == null)
         {
         }
         enumerator.Dispose();
     }
     if (!create)
     {
         return null;
     }
     frame = new UnsynchronisedLyricsFrame(description, language);
     tag.AddFrame(frame);
     return frame;
 }
コード例 #4
0
 public static GeneralEncapsulatedObjectFrame Get(TagLib.Id3v2.Tag tag, string description, bool create)
 {
     GeneralEncapsulatedObjectFrame frame;
     IEnumerator<Frame> enumerator = tag.GetFrames(FrameType.GEOB).GetEnumerator();
     try
     {
         while (enumerator.MoveNext())
         {
             Frame current = enumerator.Current;
             frame = current as GeneralEncapsulatedObjectFrame;
             if ((frame != null) && (frame.Description == description))
             {
                 return frame;
             }
         }
     }
     finally
     {
         if (enumerator == null)
         {
         }
         enumerator.Dispose();
     }
     if (!create)
     {
         return null;
     }
     frame = new GeneralEncapsulatedObjectFrame {
         Description = description
     };
     tag.AddFrame(frame);
     return frame;
 }
コード例 #5
0
 public static SynchronisedLyricsFrame Get(TagLib.Id3v2.Tag tag, string description, string language, SynchedTextType type, bool create)
 {
     IEnumerator<Frame> enumerator = tag.GetEnumerator();
     try
     {
         while (enumerator.MoveNext())
         {
             Frame current = enumerator.Current;
             SynchronisedLyricsFrame frame2 = current as SynchronisedLyricsFrame;
             if (((frame2 != null) && ((frame2.Description == description) && ((language == null) || (language == frame2.Language)))) && (type == frame2.Type))
             {
                 return frame2;
             }
         }
     }
     finally
     {
         if (enumerator == null)
         {
         }
         enumerator.Dispose();
     }
     if (!create)
     {
         return null;
     }
     SynchronisedLyricsFrame frame3 = new SynchronisedLyricsFrame(description, language, type);
     tag.AddFrame(frame3);
     return frame3;
 }
コード例 #6
0
 public static RelativeVolumeFrame Get(TagLib.Id3v2.Tag tag, string identification, bool create)
 {
     RelativeVolumeFrame frame;
     IEnumerator<Frame> enumerator = tag.GetFrames(FrameType.RVA2).GetEnumerator();
     try
     {
         while (enumerator.MoveNext())
         {
             Frame current = enumerator.Current;
             frame = current as RelativeVolumeFrame;
             if ((frame != null) && (frame.Identification == identification))
             {
                 return frame;
             }
         }
     }
     finally
     {
         if (enumerator == null)
         {
         }
         enumerator.Dispose();
     }
     if (!create)
     {
         return null;
     }
     frame = new RelativeVolumeFrame(identification);
     tag.AddFrame(frame);
     return frame;
 }
コード例 #7
0
 public static TermsOfUseFrame Get(TagLib.Id3v2.Tag tag, string language, bool create)
 {
     IEnumerator<Frame> enumerator = tag.GetFrames(FrameType.USER).GetEnumerator();
     try
     {
         while (enumerator.MoveNext())
         {
             Frame current = enumerator.Current;
             TermsOfUseFrame frame2 = current as TermsOfUseFrame;
             if ((frame2 != null) && ((language == null) || (language == frame2.Language)))
             {
                 return frame2;
             }
         }
     }
     finally
     {
         if (enumerator == null)
         {
         }
         enumerator.Dispose();
     }
     if (!create)
     {
         return null;
     }
     TermsOfUseFrame frame3 = new TermsOfUseFrame(language);
     tag.AddFrame(frame3);
     return frame3;
 }
コード例 #8
0
 public static UniqueFileIdentifierFrame Get(TagLib.Id3v2.Tag tag, string owner, bool create)
 {
     UniqueFileIdentifierFrame frame;
     IEnumerator<Frame> enumerator = tag.GetFrames(FrameType.UFID).GetEnumerator();
     try
     {
         while (enumerator.MoveNext())
         {
             Frame current = enumerator.Current;
             frame = current as UniqueFileIdentifierFrame;
             if ((frame != null) && (frame.Owner == owner))
             {
                 return frame;
             }
         }
     }
     finally
     {
         if (enumerator == null)
         {
         }
         enumerator.Dispose();
     }
     if (!create)
     {
         return null;
     }
     frame = new UniqueFileIdentifierFrame(owner, null);
     tag.AddFrame(frame);
     return frame;
 }
コード例 #9
0
 public static UserTextInformationFrame Get(TagLib.Id3v2.Tag tag, string description, StringType type, bool create)
 {
     if (tag == null)
     {
         throw new ArgumentNullException("tag");
     }
     if (description == null)
     {
         throw new ArgumentNullException("description");
     }
     if (description.Length == 0)
     {
         throw new ArgumentException("Description must not be empty.", "description");
     }
     IEnumerator<UserTextInformationFrame> enumerator = tag.GetFrames<UserTextInformationFrame>(FrameType.TXXX).GetEnumerator();
     try
     {
         while (enumerator.MoveNext())
         {
             UserTextInformationFrame current = enumerator.Current;
             if (description.Equals(current.Description))
             {
                 return current;
             }
         }
     }
     finally
     {
         if (enumerator == null)
         {
         }
         enumerator.Dispose();
     }
     if (!create)
     {
         return null;
     }
     UserTextInformationFrame frame2 = new UserTextInformationFrame(description, type);
     tag.AddFrame(frame2);
     return frame2;
 }
コード例 #10
0
 public static TextInformationFrame Get(TagLib.Id3v2.Tag tag, ByteVector ident, StringType encoding, bool create)
 {
     if (tag == null)
     {
         throw new ArgumentNullException("tag");
     }
     if (ident == null)
     {
         throw new ArgumentNullException("ident");
     }
     if (ident.Count != 4)
     {
         throw new ArgumentException("Identifier must be four bytes long.", "ident");
     }
     IEnumerator<TextInformationFrame> enumerator = tag.GetFrames<TextInformationFrame>(ident).GetEnumerator();
     try
     {
         while (enumerator.MoveNext())
         {
             return enumerator.Current;
         }
     }
     finally
     {
         if (enumerator == null)
         {
         }
         enumerator.Dispose();
     }
     if (!create)
     {
         return null;
     }
     TextInformationFrame frame = new TextInformationFrame(ident, encoding);
     tag.AddFrame(frame);
     return frame;
 }
コード例 #11
0
 public static AttachedPictureFrame Get(TagLib.Id3v2.Tag tag, string description, PictureType type, bool create)
 {
     AttachedPictureFrame frame;
     IEnumerator<Frame> enumerator = tag.GetFrames(FrameType.APIC).GetEnumerator();
     try
     {
         while (enumerator.MoveNext())
         {
             Frame current = enumerator.Current;
             frame = current as AttachedPictureFrame;
             if (((frame != null) && ((description == null) || (frame.Description == description))) && ((type == PictureType.Other) || (frame.Type == type)))
             {
                 return frame;
             }
         }
     }
     finally
     {
         if (enumerator == null)
         {
         }
         enumerator.Dispose();
     }
     if (!create)
     {
         return null;
     }
     frame = new AttachedPictureFrame {
         Description = description,
         Type = type
     };
     tag.AddFrame(frame);
     return frame;
 }