protected void Button1_Click(object sender, EventArgs e) { ReqUtils gn = new ReqUtils(); ArrayList NewList = gn.ExtractNewsLinks(txtString.Text, txtRegEx.Text, ""); Response.Write(NewList.Count); }
public void GetSingleSite(int privateSiteCode, int privateLimitCount) { int Count = 1; string NewsTitle = ""; string HtmlContent = ""; string EditedNewsTitle = ""; string NewsTextTitle = ""; ReqUtils gn; string SelectStatement = ""; BOLResourseSiteCats ResourceSiteCatsBOL = new BOLResourseSiteCats(1); vResourseSiteCats SingleSite = ResourceSiteCatsBOL.GetSingleSite(privateSiteCode); int SiteCode = SingleSite.Code; string SiteName = SingleSite.Name; string SiteUrl = SingleSite.Url; int? EncodingTypeCode = SingleSite.HCEncodingTypeCode; string BaseURL = SingleSite.BaseURL; string RELink = SingleSite.RELink; string REDetail = SingleSite.REDetail; string REImage = SingleSite.REImage; string REVideo = SingleSite.REVideo; ArrayList NewList = new ArrayList(); gn = new ReqUtils(); System.Text.Encoding enc = System.Text.Encoding.UTF8; if (EncodingTypeCode != 1) { IBaseBOL <DataTable> BolHardCode = new BOLHardCode(); BolHardCode.QueryObjName = "HCEncodingTypes"; DataTable dt = BolHardCode.GetDetails((int)EncodingTypeCode); enc = System.Text.Encoding.GetEncoding(dt.Rows[0]["Description"].ToString()); } int LastSlash = SiteUrl.LastIndexOf("/"); string LinkDomainName; if (BaseURL != null && BaseURL != "") { LinkDomainName = BaseURL; } else { LinkDomainName = SiteUrl.Substring(0, LastSlash + 1); } if (!(bool)SingleSite.RssIsActive) { HtmlContent = gn.GetHTML(SiteUrl, enc); NewList = gn.ExtractNewsLinks(HtmlContent, RELink, LinkDomainName); } else { NewList = GetNewsList(SingleSite.RssUrl); } IEnumerator NewENum = NewList.GetEnumerator(); gn = new ReqUtils(); while (NewENum.MoveNext()) { NewsTitle = NewENum.Current.ToString(); NewsTextTitle = gn.RemoveTags(NewsTitle); BOLNews NewsBOl = new BOLNews(); if (!NewsBOl.CheckNewsExists(NewsTextTitle, SiteCode)) { string RealLink = gn.ExtractLink(NewsTitle); string outStr = ""; //outStr = string.Format("<table width=100% ><tr><td class=\"cNews\">{1}</td><td>{0}</td></tr></table>", Count, NewsTitle); //Response.Write(outStr); //Response.Flush(); ListNews(SiteCode, RealLink, NewsTitle, REDetail, REImage, REVideo, Count, LinkDomainName, (int)EncodingTypeCode); } Count++; if (privateLimitCount != 0) { if (privateLimitCount == Count) { break; } } } }