示例#1
0
        bool RefreshSettings()
        {
            logger.write("Refreshing settings..");

            bool settingsWrited = settings.write();

            if (!settingsWrited)
            {
                logger.write("Couldn't write settings");
            }
            else
            {
                if (NetFilterWrap.Started(netMon))
                {
                    NetFilterWrap.RefreshSetting(netMon);
                    logger.write("Settings has been refreshed..");
                }
                else
                {
                    logger.write("Netfilter is not started..");
                }
            }

            return(settingsWrited);
        }
示例#2
0
 private void toolStripMenuItemDeleteFile_Click(object sender, EventArgs e)
 {
     DeleteSelectedTreeItem(filteredAppsTreeView.SelectedNode);
     if (settings.TracingProcesses.Count == 0)
     {
         NetFilterStatus status = (NetFilterWrap.Started(netMon))
             ? NetFilterStatus.DisableRefreshing : NetFilterStatus.NotStarted;
         updateFormItems(status);
     }
 }
示例#3
0
        private void AddDirectoryHandler()
        {
            DialogResult dialogResult = folderBrowserDialog.ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
                NetFilterStatus status = (NetFilterWrap.Started(netMon))
                    ? NetFilterStatus.Refreshed : NetFilterStatus.Ready;

                AddDirectory(folderBrowserDialog.SelectedPath);
                updateFormItems(status);
            }
        }
示例#4
0
        void StopNetfilter()
        {
            if (NetFilterWrap.Started(netMon))
            {
                NetFilterWrap.Stop(netMon);
                updateFormItems(NetFilterStatus.Stopped);

                logger.write("Netfilter has been stopped..");
            }
            else
            {
                logger.write("Netfilter is not started..");
            }
        }
示例#5
0
 private void AddProcessHandler()
 {
     DialogResult dialogResult = openFileDialog.ShowDialog();
     {
         if (dialogResult == DialogResult.OK)
         {
             NetFilterStatus status = (NetFilterWrap.Started(netMon))
                 ? NetFilterStatus.Refreshed : NetFilterStatus.Ready;
             foreach (var process in openFileDialog.FileNames)
             {
                 AddProcess(process);
                 updateFormItems(status);
             }
         }
     }
 }
示例#6
0
        private void filteredAppsTreeView_DragDrop(object sender, DragEventArgs e)
        {
            string[] draggedItems = (string[])e.Data.GetData(DataFormats.FileDrop, true);
            foreach (string item in draggedItems)
            {
                FileAttributes  attr   = File.GetAttributes(item);
                NetFilterStatus status = (NetFilterWrap.Started(netMon))
                    ? NetFilterStatus.Refreshed : NetFilterStatus.Ready;

                if ((attr & FileAttributes.Directory) == FileAttributes.Directory)
                {
                    AddDirectory(item);
                    updateFormItems(status);
                }
                else if (Path.GetExtension(item) == ".exe")
                {
                    if (!settings.isExistsTracingProcess(item))
                    {
                        AddProcess(item);
                        updateFormItems(status);
                    }
                }
            }
        }