public static string GetCookieByHead(string sInput) { List <string> list = CRegex.GetList(CRegex.GetText(sInput, @"Set-Cookie:(?<Cookie>[\s\S]+?)\n", "Cookie"), @"(?<cookie>[\w\d\.]+=[\w\d\._-]+);", "cookie"); string str2 = ""; foreach (string str3 in list) { str2 = str2 + str3 + "; "; } return(str2); }
public static string ClearTag(string sHtml, bool bClear) { if (sHtml == "") { return(""); } sHtml = CRegex.Replace(sHtml, CRegex.sIFrameReg, "", 0); sHtml = CRegex.Replace(sHtml, CRegex.sScriptReg, "", 0); sHtml = CRegex.Replace(sHtml, @"(<[^>\s]*\b(\w)+\b[^>]*>)|([\s]+)|(<>)|( )", "", 0); sHtml = sHtml.Replace("\"", "").Replace("<", "").Replace(">", ""); return(sHtml); }
public static List <CookieObj> GetCookieList(string sInput, List <CookieObj> listInput) { List <string> list = CRegex.GetList(CRegex.Replace(CRegex.GetText(sInput, @"Set-Cookie:(?<Cookie>[\s\S]+?)\n", "Cookie"), "expires=([^;]+)GMT;", "", 0).Replace("path=/", ""), @"(?<cookie>[\w\d\&\.=]+[\w\d\._-]+);", "cookie"); CookieObj item = null; List <CookieObj> list2 = new List <CookieObj>(); foreach (string str4 in list) { if (str4.IndexOf('=') >= 1) { string str2 = str4.Substring(0, str4.IndexOf('=')); if (str2 != "domain") { string str3; if (str4.Length < (str4.IndexOf('=') + 1)) { str3 = ""; } else { str3 = str4.Substring(str4.IndexOf('=') + 1); } item = new CookieObj { cookieName = str2, cookieValue = str3 }; list2.Add(item); } } } foreach (CookieObj obj4 in list2) { bool flag = false; for (int i = 0; i < listInput.Count; i++) { CookieObj obj3 = listInput[i]; if (obj3.cookieName == obj4.cookieName) { flag = true; obj3.cookieValue = obj4.cookieValue; } } if (!flag) { listInput.Add(obj4); } } return(listInput); }
public static string ClearTag(string sHtml) { if (sHtml == "") { return(""); } sHtml = CRegex.Replace(sHtml, CRegex.sIFrameReg, "", 0); sHtml = CRegex.Replace(sHtml, CRegex.sScriptReg, "", 0); sHtml = Regex.Replace(sHtml, "<[^>]*>| ", string.Empty, RegexOptions.IgnoreCase); sHtml = Regex.Replace(sHtml, @"\s\s", " ", RegexOptions.IgnoreCase); sHtml = Regex.Replace(sHtml, @"\s\s", " ", RegexOptions.IgnoreCase); sHtml = Regex.Replace(sHtml, @"\s\s", " ", RegexOptions.IgnoreCase); sHtml = Regex.Replace(sHtml, "“", "“", RegexOptions.IgnoreCase); sHtml = Regex.Replace(sHtml, "”", "”", RegexOptions.IgnoreCase); return(sHtml); }
public static string JsToHtml(string strJS) { return(CRegex.Replace(strJS.Replace("document.writeln(\"", "").Replace("document.write(\"", "").Replace("document.write('", ""), @"(?<backslash>\\)[^\\]", "", "backslash").Replace(@"\\", @"\").Replace(@"/\\\", @"\").Replace(@"/\\\'", @"\'").Replace(@"/\\\//", @"\/").Replace("\");", "").Replace("\")", "").Replace("');", "")); }