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


C# Tag.AddFrame方法代码示例

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


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

示例1: Get

		public static UserTextInformationFrame Get (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");
			
			foreach (UserTextInformationFrame frame in
				tag.GetFrames<UserTextInformationFrame> (
					FrameType.TXXX))
				if (description.Equals (frame.Description))
					return frame;
			
			if (!create)
				return null;
			
			UserTextInformationFrame new_frame =
				new UserTextInformationFrame (description,
					type);
			tag.AddFrame (new_frame);
			return new_frame;
		}
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:31,代码来源:TextIdentificationFrame.cs

示例2: Get

        /// <summary>
        ///    Gets a <see cref="UrlLinkFrame" /> object of a
        ///    specified type from a specified tag, optionally creating
        ///    and adding one with a specified encoding if none is
        ///    found.
        /// </summary>
        /// <param name="tag">
        ///    A <see cref="Tag" /> object to search for the specified
        ///    tag in.
        /// </param>
        /// <param name="ident">
        ///    A <see cref="ByteVector" /> object containing the frame
        ///    identifer to search for.
        /// </param>
        /// <param name="create">
        ///    A <see cref="bool" /> value specifying whether or not to
        ///    create a new frame if an existing frame was not found.
        /// </param>
        /// <returns>
        ///    A <see cref="UrlLinkFrame" /> object containing
        ///    the frame found in or added to <paramref name="tag" /> or
        ///    <see langword="null" /> if no value was found <paramref
        ///    name="create" /> is <see langword="false" />.
        /// </returns>
        /// <remarks>
        ///    To create a frame without having to specify the encoding,
        ///    use <see cref="Get(Tag,ByteVector,bool)" />.
        /// </remarks>
        /// <exception cref="ArgumentNullException">
        ///    <paramref name="tag" /> or <paramref name="type" /> is
        ///    <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentException">
        ///    <paramref name="type" /> is not exactly four bytes long.
        /// </exception>
        public static UrlLinkFrame Get(Tag tag,
            ByteVector ident,
            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");

              foreach (UrlLinkFrame frame in
            tag.GetFrames<UrlLinkFrame>(ident))
            return frame;

              if (!create)
            return null;

              UrlLinkFrame new_frame =
            new UrlLinkFrame(ident);
              tag.AddFrame(new_frame);
              return new_frame;
        }
开发者ID:sanyaade-embedded-systems,项目名称:MPTagThat,代码行数:62,代码来源:UrlLinkFrame.cs

示例3: Get

		/// <summary>
		///    Gets a specified picture frame from the specified tag,
		///    optionally creating it if it does not exist.
		/// </summary>
		/// <param name="tag">
		///    A <see cref="Tag" /> object to search in.
		/// </param>
		/// <param name="description">
		///    A <see cref="string" /> specifying the description to
		///    match.
		/// </param>
		/// <param name="type">
		///    A <see cref="PictureType" /> specifying the picture type
		///    to match.
		/// </param>
		/// <param name="create">
		///    A <see cref="bool" /> specifying whether or not to create
		///    and add a new frame to the tag if a match is not found.
		/// </param>
		/// <returns>
		///    A <see cref="AttachedPictureFrame" /> object containing
		///    the matching frame, or <see langword="null" /> if a match
		///    wasn't found and <paramref name="create" /> is <see
		///    langword="false" />.
		/// </returns>
		/// <example>
		///    <para>Sets a cover image with a description. Because <see
		///    cref="Get(Tag,string,PictureType,bool)" /> is used, if
		///    the program is called again with the same audio file and
		///    desciption, the picture will be overwritten with the new
		///    one.</para>
		///    <code lang="C#">
		/// using TagLib;
		/// using TagLib.Id3v2;
		///
		/// public static class SetId3v2Cover
		/// {
		/// 	public static void Main (string [] args)
		/// 	{
		/// 		if (args.Length != 3)
		/// 			throw new ApplicationException (
		/// 				"USAGE: SetId3v2Cover.exe AUDIO_FILE PICTURE_FILE DESCRIPTION");
		///
		/// 		// Create the file. Can throw file to TagLib# exceptions.
		/// 		File file = File.Create (args [0]);
		///
		/// 		// Get or create the ID3v2 tag.
		/// 		TagLib.Id3v2.Tag tag = file.GetTag (TagTypes.Id3v2, true) as TagLib.Id3v2.Tag;
		/// 		if (tag == null)
		/// 			throw new ApplicationException ("File does not support ID3v2 tags.");
		///
		/// 		// Create a picture. Can throw file related exceptions.
		///		TagLib.Picture picture = TagLib.Picture.CreateFromPath (args [1]);
		///
		/// 		// Get or create the picture frame.
		/// 		AttachedPictureFrame frame = AttachedPictureFrame.Get (
		/// 			tag, args [2], PictureType.FrontCover, true);
		///
		/// 		// Set the data from the picture.
		/// 		frame.MimeType = picture.MimeType;
		/// 		frame.Data     = picture.data;
		/// 		
		/// 		// Save the file.
		/// 		file.Save ();
		/// 	}
		/// }
		///    </code>
		/// </example>
		public static AttachedPictureFrame Get (Tag tag,
		                                        string description,
		                                        PictureType type,
		                                        bool create)
		{
			AttachedPictureFrame apic;
			foreach (Frame frame in tag.GetFrames (FrameType.APIC)) {
				apic = frame as AttachedPictureFrame;
				
				if (apic == null)
					continue;
				
				if (description != null && apic.Description != description)
					continue;
				
				if (type != PictureType.Other && apic.Type != type)
					continue;
				
				return apic;
			}
			
			if (!create)
				return null;
			
			apic = new AttachedPictureFrame ();
			apic.Description = description;
			apic.Type = type;
			
			tag.AddFrame (apic);
			
			return apic;
		}
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:100,代码来源:AttachedPictureFrame.cs

