/// <summary> /// Constructor /// </summary> /// <param name="site">The item's site</param> /// <param name="id">The item's id in the format Q####</param> public Item(Site site, string id) { this.site = site; try { id = id.Substring(1); this.id = int.Parse(id); } catch (FormatException ex) { throw new WikiBotException("The id must be in the form Q####.", ex); } }
/// <summary>This constructor creates Page object with specified title and specified /// Site object. This is preferable constructor. When constructed, new Page object doesn't /// contain text. Use Load() method to get text from live wiki. Or use LoadEx() to get /// both text and metadata via XML export interface.</summary> /// <param name="site">Site object, it must be constructed beforehand.</param> /// <param name="title">Page title as string.</param> /// <returns>Returns Page object.</returns> public Page(Site site, string title) { this.title = title; this.site = site; }
/// <summary>This constructor creates empty Page object without title. Site object with /// default properties is created internally and logged in. Constructing new Site object /// is too slow, avoid using this constructor needlessly.</summary> /// <returns>Returns Page object.</returns> public Page() { this.site = new Site(); }
/// <summary>This constructor creates Page object with specified page's numeric revision ID /// (also called "oldid"). Page title is retrieved automatically in this constructor. /// Site object with default properties is created internally and logged in. Constructing /// new Site object is too slow, don't use this constructor needlessly.</summary> /// <param name="revisionID">Page's numeric revision ID (also called "oldid").</param> /// <returns>Returns Page object.</returns> public Page(Int64 revisionID) { if (revisionID <= 0) throw new ArgumentOutOfRangeException("revisionID", Bot.Msg("Revision ID must be positive.")); this.site = new Site(); lastRevisionID = revisionID.ToString(); GetTitle(); }
/// <summary>This constructor creates Page object with specified title. Site object /// with default properties is created internally and logged in. Constructing /// new Site object is too slow, don't use this constructor needlessly.</summary> /// <param name="title">Page title as string.</param> /// <returns>Returns Page object.</returns> public Page(string title) { this.site = new Site(); this.title = title; }
/// <summary>This constructor creates empty Page object with specified Site object, /// but without title. Avoid using this constructor needlessly.</summary> /// <param name="site">Site object, it must be constructed beforehand.</param> /// <returns>Returns Page object.</returns> public Page(Site site) { this.site = site; }
/// <summary> /// Constructor /// </summary> /// <param name="site">The item's site</param> /// <param name="id">The item's id</param> public Item(Site site, int id) { this.site = site; this.id = id; }
/// <summary> /// Constructor /// </summary> /// <param name="site">The item's site</param> public Item(Site site) { this.site = site; }