public void AppendScanPath(string path) { if (string.IsNullOrEmpty(path)) { return; } _scan_path.Enqueue(path); }
private void _run() { _manual_event.WaitOne(); _manual_event.Reset(); while (true) { var path = _scan_path.Dequeue(); if (string.IsNullOrEmpty(path)) { _scan_obj_queue.Enqueue("exit"); break; } travel(path); } _manual_event.Set(); }
private void scan() { _mannul_event.WaitOne(); _mannul_event.Reset(); var _Stopwatch = new Stopwatch(); _Stopwatch.Start(); while (true) { var file_path = _scan_objs.Dequeue(); if (string.IsNullOrEmpty(file_path)) { Thread.Sleep(10); continue; } if (file_path == "exit") { _scan_objs.Enqueue("exit"); break; } ScanFileCount++; var res = _lame.ScanFile(file_path); if (res != null) { VirusCount++; } MtdUtility.ShowScanResult(file_path, res); } _Stopwatch.Stop(); ElapsedMilliseconds = _Stopwatch.ElapsedMilliseconds; _mannul_event.Set(); }