C# Класс ScrewTurn.Wiki.Tools

Contains useful Tools.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
UppercaseInitial ( string value ) : string

Описание методов

BytesToString() публичный статический Метод

Converts a byte number into a string, formatted using KB, MB or GB.
public static BytesToString ( long bytes ) : string
bytes long The # of bytes.
Результат string

ComputeSecurityHash() публичный статический Метод

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.
Результат string

DetectCurrentFullName() публичный статический Метод

Detects the full name of the current page using the Page and NS parameters in the query string.
public static DetectCurrentFullName ( ) : string
Результат string

DetectCurrentNamespace() публичный статический Метод

Detects the name of the current namespace using the NS parameter in the query string.
public static DetectCurrentNamespace ( ) : string
Результат string

DetectCurrentNamespaceInfo() публичный статический Метод

Detects the correct T:NamespaceInfo object associated to the current namespace using the NS parameter in the query string.
public static DetectCurrentNamespaceInfo ( ) : NamespaceInfo
Результат NamespaceInfo

DetectCurrentPageInfo() публичный статический Метод

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.
Результат System.PageInfo

DiskUsage() публичный статический Метод

Computes the Disk Space Usage of a directory.
public static DiskUsage ( string dir ) : long
dir string The directory.
Результат long

EscapeString() публичный статический Метод

Escapes bad characters in a string (pipes and \n).
public static EscapeString ( string input ) : string
input string The input string.
Результат string

ExtractDirectoryName() публичный статический Метод

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/'.
Результат string

GenerateRandomPassword() публичный статический Метод

Generates a random 10-char Password.
public static GenerateRandomPassword ( ) : string
Результат string

GetDirectoryName() публичный статический Метод

Gets the name of a file's directory.
public static GetDirectoryName ( string filename ) : string
filename string The filename.
Результат string

GetIncludes() публичный статический Метод

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).
Результат string

GetJavaScriptIncludes() публичный статический Метод

Gets all the JavaScript files to include.
public static GetJavaScriptIncludes ( ) : string
Результат string

GetMessageIdForAnchor() публичный статический Метод

Gets the message ID for HTML anchors.
public static GetMessageIdForAnchor ( System.DateTime messageDateTime ) : string
messageDateTime System.DateTime The message date/time.
Результат string

GetUpdateStatus() публичный статический Метод

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.
Результат UpdateStatus

GetVersionString() публичный статический Метод

Generates the standard 5-digit Page Version string.
public static GetVersionString ( int version ) : string
version int The Page version.
Результат string

HashDocumentNameForTemporaryIndex() публичный статический Метод

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.
Результат uint

IsRightToLeftCulture() публичный статический Метод

Get the direction of the current culture.
public static IsRightToLeftCulture ( ) : bool
Результат bool

ObfuscateText() публичный статический Метод

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.
Результат string

RemoveHtmlMarkup() публичный статический Метод

Removes all HTML tags from a text.
public static RemoveHtmlMarkup ( string html ) : string
html string The input HTML.
Результат string

TimeSpanToString() публичный статический Метод

Converts a Time Span to string.
public static TimeSpanToString ( System.TimeSpan span ) : string
span System.TimeSpan The Time Span.
Результат string

UnescapeString() публичный статический Метод

Unescapes bad characters in a string (pipes and \n).
public static UnescapeString ( string input ) : string
input string The input string.
Результат string

UrlDecode() публичный статический Метод

Executes URL-decoding, replacing spaces as processed by UrlEncode.
public static UrlDecode ( string input ) : string
input string The input string.
Результат string

UrlEncode() публичный статический Метод

Executes URL-encoding, avoiding to use '+' for spaces.
public static UrlEncode ( string input ) : string
input string The input string.
Результат string