Jump to content

Wikipedia:WikiFunctions

From Wikipedia, the free encyclopedia
(Redirected from Wikipedia:FUNCTIONS)

WikiFunctions.dll is a Microsoft .NET Framework dynamically linked library containing various classes and user interface elements related to wiki editing. Besides being a repository for code shared between various AWB executables, WikiFunctions also contains much in the way of standalone code reusable by other projects and AWB plugins.

Objects

[edit]

WikiFunctions contains various objects and modules used by AutoWikiBrowser, other AWB products, and AWB plugins. It also contains various items which may be of use to 3rd party developers, some of which are:

WikiFunctions.Browser.WebControl Provides a WebBrowser component adapted and extended for use with Wikis.
WikiFunctions.Controls.Help Provides a web-based help browser. Must be inherited.
WikiFunctions.Controls.LED A simple "LED" control. Can be seen on the AWB logging-to-file tab.
WikiFunctions.Controls.TransparentLabel A label that can be transparent.
WikiFunctions.Controls.Lists namespace Various controls for manipulating lists.
WikiFunctions.DatabaseScanner.DatabaseScanner Provides a form and functions for searching XML data dumps.
WikiFunctions.Controls.NoFlickerExtendedListView This is advanced ListView control with custom column sorting and flicker-free rendering.
WikiFunctions.Encryption.RijndaelSimple Contains an easy to use wrapper around Rijndael encryption. The class uses a symmetric key algorithm (Rijndael/AES) to encrypt and decrypt data. As long as encryption and decryption routines use the same parameters to generate the keys, the keys are guaranteed to be the same.
WikiFunctions.Lists Provides functionality to create and manipulate Lists of pages from many different sources.
WikiFunctions.Logging.IMyTraceListener An interface implemented by all trace (logging) classes including the trace manager
WikiFunctions.Logging.TraceListenerBase This abstract class can be used to build trace listener classes
WikiFunctions.Logging.TraceListenerUploadableBase An abstract class for building auto-uploading trace listeners
WikiFunctions.Logging.TraceManager An inheritable implementation of a Logging manager, built around a generic collection of IMyTraceListener objects and String keys
WikiFunctions.Logging.WikiTraceListener This class logs in Mediawiki-markup format
WikiFunctions.Logging.XHTMLTraceListener This class logs in XHTML format
WikiFunctions.Logging.Uploader.ITraceStatusProvider Implemented by classes which expose a TraceStatus object
WikiFunctions.Logging.Uploader.LogEntry Object which contains details of target pages for log entries (see e.g. User:Kingbotk/Logs, Wikipedia:WikiProject Biography/Automation/Logs)
WikiFunctions.Logging.Uploader.LogUploader A class which uploads logs to Wikipedia. Inherits from WikiFunctions.Editor in AWB's DLL
WikiFunctions.Logging.Uploader.TraceStatus A class which keeps track of statistics and not-yet-uploaded log entries.
WikiFunctions.Logging.Uploader.UploadableLogSettings A simple settings class for logging solutions
WikiFunctions.Logging.Uploader.UploadableLogSettings2 An extended base class with extra properties for a comprehensive logging solution
WikiFunctions.Logging.Uploader.UploadingPleaseWaitForm A form for displaying when the application is busy uploading
WikiFunctions.Logging.UploaderUsernamePassword Stores the user's login details/cookies
WikiFunctions.TalkPages.TalkPageHeaders.ProcessTalkPage Parses a talk page for a {{talk header}} and/or {{skip to talk}} template and moves them to the top.
WikiFunctions.Tools Provides various tools as static methods, such as getting the html of a page.

ApiEdit

[edit]

Login

[edit]

Example to simply login to the English Wikipedia.

You need to reference the WikiFunctions.dll or the project.

using WikiFunctions.API;

class Program
{
	static void Main(string[] args)
	{
		ApiEdit editor = new ApiEdit("http://wiki.riteme.site/w/");

		try
		{
			editor.Login("Username", "Password");
			Console.WriteLine(" succeeded");
		}
		catch (LoginException)
		{
			Console.WriteLine(" failed");
		}
	}
}

Append

[edit]

Example to append text to an existing page.

using WikiFunctions.API;

class Program
{
	static void Main(string[] args)
	{
		ApiEdit editor = new ApiEdit("http://wiki.riteme.site/w/");

		try
		{
			editor.Login("Username", "Password");
			string pageString = editor.Open("Page_Title_To_Be_Opened");
			PageInfo page = editor.Page;
			string newContent = "<br>.<br>";
			pageString = pageString + newContent;
			editor.Save(pageString, "Page Title Goes Here", true, WatchOptions.NoChange);
			Console.WriteLine(" succeeded");
		}
		catch (LoginException)
		{
			Console.WriteLine(" failed");
		}
	}
}