C# Class WikiFunctions.Variables

Holds static variables, to allow functionality on different wikis.
Show file Open project: reedy/AutoWikiBrowser

Public Properties

Property Type Description
CanonicalNamespaceAliases List>.Dictionary
CanonicalNamespaces string>.Dictionary
ENLangMonthNames string[]
MagicWords List>.Dictionary
MonthNames string[]
NamespaceAliases List>.Dictionary
Namespaces string>.Dictionary
NamespacesCaseInsensitive string>.Dictionary
Profiler Profiler
ReloadProjectSettings ProjectHoldArea
RetfPath string
SectStub string
SectStubRegex System.Text.RegularExpressions.Regex
Stub string
URL string
UnderscoredTitles List

Public Methods

Method Description
AWBVersionString ( string version ) : string
AddUnderscoredTitles ( List titles ) : void

For unit tests only, method to add entries to UnderscoredTitles

GetArticleHistoryURL ( string title ) : string

returns full URL to the history page of the input title, depends on project settings

GetEditURL ( string title ) : string

returns full URL to the edit page of the input title, depends on project settings

GetPlainTextURL ( string title ) : string

Returns the full URL to the input wiki page using current site settings, specifying &action=raw

GetUserTalkURL ( string username ) : string

returns full URL to the user talk page of the input user, depends on project settings

NonPrettifiedURL ( string title ) : string

returns full URL to the given page, depends on project settings

PrepareWebRequest ( string url ) : HttpWebRequest

Creates an HTTP web request. Timeout set to 15 seconds

PrepareWebRequest ( string url, string userAgent ) : HttpWebRequest

Creates an HTTP web request. Timeout set to 15 seconds

RefreshProxy ( ) : void

Refreshs the system proxy.

SetProject ( string langCode, ProjectEnum projectName ) : void

Sets different language variables, such as namespaces. Default is english Wikipedia

SetProject ( string langCode, ProjectEnum projectName, string customProject, string protocol ) : void

Sets different language variables, such as namespaces. Default is english Wikipedia

SetProjectLangCode ( string langCode ) : void

Sets the language code of the current project

Do not use this outside unit tests

SetProjectSimple ( string langCode, ProjectEnum projectName ) : void

Sets different language variables, such as namespaces. Default is English Wikipedia

Do not use this outside unit tests

WaitForDelayedRequests ( ) : void

Waits for all background stuff to be loaded

Private Methods

Method Description
AWBDefaultSummaryTag ( ) : void

Sets the AWB default summary tag.

CancelBackgroundRequests ( ) : void
LoadUnderscores ( ) : void
PrepareAliases ( string>.Dictionary namespaces ) : List>.Dictionary
RegenerateRegexes ( ) : void

SetLanguageSpecificValues ( string langCode, ProjectEnum projectName ) : void

Sets the language specific values: summary tag, stub regex, AWB project link

SetToEnglish ( ) : void

UnderscoresLoaded ( WikiFunctions.Background.BackgroundRequest req ) : void
Variables ( ) : System

Method Details

AWBVersionString() public static method

public static AWBVersionString ( string version ) : string
version string
return string

AddUnderscoredTitles() public static method

For unit tests only, method to add entries to UnderscoredTitles
public static AddUnderscoredTitles ( List titles ) : void
titles List
return void

GetArticleHistoryURL() public static method

returns full URL to the history page of the input title, depends on project settings
public static GetArticleHistoryURL ( string title ) : string
title string
return string

GetEditURL() public static method

returns full URL to the edit page of the input title, depends on project settings
public static GetEditURL ( string title ) : string
title string
return string

GetPlainTextURL() public static method

Returns the full URL to the input wiki page using current site settings, specifying &action=raw
public static GetPlainTextURL ( string title ) : string
title string
return string

GetUserTalkURL() public static method

returns full URL to the user talk page of the input user, depends on project settings
public static GetUserTalkURL ( string username ) : string
username string
return string

