当前位置: 首页>>代码示例>>C#>>正文


C# TagLib.GetFrames方法代码示例

本文整理汇总了C#中TagLib.GetFrames方法的典型用法代码示例。如果您正苦于以下问题:C# TagLib.GetFrames方法的具体用法?C# TagLib.GetFrames怎么用?C# TagLib.GetFrames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TagLib的用法示例。


在下文中一共展示了TagLib.GetFrames方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Get

 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;
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:33,代码来源:GeneralEncapsulatedObjectFrame.cs

示例2: Get

 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;
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:31,代码来源:RelativeVolumeFrame.cs

示例3: Get

 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;
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:31,代码来源:UnsynchronisedLyricsFrame.cs

示例4: GetPreferred

 public static TermsOfUseFrame GetPreferred(TagLib.Id3v2.Tag tag, string language)
 {
     TermsOfUseFrame frame = null;
     IEnumerator<Frame> enumerator = tag.GetFrames(FrameType.USER).GetEnumerator();
     try
     {
         while (enumerator.MoveNext())
         {
             Frame current = enumerator.Current;
             TermsOfUseFrame frame3 = current as TermsOfUseFrame;
             if (frame3 != null)
             {
                 if (frame3.Language == language)
                 {
                     return frame3;
                 }
                 if (frame == null)
                 {
                     frame = frame3;
                 }
             }
         }
     }
     finally
     {
         if (enumerator == null)
         {
         }
         enumerator.Dispose();
     }
     return frame;
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:32,代码来源:TermsOfUseFrame.cs

示例5: Get

 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;
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:34,代码来源:AttachedPictureFrame.cs

示例6: Get

 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;
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:30,代码来源:TermsOfUseFrame.cs

示例7: Get

 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;
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:31,代码来源:UniqueFileIdentifierFrame.cs

示例8: GetDate

        public static string GetDate(TagLib.Id3v2.Tag tag)
        {
            String date = "";
            var frames = tag.GetFrames<TagLib.Id3v2.TextInformationFrame>("TDRC");
            foreach (TagLib.Id3v2.TextInformationFrame frame in frames)
            {
                foreach (string text in frame.Text)
                    if (text.Length > date.Length)
                        date = text;
            }

            return date;
        }
开发者ID:gclark916,项目名称:Howler,代码行数:13,代码来源:ID3v2Tagger.cs

示例9: Get

 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;
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:41,代码来源:UserTextInformationFrame.cs

示例10: GetPreferred

 public static CommentsFrame GetPreferred(TagLib.Id3v2.Tag tag, string description, string language)
 {
     bool flag = (description == null) || !description.StartsWith("iTun");
     int num = -1;
     CommentsFrame frame = null;
     IEnumerator<Frame> enumerator = tag.GetFrames(FrameType.COMM).GetEnumerator();
     try
     {
         while (enumerator.MoveNext())
         {
             Frame current = enumerator.Current;
             CommentsFrame frame3 = current as CommentsFrame;
             if ((frame3 != null) && (!flag || !frame3.Description.StartsWith("iTun")))
             {
                 bool flag2 = frame3.Description == description;
                 bool flag3 = frame3.Language == language;
                 if (flag2 && flag3)
                 {
                     return frame3;
                 }
                 int num2 = !flag3 ? (!flag2 ? 0 : 1) : 2;
                 if (num2 > num)
                 {
                     num = num2;
                     frame = frame3;
                 }
             }
         }
     }
     finally
     {
         if (enumerator == null)
         {
         }
         enumerator.Dispose();
     }
     return frame;
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:38,代码来源:CommentsFrame.cs

示例11: GetPreferred

 public static UnsynchronisedLyricsFrame GetPreferred(TagLib.Id3v2.Tag tag, string description, string language)
 {
     int num = -1;
     UnsynchronisedLyricsFrame frame = null;
     IEnumerator<Frame> enumerator = tag.GetFrames(FrameType.USLT).GetEnumerator();
     try
     {
         while (enumerator.MoveNext())
         {
             Frame current = enumerator.Current;
             UnsynchronisedLyricsFrame frame3 = current as UnsynchronisedLyricsFrame;
             if (frame3 != null)
             {
                 bool flag = frame3.Description == description;
                 bool flag2 = frame3.Language == language;
                 if (flag && flag2)
                 {
                     return frame3;
                 }
                 int num2 = !flag2 ? (!flag ? 0 : 1) : 2;
                 if (num2 > num)
                 {
                     num = num2;
                     frame = frame3;
                 }
             }
         }
     }
     finally
     {
         if (enumerator == null)
         {
         }
         enumerator.Dispose();
     }
     return frame;
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:37,代码来源:UnsynchronisedLyricsFrame.cs

示例12: Get

 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;
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:37,代码来源:TextInformationFrame.cs

示例13: StoreRating

        // Overwrites all POPM frames with the new rating and playcount.
        // If no *known-compatible* frames are found, a new "Banshee"-authored
        // frame is also created to store this information.
        public static void StoreRating(int rating, TagLib.Id3v2.Tag id3v2tag)
        {
            bool howlerPopmFound = false;
            var popmFrames = id3v2tag.GetFrames<TagLib.Id3v2.PopularimeterFrame>();
            foreach (TagLib.Id3v2.PopularimeterFrame popm in popmFrames)
            {
                switch(popm.User)
                {
                    case "Banshee":
                    case "[email protected]":
                        // A Howler "0" rating is saved as a Banshee "1" because
                        // Banshee interprets a POPM of 0 as no rating
                        if (rating == 0)
                            popm.Rating = BansheeToPopm(1);
                        else
                        {
                            int bansheeRating = (int)Math.Ceiling((double)rating / 5.0);
                            popm.Rating = BansheeToPopm(bansheeRating);
                        }
                        break;
                    case "Windows Media Player 9 Series":
                    case "[email protected]":
                        popm.Rating = MediaMonkeyToPopm(rating);
                        break;
                    case "Howler":
                        popm.Rating = HowlerToPopm(rating);
                        howlerPopmFound = true;
                        break;
                    default:
                        System.Console.Out.Write("Unrecognized POPM user {0}", popm.User);
                        break;
                }
            }

            if (!howlerPopmFound)
            {
                // Create a Howler popm frame if it doesn't exist
                TagLib.Id3v2.PopularimeterFrame popm = TagLib.Id3v2.PopularimeterFrame.Get(id3v2tag,
                                                                                            HowlerUsername,
                                                                                            true);
                popm.Rating = HowlerToPopm(rating);
            }
        }
开发者ID:gclark916,项目名称:Howler,代码行数:46,代码来源:ID3v2Tagger.cs

示例14: StorePlayCount

        public static void StorePlayCount(int playcount, TagLib.Id3v2.Tag id3v2tag)
        {
            bool known_frames_found = false;
            foreach (TagLib.Id3v2.PopularimeterFrame popm in
                        id3v2tag.GetFrames<TagLib.Id3v2.PopularimeterFrame>())
            {
                if (System.Array.IndexOf(POPM_known_creator_list, popm.User) >= 0)
                {
                    // Found a known-good POPM frame, don't need to create a "Banshee" frame.
                    known_frames_found = true;
                }

                popm.PlayCount = (ulong)playcount;
            }

            if (!known_frames_found)
            {
                // No known-good frames found, create a new POPM frame (with creator string "Banshee")
                TagLib.Id3v2.PopularimeterFrame popm = TagLib.Id3v2.PopularimeterFrame.Get(id3v2tag,
                                                                                            HowlerUsername,
                                                                                            true);
                popm.PlayCount = (ulong)playcount;
            }
        }
开发者ID:gclark916,项目名称:Howler,代码行数:24,代码来源:ID3v2Tagger.cs

示例15: GetUserTextFrame

 string GetUserTextFrame(TagLib.Id3v2.Tag id3v2, string description)
 {
     return id3v2
         .GetFrames<UserTextInformationFrame>()
         .Where(f => String.Equals(f.Description, description, StringComparison.CurrentCultureIgnoreCase))
         .SelectMany(f => f.Text)
         .FirstOrDefault();
 }
开发者ID:rdingwall,项目名称:mixplanner,代码行数:8,代码来源:Id3Reader.cs


注:本文中的TagLib.GetFrames方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。