示例4: Get

		/// <summary>
		///    Gets a specified comments frame from the specified tag,
		///    optionally creating it if it does not exist.
		/// </summary>
		/// <param name="tag">
		///    A <see cref="Tag" /> object to search in.
		/// </param>
		/// <param name="description">
		///    A <see cref="string" /> specifying the description to
		///    match.
		/// </param>
		/// <param name="language">
		///    A <see cref="string" /> specifying the ISO-639-2 language
		///   code to match.
		/// </param>
		/// <param name="create">
		///    A <see cref="bool" /> specifying whether or not to create
		///    and add a new frame to the tag if a match is not found.
		/// </param>
		/// <returns>
		///    A <see cref="CommentsFrame" /> object containing the
		///    matching frame, or <see langword="null" /> if a match
		///    wasn't found and <paramref name="create" /> is <see
		///    langword="false" />.
		/// </returns>
		public static CommentsFrame Get (Tag tag, string description,
		                                 string language, bool create)
		{
			CommentsFrame comm;
			foreach (Frame frame in tag.GetFrames (FrameType.COMM)) {
				comm = frame as CommentsFrame;
				
				if (comm == null)
					continue;
				
				if (comm.Description != description)
					continue;
				
				if (language != null && language != comm.Language)
					continue;
				
				return comm;
			}
			
			if (!create)
				return null;
			
			comm = new CommentsFrame (description, language);
			tag.AddFrame (comm);
			return comm;
		}
开发者ID:JohnThomson,项目名称:taglib-sharp,代码行数:51,代码来源:CommentsFrame.cs

示例5: Get

		/// <summary>
		///    Gets a specified terms of use frame from the specified
		///    tag, optionally creating it if it does not exist.
		/// </summary>
		/// <param name="tag">
		///    A <see cref="Tag" /> object to search in.
		/// </param>
		/// <param name="language">
		///    A <see cref="string" /> specifying the ISO-639-2 language
		///   code to match.
		/// </param>
		/// <param name="create">
		///    A <see cref="bool" /> specifying whether or not to create
		///    and add a new frame to the tag if a match is not found.
		/// </param>
		/// <returns>
		///    A <see cref="TermsOfUseFrame" /> object containing the
		///    matching frame, or <see langword="null" /> if a match
		///    wasn't found and <paramref name="create" /> is <see
		///    langword="false" />.
		/// </returns>
		public static TermsOfUseFrame Get (Tag tag, string language,
		                                   bool create)
		{
			foreach (Frame f in tag.GetFrames (FrameType.USER)) {
				TermsOfUseFrame cf = f as TermsOfUseFrame;
				
				if (cf != null && (language == null ||
					language == cf.Language))
					return cf;
			}
			
			if (!create)
				return null;
			
			TermsOfUseFrame frame = new TermsOfUseFrame (language);
			tag.AddFrame (frame);
			return frame;
		}
开发者ID:JohnThomson,项目名称:taglib-sharp,代码行数:39,代码来源:TermsOfUseFrame.cs

