public override Frame Clone() { PopularimeterFrame frame = new PopularimeterFrame(user); frame.play_count = play_count; frame.rating = rating; return(frame); }
/// <summary> /// Gets a popularimeter frame from a 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="user"> /// A <see cref="string" /> containing the user to search for /// in the current instance. /// </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="PopularimeterFrame" /> 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 PopularimeterFrame Get(Tag tag, string user, bool create) { PopularimeterFrame popm; foreach (Frame frame in tag) { popm = frame as PopularimeterFrame; if (popm != null && popm.user.Equals(user)) { return(popm); } } if (!create) { return(null); } popm = new PopularimeterFrame(user); tag.AddFrame(popm); return(popm); }
public override Frame Clone () { PopularimeterFrame frame = new PopularimeterFrame (user); frame.play_count = play_count; frame.rating = rating; return frame; }
/// <summary> /// Gets a popularimeter frame from a 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="user"> /// A <see cref="string" /> containing the user to search for /// in the current instance. /// </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="PopularimeterFrame" /> 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 PopularimeterFrame Get (Tag tag, string user, bool create) { PopularimeterFrame popm; foreach (Frame frame in tag) { popm = frame as PopularimeterFrame; if (popm != null && popm.user.Equals (user)) return popm; } if (!create) return null; popm = new PopularimeterFrame (user); tag.AddFrame (popm); return popm; }