private decimal?GetParameterValue(string prefix, string postfix, string pageContent = null) { if (string.IsNullOrEmpty(pageContent)) { pageContent = WebPageContent; } var checker = new BasePriceChecker(prefix, postfix); var draftValue = checker.GetElementValue(pageContent); if (string.IsNullOrEmpty(draftValue)) { return(null); } int index = draftValue.Length - 1; string stringValue = string.Empty; while (draftValue[index] != '>') { stringValue = draftValue[index--] + stringValue; } stringValue = stringValue.Replace("–", "-"); stringValue = stringValue.Replace("�", ""); if (stringValue == "-") { return(null); } return(Convert.ToDecimal(stringValue)); }
private decimal?GetDohWeek() { string prefix = @"Доходность за период"; prefix = prefix.Replace("'", "\""); //var postfix = "</td><td>"; var postfix = "%</td></tr></tbody></table></div"; postfix = postfix.Replace("'", "\""); var checker = new BasePriceChecker(prefix, postfix); var draftValue = checker.GetElementValue(WebPageContent); if (string.IsNullOrEmpty(draftValue)) { return(null); } int index = draftValue.Length - 1; string stringValue = string.Empty; char currentSymbol; do { currentSymbol = draftValue[index]; draftValue = draftValue.Substring(0, draftValue.Length - 1); --index; }while (currentSymbol != '%'); //prefix = draftValue.Substring(0, 1); //postfix = "%"; index = draftValue.Length - 1; stringValue = string.Empty; while (draftValue[index] != '>') { stringValue = draftValue[index--] + stringValue; } stringValue = stringValue.Replace("–", "-"); if (stringValue == "-") { return(null); } return(Convert.ToDecimal(stringValue)); }