コード例 #1
0
ファイル: Vorbis.cs プロジェクト: gchudov/taglib-sharp
        /// <summary>
        ///    Replaces the comment packet in a collection of packets
        ///    with the rendered version of a Xiph comment or inserts a
        ///    comment packet if the stream lacks one.
        /// </summary>
        /// <param name="packets">
        ///    A <see cref="ByteVectorCollection" /> object containing
        ///    a collection of packets.
        /// </param>
        /// <param name="comment">
        ///    A <see cref="XiphComment" /> object to store the rendered
        ///    version of in <paramref name="packets" />.
        /// </param>
        /// <exception cref="ArgumentNullException">
        ///    <paramref name="packets" /> or <paramref name="comment"
        ///    /> is <see langword="null" />.
        /// </exception>
        public override void SetCommentPacket(ByteVectorCollection packets,
                                              XiphComment comment)
        {
            if (packets == null)
            {
                throw new ArgumentNullException("packets");
            }

            if (comment == null)
            {
                throw new ArgumentNullException("comment");
            }

            ByteVector data = new ByteVector((byte)0x03);

            data.Add(id);
            data.Add(comment.Render(true));
            if (packets.Count > 1 && PacketType(packets [1]) == 0x03)
            {
                if (data.Count < packets [1].Count)
                {
                    data.Add(new ByteVector(packets [1].Count - data.Count, 0));
                }
                packets [1] = data;
            }
            else
            {
                packets.Insert(1, data);
            }
        }
コード例 #2
0
        public void Insert()
        {
            ByteVectorCollection list = BuildList();

            list.Insert(1, "QUACK");
            Assert.AreEqual("ABC,QUACK,DEF,GHI", list.ToByteVector(",").ToString());
        }
コード例 #3
0
        /// <summary>
        ///    Replaces the comment packet in a collection of packets
        ///    with the rendered version of a Xiph comment or inserts a
        ///    comment packet if the stream lacks one.
        /// </summary>
        /// <param name="packets">
        ///    A <see cref="ByteVectorCollection" /> object containing
        ///    a collection of packets.
        /// </param>
        /// <param name="comment">
        ///    A <see cref="XiphComment" /> object to store the rendered
        ///    version of in <paramref name="packets" />.
        /// </param>
        /// <exception cref="ArgumentNullException">
        ///    <paramref name="packets" /> or <paramref name="comment"
        ///    /> is <see langword="null" />.
        /// </exception>
        public override void SetCommentPacket(ByteVectorCollection packets,
                                              XiphComment comment)
        {
            if (packets == null)
            {
                throw new ArgumentNullException("packets");
            }

            if (comment == null)
            {
                throw new ArgumentNullException("comment");
            }

            ByteVector data = new ByteVector();

            data.Add(magic_signature_comment);
            data.Add(comment.Render(true));
            if (packets.Count > 1 && MagicSignature(packets [1])
                == magic_signature_comment)
            {
                packets [1] = data;
            }
            else
            {
                packets.Insert(1, data);
            }
        }
コード例 #4
0
ファイル: Vorbis.cs プロジェクト: androidhacker/DotNetProjs
		/// <summary>
		///    Replaces the comment packet in a collection of packets
		///    with the rendered version of a Xiph comment or inserts a
		///    comment packet if the stream lacks one.
		/// </summary>
		/// <param name="packets">
		///    A <see cref="ByteVectorCollection" /> object containing
		///    a collection of packets.
		/// </param>
		/// <param name="comment">
		///    A <see cref="XiphComment" /> object to store the rendered
		///    version of in <paramref name="packets" />.
		/// </param>
		/// <exception cref="ArgumentNullException">
		///    <paramref name="packets" /> or <paramref name="comment"
		///    /> is <see langword="null" />.
		/// </exception>
		public override void SetCommentPacket (ByteVectorCollection packets,
		                                       XiphComment comment)
		{
			if (packets == null)
				throw new ArgumentNullException ("packets");
			
			if (comment == null)
				throw new ArgumentNullException ("comment");
			
			ByteVector data = new ByteVector ((byte) 0x03);
			data.Add (id);
			data.Add (comment.Render (true));
			if (packets.Count > 1 && PacketType (packets [1]) == 0x03)
			{
				if (data.Count < packets [1].Count)
					data.Add (new ByteVector (packets [1].Count - data.Count, 0));
				packets [1] = data;
			}
			else
				packets.Insert (1, data);
		}
コード例 #5
0
 public override void SetCommentPacket(ByteVectorCollection packets, XiphComment comment)
 {
     if (packets == null)
     {
         throw new ArgumentNullException("packets");
     }
     if (comment == null)
     {
         throw new ArgumentNullException("comment");
     }
     byte[] data = new byte[] { 0x81 };
     ByteVector item = new ByteVector(data) {
         id,
         comment.Render(1)
     };
     if ((packets.Count > 1) && (PacketType(packets[1]) == 0x81))
     {
         packets[1] = item;
     }
     else
     {
         packets.Insert(1, item);
     }
 }
コード例 #6
0
ファイル: Opus.cs プロジェクト: tcHylmrX/taglib-sharp
		/// <summary>
		///    Replaces the comment packet in a collection of packets
		///    with the rendered version of a Xiph comment or inserts a
		///    comment packet if the stream lacks one.
		/// </summary>
		/// <param name="packets">
		///    A <see cref="ByteVectorCollection" /> object containing
		///    a collection of packets.
		/// </param>
		/// <param name="comment">
		///    A <see cref="XiphComment" /> object to store the rendered
		///    version of in <paramref name="packets" />.
		/// </param>
		/// <exception cref="ArgumentNullException">
		///    <paramref name="packets" /> or <paramref name="comment"
		///    /> is <see langword="null" />.
		/// </exception>
		public override void SetCommentPacket (ByteVectorCollection packets,
		                                       XiphComment comment)
		{
			if (packets == null)
				throw new ArgumentNullException ("packets");

			if (comment == null)
				throw new ArgumentNullException ("comment");

			ByteVector data = new ByteVector ();
			data.Add (magic_signature_comment);
			data.Add (comment.Render (true));
			if (packets.Count > 1 && MagicSignature (packets [1])
						  == magic_signature_comment)
				packets [1] = data;
			else
				packets.Insert (1, data);
		}