public void start_scan() { Mutex scan_Mutex = new Mutex(); scan_Mutex.WaitOne(); ScanReport Scaning = new ScanReport(); //ScanSession ini = new ScanSession(); for (int i = 0; i < Info.Count(); i++) { string file_path = Info[i]; bool type_scan = type[i]; string save_time; int count_vir = 0; save_time = Get_Time(); file_step(file_path); if (vir_path != null && vir_type != null) { count_vir++; Scaning.insert_Report(inintScan(type_scan), save_time, Get_Time(), scaned_files, scaned_objects, count_vir, vir_type, vir_path); vir_path = null; vir_type = null; } ScanReportsRepository inserter = new ScanReportsRepository(); inserter.insert(Scaning); } scan_Mutex.ReleaseMutex(); }
public void insert(ScanReport report) { int i = 0; mutex_SRR.WaitOne(); int counter = report.viruses.Count(); if (File.Exists(SRR)) { using (StreamWriter FD = new StreamWriter(SRR, true)) { FD.WriteLine(report.initscan + ", " + report.start_scan + ", " + report.end_scan + ", " + report.scaned_files + ", " + report.scaned_objects + ", " + report.danger_count + "|"); while (i < counter) { FD.WriteLine(Convert.ToString(report.viruses[i]) + ", " + Convert.ToString(report.file_path[i])); i++; } } i = 0; } mutex_SRR.ReleaseMutex(); }