/// <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); }
/// <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() { UniqueFileIdentifierFrame frame = new UniqueFileIdentifierFrame(owner); if (identifier != null) { frame.identifier = new ByteVector(identifier); } return(frame); }