c#????????????????
???????????? ???????[ 2014/1/15 9:29:22 ] ????????c# ???????? bug
//????
void search()
{
int i = 0;
LinkQueue.addUnvisitedUrl("http://blog.csdn.net/zhujunxxxxx/");
while (!LinkQueue.unVisitedUrlsEmpty()
&& LinkQueue.getVisitedUrlNum() <= 1000)
{
//???URL ??????
String visitUrl=(String)LinkQueue.unVisitedUrlDeQueue();
if(visitUrl==null)
continue;
zzHttp downLoader = new zzHttp();
CookieContainer cookie = new CookieContainer();
//???????
string content=downLoader.SendDataByGET(visitUrl??""??ref cookie);
//??URL ??????????URL ??
LinkQueue.addVisitedUrl(visitUrl);
//?????????????е?URL
string baseUri = Utility.GetBaseUri(visitUrl);
string[] links = Parser.ExtractLinks(baseUri?? content);
//?μ?δ?????URL ???
i++;
Add2Message("????????:" + LinkQueue.getVisitedUrlNum() + "??count=" + LinkQueue.getUnVisitedUrl().getcount());
foreach (string link in links)
{
if (link.Contains("css") || link.Contains("js") || link.Contains("gif") || link.Contains("jpg") || link.Contains("png") || link.Contains("jpeg"))
continue;
LinkQueue.addUnvisitedUrl(link);
AddMessage(link);
}
}
}
private void button2_Click(object sender?? EventArgs e)
{
new Thread(search).Start();
}
private delegate void InfoDelegate(string message);
public void AddMessage(string message)
{
if (richTextBox1.InvokeRequired)//?????????????
{
InfoDelegate d = new InfoDelegate(AddMessage);
richTextBox1.Invoke(d?? new object[] { message});
}
else
{
richTextBox1.AppendText(message + Environment.NewLine);
richTextBox1.ScrollToCaret();
}
}
private delegate void Info2Delegate(string message);
public void Add2Message(string message)
{
if (label2.InvokeRequired)//?????????????
{
Info2Delegate d = new Info2Delegate(Add2Message);
label2.Invoke(d?? new object[] { message });
}
else
{
label2.Text = message;
}
}
}
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11