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); }
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); } }
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); } }
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.."); } }
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); } } } }
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); } } } }