public UploadResult UploadImage(string localFilePath) { // Create the connector MediaWiki connector = new MediaWiki(this.Options); // Get the file name to save string filename = Path.GetFileName(localFilePath); // Upload the image connector.UploadImage(localFilePath, filename); string remotePath = Options.Account.Url + "/index.php?title=Image:" + filename; // Create the file manager object UploadResult ur = new UploadResult() { URL = remotePath }; return ur; }
private void TestMediaWikiAccountThread(MediaWikiAccount acc, Action success, Action<string> failure) { try { MediaWiki connector = new MediaWiki(new MediaWikiOptions(acc, null)); // TODO: MediaWiki CheckProxySettings().GetWebProxy connector.Login(); success(); } catch (Exception ex) { // ignore ThreadInterruptedException : the request timed out and the thread was interrupted if (!(ex.InnerException is ThreadInterruptedException)) failure(ex.Message); } }