當前位置: 首頁>>代碼示例>>C#>>正文


C# DBScanner.ArticleInfo類代碼示例

本文整理匯總了C#中WikiFunctions.DBScanner.ArticleInfo的典型用法代碼示例。如果您正苦於以下問題:C# ArticleInfo類的具體用法?C# ArticleInfo怎麽用?C# ArticleInfo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ArticleInfo類屬於WikiFunctions.DBScanner命名空間,在下文中一共展示了ArticleInfo類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Check

        public override bool Check(ArticleInfo article)
        {
            foreach (Regex r in Contains)
            {
                if (!r.IsMatch(article.Text))
                    return false;
            }

            return true;
        }
開發者ID:svn2github,項目名稱:autowikibrowser,代碼行數:10,代碼來源:Scanners.cs

示例2: Process

        private void Process()
        {
            string articleTitle = "";

            try
            {
                using (XmlTextReader reader = new XmlTextReader(stream))
                {
                    reader.WhitespaceHandling = WhitespaceHandling.None;

                    if (From.Length > 0)
                    {
                        //move to start from article
                        while (reader.Read() && mRun)
                        {
                            if (reader.Name == "page")
                            {
                                reader.ReadToFollowing("title");
                                articleTitle = reader.ReadString();

                                if (From == articleTitle)
                                    break;
                            }
                        }
                    }

                    while (reader.Read() && mRun)
                    {
                        if (reader.Name == "page")
                        {
                            ArticleInfo ai = new ArticleInfo();

                            reader.ReadToFollowing("title");
                            ai.Title = articleTitle = reader.ReadString();

                            //reader.ReadToFollowing(restriction); //TODO:This is wrong. Only want to read the restriction if in that <page></page>

                            if (reader.Name == "restrictions")
                                ai.Restrictions = reader.ReadString();
                            else
                                ai.Restrictions = "";

                            reader.ReadToFollowing("timestamp");
                            ai.Timestamp = reader.ReadString();
                            reader.ReadToFollowing("text");
                            ai.Text = reader.ReadString();

                            if (IgnoreComments)
                                ai.Text = WikiRegexes.Comments.Replace(ai.Text, "");

                            if (MultiThreaded)
                            {
                                if (PendingArticles.Count < ProcessorCount * 4 + 5)
                                {
                                    PendingArticles.Add(ai);
                                }
                                else
                                {
                                    ScanArticle(ai);
                                }
                            }
                            else
                            {
                                ScanArticle(ai);
                            }
                        }
                    }

                    lock (ScanThread)
                    {
                        stream = null;
                    }

                    if (MultiThreaded)
                    {
                        while (PendingArticles.Count > 0)
                            Thread.Sleep(10);

                        mRun = false;

                        foreach (Thread thr in SecondaryThreads)
                            thr.Join();
                    }
                }
            }
            catch (ThreadAbortException) { }
            catch (Exception ex)
            {
                if (boolMessage)
                    //System.Windows.Forms.MessageBox.Show("Problem on " + articleTitle + "\r\n\r\n" + ex.Message);
                    ErrorHandler.Handle(ex);
            }
            finally
            {
                if (boolMessage)
                    context.Post(SOPCstopped, articleTitle);
            }
        }
開發者ID:svn2github,項目名稱:autowikibrowser,代碼行數:98,代碼來源:MainProcess.cs

示例3: ReadArticle

        /// <summary>
        /// Reads a page from the reader, returns ArticleInfo or null if EOF
        /// </summary>
        private ArticleInfo ReadArticle(XmlReader reader)
        {
            do
                if (!reader.ReadToFollowing("page")) return null;
            while (!reader.IsStartElement());

            ArticleInfo ai = new ArticleInfo();
            while (reader.Read() && reader.Name != "page") // stop on closing element
            {
                if (!reader.IsStartElement()) continue;
                switch (reader.Name)
                {
                    case "title":
                        ai.Title = reader.ReadString();
                        break;
                    case "timestamp":
                        ai.Timestamp = reader.ReadString();
                        break;
                    case "restrictions":
                        ai.Restrictions = reader.ReadString();
                        break;
                    case "text":
                        ai.Text = reader.ReadString();
                        break;
                }
            }

            return ai.IsFullyRead ? ai : null;
        }
開發者ID:reedy,項目名稱:AutoWikiBrowser,代碼行數:32,代碼來源:MainProcess.cs

示例4: Check

 public override bool Check(ArticleInfo article)
 {
     return Parsers.MissingDefaultSort(article.Text, article.Title);
 }
開發者ID:svn2github,項目名稱:awb,代碼行數:4,代碼來源:Scanners.cs

示例5: Check

        public override bool Check(ArticleInfo article)
        {
            if (WikiRegexes.Category.IsMatch(article.Text))
                return false;

            foreach (Match m in WikiRegexes.Template.Matches(article.Text))
            {
                if (!m.Value.Contains("stub"))
                    return false;
            }

            return true;
        }
開發者ID:svn2github,項目名稱:autowikibrowser,代碼行數:13,代碼來源:Scanners.cs

示例6: ScanArticle

        private void ScanArticle(ArticleInfo ai)
        {
            if (IgnoreComments)
                ai.Text = WikiRegexes.Comments.Replace(ai.Text, "");

            foreach (Scan z in Scanners)
            {
                if (!z.Check(ai))
                {
                    return;
                }
            }

            OutputQueue.Add(ai.Title);
        }
開發者ID:reedy,項目名稱:AutoWikiBrowser,代碼行數:15,代碼來源:MainProcess.cs

示例7: ScanArticle

        private void ScanArticle(ArticleInfo ai)
        {
            foreach (Scan z in Scanners)
            {
                if (!z.Check(ref ai.Text, ref ai.Title, ai.Timestamp, ai.Restrictions))
                {
                    return;
                }
            }

            OutputQueue.Add(ai.Title);
        }
開發者ID:svn2github,項目名稱:autowikibrowser,代碼行數:12,代碼來源:MainProcess.cs


注:本文中的WikiFunctions.DBScanner.ArticleInfo類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。