using System;
using System.Collections.Generic;
using System.Text;
namespace ScrewTurn.Wiki.PluginFramework {
///
/// Contains the Content of a Page.
///
public class PageContent {
///
/// The PageInfo object.
///
protected PageInfo pageInfo;
///
/// The Title of the Page.
///
protected string title;
///
/// The Username of the user who modified the Page.
///
protected string user;
///
/// The Date/Time of the last modification.
///
protected DateTime lastModified;
///
/// The comment of the editor, about this revision.
///
protected string comment;
///
/// The Content of the Page (WikiMarkup).
///
protected string content;
///
/// The keywords, usually used for SEO.
///
protected string[] keywords;
///
/// The page description, usually used for SEO.
///
protected string description;
///
/// The Pages linked in this Page (both existent and inexistent).
///
protected string[] linkedPages = new string[0];
///
/// Initializes a new instance of the class.
///
/// The PageInfo object.
/// The Title.
/// The User that last modified the Page.
/// The last modification Date and Time.
/// The Comment of the editor, about this revision.
/// The unparsed Content.
/// The keywords, usually used for SEO, or null.
/// The description, usually used for SEO, or null.
public PageContent(PageInfo pageInfo, string title, string user, DateTime lastModified, string comment, string content,
string[] keywords, string description) {
this.pageInfo = pageInfo;
this.title = title;
this.user = user;
this.lastModified = lastModified;
this.content = content;
this.comment = comment;
this.keywords = keywords != null ? keywords : new string[0];
this.description = description;
}
///
/// Gets the PageInfo.
///
public PageInfo PageInfo {
get { return pageInfo; }
}
///
/// Gets the Title.
///
public string Title {
get { return title; }
}
///
/// Gets the User.
///
public string User {
get { return user; }
}
///
/// Gets the last modification Date and Time.
///
public DateTime LastModified {
get { return lastModified; }
}
///
/// Gets the Comment of the editor, about this revision.
///
public string Comment {
get { return comment; }
}
///
/// Gets the unformatted Content.
///
public string Content {
get { return content; }
}
///
/// Gets the keywords, usually used for SEO.
///
public string[] Keywords {
get { return keywords; }
}
///
/// Gets the description, usually used for SEO.
///
public string Description {
get { return description; }
}
///
/// Gets or sets the Linked Pages, both existent and inexistent.
///
public string[] LinkedPages {
get { return linkedPages; }
set { linkedPages = value; }
}
///
/// Determines whether the current instance was built using .
///
/// True if the instance is empty, false otherwise.
public bool IsEmpty() {
return this is EmptyPageContent;
}
///
/// Gets an empty instance of .
///
/// The page.
/// The instance.
public static PageContent GetEmpty(PageInfo page) {
return new EmptyPageContent(page);
}
///
/// Represents an empty page content.
///
private class EmptyPageContent : PageContent {
///
/// Initializes a new instance of the class.
///
/// The page the content refers to.
public EmptyPageContent(PageInfo page)
: base(page, "", "", DateTime.MinValue, "", "", null, "") { }
}
}
}