Esempio n. 1
0
        protected void OnBtnScanWithClamdClicked(object sender, EventArgs e)
        {
            if (treeFiles.SelectedItem == null)
            {
                return;
            }

            DbFile file = Workers.GetDBFile(((DbFile)treeFiles.SelectedItem).Sha256);

            outIter = (DbFile)treeFiles.SelectedItem;

            if (file == null)
            {
                MessageBox.Show("Cannot get file from database", MessageBoxType.Error);
                return;
            }

            treeFiles.Enabled            = false;
            btnToggleCrack.Enabled       = false;
            btnScanWithClamd.Enabled     = false;
            btnCheckInVirusTotal.Enabled = false;
            prgProgressFiles1.Visible    = true;
            lblProgressFiles1.Visible    = true;
            Workers.Failed         += ClamdFailed;
            Workers.ScanFinished   += ClamdFinished;
            Workers.UpdateProgress += UpdateVirusProgress;

            lblProgressFiles1.Text          = "Scanning file with clamd.";
            prgProgressFiles1.Indeterminate = true;

            thdScanFile = new Thread(() => Workers.ClamScanFileFromRepo(file));
            thdScanFile.Start();
        }
Esempio n. 2
0
        protected void OnBtnScanWithClamdClicked(object sender, EventArgs e)
        {
            if (!treeFiles.Selection.GetSelected(out outIter))
            {
                return;
            }

            DbFile file = Workers.GetDBFile((string)fileView.GetValue(outIter, 0));

            if (file == null)
            {
                MessageDialog dlgMsg = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok,
                                                         "Cannot get file from database");
                dlgMsg.Run();
                dlgMsg.Destroy();
                return;
            }

            treeFiles.Sensitive            = false;
            btnToggleCrack.Sensitive       = false;
            btnScanWithClamd.Sensitive     = false;
            btnCheckInVirusTotal.Sensitive = false;
            prgProgressFiles1.Visible      = true;
            Workers.Failed         += ClamdFailed;
            Workers.ScanFinished   += ClamdFinished;
            Workers.UpdateProgress += UpdateVirusProgress;

            prgProgressFiles1.Text = "Scanning file with clamd.";
            thdPulseProgress       = new Thread(() =>
            {
                while (true)
                {
                    Application.Invoke(delegate { prgProgressFiles1.Pulse(); });
                    Thread.Sleep(66);
                }
            });
            thdPulseProgress.Start();
            thdScanFile = new Thread(() => Workers.ClamScanFileFromRepo(file));
            thdScanFile.Start();
        }