void download_OnDownloadCompleted(object sender, DownloadCompletedEventArgs e) { string url = (sender as HtmlDownloader).Url; if (e.Canceled) { UpdateGridView(url, SpiderState.取消); return; } if (e.Exception != null) { UpdateGridView(url, SpiderState.失败); MyConsole.AppendLine(string.Format("下载Url:{0}失败,异常原因:{1}" + url, e.Exception.Message)); return; } if (e.ResultType == typeof(String)) { IHtmlParser parser = (AttachControl as IHtmlSpider).ParserEngin; List <string> newUrls = parser.ParseUrl(e.Result.ToString(), _baseForlder, url); UrlManager.AddNewUrls(url, newUrls.ToArray()); } else { //文件存储 ContentManger.Save(txtBasePath.Text, e.Result as byte[], SaveType.文件, Path.GetFileName(url)); _downloadFileCount++; } UpdateGridView(url, SpiderState.已完成); }
private void dataGridView2_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0 || e.ColumnIndex != Column7.Index) { return; } ContentManger.View(_baseForlder, SaveType.文件, Path.GetFileName(dataGridView2[1, e.RowIndex].Value.ToString())); }