示例6: Get

		/// <summary>
		///    Gets a specified private frame from the specified tag,
		///    optionally creating it if it does not exist.
		/// </summary>
		/// <param name="tag">
		///    A <see cref="Tag" /> object to search in.
		/// </param>
		/// <param name="owner">
		///    A <see cref="string" /> specifying the owner to match.
		/// </param>
		/// <param name="create">
		///    A <see cref="bool" /> specifying whether or not to create
		///    and add a new frame to the tag if a match is not found.
		/// </param>
		/// <returns>
		///    A <see cref="PrivateFrame" /> object containing the
		///    matching frame, or <see langword="null" /> if a match
		///    wasn't found and <paramref name="create" /> is <see
		///    langword="false" />.
		/// </returns>
		public static PrivateFrame Get (Tag tag, string owner,
		                                bool create)
		{
			PrivateFrame priv;
			
			foreach (Frame frame in tag.GetFrames (FrameType.PRIV)) {
				priv = frame as PrivateFrame;
				if (priv != null && priv.Owner == owner)
					return priv;
			}
			
			if (!create)
				return null;
			
			priv = new PrivateFrame (owner);
			tag.AddFrame (priv);
			return priv;
		}
开发者ID:JohnThomson,项目名称:taglib-sharp,代码行数:38,代码来源:PrivateFrame.cs

示例7: Get

		/// <summary>
		///    Gets a music CD identifier frame from a specified tag,
		///    optionally creating it if it does not exist.
		/// </summary>
		/// <param name="tag">
		///    A <see cref="Tag" /> object to search in.
		/// </param>
		/// <param name="create">
		///    A <see cref="bool" /> specifying whether or not to create
		///    and add a new frame to the tag if a match is not found.
		/// </param>
		/// <returns>
		///    A <see cref="MusicCdIdentifierFrame" /> object containing
		///    the matching frame, or <see langword="null" /> if a match
		///    wasn't found and <paramref name="create" /> is <see
		///    langword="false" />.
		/// </returns>
		public static MusicCdIdentifierFrame Get (Tag tag, bool create)
		{
			MusicCdIdentifierFrame mcdi;
			foreach (Frame frame in tag) {
				mcdi = frame as MusicCdIdentifierFrame;
				
				if (mcdi != null)
					return mcdi;
			}
			
			if (!create)
				return null;
			
			mcdi = new MusicCdIdentifierFrame ();
			tag.AddFrame (mcdi);
			return mcdi;
		}
开发者ID:JohnThomson,项目名称:taglib-sharp,代码行数:34,代码来源:MusicCdIdentifierFrame.cs

示例8: Get

		/// <summary>
		///    Gets a specified unique file identifer frame from the
		///    specified tag, optionally creating it if it does not
		///    exist.
		/// </summary>
		/// <param name="tag">
		///    A <see cref="Tag" /> object to search in.
		/// </param>
		/// <param name="owner">
		///    A <see cref="string" /> specifying the owner to match.
		/// </param>
		/// <param name="create">
		///    A <see cref="bool" /> specifying whether or not to create
		///    and add a new frame to the tag if a match is not found.
		/// </param>
		/// <returns>
		///    A <see cref="UserTextInformationFrame" /> object
		///    containing the matching frame, or <see langword="null" />
		///    if a match wasn't found and <paramref name="create" /> is
		///    <see langword="false" />.
		/// </returns>
		public static UniqueFileIdentifierFrame Get (Tag tag,
		                                             string owner,
		                                             bool create)
		{
			UniqueFileIdentifierFrame ufid;
			
			foreach (Frame frame in tag.GetFrames (FrameType.UFID)) {
				ufid = frame as UniqueFileIdentifierFrame;
				
				if (ufid == null)
					continue;
				
				if (ufid.Owner == owner)
					return ufid;
			}
			
			if (!create)
				return null;
			
			ufid = new UniqueFileIdentifierFrame (owner, null);
			tag.AddFrame (ufid);
			return ufid;
		}
开发者ID:JohnThomson,项目名称:taglib-sharp,代码行数:44,代码来源:UniqueFileIdentifierFrame.cs

