void ReportAbandonURI(UriResource u, string reason) { try { AbandonLinks++; lbAbandonLinks.Text = strAbandonLinks + AbandonLinks; AbandonUri a = new AbandonUri(); a.Info = u; a.Reason = reason; AbandonLinkList.Add(a); if (AbandonLinkList.Count > 100) { AbandonLinkList.RemoveAt(0); } try { a.Keyword = hunter.projectInfo.strategy.GetKeyword(u.Keyword); } catch { a.Keyword = "[获取出错]"; } WriteAbandonUri(a); } catch (Exception ex) { WriteException(ex); } }
public void ShowContent(List <AbandonUri> arg) { Console.Clear(); //foreach (AbandonUri a in arg) for (int i = 0; i != (arg.Count > MAX ? MAX : arg.Count); i++) { AbandonUri a = arg[arg.Count - 1 - i]; Console.WriteLine("链接: " + a.Info.Url, HunterConfig.ColorMessage); Console.WriteLine("原因: " + a.Reason, HunterConfig.ColorException); Console.WriteLine("标题: " + a.Info.Text, HunterConfig.ColorMessage); Console.WriteLine("关键字: " + a.Keyword, HunterConfig.ColorMessage); Console.WriteLine("------------------------------", HunterConfig.ColorMessage); } this.ShowDialog(); }
void WriteAbandonUri(AbandonUri a) { try { if (cbViewAbandonLinks.Checked) { try { hunterTextBox.WriteLine("[抛弃链接 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "] " + a.Info.Url + ",标题:\"" + a.Info.Text + "\",关键字:\"" + hunter.projectInfo.strategy.GetKeyword(a.Info.Keyword) + "\",原因:" + a.Reason , HunterConfig.ColorAbandonLink); } catch { hunterTextBox.WriteLine("[抛弃链接 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "] " + a.Info.Url + ",标题:\"" + a.Info.Text + "\",关键字:\"[获取失败]\",原因:" + a.Reason , HunterConfig.ColorAbandonLink); } } } catch (Exception ex) { WriteException(ex); } }