• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# DotNetWikiBot.Site类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中DotNetWikiBot.Site的典型用法代码示例。如果您正苦于以下问题:C# Site类的具体用法?C# Site怎么用?C# Site使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Site类属于DotNetWikiBot命名空间,在下文中一共展示了Site类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ReplacementJob

 public ReplacementJob(Site site,
                       IDictionary<string, string> replacements,
                       IDictionary<Regex, string> regexReplacements,
                       GeneralExtensions.Placeholder placeholders)
     : base(site)
 {
     Replacements = replacements;
     RegexReplacements = regexReplacements;
     Placeholders = placeholders;
 }
开发者ID:knabbi,项目名称:GW2WBot,代码行数:10,代码来源:ReplacementJob.cs


示例2: Main

        static void Main(string[] args)
        {
            foreach (var line in File.ReadLines("config.txt"))
            {
                var indexOfSep = line.IndexOf('=');
                var key = line.Substring(0,indexOfSep).Trim();
                var val = line.Substring(indexOfSep + 1).Trim();

                if (key == "user") User = val;
                if (key == "pass") Pass = val;
                if (key == "apiAuthentication") ApiAuthentication = val;
            }

            if (string.IsNullOrEmpty(User) || string.IsNullOrEmpty(Pass) || string.IsNullOrEmpty(ApiAuthentication))
            {
                Console.WriteLine("Incomplete config");
                return;
            }

            var statusApi = new StatusApi();
            statusApi.SetStatus(false);

            var s = new Site("http://wiki-de.guildwars2.com/wiki/", User, Pass);

            if (args.Contains("-generatePagelist") || !File.Exists("pagelist.txt"))
            {
                Console.WriteLine("Generating pagelist...");
                var pagelist = new PageList(s);
                pagelist.FillFromCategoryTree("Guild Wars 2");
                pagelist.SaveTitlesToFile("pagelist.txt");
            }

            try
            {
                Run(s);
            }
            finally
            {
                statusApi.SetStatus(false);
            }
        }
开发者ID:knabbi,项目名称:GW2WBot,代码行数:41,代码来源:Program.cs


示例3: AngebotSubpageToMainarticleJob

 public AngebotSubpageToMainarticleJob(Site site)
     : base(site)
 {
 }
开发者ID:knabbi,项目名称:GW2WBot,代码行数:4,代码来源:AngebotSubpageToMainarticleJob.cs


示例4: Page

 /// <summary>This constructor creates Page object without title using most recently
 /// created Site object.</summary>
 /// <returns>Returns Page object.</returns>
 public Page()
 {
     this.site = Bot.GetMostRecentSiteObject();
 }
开发者ID:KernelFreeze,项目名称:inteliBOT,代码行数:7,代码来源:DotNetWikiBot.cs


示例5: DoStuff

        public static void DoStuff()
        {
            string username = "";
            string password = "";

            Console.WriteLine("Enter wiki username: ");
            username = Console.ReadLine();
            Console.WriteLine("Enter wiki password: ");
            password = Console.ReadLine();
            password = password.Trim();

            newWiki = new Site(WIKI_URL, username, password);
            string[,] toPort = 
            {
                //{"MissionEditorCompatibility", "Mission Editor game compatibility"},
                //{"MissionEditorStartPage", "Mission Editor"},
                //{"MissionEditorWINE", "Mission Editor in WINE"},
                //{"FactoryOrdersTutorial", "Mission Editor Factory Orders Tutorial"},
                //{"MissionEditorTutorial", "Mission Editor Tutorial"},
                //{"MissionEditorCutsceneTutorial", "Mission Editor Cutscenes Tutorial"}
            };
            for (int i=0; i<toPort.GetLength(0); i++)
            {
                ConvertPage(toPort[i, 0], toPort[i, 1], true);
            }

            string[] toReformat =
            {
                //"Mission Editor Cutscenes Tutorial"
            };
            for (int i = 0; i < toReformat.GetLength(0); i++)
            {
                ReformatPage(toReformat[i]);
            }
        }