示例9: Get

        /// <summary>
        ///    Gets a specified lyrics frame from the specified tag,
        ///    optionally creating it if it does not exist.
        /// </summary>
        /// <param name="tag">
        ///    A <see cref="Tag" /> object to search in.
        /// </param>
        /// <param name="description">
        ///    A <see cref="string" /> object specifying the description
        ///    to match.
        /// </param>
        /// <param name="language">
        ///    A <see cref="string" /> object specifying the ISO-639-2
        ///    language code to match.
        /// </param>
        /// <param name="type">
        ///    A <see cref="SynchedTextType" /> value specifying the
        ///    text type to match.
        /// </param>
        /// <param name="create">
        ///    A <see cref="bool" /> specifying whether or not to create
        ///    and add a new frame to the tag if a match is not found.
        /// </param>
        /// <returns>
        ///    A <see cref="SynchronisedLyricsFrame" /> object
        ///    containing the matching frame, or <see langword="null" />
        ///    if a match wasn't found and <paramref name="create" /> is
        ///    <see langword="false" />.
        /// </returns>
        public static SynchronisedLyricsFrame Get(Tag tag,
            string description,
            string language,
            SynchedTextType type,
            bool create)
        {
            foreach (Frame f in tag) {
                SynchronisedLyricsFrame lyr =
                    f as SynchronisedLyricsFrame;

                if (lyr == null)
                    continue;

                if (lyr.Description == description &&
                    (language == null ||
                        language == lyr.Language) &&
                    type == lyr.Type)
                    return lyr;
            }

            if (!create)
                return null;

            SynchronisedLyricsFrame frame =
                new SynchronisedLyricsFrame (description,
                    language, type);
            tag.AddFrame (frame);
            return frame;
        }
开发者ID:sanyaade-embedded-systems,项目名称:MPTagThat,代码行数:58,代码来源:SynchronizedLyricsFrame.cs

示例10: Get

		/// <summary>
		///    Gets a play count frame from a specified tag, optionally
		///    creating it if it does not exist.
		/// </summary>
		/// <param name="tag">
		///    A <see cref="Tag" /> object to search in.
		/// </param>
		/// <param name="create">
		///    A <see cref="bool" /> specifying whether or not to create
		///    and add a new frame to the tag if a match is not found.
		/// </param>
		/// <returns>
		///    A <see cref="PlayCountFrame" /> object containing the
		///    matching frame, or <see langword="null" /> if a match
		///    wasn't found and <paramref name="create" /> is <see
		///    langword="false" />.
		/// </returns>
		public static PlayCountFrame Get (Tag tag, bool create)
		{
			PlayCountFrame pcnt;
			foreach (Frame frame in tag) {
				pcnt = frame as PlayCountFrame;
				
				if (pcnt != null)
					return pcnt;
			}
			
			if (!create)
				return null;
			
			pcnt = new PlayCountFrame ();
			tag.AddFrame (pcnt);
			return pcnt;
		}
开发者ID:JohnThomson,项目名称:taglib-sharp,代码行数:34,代码来源:PlayCountFrame.cs

示例11: Get

        /// <summary>
        ///    Gets a specified encapsulated object frame from the
        ///    specified tag, optionally creating it if it does not
        ///    exist.
        /// </summary>
        /// <param name="tag">
        ///    A <see cref="Tag" /> object to search in.
        /// </param>
        /// <param name="description">
        ///    A <see cref="string" /> specifying the description to
        ///    match.
        /// </param>
        /// <param name="create">
        ///    A <see cref="bool" /> specifying whether or not to create
        ///    and add a new frame to the tag if a match is not found.
        /// </param>
        /// <returns>
        ///    A <see cref="GeneralEncapsulatedObjectFrame" /> object
        ///    containing the matching frame, or <see langword="null" />
        ///    if a match wasn't found and <paramref name="create" /> is
        ///    <see langword="false" />.
        /// </returns>
        public static GeneralEncapsulatedObjectFrame Get(Tag tag,
            string description,
            bool create)
        {
            GeneralEncapsulatedObjectFrame geob;
            foreach (Frame frame in tag.GetFrames (FrameType.GEOB)) {
                geob = frame as GeneralEncapsulatedObjectFrame;

                if (geob == null)
                    continue;

                if (geob.Description != description)
                    continue;

                return geob;
            }

            if (!create)
                return null;

            geob = new GeneralEncapsulatedObjectFrame ();
            geob.Description = description;
            tag.AddFrame (geob);
            return geob;
        }
开发者ID:sanyaade-embedded-systems,项目名称:MPTagThat,代码行数:47,代码来源:GeneralEncapsulatedObjectFrame.cs

示例12: Get

 public static UnsynchronisedLyricsFrame Get (Tag tag, string description, string language, bool create)
 {
    foreach (Frame f in tag.GetFrames (FrameType.USLT))
    {
       UnsynchronisedLyricsFrame cf = f as UnsynchronisedLyricsFrame;
       
       if (cf != null && cf.Description == description && (language == null || language == cf.Language))
          return cf;
    }
    
    if (!create)
       return null;
    
    UnsynchronisedLyricsFrame frame = new UnsynchronisedLyricsFrame (description, language);
    tag.AddFrame (frame);
    return frame;
 }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:17,代码来源:UnsynchronisedLyricsFrame.cs