NonPrettifiedURL() public static method

returns full URL to the given page, depends on project settings
public static NonPrettifiedURL ( string title ) : string
title string
return string

PrepareWebRequest() public static method

Creates an HTTP web request. Timeout set to 15 seconds
public static PrepareWebRequest ( string url ) : HttpWebRequest
url string /// URL. ///
return System.Net.HttpWebRequest

PrepareWebRequest() public static method

Creates an HTTP web request. Timeout set to 15 seconds
public static PrepareWebRequest ( string url, string userAgent ) : HttpWebRequest
url string
userAgent string
return System.Net.HttpWebRequest

RefreshProxy() public static method

Refreshs the system proxy.
public static RefreshProxy ( ) : void
return void

SetProject() public static method

Sets different language variables, such as namespaces. Default is english Wikipedia
public static SetProject ( string langCode, ProjectEnum projectName ) : void
langCode string The language code, default is en
projectName ProjectEnum The project name default is Wikipedia
return void

SetProject() public static method

Sets different language variables, such as namespaces. Default is english Wikipedia
public static SetProject ( string langCode, ProjectEnum projectName, string customProject, string protocol ) : void
langCode string The language code, default is en
projectName ProjectEnum The project name default is Wikipedia
customProject string Script path of a custom project or ""
protocol string
return void

SetProjectLangCode() public static method

Sets the language code of the current project
Do not use this outside unit tests
public static SetProjectLangCode ( string langCode ) : void
langCode string The new language code to use
return void

SetProjectSimple() public static method

Sets different language variables, such as namespaces. Default is English Wikipedia
Do not use this outside unit tests
public static SetProjectSimple ( string langCode, ProjectEnum projectName ) : void
langCode string The language code, default is en
projectName ProjectEnum The project name default is Wikipedia
return void

WaitForDelayedRequests() public static method

Waits for all background stuff to be loaded
public static WaitForDelayedRequests ( ) : void
return void

Property Details

CanonicalNamespaceAliases public static property

Canonical namespace aliases
public static Dictionary> CanonicalNamespaceAliases
return List>.Dictionary

CanonicalNamespaces public static property

Provides access to the en namespace keys e.g. Category:
public static Dictionary CanonicalNamespaces
return string>.Dictionary

ENLangMonthNames public static property

public static string[] ENLangMonthNames
return string[]

MagicWords public static property

public static Dictionary> MagicWords
return List>.Dictionary

MonthNames public static property

localized names of months
public static string[] MonthNames
return string[]

NamespaceAliases public static property

Aliases for current namespaces
public static Dictionary> NamespaceAliases
return List>.Dictionary

Namespaces public static property

Provides access to the namespace keys e.g. Category:
public static Dictionary Namespaces
return string>.Dictionary

NamespacesCaseInsensitive public static property

Provides access to the namespace keys in a form so the first letter is case insensitive e.g. [Ww]ikipedia:
public static Dictionary NamespacesCaseInsensitive
return string>.Dictionary

Profiler public static property

Performance profiler
public static Profiler,WikiFunctions Profiler
return Profiler

ReloadProjectSettings public static property

public static ProjectHoldArea ReloadProjectSettings
return ProjectHoldArea

RetfPath public static property

Page of RegexTypoFix rules page e.g. Project:AutoWikiBrowser/Typos. Can be full URL if specified as such on <!--Typos--> check page comment
public static string RetfPath
return string

SectStub public static property

public static string SectStub
return string

SectStubRegex public static property

public static Regex,System.Text.RegularExpressions SectStubRegex
return System.Text.RegularExpressions.Regex

Stub public static property

public static string Stub
return string

URL public static property

Gets a URL of the site, e.g. "https://en.wikipedia.org".
public static string URL
return string

UnderscoredTitles public static property

Contains list of pages with underscores in titles, from [[Category:Articles with underscores in the title]] for en wiki
public static List UnderscoredTitles
return List