开发者ID:DeinFreund,项目名称:Zero-K-Infrastructure,代码行数:35,代码来源:WikiPortingMW.cs


示例6: Page

 /// <summary>This constructor creates Page object with specified title. Site object
 /// with default properties is created internally and logged in. Constructing
 /// new Site object is too slow, don't use this constructor needlessly.</summary>
 /// <param name="title">Page title as string.</param>
 /// <returns>Returns Page object.</returns>
 public Page(string title)
 {
     this.site = new Site();
     this.title = title;
 }
开发者ID:wikigit,项目名称:Picasa-Review-Bot,代码行数:10,代码来源:DotNetWikiBot.cs


示例7: PageList

 /// <summary>This constructor creates empty PageList object with specified
 /// Site object.</summary>
 /// <param name="site">Site object, it must be constructed beforehand.</param>
 /// <returns>Returns the PageList object.</returns>
 public PageList(Site site)
 {
     this.site = site;
 }
开发者ID:wikigit,项目名称:Picasa-Review-Bot,代码行数:8,代码来源:DotNetWikiBot.cs


示例8: AufgestiegenerSchmuckJob

 public AufgestiegenerSchmuckJob(Site site)
     : base(site)
 {
 }
开发者ID:knabbi,项目名称:GW2WBot,代码行数:4,代码来源:AufgestiegenerSchmuckJob.cs


示例9: RemoveUeberfluessigeParameter

 public RemoveUeberfluessigeParameter(Site site)
     : base(site)
 {
 }
开发者ID:knabbi,项目名称:GW2WBot,代码行数:4,代码来源:RemoveUeberfluessigeParameter.cs


示例10: Login

        private void Login()
        {
            this.Hide();
            loginForm = new FormLogin();
            if (loginForm.ShowDialog(this) != System.Windows.Forms.DialogResult.OK)
            {
                Application.Exit();
                return;
            }

            loadingDialog = new LoadingDialog();
            loadingDialog.Message = "Logging in...";
            loadingDialog.Show(this);
            this.Enabled = false;
            Thread loginThread = new Thread(new ThreadStart(delegate()
            {
                try
                {
                    errorMessage = null;
                    site = new Site("http://en.wikipedia.org", loginForm.Username, loginForm.Password);
                }
                catch (WikiBotException ex)
                {
                    if (ex.Message.Contains("Login failed"))
                    {
                        errorMessage = "Login failed. Check your username and password and try again.";
                    }
                    else
                    {
                        errorMessage = "Encountered error: " + ex.Message;
                    }
                }
                this.Invoke(new MethodInvoker(CompleteLogin));
            }));
            loginThread.Start();
        }
开发者ID:wikigit,项目名称:Persondata-o-matic,代码行数:36,代码来源:FormMain.cs


示例11: LoadPages

        void LoadPages()
        {
            //site = new Site("http://localhost/index.php/", "ZenithBot", "Bot");
            site = new Site("http://en.wikipedia.org/", "HNCluster", "csce470");
            Invoke(CheckSiteLoaded);

            pageList = new PageList(site);
            //pageList.FillFromFile(@"ComputerScienceWikipediaPagesList");
            pageList.FillAndLoadFromXMLDump(@"Wikipedia-ComputerScience.xml");

            wikiCollection.LoadFromPageList(pageList);
            Invoke(IncrementPagesLoadedByVal, wikiCollection.wikiPages.Count);
            pagesLoaded += wikiCollection.wikiPages.Count;

            if (InvokeRequired)
            {
                Invoke(UpdateText);
            }
            else
            {
                UpdateTextMethod();
            }

            Invoke(CheckTitlesLoaded);
            wikiCollection.ExtractTokens();
            Invoke(CheckTokenized);
            if (InvokeRequired)
            {
                Invoke(UpdateText);
            }
            else
            {
                UpdateTextMethod();
            }
            /*
            int num = 100;

            for (int i = 0; i < pageList.pages.Count; ++i)
            {
                if (i + num < pageList.pages.Count)
                {
                    Parallel.For(i, i + num, n =>
                    {
                        pageList.pages[n].Load();
                    });
                    i += num - 1;
                    pagesLoaded += num;
                    Invoke(IncrementPagesLoadedByVal, num);
                }
                else
                {
                    Parallel.For(i, pageList.pages.Count, n =>
                    {
                        pageList.pages[n].Load();
                    });
                    i += num - 1;
                    pagesLoaded += pageList.pages.Count - i;
                    Invoke(IncrementPagesLoadedByVal, pageList.pages.Count - i);
                }

            }*/
            /*
            foreach (Page page in pageList)
            {
                page.Load();
                if (numericUpDown1.Value == 0)
                {
                    Invoke(AddPageText, new object[] { pageList[0] });
                }
                pagesLoaded += 1;
                Invoke(IncrementPagesLoaded);
                //Application.DoEvents();
            }*/
        }
开发者ID:ZenithWest,项目名称:Wikipedia-Clustering,代码行数:74,代码来源:Form1.cs


示例12: FixParameterfehlerJob

 public FixParameterfehlerJob(Site site)
     : base(site)
 {
 }
开发者ID:knabbi,项目名称:GW2WBot,代码行数:4,代码来源:FixParameterfehlerJob.cs


示例13: DoStuff

        public static void DoStuff()
        {
            string username = "";
            string password = "";

            Console.WriteLine("Enter wiki username: ");
            username = Console.ReadLine();
            Console.WriteLine("Enter wiki password: ");
            password = Console.ReadLine();
            password = password.Trim();

            newWiki = new Site(WIKI_URL, username, password);

            int count = 0;  // increment this when we actually create a page
            var files = new System.Collections.Generic.List<string>(Directory.GetFiles(@"G:\zkwiki\output\markup"));
            files = files.Shuffle();
            foreach (string path in files)
            {
                string unitname = Path.GetFileNameWithoutExtension(path);
                unitname = unitname.Replace("&#47;", "/");
                var page = new Page(newWiki, unitname);
                page.Load();
                if (page.Exists())
                {
                    // do nothing
                }
                else
                {
                    var text = File.ReadAllText(path);
                    Console.WriteLine("-- Making page {0} --", unitname);
                    page.Save(text, "Created page from unitguide builder export", false);
                    count++;
                    //if (count >= 20) break;
                }
            }

            string[,] toPort = 
            {
                //{"MissionEditorCompatibility", "Mission Editor game compatibility"},
                //{"MissionEditorStartPage", "Mission Editor"},
                //{"MissionEditorWINE", "Mission Editor in WINE"},
                //{"FactoryOrdersTutorial", "Mission Editor Factory Orders Tutorial"},
                //{"MissionEditorTutorial", "Mission Editor Tutorial"},
                //{"MissionEditorCutsceneTutorial", "Mission Editor Cutscenes Tutorial"}
            };
            for (int i=0; i<toPort.GetLength(0); i++)
            {
                ConvertPage(toPort[i, 0], toPort[i, 1], false);
            }

            string[] toReformat =
            {
                //"Mission Editor Cutscenes Tutorial"
            };
            for (int i = 0; i < toReformat.GetLength(0); i++)
            {
                ReformatPage(toReformat[i]);
            }
        }
开发者ID:GoogleFrog,项目名称:Zero-K-Infrastructure,代码行数:59,代码来源:WikiPortingMW.cs


示例14: Main

        static void Main(string[] args)
        {
            Site site = new Site("http://commons.wikimedia.org", args[0], args[1]);
            while (true)
            {
                PageList list = new PageList(site);
                list.FillAllFromCategory("Category:Rotate270");
                foreach (Page page in list)
                {
                    if (!page.title.ToLower().EndsWith(".jpg")) continue;
                    page.Load();
                    if (!page.text.Contains("{{rotate"))
                    {
                        page.text = "{{rotate|270}}\n" + page.text;
                        page.Save("Add {{rotate|270}} tag since it's in Category:Rotate270", /*isMinorEdit*/false);
                    }
                }

                list = new PageList(site);
                list.FillAllFromCategory("Category:Images requiring rotation");
                foreach (Page page in list)
                {
                    Regex regex = new Regex(@"\{\{Rotate\|nobot=true\|reason='''Reason''': corrupt JPEG file.\|([^}]*)\}\}", RegexOptions.IgnoreCase);
                    page.Load();
                    Match m = regex.Match(page.text);
                    if (m.Success)
                    {
                        page.text = regex.Replace(page.text, "{{Rotate|" + m.Groups[1].Value + "}}");
                        page.Save("Undo mistagging by [[User:Rotatebot]], JPEG should not be corrupt", /*isMinorEdit*/false);
                    }
                }

                list = new PageList(site);
                list.FillAllFromCategory("Category:Images requiring rotation by bot");
                try
                {
                    foreach (Page page in list)
                    {
                        if (!page.title.ToLower().EndsWith(".jpg")) continue;
                        page.Load();
                        MatchCollection matches = new Regex(@"\{\{rotate\|([0-9]+)\}\}", RegexOptions.IgnoreCase).Matches(page.text);
                        if (matches.Count == 0)
                        {
                            matches = new Regex(@"\{\{rotate\|degree=([0-9]+)\}\}", RegexOptions.IgnoreCase).Matches(page.text);
                            if (matches.Count == 0)
                            {
                                matches = new Regex(@"\{\{rotate\|([0-9]+)\|[^}]*\}\}", RegexOptions.IgnoreCase).Matches(page.text);
                                if (matches.Count == 0)
                                {
                                    continue;
                                }
                            }
                        }
                        if (matches.Count > 1)
                        {
                            while (matches.Count > 1)
                            {
                                page.text = page.text.Remove(matches[0].Index, matches[0].Length);
                                matches = new Regex(@"\{\{rotate\|([0-9]+)\}\}", RegexOptions.IgnoreCase).Matches(page.text);
                                if (matches.Count == 0)
                                {
                                    matches = new Regex(@"\{\{rotate\|degree=([0-9]+)\}\}", RegexOptions.IgnoreCase).Matches(page.text);
                                    if (matches.Count == 0)
                                    {
                                        matches = new Regex(@"\{\{rotate\|([0-9]+)\|[^}]*\}\}", RegexOptions.IgnoreCase).Matches(page.text);
                                    }
                                }
                            }
                            page.Save("Remove redundant rotate tags", /*isMinorEdit*/false);
                        }

                        Match m = matches[0];
                        int degrees = int.Parse(m.Groups[1].Value);
                        page.DownloadImage("tempin.jpg");
                        File.Delete("tempout.jpg");
                        ProcessStartInfo info = new ProcessStartInfo(@"..\..\jpegtran.exe", "-rotate " + degrees + " tempin.jpg tempout.jpg");
                        info.CreateNoWindow = true;
                        info.UseShellExecute = false;
                        Process p = Process.Start(info);
                        p.WaitForExit();
                        if (File.Exists("tempout.jpg"))
                        {
                            page.UploadImage("tempout.jpg", "Losslessly rotate by " + degrees + " degrees per request using jpegtran", "", "", "");
                            page.Load();
                            page.text = page.text.Replace(m.Value + "\n", "");
                            page.text = page.text.Replace(m.Value, "");
                            page.text = page.text.Replace("[[Category:Rotate270]]\n", "");
                            page.text = page.text.Replace("[[Category:Rotate270]]", "");
                            page.Save("Done with rotation by " + degrees + " degrees, removing tag", /*isMinorEdit*/false);
                        }
                    }
                    System.Threading.Thread.Sleep(new TimeSpan(0, 2, 0));
                }
                catch (Exception e)
                {
                    Console.WriteLine("Caught exception: " + e.Message + e.StackTrace);
                }
            }
        }
开发者ID:wikigit,项目名称:DotNetRotateBot,代码行数:99,代码来源:Program.cs


