///
/// 本周起止时间
///
///
///
private string weekrange(System.DateTime dt)
{
int weeknow = Convert.ToInt32(dt.DayOfWeek);
int daydiff = (-1) * weeknow;
int dayadd = 6-weeknow;
string datebegin = System.DateTime.Now.AddDays(daydiff).ToString("yyyyMMdd");
string dateend = System.DateTime.Now.AddDays(dayadd).ToString("yyyyMMdd");
return datebegin + " - " +dateend;
}
///
/// 返回指定URL的源代码
///
///
private string GetHTML( string url,string tag)
{
byte[] buf = new byte[38192];
.WebRequest request = WebRequest.Create(url);;
WebResponse response =request.GetResponse();
Stream resStream = response.GetResponseStream();
int count = resStream.Read(buf, 0, buf.Length);
string result = Encoding.Default.GetString(buf, 0, count);
resStream.Close();
Regex reg=new Regex(@"(?.*?"+tag+">)",RegexOptions.IgnoreCase);
string output=reg.Match(result).Value;
return StripHTML(output);
}
///
/// 去除HTML标记
///
/// 包括HTML的源码
/// 已经去除后的文字
public static string StripHTML(string strHtml)
{
string [] aryReg ={
@"",
@"",
@"([/r/n])[/s]+",
@"&(quot|#34);",
@"&(amp|#38);",
@"&(lt|#60);",
@"&(gt|#62);",
@"&(nbsp|#160);",
@"&(iexcl|#161);",
@"&(cent|#162);",
@"&(pound|#163);",
@"&(copy|#169);",
@"(/d+);",
@"-->",
@"