/// <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); }
/// <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); }