void Potok4(string line) { Print_scan_listBox("Идет распаковка архивов."); Preparation_scan pr = new Preparation_scan(); pr.preparation(line); Print_scan_listBox("Распаковка архивов закончена."); ScanEngine Seng = new ScanEngine(); var Observer_Virus_detection_DaD = new Observer_Virus_detection(); Seng.Attach(Observer_Virus_detection_DaD); string full_path_file = Path.GetDirectoryName(line) + @"\" + Path.GetFileNameWithoutExtension(line); this.Invoke(new System.Threading.ThreadStart(delegate { scanir.Enabled = false; timer_nach = DateTime.Now; btimer = true; })); if (!backgroundWorker2.IsBusy) { backgroundWorker2.RunWorkerAsync(); } List <string> InfFile = Seng.scan_List(full_path_file); Print_scan_listBox(full_path_file, InfFile); Seng.Detach(Observer_Virus_detection_DaD); this.Invoke(new System.Threading.ThreadStart(delegate { btimer = false; })); }
//----------------------------------------Листбокс FileWatcher----------------------------------------- //Drag and Drop void Potok3(string obj, List <string> paths, ScanEngine Seng, Preparation_scan pr) { var observerDragandDrop = new Observer_Virus_detection(); Seng.Attach(observerDragandDrop); Print_scan_listBox("Идет распаковка архивов."); pr.preparation(obj); Print_scan_listBox("Распаковка архивов закончена."); paths = Seng.scan_List(obj); Print_scan_listBox("Кол-во вирусом: " + paths.Count.ToString()); Seng.Detach(observerDragandDrop); }
//void Potok1(object sender, EventArgs e) private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { String line = key_create.GetValue("path").ToString(); var subject = new ScanEngine(); var observerA = new Observer_Virus_detection(); subject.Attach(observerA); this.Invoke(new System.Threading.ThreadStart(delegate { scanir.Enabled = false; //progressBar1.Style = ProgressBarStyle.Marquee; timer_nach = DateTime.Now; btimer = true; })); if (!backgroundWorker2.IsBusy) { backgroundWorker2.RunWorkerAsync(); } Print_scan_listBox("Идет распаковка архивов."); Preparation_scan pr = new Preparation_scan(); pr.preparation(line); Print_scan_listBox("Распаковка архивов закончена."); List <string> InfFile = subject.scan_List(line); this.Invoke(new System.Threading.ThreadStart(delegate { //progressBar1.Style = ProgressBarStyle.Blocks; btimer = false; })); subject.Detach(observerA); Print_scan_listBox(line, InfFile); this.Invoke(new System.Threading.ThreadStart(delegate { scanir.Enabled = true; })); }