C# Class ScrewTurn.Wiki.Tools

Contains useful Tools.
显示文件 Open project: mono/ScrewTurnWiki Class Usage Examples

Public Methods

Method Description
BytesToString ( long bytes ) : string

Converts a byte number into a string, formatted using KB, MB or GB.

ComputeSecurityHash ( string username, string email, System.DateTime dateTime ) : string

Computes the Hash of a Username, mixing it with other data, in order to avoid illegal Account activations.

DetectCurrentFullName ( ) : string

Detects the full name of the current page using the Page and NS parameters in the query string.

DetectCurrentNamespace ( ) : string

Detects the name of the current namespace using the NS parameter in the query string.

DetectCurrentNamespaceInfo ( ) : NamespaceInfo

Detects the correct T:NamespaceInfo object associated to the current namespace using the NS parameter in the query string.

DetectCurrentPageInfo ( bool loadDefault ) : System.PageInfo

Detects the correct T:PageInfo object associated to the current page using the Page and NS parameters in the query string.

DiskUsage ( string dir ) : long

Computes the Disk Space Usage of a directory.

EscapeString ( string input ) : string

Escapes bad characters in a string (pipes and \n).

ExtractDirectoryName ( string path ) : string

Extracts the directory name from a path used in the Files Storage Providers.

GenerateRandomPassword ( ) : string

Generates a random 10-char Password.

GetDirectoryName ( string filename ) : string

Gets the name of a file's directory.

GetIncludes ( string nspace ) : string

Gets all the included files for the HTML Head, such as CSS, JavaScript and Icon pluginAssemblies, for a namespace.

GetJavaScriptIncludes ( ) : string

Gets all the JavaScript files to include.

GetMessageIdForAnchor ( System.DateTime messageDateTime ) : string

Gets the message ID for HTML anchors.

GetUpdateStatus ( string url, string currentVersion, string &newVersion, string &newAssemblyUrl ) : UpdateStatus

Gets the update status of a component.

This method only works in Full Trust.

GetVersionString ( int version ) : string

Generates the standard 5-digit Page Version string.

HashDocumentNameForTemporaryIndex ( string value ) : uint

Computes the hash value of a string that is value across application instances and versions.

IsRightToLeftCulture ( ) : bool

Get the direction of the current culture.

ObfuscateText ( string input ) : string

Obfuscates text, replacing each character with its HTML escaped sequence, for example a becomes a.

RemoveHtmlMarkup ( string html ) : string

Removes all HTML tags from a text.

TimeSpanToString ( System.TimeSpan span ) : string

Converts a Time Span to string.

UnescapeString ( string input ) : string

Unescapes bad characters in a string (pipes and \n).

UrlDecode ( string input ) : string

Executes URL-decoding, replacing spaces as processed by UrlEncode.

UrlEncode ( string input ) : string

Executes URL-encoding, avoiding to use '+' for spaces.

Private Methods

Method Description
UppercaseInitial ( string value ) : string

Method Details

BytesToString() public static method

Converts a byte number into a string, formatted using KB, MB or GB.
public static BytesToString ( long bytes ) : string
bytes long The # of bytes.
return string

ComputeSecurityHash() public static method

Computes the Hash of a Username, mixing it with other data, in order to avoid illegal Account activations.
public static ComputeSecurityHash ( string username, string email, System.DateTime dateTime ) : string
username string The Username.
email string The email.
dateTime System.DateTime The date/time.
return string

DetectCurrentFullName() public static method

Detects the full name of the current page using the Page and NS parameters in the query string.
public static DetectCurrentFullName ( ) : string
return string

DetectCurrentNamespace() public static method

Detects the name of the current namespace using the NS parameter in the query string.
public static DetectCurrentNamespace ( ) : string
return string

DetectCurrentNamespaceInfo() public static method

Detects the correct T:NamespaceInfo object associated to the current namespace using the NS parameter in the query string.
public static DetectCurrentNamespaceInfo ( ) : NamespaceInfo
return NamespaceInfo

DetectCurrentPageInfo() public static method

Detects the correct T:PageInfo object associated to the current page using the Page and NS parameters in the query string.
public static DetectCurrentPageInfo ( bool loadDefault ) : System.PageInfo
loadDefault bool true to load the default page of the specified namespace when Page is not specified, false otherwise.
return System.PageInfo

DiskUsage() public static method

Computes the Disk Space Usage of a directory.
public static DiskUsage ( string dir ) : long
dir string The directory.
return long

EscapeString() public static method

Escapes bad characters in a string (pipes and \n).
public static EscapeString ( string input ) : string
input string The input string.
return string

ExtractDirectoryName() public static method

Extracts the directory name from a path used in the Files Storage Providers.
public static ExtractDirectoryName ( string path ) : string
path string The path, for example '/folder/blah/'.
return string

GenerateRandomPassword() public static method

Generates a random 10-char Password.
public static GenerateRandomPassword ( ) : string
return string

GetDirectoryName() public static method

Gets the name of a file's directory.
public static GetDirectoryName ( string filename ) : string
filename string The filename.
return string

GetIncludes() public static method

Gets all the included files for the HTML Head, such as CSS, JavaScript and Icon pluginAssemblies, for a namespace.
public static GetIncludes ( string nspace ) : string
nspace string The namespace (null for the root).
return string

GetJavaScriptIncludes() public static method

Gets all the JavaScript files to include.
public static GetJavaScriptIncludes ( ) : string
return string

GetMessageIdForAnchor() public static method

Gets the message ID for HTML anchors.
public static GetMessageIdForAnchor ( System.DateTime messageDateTime ) : string
messageDateTime System.DateTime The message date/time.
return string

GetUpdateStatus() public static method

Gets the update status of a component.
This method only works in Full Trust.
public static GetUpdateStatus ( string url, string currentVersion, string &newVersion, string &newAssemblyUrl ) : UpdateStatus
url string The version file URL.
currentVersion string The current version.
newVersion string The new version, if any.
newAssemblyUrl string The URL of the new assembly, if applicable and available.
return UpdateStatus

GetVersionString() public static method

Generates the standard 5-digit Page Version string.
public static GetVersionString ( int version ) : string
version int The Page version.
return string

HashDocumentNameForTemporaryIndex() public static method

Computes the hash value of a string that is value across application instances and versions.
public static HashDocumentNameForTemporaryIndex ( string value ) : uint
value string The string to compute the hash of.
return uint

IsRightToLeftCulture() public static method

Get the direction of the current culture.
public static IsRightToLeftCulture ( ) : bool
return bool

ObfuscateText() public static method

Obfuscates text, replacing each character with its HTML escaped sequence, for example a becomes a.
public static ObfuscateText ( string input ) : string
input string The input text.
return string

RemoveHtmlMarkup() public static method

Removes all HTML tags from a text.
public static RemoveHtmlMarkup ( string html ) : string
html string The input HTML.
return string

TimeSpanToString() public static method

Converts a Time Span to string.
public static TimeSpanToString ( System.TimeSpan span ) : string
span System.TimeSpan The Time Span.
return string

UnescapeString() public static method

Unescapes bad characters in a string (pipes and \n).
public static UnescapeString ( string input ) : string
input string The input string.
return string

UrlDecode() public static method

Executes URL-decoding, replacing spaces as processed by UrlEncode.
public static UrlDecode ( string input ) : string
input string The input string.
return string

UrlEncode() public static method

Executes URL-encoding, avoiding to use '+' for spaces.
public static UrlEncode ( string input ) : string
input string The input string.
return string