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;
 }
        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);
        }
 public override Frame Clone()
 {
     GeneralEncapsulatedObjectFrame frame = new GeneralEncapsulatedObjectFrame {
         encoding = this.encoding,
         mime_type = this.mime_type,
         file_name = this.file_name,
         description = this.description
     };
     if (this.data != null)
     {
         frame.data = new ByteVector(this.data);
     }
     return frame;
 }
Beispiel #4
0
        public override Frame Clone()
        {
            GeneralEncapsulatedObjectFrame frame = new GeneralEncapsulatedObjectFrame();

            frame.encoding    = encoding;
            frame.mime_type   = mime_type;
            frame.file_name   = file_name;
            frame.description = description;
            if (data != null)
            {
                frame.data = new ByteVector(data);
            }
            return(frame);
        }
Beispiel #5
0
		public void TestGeneralEncapsulatedObjectFrame ()
		{
			GeneralEncapsulatedObjectFrame frame = new GeneralEncapsulatedObjectFrame ();
			
			string name = "TEST.txt";
			string mime = "text/plain";
			string desc = "description";
			ByteVector data = val_sing;
			data.Add (data); data.Add (data); data.Add (data);
			data.Add (data); data.Add (data); data.Add (data);
			data.Add (data); data.Add (data); data.Add (data);
			data.Add (data); data.Add (data); data.Add (data);
			// data.Add (data); data.Add (data); data.Add (data);
			
			
			frame.FileName = name;
			frame.MimeType = mime;
			frame.Description = desc;
			frame.Object = data;
			
			FrameTest (frame, 2,
				delegate (Frame f, StringType e) {
					(f as GeneralEncapsulatedObjectFrame).TextEncoding = e;
				},
				
				delegate (ByteVector d, byte v) {
					return new GeneralEncapsulatedObjectFrame (d, v);
				},
				
				delegate (Frame f, string m) {
					GeneralEncapsulatedObjectFrame g = (f as GeneralEncapsulatedObjectFrame);
					Assert.AreEqual (name, g.FileName, m);
					Assert.AreEqual (mime, g.MimeType, m);
					Assert.AreEqual (desc, g.Description, m);
					Assert.AreEqual (data, g.Object, m);
				});
		}
 /// <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()
 {
     GeneralEncapsulatedObjectFrame frame =
         new GeneralEncapsulatedObjectFrame ();
     frame.encoding = encoding;
     frame.mime_type = mime_type;
     frame.file_name = file_name;
     frame.description = description;
     if (data != null)
         frame.data = new ByteVector (data);
     return frame;
 }
        /// <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;
        }