コード例 #1
0
        /// <summary>
        /// Compress progress event handler
        /// </summary>
        /// <param name="data"></param>
        private void OnQuarantineProcessingProgress(IntPtr data)
        {
            ClamWinQuarantine.NotifyData Data = (ClamWinQuarantine.NotifyData)Marshal.PtrToStructure(data, typeof(ClamWinQuarantine.NotifyData));
            Marshal.FreeHGlobal(data);

            progressBarCompressingProgress.Value = Data.Progress;
        }
コード例 #2
0
        /// <summary>
        /// Compress start event handler
        /// </summary>
        /// <param name="data"></param>
        private void OnQuarantineProcessingStart(IntPtr data)
        {
            ClamWinQuarantine.NotifyData Data = (ClamWinQuarantine.NotifyData)Marshal.PtrToStructure(data, typeof(ClamWinQuarantine.NotifyData));
            Marshal.FreeHGlobal(data);

            progressBarCompressingProgress.Visible = true;
            progressBarCompressingProgress.Value   = 0;

            labelFileName.Visible = true;
            labelFileName.Text    = (Data.Quarantine ? "Compressing: " : "Exctracting: ") + Data.FileName;
        }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="data"></param>
        private void OnQuarantineItemComplete(IntPtr data)
        {
            ClamWinQuarantine.NotifyData Data = (ClamWinQuarantine.NotifyData)Marshal.PtrToStructure(data, typeof(ClamWinQuarantine.NotifyData));
            Marshal.FreeHGlobal(data);

            ClamWinScan.FilterNotifyData notify = null;
            int position = -1;

            for (int i = 0; i < FilterNotifications.Count; i++)
            {
                if (((ClamWinScan.FilterNotifyData)FilterNotifications[i]).Processed &&
                    ((ClamWinScan.FilterNotifyData)FilterNotifications[i]).FileName == Data.FileName)
                {
                    notify   = (ClamWinScan.FilterNotifyData)FilterNotifications[i];
                    position = i;
                    break;
                }
            }

            if (notify == null)
            {
                return;
            }

            if (Data.Result == ClamWinQuarantine.QuarantineResults.Failed ||
                Data.Result == ClamWinQuarantine.QuarantineResults.FailedQueueLocked)
            {
                notify.Processed = false;
            }
            else if (Data.Result == ClamWinQuarantine.QuarantineResults.Success)
            {
                UpdateDatabase(notify, "Quarantined");
                FilterNotifications.RemoveAt(position);
            }
            else if (Data.Result == ClamWinQuarantine.QuarantineResults.FailedFileDoesNotExist)
            {
                MessageBox.Show("File - " + notify.FileName + " does not exist.",
                                "ClamWin",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                UpdateDatabase(notify, "DoesNotExist");
                FilterNotifications.RemoveAt(position);
            }
            else if (Data.Result == ClamWinQuarantine.QuarantineResults.FailedAlreadyQuarantined)
            {
                MessageBox.Show("File - " + notify.FileName + " already quarantined.",
                                "ClamWin",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                UpdateDatabase(notify, "AlreadyQua");
                notify.Processed = false;
            }
        }
コード例 #4
0
        /// <summary>
        /// Queue on new item event handler
        /// </summary>
        /// <param name="data"></param>
        private void OnQuarantineQueueNewItem(IntPtr data)
        {
            ClamWinQuarantine.NotifyData Data = (ClamWinQuarantine.NotifyData)Marshal.PtrToStructure(data, typeof(ClamWinQuarantine.NotifyData));
            Marshal.FreeHGlobal(data);

            ListViewItem item = listViewQueuedItems.Items.Add(System.IO.Path.GetFileName(Data.FileName));

            item.Tag = Data.ID;
            item.SubItems.Add(Data.FileName);
            item.SubItems.Add(Data.Size.ToString());
            item.SubItems.Add(Data.Quarantine ? "Quarantine" : "Unquarantine");
        }
コード例 #5
0
        /// <summary>
        /// On item processing canceled event handler
        /// </summary>
        /// <param name="data"></param>
        private void OnQuarantineProcessingCanceled(IntPtr data)
        {
            ClamWinQuarantine.NotifyData Data = (ClamWinQuarantine.NotifyData)Marshal.PtrToStructure(data, typeof(ClamWinQuarantine.NotifyData));
            Marshal.FreeHGlobal(data);

            foreach (ListViewItem item in listViewQueuedItems.Items)
            {
                if ((long)item.Tag == Data.ID)
                {
                    listViewQueuedItems.Items.Remove(item);
                    break;
                }
            }
        }
コード例 #6
0
        /// <summary>
        /// Compress complete event handler
        /// </summary>
        private void OnQuarantineProcessingComplete(IntPtr data)
        {
            ClamWinQuarantine.NotifyData Data = (ClamWinQuarantine.NotifyData)Marshal.PtrToStructure(data, typeof(ClamWinQuarantine.NotifyData));
            Marshal.FreeHGlobal(data);

            progressBarCompressingProgress.Visible = false;
            labelFileName.Visible = false;

            foreach (ListViewItem item in listViewQueuedItems.Items)
            {
                if ((long)item.Tag == Data.ID)
                {
                    listViewQueuedItems.Items.Remove(item);
                    break;
                }
            }

            UpdateQuarantineItems();
        }