public void Start(string virusTotalApiKey) { VirusTotalQueue.Start(virusTotalApiKey); _localStorage.Load(); _shouldStopRunning = false; new Thread(ThreadMethod).Start(); }
public void Stop() { _shouldStopRunning = true; VirusTotalQueue.Stop(); _localStorage.Save(); SaveFoundVirusesDatabase(); }
/// <summary> /// Initializes a new instance of the virus scanner /// </summary> public VirusScanner() { LoadFoundVirusesDatabase(); VirusTotalQueue = new VirusTotalQueue(OnVirusFound); _localStorage = new CachedDefinitions(); _fileQueue = new ConcurrentBag <string>(); VirusTotalQueue.NewDefinition += VirusTotalQueue_NewDefinition; }
private void HandleFile(FileInfo fileInfo) { var sha256Hash = HashHelper.GetSHA256(fileInfo); if (_localStorage.Definitions.Exists(sr => sr.Hash == sha256Hash)) { AlertOnPositive(sha256Hash, fileInfo.FullName); } else { VirusTotalQueue.Enqueue(fileInfo); } }