public static PlayCountFrame Get(TagLib.Id3v2.Tag tag, bool create)
 {
     PlayCountFrame frame;
     IEnumerator<Frame> enumerator = tag.GetEnumerator();
     try
     {
         while (enumerator.MoveNext())
         {
             Frame current = enumerator.Current;
             frame = current as PlayCountFrame;
             if (frame != null)
             {
                 return frame;
             }
         }
     }
     finally
     {
         if (enumerator == null)
         {
         }
         enumerator.Dispose();
     }
     if (!create)
     {
         return null;
     }
     frame = new PlayCountFrame();
     tag.AddFrame(frame);
     return frame;
 }
        /// <summary>
        ///    Creates a deep copy of the current instance.
        /// </summary>
        /// <returns>
        ///    A new <see cref="Frame" /> object identical to the
        ///    current instance.
        /// </returns>
        public override Frame Clone()
        {
            PlayCountFrame frame = new PlayCountFrame();

            frame.play_count = play_count;
            return(frame);
        }
示例#3
0
        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);
        }
		/// <summary>
		///    Creates a deep copy of the current instance.
		/// </summary>
		/// <returns>
		///    A new <see cref="Frame" /> object identical to the
		///    current instance.
		/// </returns>
		public override Frame Clone ()
		{
			PlayCountFrame frame = new PlayCountFrame ();
			frame.play_count = play_count;
			return frame;
		}
		/// <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;
		}
示例#6
0
		public void TestPlayCountFrame ()
		{
			PlayCountFrame frame = new PlayCountFrame ();
			
			ulong value = 0xFFFFFFFFFFFFFFFF;
			frame.PlayCount = value;
			
			FrameTest (frame, 2, null,
				delegate (ByteVector d, byte v) {
					return new PlayCountFrame (d, v);
				},
				
				delegate (Frame f, string m) {
					PlayCountFrame g = (f as PlayCountFrame);
					Assert.AreEqual (value, g.PlayCount, m);
				});
		}