ExtractIncluded(string htmlResponse, string branch, string url) { var includedHtml = new RegexMatchChainer(htmlResponse, branch, url) .Next(_included, ErrorMessages.MatchInclItemsLotsFailed, Stages.InclItemsLots) .GetMatch(); var includedItemsCount = new RegexMatchChainer(includedHtml, branch, url) .Next(_numOfItems, ErrorMessages.MatchNumOfItemsFailed, Stages.NumOfItems) .Next(_number, ErrorMessages.MatchNumberFailed, Stages.Number) .GetMatchAsInt(); var includedLotsCount = new RegexMatchChainer(includedHtml, branch, url) .Next(_numOfLots, ErrorMessages.MatchNumOfLotsFailed, Stages.NumOfLots) .Next(_number, ErrorMessages.MatchNumberFailed, Stages.Number) .GetMatchAsInt(); var match = _notIncluded.Match(htmlResponse); if (match.Success) { var notIncludedItemsCount = new RegexMatchChainer(match.Value, branch, url) .Next(_numOfItems, ErrorMessages.MatchNumOfItemsFailed, Stages.NumOfItems) .Next(_number, ErrorMessages.MatchNumberFailed, Stages.Number) .GetMatchAsInt(); var notIncludedLotsCount = new RegexMatchChainer(match.Value, branch, url) .Next(_numOfLots, ErrorMessages.MatchNumOfLotsFailed, Stages.NumOfLots) .Next(_number, ErrorMessages.MatchNumberFailed, Stages.Number) .GetMatchAsInt(); return(includedItemsCount, includedLotsCount, notIncludedItemsCount, notIncludedLotsCount); } return(includedItemsCount, includedLotsCount, 0, 0); }
private static decimal ExtractPrice(string htmlResponse, Regex regex, string branch, string url) { var price = new RegexMatchChainer(htmlResponse, branch, url) .Next(regex, Stages.Title, ErrorMessages.MatchTitleFailed) .Next(_withinBTags, Stages.PartOutValue, ErrorMessages.MatchPartOutValue) .Next(_decimal, Stages.Decimal, ErrorMessages.MatchDeciamlFailed) .GetMatchAsDecimal(); return(price); }