private void AlertOnPositive(string sha256Hash, string pathToFile) { var definition = _localStorage.Definitions.Single(sr => sr.Hash == sha256Hash); var scanResults = definition.ScanResults; OnNewFileScan(new NewFileScanEventHandlerArgs { FileScan = new FileScan { Path = pathToFile, PositiveScans = scanResults.Count(sr => sr.IsVirus), TotalScans = scanResults.Count } }); if (scanResults.Any(sr => sr.IsVirus)) { OnVirusFound(new DetectedVirus { Path = pathToFile, VirusName = DetectedVirus.GenerateName(definition), DetectionTime = DateTime.Now, HitCount = scanResults.Count(sr => sr.IsVirus), ScanCount = scanResults.Count }); } }
private void OnVirusFound(DetectedVirus virus) { FoundViruses.Add(virus); if (VirusFound != null) { VirusFound(this, new VirusFoundEventHandlerArgs { Virus = virus }); } }