private async Task ScanFile(string scanPath) { WriteLogLine("Scanning file " + scanPath); var result = await _clamEngine.ScanFileAsync(scanPath); if (result.Infected) { WriteLogLine("File infected with " + result.VirusName); } else { WriteLogLine("File clean"); } WriteLogLine("=========="); }
/// <summary> /// Asynchronously scans a file for viruses with the default scan options. /// </summary> /// <param name="engine">ClamAV engine instance.</param> /// <param name="path">Path to the file to be scanned.</param> /// <returns>The task object representing the asynchronous operation. The Result property on the task returns a scan result.</returns> public static async Task <FileScanResult> ScanFileAsync(this ClamEngine engine, string path) { return(await engine.ScanFileAsync(path, ScanOptions.StandardOptions)); }