Exemplo n.º 1
0
 void FillListViewWithFoundViruses()
 {
     this.HandleInvoke(() =>
     {
         lvwVirusHistory.Items.Clear();
         foreach (var virus in _scanner.FoundViruses)
         {
             var item = new ListViewItem(Path.GetFileName(virus.Path));
             var detectionTimeString = virus.DetectionTime.ToString(CultureInfo.InvariantCulture);
             item.SubItems.Add(detectionTimeString);
             item.SubItems.Add(virus.HitCount + "/" + virus.ScanCount);
             item.SubItems.Add(FileScan.CalculateVirusRisk(virus));
             item.SubItems.Add(virus.Path);
             lvwVirusHistory.Items.Add(item);
         }
     });
 }
Exemplo n.º 2
0
 /// <summary>
 /// The event that gets triggered when a new file scan occures
 /// </summary>
 /// <param name="sender">The class that triggered the event</param>
 /// <param name="e">The data that got scanned</param>
 void VirusScanner_NewScanFile(object sender, NewFileScanEventHandlerArgs e)
 {
     this.HandleInvoke(() =>
     {
         _scanCount++;
         var item = new ListViewItem(Path.GetFileName(e.FileScan.Path));
         item.SubItems.Add(DateTime.Now.ToLongTimeString());
         var totalScans = e.FileScan.TotalScans;
         item.SubItems.Add(e.FileScan.PositiveScans + "/" + (totalScans == 0 ? 57 : totalScans));
         var virusPrognosis = FileScan.CalculateVirusRisk(e.FileScan);
         item.SubItems.Add(virusPrognosis);
         lvwScanLog.Items.Add(item);
         if (lvwScanLog.Items.Count > 21)
         {
             lvwScanLog.Items.RemoveAt(0);
         }
         tbxTotalScans.Text = _scanCount.ToString();
     });
 }