📄 ihost.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Net.Mail;
namespace ScrewTurn.Wiki.PluginFramework {
/// <summary>
/// It is the interface that the ScrewTurn Wiki's Host object implements.
/// </summary>
public interface IHost {
/// <summary>
/// Gets the values of the Wiki Settings.
/// </summary>
/// <param name="name">The Setting's Name.</param>
/// <returns>The Setting's value.</returns>
string GetSettingValue(SettingName name);
/// <summary>
/// Gets the list of the Pages (read-only).
/// </summary>
PageInfo[] AllPages { get; }
/// <summary>
/// Gets the list of the Categories (read-only).
/// </summary>
CategoryInfo[] AllCategories { get; }
/// <summary>
/// Gets the list of Snippets (read-only).
/// </summary>
Snippet[] AllSnippets { get; }
/// <summary>
/// Gets the list of Navigation Paths (read-only).
/// </summary>
NavigationPath[] AllNavigationPaths { get; }
/// <summary>
/// Gets the Categories of a Page.
/// </summary>
/// <param name="page">The Page.</param>
/// <returns>The Categories.</returns>
CategoryInfo[] GetCategoriesPerPage(PageInfo page);
/// <summary>
/// Gets the WikiPage with the specified Name, or null.
/// </summary>
/// <param name="name">The Name of the Page.</param>
/// <returns>The Wiki Page, or null.</returns>
PageInfo FindPage(string name);
/// <summary>
/// Gets the Content of a Page.
/// </summary>
/// <param name="page">The Page.</param>
/// <returns>The Page Content.</returns>
PageContent GetPageContent(PageInfo page);
/// <summary>
/// Gets the Backup/Revision numbers of a Page.
/// </summary>
/// <param name="page">The Page.</param>
/// <returns>The Backup/Revision numbers.</returns>
int[] GetBackups(PageInfo page);
/// <summary>
/// Gets the Content of a Page Backup.
/// </summary>
/// <param name="page">The Page.</param>
/// <param name="revision">The revision.</param>
/// <returns>The Backup Content.</returns>
PageContent GetBackupContent(PageInfo page, int revision);
/// <summary>
/// Gets the formatted content of a Page, retrieving it from the cache (if available).
/// </summary>
/// <param name="page">The Page.</param>
/// <returns>The formatted content of the Page.</returns>
string GetFormattedContent(PageInfo page);
/// <summary>
/// Formats a block of WikiMarkup, using the built-in formatter only.
/// </summary>
/// <param name="raw">The block of WikiMarkup.</param>
/// <returns>The formatted content.</returns>
string Format(string raw);
/// <summary>
/// Sends an Email.
/// </summary>
/// <param name="recipient">The Recipient Email address.</param>
/// <param name="sender">The Sender's Email address.</param>
/// <param name="subject">The Subject.</param>
/// <param name="body">The Body.</param>
/// <param name="html">True if the message is HTML.</param>
/// <returns>True if the message has been sent successfully.</returns>
bool SendEmail(string recipient, string sender, string subject, string body, bool html);
/// <summary>
/// Logs a new message.
/// </summary>
/// <param name="message">The Message.</param>
/// <param name="entryType">The Entry Type.</param>
/// <param name="caller">The Component that calls the method. The caller cannot be null.</param>
void LogEntry(string message, LogEntryType entryType, object caller);
/// <summary>
/// Reads a text file.
/// </summary>
/// <param name="filename">The filename.</param>
/// <returns>The content of the file.</returns>
string ReadFile(string filename);
/// <summary>
/// Writes a text file.
/// </summary>
/// <param name="filename">The filename.</param>
/// <param name="content">The content.</param>
/// <returns>True if the file is written.</returns>
bool WriteFile(string filename, string content);
/// <summary>
/// Aligns a Date and Time object to the User's Time Zone preferences.
/// </summary>
/// <param name="dt">The Date/Time to align.</param>
/// <returns>The aligned Date/Time.</returns>
/// <remarks>The method takes care of daylight saving settings.</remarks>
DateTime AlignDateTimeWithPreferences(DateTime dt);
/// <summary>
/// Forces to reload a list of items.
/// </summary>
/// <param name="list">The list to Reload.</param>
/// <param name="caller">The Component that calls the method. The caller cannot be null.</param>
void RequestRefresh(RefreshList list, object caller);
}
/// <summary>
/// Enumerates the Types of Log Entries.
/// </summary>
public enum LogEntryType {
/// <summary>
/// Represents a simple Message.
/// </summary>
General,
/// <summary>
/// Represents a Warning.
/// </summary>
Warning,
/// <summary>
/// Represents an Error.
/// </summary>
Error
}
/// <summary>
/// Enumerates the Setting values' names.
/// </summary>
public enum SettingName {
/// <summary>
/// The Title of the Wiki.
/// </summary>
WikiTitle,
/// <summary>
/// The Main URL of the Wiki.
/// </summary>
MainUrl,
/// <summary>
/// The current Theme Name.
/// </summary>
Theme,
/// <summary>
/// The Contact Email.
/// </summary>
ContactEmail,
/// <summary>
/// The Sender Email.
/// </summary>
SenderEmail,
/// <summary>
/// The current Theme relative path (URL).
/// </summary>
ThemePath,
/// <summary>
/// The Name of the default Page.
/// </summary>
DefaultPage,
/// <summary>
/// The Date/Time format.
/// </summary>
DateTimeFormat,
/// <summary>
/// The default Language (for example <b>en-US</b>).
/// </summary>
DefaultLanguage,
/// <summary>
/// The default Time Zone (a string representing the shift in <b>minutes</b> respect to the Greenwich time, for example <b>-120</b>).
/// </summary>
DefaultTimeZone,
/// <summary>
/// The Wiki Access status (<b>PRIVATE</b>, <b>NORMAL</b>, <b>PUBLIC</b>).
/// </summary>
AccessStatus,
/// <summary>
/// The Themes directory.
/// </summary>
ThemesDirectory,
/// <summary>
/// The Public directory.
/// </summary>
PublicDirectory,
/// <summary>
/// The Messages directory.
/// </summary>
MessagesDirectory,
/// <summary>
/// The Pages directory.
/// </summary>
PagesDirectory,
/// <summary>
/// The Plugins directory.
/// </summary>
PluginsDirectory,
/// <summary>
/// The Snippets directory.
/// </summary>
SnippetsDirectory,
/// <summary>
/// The Temp directory.
/// </summary>
TempDirectory,
/// <summary>
/// The Upload directory.
/// </summary>
UploadDirectory
}
/// <summary>
/// Enumerates the refreshable Lists.
/// </summary>
public enum RefreshList {
/// <summary>
/// The Users list.
/// </summary>
Users,
/// <summary>
/// The Pages list.
/// </summary>
Pages
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -