Claymore.NewPagesWikiBot.CategoryTemplateIntersection.ProcessData C# (CSharp) Method

ProcessData() public method

public ProcessData ( Wiki wiki ) : string
wiki Claymore.SharpMediaWiki.Wiki
return string
        public virtual string ProcessData(Wiki wiki)
        {
            HashSet<string> ignore = new HashSet<string>();
            foreach (var category in CategoriesToIgnore)
            {
                string fileName = "Cache\\" + Module.Language + "\\PagesInCategoryWithTemplates\\" + Cache.EscapePath(category + "-" + Templates) + ".txt";
                using (TextReader streamReader = new StreamReader(fileName))
                {
                    streamReader.ReadLine();
                    streamReader.ReadLine();
                    string line;
                    while ((line = streamReader.ReadLine()) != null)
                    {
                        string[] groups = line.Split(new char[] { '\t' });
                        if (groups[2] == Namespace.ToString())
                        {
                            string title = groups[0].Replace('_', ' ');
                            ignore.Add(title);
                        }
                    }
                }
            }

            var pageList = new List<string>();
            var pages = new HashSet<string>();
            foreach (var category in Categories)
            {
                string fileName = "Cache\\" + Module.Language + "\\PagesInCategoryWithTemplates\\" + Cache.EscapePath(category + "-" + Templates) + ".txt";
                Console.Out.WriteLine("Processing data of " + category);
                using (TextReader streamReader = new StreamReader(fileName))
                {
                    streamReader.ReadLine();
                    streamReader.ReadLine();
                    string line;
                    while ((line = streamReader.ReadLine()) != null)
                    {
                        string[] groups = line.Split(new char[] { '\t' });
                        if (groups.Length > 2 && groups[2] == Namespace.ToString())
                        {
                            string title = groups[0].Replace('_', ' ');
                            if (ignore.Contains(title))
                            {
                                continue;
                            }
                            if (!pages.Contains(title))
                            {
                                pages.Add(title);
                                pageList.Add(title);
                            }
                        }
                    }
                }
            }

            var result = new List<string>();

            foreach (var el in pageList)
            {
                result.Add(string.Format(Format, el));
            }
            if (result.Count == 0)
            {
                return "";
            }
            return Header + string.Join(Delimeter, result.ToArray()) + Footer;
        }