Esempio n. 1
0
        private static void SetBackersAllowedValues(HtmlNode htmlNode, BackingLevel level)
        {
            var limitBackersNode = GetNodesFor(htmlNode, "span", "class", "limited-number").ToList();

            if (limitBackersNode.Any())
            {
                // Format: (3 of 6 left)
                level.RemainingBackersAllowed = int.Parse(limitBackersNode.First().InnerText.Split(' ')[0].Replace("(", string.Empty));
                level.MaxBackersAllowed = int.Parse(limitBackersNode.First().InnerText.Split(' ')[2]);
            }
        }
Esempio n. 2
0
        private static IEnumerable<BackingLevel> GetLevels(HtmlDocument doc, Currency currency)
        {
            var rewardNode = GetNodesFor(doc, "div", "class", "NS-projects-reward");

            foreach (var htmlNode in rewardNode)
            {
                var level = new BackingLevel(currency);

                level.Money = GetMoney(htmlNode);

                level.Backers = GetBackers(htmlNode);

                SetBackersAllowedValues(htmlNode, level);

                level.IsSoldOut = GetIsSoldOut(htmlNode);

                if (level.IsSoldOut) level.MaxBackersAllowed = level.Backers;

                level.Description = GetDescription(htmlNode);

                yield return level;
            }
        }