void ReportAbandonFile(DownloadInfo d, string reason) { try { AbandonFiles++; lbAbandonFiles.Text = strAbandonFiles + AbandonFiles; AbandonFile a = new AbandonFile(); a.Info = d; a.Reason = reason; AbandonFileList.Add(a); if (AbandonFileList.Count > 100) { AbandonFileList.RemoveAt(0); } try { a.Keyword = hunter.projectInfo.strategy.GetKeyword(d.Keyword); } catch { a.Keyword = "[获取出错]"; } WriteAbandonFile(a); } catch (Exception ex) { WriteException(ex); } }
void WriteAbandonFile(AbandonFile a) { try { if (cbViewAbandonFiles.Checked) { hunterTextBox.WriteLine("[抛弃文件 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "] " + a.Info.Url + ",关键字:\"" + hunter.projectInfo.strategy.GetKeyword(a.Info.Keyword) + "\",原因:" + a.Reason , HunterConfig.ColorAbandonFile); } } catch (Exception ex) { WriteException(ex); } }
public void ShowContent(List <AbandonFile> arg) { Console.Clear(); for (int i = 0; i != (arg.Count > MAX ? MAX : arg.Count); i++) { AbandonFile a = arg[arg.Count - 1 - i]; Console.WriteLine("文件路径: " + a.Info.Filepath, HunterConfig.ColorMessage); Console.WriteLine("原因: " + a.Reason, HunterConfig.ColorException); Console.WriteLine("来源: " + a.Info.Url, HunterConfig.ColorMessage); Console.WriteLine("关键字: " + a.Keyword, HunterConfig.ColorMessage); Console.WriteLine("MD5: " + a.Info.Md5, HunterConfig.ColorMessage); Console.WriteLine("------------------------------", HunterConfig.ColorMessage); } this.ShowDialog(); }