示例15: Load

        public override void Load()
        {
            try
            {
                ch = core.getChannel(RequestLabs.RequestCh);
                if (ch == null)
                {
                    Log("CRITICAL: the bot isn't in " + RequestLabs.RequestCh + " unloading requests", true);
                    return;
                }
                RequestCache.Load();
                notifications = new Thread(Run);
                notifications.Start();
                Site wikitech = new Site("https://wikitech.wikimedia.org", "wmib", "");
                while (true)
                {
                    try
                    {
                        List<string> shell = new List<string>();
                        List<string> tooldata = new List<string>();
                        PageList requests = new PageList(wikitech);
                        requests.FillAllFromCategory("Shell Access Requests");
                        foreach (Page page in requests)
                        {
                            string title = page.title.Replace("Shell Request/", "");
                            if (RequestCache.Contains(title))
                            {
                                continue;
                            }
                            page.Load();
                            if (!Matches(page.text))
                            {
                                RequestCache.Insert(title);
                                lock (Shell)
                                {
                                    // this one was already processed
                                    RequestLabs previous = Contains(title);
                                    if (previous != null)
                                    {
                                        Shell.Remove(previous);
                                    }
                                }
                                continue;
                            }
                            else
                            {
                                if (!shell.Contains(title))
                                {
                                    shell.Add(title);
                                }
                                lock (Shell)
                                {
                                    if (Contains(title) == null)
                                    {
                                        Shell.Add(new RequestLabs(title));
                                    }
                                }
                            }
                        }

                        requests = new PageList(wikitech);
                        requests.FillAllFromCategory("Tools_Access_Requests");
                        foreach (Page page in requests)
                        {
                            string title = page.title.Replace("Nova Resource:Tools/Access Request/", "");
                            if (RequestCache.ContainsLabs(title))
                            {
                                continue;
                            }
                            page.Load();
                            if (!(Matches(page.text)))
                            {
                                RequestCache.InsertLabs(title);
                                lock (Tools)
                                {
                                    // this one was already processed
                                    RequestLabs previous = ContainsLabs(title);
                                    if (previous != null)
                                    {
                                        Tools.Remove(previous);
                                    }
                                }
                                continue;
                            }
                            else
                            {
                                if (!tooldata.Contains(title))
                                {
                                    tooldata.Add(title);
                                }
                                lock (Tools)
                                {
                                    if (ContainsLabs(title) == null)
                                    {
                                        Tools.Add(new RequestLabs(title));
                                    }
                                }
                            }
                        }
                        Thread.Sleep(60000);
//.........这里部分代码省略.........
开发者ID:Krenair,项目名称:wikimedia-bot,代码行数:101,代码来源:Request.cs


示例16: Main

        static void Main(string[] args)
        {
            username = args[0];
            password = args[1];

            Bot.unsafeHttpHeaderParsingUsed = 0;
            Site site = new Site(wikiSiteUrl, username, password);
            while (true)
            {
                int totalPagesProcessed = 0;
                try
                {
                    PageList pageList = new PageList(site);
            #if true
                    if (catScanning != null)
                        pageList.FillFromCategory(catScanning);
                    else
                        pageList.FillFromSearchResults(searchScanning, int.MaxValue);
            #endif

                    string failureReason = null;
                    foreach (Page page in pageList)
                    {
                        if (resumeAfter != null)
                        {
                            if (page.title == resumeAfter) resumeAfter = null;
                            continue;
                        }

                        totalPagesProcessed++;
                        if (!page.title.StartsWith("File:"))
                        {
                            continue;
                        }
                        while (true)
                        {
                            try
                            {
                                page.Load();

                                if (tagCompletedRegex.Match(page.text).Success)
                                {
                                    break;
                                }

                                if (!tagRegex.Match(page.text).Success &&
                                    !page.text.ToLower().Contains("{{picasareviewunnecessary}}") &&
                                    !page.text.ToLower().Contains("user:picasa review bot/reviewed-error"))
                                {
                                    Regex licenseReviewRegex = new Regex("{{LicenseReview\\|[^|]*\\|([^|]*)\\|([^}]*)}}");
                                    Match m;
                                    if ((m = licenseReviewRegex.Match(page.text)).Success)
                                    {
                                        page.text = licenseReviewRegex.Replace(page.text, "{{picasareview|" + m.Groups[1].ToString() + "|" + m.Groups[2].ToString() + "}}");
                                        SavePage(page, "Converting old LicenseReview tag into picasareview tag");
                                        break;
                                    }
                                    else
                                    {
                                        page.text += "\n{{picasareview}}\n";
                                    }
                                }

                                bool success = false;
                                do
                                {
                                    File.Delete("temp_wiki_image");
                                    File.Delete("temp_picasa_image");
                                    File.Delete("temp_picasa_image_full");

                                    string licenseName, mediaUrl;

                                    bool reviewUnnecessary = false;
                                    if (CheckIfReviewUnnecessary(page))
                                    {
                                        // Keep running so we can upload the original version, break out later
                                        // (unless it has an OTRS tag, in which case we shouldn't raise the resolution,
                                        // or is Flickr reviewed, in which case only a lower-resolution version may
                                        // be released on Flickr)
                                        reviewUnnecessary = true;
                                        success = true;
                                        if (HasOtrsTag(page) || IsFlickrReviewed(page)) continue;
                                    }

                                    if (!page.title.ToLower().EndsWith(".jpg") && !page.title.ToLower().EndsWith(".png") && !page.title.ToLower().EndsWith(".tiff"))
                                    {
                                        failureReason = "can only review image files, not other file types";
                                        continue;
                                    }

                                    if (!FetchPicasaImageInfo(page, out licenseName, out mediaUrl))
                                    {
                                        failureReason = "could not retrieve image information from Picasa";
                                        continue;
                                    }

                                    if (!reviewUnnecessary && !CheckLicense(page, licenseName))
                                    {
                                        failureReason = "image license on Picasa is invalid";
                                        continue;
//.........这里部分代码省略.........
开发者ID:wikigit,项目名称:Picasa-Review-Bot,代码行数:101,代码来源:Program.cs


示例17: User

 public User(Site site, string _name)
 {
     this.name = _name;
     this.site = site;
 }
开发者ID:BackupTheBerlios,项目名称:wikifighter-svn,代码行数:5,代码来源:DotNetWikiBot.cs


示例18: PageList

 /// <returns>Returns the PageList object.</returns>
 public PageList(Site site, string[] pageNames)
 {
     this.site = site;
     foreach (string pageName in pageNames)
         pages.Add(new Page(site, pageName));
 }
开发者ID:BackupTheBerlios,项目名称:wikifighter-svn,代码行数:7,代码来源:DotNetWikiBot.cs


示例19: LogIn

        public Site LogIn()
        {
            const string siteName = "https://wikidata.org";

            int it = 0;
            while (it < MaxItNum)
            {
                try
                {
                    _wikidataSite = new Site(siteName, Settings.Default.Login, Settings.Default.Password);
                    _commonlog.LogData("Logged to Wikidata", 2);
                    return _wikidataSite;
                }
                catch (Exception e)
                {
                    _commonlog.LogData(e.ToString(), 2);
                    it++;
                    Thread.Sleep(10000 * (int)Math.Pow(2, it));
                }
            }
            _commonlog.LogData("Cannot login", 2);
            throw new ApplicationException("Cannot log in");
        }
开发者ID:EmausWP,项目名称:SharpInterwiki,代码行数:23,代码来源:MovedPages.cs


示例20: BiblioBot

 public BiblioBot()
 {
     Site = new Site("www.bibliopedia.org/smw", "Biblioadmin", "biblio$Wiki0");
 }
开发者ID:mwidner,项目名称:bibliopedia,代码行数:4,代码来源:BiblioBot.cs



注:本文中的DotNetWikiBot.Site类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Parser.Parser类代码示例发布时间:2022-05-24
下一篇:
C# DotNetWikiBot.Page类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap