当前位置: 首页>>代码示例>>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;未经允许,请勿转载。