public List<string> GetSpecialCases(int number) { Log4netWrapper.Debug("Special Cases Sequence started for : " + number); List<string> strList = new List<string>(); for (int i = 0; i <= number; i++) { if (IsMultipleofThreeAndFive(i)) { strList.Add("Z"); } else if (IsMultipleofFive(i)) { strList.Add("E"); } else if (IsMultipleofThree(i)) { strList.Add("C"); } else { strList.Add(i.ToString()); } } Log4netWrapper.Debug("Special Cases Sequence finished for : " + number); return strList; }
public List<int> GetAllNumbers(int number) { Log4netWrapper.Debug("Even Number Sequence started for : " + number); List<int> numList = new List<int>(); for (int i = 0; i <= number; i++) { numList.Add(i); Log4netWrapper.Debug("Even Number Sequence for : " + number + " - " + i); } Log4netWrapper.Debug("Odd Number Sequence finished for : " + number); return numList; }
public List <SearchRecord> FindTopPosition(string p_SiteURL, string p_Keyword, int p_MaxRecords) { string l_Url = ParserUrl(Constants.SEARCHPARAMS.GOOGLE_SEARCH_URL, p_Keyword, p_MaxRecords); Log4netWrapper.Debug("Complete google Search URL with params : " + l_Url); string l_WebResponse = _NetworkManager.GetWebResponse(l_Url); if (!string.IsNullOrEmpty(l_WebResponse)) { Log4netWrapper.Debug("Web response found for : " + l_Url); return(ParseResults(l_WebResponse, p_SiteURL)); } else { Log4netWrapper.Debug("Web response not found for : " + l_Url); return(null); } }
private List <SearchRecord> ParseResults(string p_WebResponse, string p_SiteURL) { int l_SitePosition = 1; List <SearchRecord> l_SearchRecords = new List <SearchRecord>(); //Get DIV level tags from html foreach (Match l_GroupMatch in Regex.Matches(p_WebResponse, Constants.REGEX.DIV_REGEX)) { if (l_GroupMatch != null && l_GroupMatch.Groups.Count > 0) { //Get H3 level tags from html foreach (Match l_ResultMatch in Regex.Matches(l_GroupMatch.Groups[Constants.RegexIndex.GROUP].Value, Constants.REGEX.H3_REGEX)) { if (l_ResultMatch != null && l_ResultMatch.Groups.Count > 0) { //Get A level tags from html MatchCollection l_LinktMatchs = Regex.Matches(l_ResultMatch.Groups[Constants.RegexIndex.GROUP].Value, Constants.REGEX.ATAG_REGEX); if (l_LinktMatchs.Count > 0 && l_LinktMatchs[Constants.RegexIndex.VALUE].Groups.Count > 0) { if (l_LinktMatchs[Constants.RegexIndex.VALUE].Value.Contains(p_SiteURL)) { Log4netWrapper.Debug(string.Format("Site link [ {0} ] found in URL [ {1} ]", p_SiteURL, l_LinktMatchs[Constants.RegexIndex.VALUE].Value)); SearchRecord l_MatchRecord = new SearchRecord(); l_MatchRecord.URLDetails = l_LinktMatchs[Constants.RegexIndex.VALUE].Value; l_MatchRecord.Position = l_SitePosition; l_SearchRecords.Add(l_MatchRecord); } } } } } l_SitePosition++; } return(l_SearchRecords); }