C# Класс ForTheCommonGood.MorebitsDotNet

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

Открытые свойства

Свойство Тип Описание
LoginSessions LoginInfo>.Dictionary

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

Метод Описание
DefaultErrorHandler ( string message ) : void
DefaultErrorHandler ( string message, MessageBoxIcon icon ) : void
GetApi ( Wiki wiki, string queryString, object userToken, MorebitsDotNetGetSuccess onSuccess ) : void

Makes an HTTP GET request to the specified MediaWiki API endpoint.

GetDomain ( Wiki w ) : string
GetProtocol ( ) : string
LogIn ( Wiki wiki, string userName, string password, MorebitsDotNetLoginSuccess onSuccess, MorebitsDotNetError onError ) : void

Logs into the specified MediaWiki API endpoint.

PostApi ( Wiki wiki, StringDictionary query, MorebitsDotNetPostSuccess onSuccess ) : void
PostApi ( Wiki wiki, StringDictionary query, MorebitsDotNetPostSuccess onSuccess, MorebitsDotNetError onError ) : void
PostApi ( Wiki wiki, StringDictionary query, MorebitsDotNetPostSuccess onSuccess, MorebitsDotNetError onError, string method ) : void

Makes an HTTP request to the specified MediaWiki API endpoint.

UploadFile ( Wiki wiki, StringDictionary query, byte file, string fileName, string fileParamName, MorebitsDotNetPostSuccess onSuccess ) : void
UploadFile ( Wiki wiki, StringDictionary query, byte file, string fileName, string fileParamName, MorebitsDotNetPostSuccess onSuccess, MorebitsDotNetError onError ) : void

Uploads a file by making an HTTP POST request to the specified MediaWiki API endpoint.

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

Метод Описание
GetApiUri ( Wiki w ) : string
PostApi ( Wiki wiki, StringDictionary query, MorebitsDotNetPostSuccess onSuccess, MorebitsDotNetError onError, bool loggingIn, string method ) : void
TimeoutCallback ( object state, bool timedOut ) : void

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

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

public static DefaultErrorHandler ( string message ) : void
message string
Результат void

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

public static DefaultErrorHandler ( string message, MessageBoxIcon icon ) : void
message string
icon MessageBoxIcon
Результат void

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

Makes an HTTP GET request to the specified MediaWiki API endpoint.
public static GetApi ( Wiki wiki, string queryString, object userToken, MorebitsDotNetGetSuccess onSuccess ) : void
wiki Wiki The to contact.
queryString string The query string, to be appended to the URL after a "?" character. /// No escaping is performed.
userToken object A custom object that is passed on to the callback, for state tracking. /// Set to null if not required.
onSuccess MorebitsDotNetGetSuccess A function that will be called when the request is successful. /// The function is passed the string of response received, as well as the value of .
Результат void

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

public static GetDomain ( Wiki w ) : string
w Wiki
Результат string

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

public static GetProtocol ( ) : string
Результат string

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

Logs into the specified MediaWiki API endpoint.
public static LogIn ( Wiki wiki, string userName, string password, MorebitsDotNetLoginSuccess onSuccess, MorebitsDotNetError onError ) : void
wiki Wiki The to contact.
userName string The user name to use for the login attempt.
password string The password to use for the login attempt.
onSuccess MorebitsDotNetLoginSuccess A function that will be called when the login attempt is successful.
onError MorebitsDotNetError A function that will be called when the login attempt fails. /// The function is passed the error message string as its only parameter.
Результат void

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

public static PostApi ( Wiki wiki, StringDictionary query, MorebitsDotNetPostSuccess onSuccess ) : void
wiki Wiki
query System.Collections.Specialized.StringDictionary
onSuccess MorebitsDotNetPostSuccess
Результат void

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

public static PostApi ( Wiki wiki, StringDictionary query, MorebitsDotNetPostSuccess onSuccess, MorebitsDotNetError onError ) : void
wiki Wiki
query System.Collections.Specialized.StringDictionary
onSuccess MorebitsDotNetPostSuccess
onError MorebitsDotNetError
Результат void

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

Makes an HTTP request to the specified MediaWiki API endpoint.
public static PostApi ( Wiki wiki, StringDictionary query, MorebitsDotNetPostSuccess onSuccess, MorebitsDotNetError onError, string method ) : void
wiki Wiki The to contact.
query System.Collections.Specialized.StringDictionary A dictionary of key-value pairs that represent the request parameters.
onSuccess MorebitsDotNetPostSuccess A function that will be called when the request is successful. /// The function is passed the XML response as its only parameter.
onError MorebitsDotNetError A function that will be called when the request fails. /// The function is passed the error message string as its only parameter.
method string The HTTP method to use. Use one of the constants in .
Результат void

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

public static UploadFile ( Wiki wiki, StringDictionary query, byte file, string fileName, string fileParamName, MorebitsDotNetPostSuccess onSuccess ) : void
wiki Wiki
query System.Collections.Specialized.StringDictionary
file byte
fileName string
fileParamName string
onSuccess MorebitsDotNetPostSuccess
Результат void

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

Uploads a file by making an HTTP POST request to the specified MediaWiki API endpoint.
public static UploadFile ( Wiki wiki, StringDictionary query, byte file, string fileName, string fileParamName, MorebitsDotNetPostSuccess onSuccess, MorebitsDotNetError onError ) : void
wiki Wiki The to contact.
query System.Collections.Specialized.StringDictionary A dictionary of key-value pairs that represent the request parameters.
file byte The file to upload, as a byte array of binary data.
fileName string The name of the file to upload.
fileParamName string The name (key) of the POST parameter whose value is the file data.
onSuccess MorebitsDotNetPostSuccess A function that will be called when the request is successful. /// The function is passed the XML response as its only parameter.
onError MorebitsDotNetError A function that will be called when the request fails. /// The function is passed the error message string as its only parameter.
Результат void

Описание свойств

LoginSessions публичное статическое свойство

public static Dictionary LoginSessions
Результат LoginInfo>.Dictionary