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


C# Result.addPaper方法代碼示例

本文整理匯總了C#中System.Result.addPaper方法的典型用法代碼示例。如果您正苦於以下問題:C# Result.addPaper方法的具體用法?C# Result.addPaper怎麽用?C# Result.addPaper使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Result的用法示例。


在下文中一共展示了Result.addPaper方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: MSASConnectFetch

        public ResultList MSASConnectFetch(Uri URL)
        {

            WebClient wc = new WebClient();
            wc.Proxy = WebProxy.GetDefaultProxy();

            ResultList resList = new ResultList();


            var data = " ";
            try
            {
                data = wc.DownloadString(URL);
                //Console.WriteLine(data);
            }
            catch (Exception e)
            {
                //TabPage.displayError("MS Also blocking Dude !!! YY !!!!");
                return null;
            }
            JObject obj = JObject.Parse(data);

            int paperCount = 0;

            if (obj["d"]["Publication"]["Result"].Count() == 0)
            {

                //TabPage.displayError("No Results");
                return null;
            }
            int total = (int)obj["d"]["Publication"]["TotalItem"];
            Console.WriteLine("sdfsd" + total);
            resList.setCount(total);
            while (paperCount < obj["d"]["Publication"]["Result"].Count())
            {

                Result result = new Result();
                Paper p = new Paper();



                String title = (String)obj["d"]["Publication"]["Result"][paperCount]["Title"];
                p.settitle(title);

                String content = (String)obj["d"]["Publication"]["Result"][paperCount]["Abstract"];
                p.setdescription(content);
                int authorCount = 0;

                String authors = "";

                while (authorCount < obj["d"]["Publication"]["Result"][paperCount]["Author"].Count() && authorCount < 5)
                {

                    authors += (String)obj["d"]["Publication"]["Result"][paperCount]["Author"][authorCount]["FirstName"] + " ";

                    if ((String)obj["d"]["Publication"]["Result"][paperCount]["Author"][authorCount]["MiddleName"] != "")

                        authors += (String)obj["d"]["Publication"]["Result"][paperCount]["Author"][authorCount]["MiddleName"] + " " + (String)obj["d"]["Publication"]["Result"][paperCount]["Author"][authorCount]["LastName"] + " , ";
                    else
                        authors += (String)obj["d"]["Publication"]["Result"][paperCount]["Author"][authorCount]["LastName"] + " , ";

                    authorCount++;
                }

                p.setYear((int)obj["d"]["Publication"]["Result"][paperCount]["Year"]);
                p.setauthors(authors);

                //if (obj["d"]["Publication"]["Result"][paperCount]["Conference"] != null)
                //  p.setConferenceUrl(((String)(obj["d"]["Publication"]["Result"][paperCount]["Conference"][0])));


                int citations = Convert.ToInt32((String)obj["d"]["Publication"]["Result"][paperCount]["CitationCount"]);
                p.setnumCitations(citations);

                String url = "";

                if (obj["d"]["Publication"]["Result"][paperCount]["FullVersionURL"].Count() > 0)
                {
                    url = (String)obj["d"]["Publication"]["Result"][paperCount]["FullVersionURL"][0];
                }


                if (url != "")
                {
                    Uri titleURL = new Uri(url);
                    p.seturl(titleURL);
                }
                else
                {
                    p.seturl(null);
                }
                int id = (int)obj["d"]["Publication"]["Result"][paperCount]["ID"];
                p.setid(id);
                paperCount++;

                result.addPaper(p);
                resList.Add(result);
            }
            return resList;

//.........這裏部分代碼省略.........
開發者ID:srinivasans,項目名稱:OpenSoft2013,代碼行數:101,代碼來源:Parser.cs

示例2: GSConnect


//.........這裏部分代碼省略.........
            if (testNode != null)
            {

                TabPage.displayError("No Results Found ! Please Try Again!!!");
                return null;
            }





            testNode = document.DocumentNode.SelectSingleNode("//div[@class='gs_r']/div[@class='gs_ri']");
            if (testNode != null)
            {
                foreach (HtmlNode startNode in document.DocumentNode.SelectNodes("//div[@class='gs_r']/div[@class='gs_ri']"))
                {
                    Paper paper = new Paper();

                    HtmlNode titleNode = startNode.SelectSingleNode("h3[@class='gs_rt']");

                    resTitle = titleNode.InnerText;
                    paper.settitle(resTitle);

                    HtmlNode authorLinkNode = titleNode.SelectSingleNode("a[@href]");

                    resTitleLink = authorLinkNode.Attributes["href"].Value;

                    paper.seturl(new Uri(resTitleLink));

                    HtmlNode authorNode = startNode.SelectSingleNode("div[@class='gs_a']");


                    resAuthor = authorNode.InnerText;
                    paper.setauthors(resAuthor);


                    HtmlNode contentNode = startNode.SelectSingleNode("div[@class='gs_rs']");

                    if (contentNode != null)
                    {
                        resContent = contentNode.InnerText;
                        if (resContent != null)
                        {
                            paper.setdescription(resContent);
                        }
                    }


                    HtmlNode citeNode = startNode.SelectSingleNode("div[@class='gs_fl']");

                    int numCite;
                    if (citeNode != null)
                    {

                        HtmlNode citeInfoNode = citeNode.SelectSingleNode("a[@href]");

                        resCite = citeInfoNode.InnerText;
                        if (resCite.Contains("Cited by"))
                        {
                            resCite = resCite.Replace("Cited by ", "");
                            numCite = Convert.ToInt32(resCite);
                            paper.setnumCitations(numCite);
                            resLink = citeInfoNode.Attributes["href"].Value;

                            paper.setcitationsUrl(resLink);
                        }
                        else
                        {

                            numCite = 0;
                            paper.setnumCitations(numCite);
                        }
                    }
                    else
                    {
                        numCite = 0;
                        paper.setnumCitations(numCite);

                    }


                    result.addPaper(paper);

                }
                return result;

            }

            else
            {

                //TabPage.displayError("GS Blocking!!!");
                return null;
            }





        }
開發者ID:srinivasans,項目名稱:OpenSoft2013,代碼行數:101,代碼來源:Parser.cs


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