Exemple #1
0
        /// <summary>
        /// toolStripMenuItemQuarantine on-click event handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolStripMenuItemQuarantine_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.InitialDirectory = "c:\\";
            openFileDialog.Filter           = "All files (*.*)|*.*";
            openFileDialog.FilterIndex      = 1;
            openFileDialog.RestoreDirectory = true;

            if (openFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            if (ClamWinQuarantine.IsFileInQuarantine(openFileDialog.FileName))
            {
                MessageBox.Show("File is already quarantined!");
                return;
            }

            IntPtr[] Listeners = new IntPtr[2];
            Listeners[0] = this.Handle;
            Listeners[1] = MainFomrHandle;
            ClamWinQuarantine.QuarantineResults result = ClamWinQuarantine.QuarantineFile(openFileDialog.FileName, Listeners);

            if (result != ClamWinQuarantine.QuarantineResults.Success)
            {
                MessageBox.Show("Operation failed with message: " + ClamWinQuarantine.QuarantineResultToString(result));
            }
        }
Exemple #2
0
 /// <summary>
 /// toolStripMenuItemUnquarantine on-click event handler
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void toolStripMenuItemUnquarantine_Click(object sender, EventArgs e)
 {
     foreach (ListViewItem item in listViewQuarantineItems.Items)
     {
         if (!item.Selected)
         {
             continue;
         }
         IntPtr[] Listeners = new IntPtr[2];
         Listeners[0] = this.Handle;
         Listeners[1] = MainFomrHandle;
         ClamWinQuarantine.QuarantineResults result = ClamWinQuarantine.UnquarantineFile(item.SubItems[1].Text, Listeners, false);
         if (result != ClamWinQuarantine.QuarantineResults.Success)
         {
             MessageBox.Show("Operation failed with message: " + ClamWinQuarantine.QuarantineResultToString(result));
             break;
         }
     }
 }