public bool NeedStop(Page page, BaseTargetUrlsCreator creator) { bool canStop; if (IsContain) { canStop = false; } else { canStop = true; } foreach (var stopper in Contents) { if (IsContain) { if (page.Content.Contains(stopper)) { canStop = true; } } else { if (page.Content.Contains(stopper)) { canStop = false; } } } return(canStop); }
public bool NeedStop(Page page, BaseTargetUrlsCreator creator) { string current = creator.GetCurrentPaggerString(page.Url); int currentIndex = int.Parse(RegexUtil.NumRegex.Match(current).Value); if (currentIndex == Limit) { return(true); } return(false); }
public bool NeedStop(Page page, BaseTargetUrlsCreator creator) { var current = creator.GetCurrentPaggerString(page.Request.Method.ToUpper() == "GET" ? page.Url : page.Request.PostBody); int currentIndex = int.Parse(RegexUtil.NumRegex.Match(current).Value); if (currentIndex >= Limit) { return(true); } return(false); }
public bool NeedStop(Page page, BaseTargetUrlsCreator creator) { var tmps = page.Selectable.SelectList(SelectorUtil.Parse(TimeSelector)).GetValues(); if (tmps == null) { return(true); } List <string> timeStrings = new List <string>(); foreach (var c in tmps) { var s = c; if (TimeFormatters != null) { foreach (var formatter in TimeFormatters) { s = formatter.Formate(s); } } timeStrings.Add(s); } foreach (var c in timeStrings) { var dt = DateTime.Parse(c); if (IsBefore) { foreach (var stopper in Times) { var stopDate = DateTime.Parse(stopper); if (dt < stopDate) { return(true); } } } else { foreach (var stopper in Times) { var stopDate = DateTime.Parse(stopper); if (dt > stopDate) { return(true); } } } } return(false); }
public bool NeedStop(Page page, BaseTargetUrlsCreator creator) { int totalPage = -2000; if (TotalPageSelector != null) { string totalStr = page.Selectable.Select(SelectorUtil.Parse(TotalPageSelector)).GetValue(); if (TotalPageFormatters != null) { foreach (var formatter in TotalPageFormatters) { totalStr = formatter.Formate(totalStr); } } if (!string.IsNullOrEmpty(totalStr)) { totalPage = int.Parse(totalStr); } } int currentPage = -1000; if (CurrenctPageSelector != null) { string currentStr = page.Selectable.Select(SelectorUtil.Parse(CurrenctPageSelector)).GetValue(); if (CurrnetPageFormatters != null) { foreach (var formatter in CurrnetPageFormatters) { currentStr = formatter.Formate(currentStr); } } if (!string.IsNullOrEmpty(currentStr)) { currentPage = int.Parse(currentStr); } } if (currentPage == totalPage) { return(true); } return(false); }
public bool NeedStop(Page page, BaseTargetUrlsCreator creator) { return(Func(page, creator)); }
public bool NeedStop(Page page, BaseTargetUrlsCreator creator) { int totalPage = -2000; if (TotalPageSelector != null) { string totalStr = string.Empty; if (TotalPageSelector.Type == SelectorType.Enviroment) { var selector = SelectorUtil.Parse(TotalPageSelector) as EnviromentSelector; if (selector != null) { totalStr = EntityExtractor.GetEnviromentValue(selector.Field, page, 0); } } else { totalStr = page.Selectable.Select(SelectorUtil.Parse(TotalPageSelector)).GetValue(); } if (!string.IsNullOrEmpty(totalStr)) { if (TotalPageFormatters != null) { foreach (var formatter in TotalPageFormatters) { totalStr = formatter.Formate(totalStr); } } if (!string.IsNullOrEmpty(totalStr)) { totalPage = int.Parse(totalStr); } } } int currentPage = -1000; if (CurrenctPageSelector != null) { string currentStr = string.Empty; if (CurrenctPageSelector.Type == SelectorType.Enviroment) { var selector = SelectorUtil.Parse(CurrenctPageSelector) as EnviromentSelector; if (selector != null) { currentStr = EntityExtractor.GetEnviromentValue(selector.Field, page, 0); } } else { currentStr = page.Selectable.Select(SelectorUtil.Parse(CurrenctPageSelector)).GetValue(); } if (!string.IsNullOrEmpty(currentStr)) { if (CurrnetPageFormatters != null) { foreach (var formatter in CurrnetPageFormatters) { currentStr = formatter.Formate(currentStr); } } if (!string.IsNullOrEmpty(currentStr)) { currentPage = int.Parse(currentStr); } } } if (currentPage == totalPage) { return(true); } return(false); }