/// <summary> /// 分析 /// </summary> /// <param name="html"></param> protected override void HtmlAnalyse(string html) { if (string.IsNullOrEmpty(html)) { return; } //处理列表部分 var match = Regex.Match(html, REGEX_PATTERN); while (match.Success) { var p = Convert.ToInt32(match.Groups["p"].Value); var t = Convert.ToDouble(match.Groups["t"].Value); var ip = match.Groups["ip"].Value.Trim(); if (t <= 1) { var article = new ProxyIPNode { Port = p, IP = ip }; ResultArticleList.Add(article); } match = match.NextMatch(); } }
public virtual void WriteToTxt(string fileName) { if (string.IsNullOrEmpty(fileName)) { throw new ArgumentNullException("fileName", "[fileName] NULL"); } if (ResultArticleList.Count > 0) { ////XmlSerializeHelper.SerializeToXml<List<ProxyIPNode>>("ProxyIPConfig.o.xml", oList); File.WriteAllLines(fileName, ResultArticleList.ConvertAll <string>(x => string.Format(@"""{0}"",""{1}""", x.IP, x.Port)).ToArray()); } }