示例13: Get

		/// <summary>
		///    Gets a specified lyrics frame from the specified tag,
		///    optionally creating it if it does not exist.
		/// </summary>
		/// <param name="tag">
		///    A <see cref="Tag" /> object to search in.
		/// </param>
		/// <param name="description">
		///    A <see cref="string" /> specifying the description to
		///    match.
		/// </param>
		/// <param name="language">
		///    A <see cref="string" /> specifying the ISO-639-2 language
		///   code to match.
		/// </param>
		/// <param name="create">
		///    A <see cref="bool" /> specifying whether or not to create
		///    and add a new frame to the tag if a match is not found.
		/// </param>
		/// <returns>
		///    A <see cref="UnsynchronisedLyricsFrame" /> object
		///    containing the matching frame, or <see langword="null" />
		///    if a match wasn't found and <paramref name="create" /> is
		///    <see langword="false" />.
		/// </returns>
		public static UnsynchronisedLyricsFrame Get (Tag tag,
		                                             string description,
		                                             string language,
		                                             bool create)
		{
			UnsynchronisedLyricsFrame uslt;
			foreach (Frame frame in tag.GetFrames (FrameType.USLT)) {
				uslt = frame as UnsynchronisedLyricsFrame;
				
				if (uslt == null)
					continue;
				
				if (uslt.Description != description)
					continue;
				
				if (language != null && language != uslt.Language)
					continue;
				
				return uslt;
			}
			
			if (!create)
				return null;
			
			uslt = new UnsynchronisedLyricsFrame (description,
				language);
			tag.AddFrame (uslt);
			return uslt;
		}
开发者ID:JohnThomson,项目名称:taglib-sharp,代码行数:54,代码来源:UnsynchronisedLyricsFrame.cs

示例14: Get

        /// <summary>
        ///    Gets a specified volume adjustment frame from the
        ///    specified tag, optionally creating it if it does not
        ///    exist.
        /// </summary>
        /// <param name="tag">
        ///    A <see cref="Tag" /> object to search in.
        /// </param>
        /// <param name="identification">
        ///    A <see cref="string" /> specifying the identification to
        ///    match.
        /// </param>
        /// <param name="create">
        ///    A <see cref="bool" /> specifying whether or not to create
        ///    and add a new frame to the tag if a match is not found.
        /// </param>
        /// <returns>
        ///    A <see cref="RelativeVolumeFrame" /> object containing
        ///    the matching frame, or <see langword="null" /> if a match
        ///    wasn't found and <paramref name="create" /> is <see
        ///    langword="false" />.
        /// </returns>
        public static RelativeVolumeFrame Get(Tag tag,
            string identification,
            bool create)
        {
            RelativeVolumeFrame rva2;
            foreach (Frame frame in tag.GetFrames (FrameType.RVA2)) {
                rva2 = frame as RelativeVolumeFrame;

                if (rva2 == null)
                    continue;

                if (rva2.Identification != identification)
                    continue;

                return rva2;
            }

            if (!create)
                return null;

            rva2 = new RelativeVolumeFrame (identification);
            tag.AddFrame (rva2);
            return rva2;
        }
开发者ID:sanyaade-embedded-systems,项目名称:MPTagThat,代码行数:46,代码来源:RelativeVolumeFrame.cs

示例15: Get

		/// <summary>
		///    Gets a popularimeter frame from a specified tag,
		///    optionally creating it if it does not exist.
		/// </summary>
		/// <param name="tag">
		///    A <see cref="Tag" /> object to search in.
		/// </param>
		/// <param name="user">
		///    A <see cref="string" /> containing the user to search for
		///    in the current instance.
		/// </param>
		/// <param name="create">
		///    A <see cref="bool" /> specifying whether or not to create
		///    and add a new frame to the tag if a match is not found.
		/// </param>
		/// <returns>
		///    A <see cref="PopularimeterFrame" /> object containing the
		///    matching frame, or <see langword="null" /> if a match
		///    wasn't found and <paramref name="create" /> is <see
		///    langword="false" />.
		/// </returns>
		public static PopularimeterFrame Get (Tag tag, string user,
		                                      bool create)
		{
			PopularimeterFrame popm;
			foreach (Frame frame in tag) {
				popm = frame as PopularimeterFrame;
				
				if (popm != null && popm.user.Equals (user))
					return popm;
			}
			
			if (!create)
				return null;
			
			popm = new PopularimeterFrame (user);
			tag.AddFrame (popm);
			return popm;
		}
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:39,代码来源:PopularimeterFrame.cs


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