当前位置: 首页>>代码示例>>C#>>正文


C# HtmlNodeCollection.FirstOrDefault方法代码示例

本文整理汇总了C#中HtmlAgilityPack.HtmlNodeCollection.FirstOrDefault方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlNodeCollection.FirstOrDefault方法的具体用法?C# HtmlNodeCollection.FirstOrDefault怎么用?C# HtmlNodeCollection.FirstOrDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HtmlAgilityPack.HtmlNodeCollection的用法示例。


在下文中一共展示了HtmlNodeCollection.FirstOrDefault方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetConvertedManaCost

 private static void SetConvertedManaCost(ScrappedCardModel scrappedCard, HtmlNodeCollection table)
 {
     var row = table.FirstOrDefault(x => x.ChildNodes[1].InnerText.Contains("Converted Mana Cost"));
     if (row != null) scrappedCard.ConvertedManaCost = int.Parse(row.ChildNodes[2].InnerText.Trim());
 }
开发者ID:Kmaczek,项目名称:MDOWebSite,代码行数:5,代码来源:PageScrapper.cs

示例2: SetExpansion

 private static void SetExpansion(ScrappedCardModel scrappedCard, HtmlNodeCollection table)
 {
     var row = table.FirstOrDefault(x => x.ChildNodes[1].InnerText.Contains("Expansion"));
     if (row != null) scrappedCard.Expansion = row.ChildNodes[2].InnerText.Trim();
 }
开发者ID:Kmaczek,项目名称:MDOWebSite,代码行数:5,代码来源:PageScrapper.cs

示例3: SetPowerAndThoughness

 private static void SetPowerAndThoughness(ScrappedCardModel scrappedCard, HtmlNodeCollection table)
 {
     var row = table.FirstOrDefault(x => x.ChildNodes[1].InnerText.Contains("P/T"));
     if (row != null)
     {
         var pt = row.ChildNodes[2].InnerText.Trim().Trim('(', ')').Split('/');
         scrappedCard.Power = pt[0];
         scrappedCard.Thoughness = pt[1];
     }
 }
开发者ID:Kmaczek,项目名称:MDOWebSite,代码行数:10,代码来源:PageScrapper.cs

示例4: SetTypes

 private static void SetTypes(ScrappedCardModel scrappedCard, HtmlNodeCollection table)
 {
     var row = table.FirstOrDefault(x => x.ChildNodes[1].InnerText.Contains("Types"));
     if (row != null) scrappedCard.Types = row.ChildNodes[2].InnerText.Trim().Replace(" —", "").Split(' ').ToList();
 }
开发者ID:Kmaczek,项目名称:MDOWebSite,代码行数:5,代码来源:PageScrapper.cs

示例5: SetManaCost

        private static void SetManaCost(ScrappedCardModel scrappedCard, HtmlNodeCollection table)
        {
            var row = table.FirstOrDefault(x => x.ChildNodes[1].InnerText.Contains("Mana Cost"));
            if (row != null)
            {
                foreach (var childNode in row.ChildNodes[2].ChildNodes)
                {
                    if (childNode.Name == "#text")
                        continue;

                    var alt = childNode.GetAttributeValue("alt", "");
                    if (alt.Contains("CMC"))
                    {
                        if (alt.Length > 4)
                        {
                            scrappedCard.ColorlessMana = alt[3].ToString() + alt[4];
                        }
                        else
                        {
                            scrappedCard.ColorlessMana = alt[3].ToString();
                        }
                    }
                    else if (alt.Contains("Color R"))
                    {
                        scrappedCard.RedMana++;
                    }
                    else if (alt.Contains("Color U"))
                    {
                        scrappedCard.BlueMana++;
                    }
                    else if (alt.Contains("Color G"))
                    {
                        scrappedCard.GreenMana++;
                    }
                    else if (alt.Contains("Color W"))
                    {
                        scrappedCard.WhiteMana++;
                    }
                    else if (alt.Contains("Color B"))
                    {
                        scrappedCard.BlackMana++;
                    }
                }
            }
        }
开发者ID:Kmaczek,项目名称:MDOWebSite,代码行数:45,代码来源:PageScrapper.cs

示例6: FilterPage

 protected override bool FilterPage(HtmlNodeCollection pictureHtmlNode, ref int pageNum)
 {
     if (base.FilterPage(pictureHtmlNode, ref pageNum))
     {
         return true;
     }
     if (pictureHtmlNode.Count() <= 1)
     {
         var picNode = pictureHtmlNode.FirstOrDefault();
         if (picNode == null)
         {
             pageNum = 500;
             return true;
         }
         var picturePathName = picNode.Attributes["src"].Value;
         if (picturePathName.Contains("bctp_28.gif"))
         {
             pageNum = 500;
             return true;
         }
     }
     return false;
 }
开发者ID:key-value,项目名称:CollectionApplication,代码行数:23,代码来源:PictureSecretary.cs

示例7: GetNodeForUrl

 internal static HtmlNode GetNodeForUrl(HtmlNodeCollection nodes, string url) {
     var hrefNode = nodes.FirstOrDefault(n => n.GetAttributeValue("href", "").Contains(url));
     return hrefNode;
 }
开发者ID:slieser,项目名称:sandbox2,代码行数:4,代码来源:GoogleRankChecker.cs

示例8: GetMetaProperty

		private static string GetMetaProperty(HtmlNodeCollection nodes, string prop) 
			=> nodes.FirstOrDefault(x => x.Attributes["property"]?.Value == prop)?.Attributes["content"]?.Value;
开发者ID:irufus,项目名称:Hearthstone-Deck-Tracker,代码行数:2,代码来源:MetaTagImporter.cs

示例9: GetInfoElem

		private HtmlNode GetInfoElem(HtmlNodeCollection nodes, string title) {
			return nodes.FirstOrDefault(n => n.SelectNodes("span[text() = '" + title + "&nbsp;:']") != null);
		}
开发者ID:realzhaorong,项目名称:vocadb,代码行数:3,代码来源:KarenTAlbumImporter.cs


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