public override Frame Clone () { CommentsFrame frame = new CommentsFrame (description, language, encoding); frame.text = text; return frame; }
/// <summary> /// Gets a specified comments 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="language"> /// A <see cref="string" /> specifying the ISO-639-2 language /// code 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="CommentsFrame" /> 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 CommentsFrame Get (Tag tag, string description, string language, bool create) { CommentsFrame comm; foreach (Frame frame in tag.GetFrames (FrameType.COMM)) { comm = frame as CommentsFrame; if (comm == null) continue; if (comm.Description != description) continue; if (language != null && language != comm.Language) continue; return comm; } if (!create) return null; comm = new CommentsFrame (description, language); tag.AddFrame (comm); return comm; }