public static void Start() { try { if (SettingsManager.Firewall) { Firewall.Start(); } if (SettingsManager.NIDS) { NetworkMonitor.Start(); } if (SettingsManager.SystemMonitor) { FileSystemMonitor.Start(); } if (SettingsManager.WebAgent) { WebMonitor.Start(); } Protected = true; AntivirusState.SetProtection(true); } catch (Exception ex) { AntiCrash.LogException(ex); } finally { } }
private void ApplyConfig() { try { switch (Settings.EnableMonitoring) { case true: // Configure format Format = configuration.Format; // Initialize adapter adapterController = new AdapterController(configuration.MonitoredAdapter); monitor = new NetworkMonitor(adapterController); // Start Monitoring monitor.Start(); switch (Format) { case "Auto": timerAuto.Start(); break; case "KB": timerKB.Start(); break; case "MB": timerMB.Start(); break; } break; case false: LblUpload.Text = "N/A"; LblDownload.Text = "N/A"; break; } } catch (Exception ex) { LblUpload.Text = "N/A"; LblDownload.Text = "N/A"; } }
private void Load_Config() { try { configuration = registryManager.GetGeneralConfiguration(); if (configuration.Monitoring == true) { Format = configuration.Format; adapterController = new AdapterController(configuration.MonitoredAdapter); monitor = new NetworkMonitor(adapterController); monitor.Start(); switch (Format) { case "Auto": timerAuto.Start(); break; case "KB": timerKB.Start(); break; case "MB": timerMB.Start(); break; } } else { LblUpload.Text = "N/A"; LblDownload.Text = "N/A"; } } catch (Exception ex) { LblUpload.Text = "N/A"; LblDownload.Text = "N/A"; } }
public static void InitMonitors() { try { if (SettingsManager.WebAgent) { WebMonitor.Initialize(); WebMonitor.Start(); } if (SettingsManager.Firewall) { Firewall.Init(); Firewall.AccessDenied += new DenyRule(Firewall_AccessDenied); Firewall.Start(); } if (SettingsManager.NIDS) { NetworkMonitor.Initialize(SettingsManager.BrekleyFilter); NetworkMonitor.Start(); } if (SettingsManager.SystemMonitor) { FileSystemMonitor.Initialize(SettingsManager.HighSense); FileSystemMonitor.Start(); } DriveDetector detect = new DriveDetector(); detect.DeviceArrived += new DriveDetectorEventHandler(detect_DeviceArrived); Protected = true; } catch (Exception ex) { AntiCrash.LogException(ex); } finally { } }
public static void InitMonitors() { // Initialize UDP Monitor. _UdpMonitor = new UdpMonitor(); _UdpMonitor.PortNumber = SettingsManager.Options.UdpMonitorPort; _UdpMonitor.MessageReceived += _Monitor_MessageReceived; if (SettingsManager.Options.UdpMonitorEnabled) { _UdpMonitor.Start(); } // Initialize Clipboard Monitor. _ClipboardMonitor = new ClipboardMonitor(); _ClipboardMonitor.CopyInterval = SettingsManager.Options.ClipboardMonitorInterval; _ClipboardMonitor.MessageReceived += _Monitor_MessageReceived; if (SettingsManager.Options.ClipboardMonitorEnabled) { _ClipboardMonitor.Start(); } // Initialize Network Monitor. _NetworkMonitor = new NetworkMonitor(); _NetworkMonitor.MessageReceived += _Monitor_MessageReceived; if (SettingsManager.Options.NetworkMonitorEnabled) { _NetworkMonitor.Start(); } // Initialize Display Monitor _DisplayMonitor = new DisplayMonitor(); var colors = DisplayMonitor.ColorsFromRgbs(SettingsManager.Options.DisplayMonitorPrefix); _DisplayMonitor.SetColorPrefix(Basic.ColorsToBytes(colors, false)); _DisplayMonitor.MessageReceived += _Monitor_MessageReceived; if (SettingsManager.Options.DisplayMonitorEnabled) { _DisplayMonitor.Start(); } // Start monitoring property changes. SettingsManager.Options.PropertyChanged += Options_PropertyChanged; }
static void Options_PropertyChanged(object sender, PropertyChangedEventArgs e) { var enabledCanged = e.PropertyName == nameof(SettingsManager.Options.MonitorsEnabled); var en = SettingsManager.Options.MonitorsEnabled; var isElevated = JocysCom.ClassLibrary.Security.PermissionHelper.IsElevated; // UDP Monitor Properties. if (e.PropertyName == nameof(SettingsManager.Options.UdpMonitorPort)) { _UdpMonitor.PortNumber = SettingsManager.Options.UdpMonitorPort; } if (e.PropertyName == nameof(SettingsManager.Options.UdpMonitorEnabled) || enabledCanged) { if (SettingsManager.Options.UdpMonitorEnabled && en) { _UdpMonitor.Start(); } else { _UdpMonitor.Stop(); } } // Clipboard Monitor Properties. if (e.PropertyName == nameof(SettingsManager.Options.ClipboardMonitorInterval)) { _ClipboardMonitor.CopyInterval = SettingsManager.Options.ClipboardMonitorInterval; } if (e.PropertyName == nameof(SettingsManager.Options.ClipboardMonitorEnabled) || enabledCanged) { if (SettingsManager.Options.ClipboardMonitorEnabled && en) { _ClipboardMonitor.Start(); } else { _ClipboardMonitor.Stop(); } } // Network Monitor Properties. if (e.PropertyName == nameof(SettingsManager.Options.NetworkMonitorCapturingType)) { _NetworkMonitor.CapturingType = SettingsManager.Options.NetworkMonitorCapturingType; } if (e.PropertyName == nameof(SettingsManager.Options.NetworkMonitorEnabled) || enabledCanged) { if (SettingsManager.Options.NetworkMonitorEnabled && en && isElevated) { _NetworkMonitor.Start(); } else { _NetworkMonitor.Stop(); } } // Display Monitor Properties. if (e.PropertyName == nameof(SettingsManager.Options.DisplayMonitorInterval)) { _DisplayMonitor.ScanInterval = SettingsManager.Options.DisplayMonitorInterval; } if (e.PropertyName == nameof(SettingsManager.Options.DisplayMonitorPrefix)) { var colors = DisplayMonitor.ColorsFromRgbs(SettingsManager.Options.DisplayMonitorPrefix); _DisplayMonitor.SetColorPrefix(Basic.ColorsToBytes(colors, false)); } if (e.PropertyName == nameof(SettingsManager.Options.DisplayMonitorEnabled) || enabledCanged) { if (SettingsManager.Options.DisplayMonitorEnabled && en) { _DisplayMonitor.Start(); } else { _DisplayMonitor.Stop(); } } if (e.PropertyName == nameof(SettingsManager.Options.AudioBitsPerSample) || e.PropertyName == nameof(SettingsManager.Options.CacheAudioChannels)) { var blockAlignment = (SettingsManager.Options.AudioBitsPerSample / 8) * (int)SettingsManager.Options.CacheAudioChannels; if (blockAlignment != SettingsManager.Options.CacheAudioBlockAlign) { SettingsManager.Options.CacheAudioBlockAlign = blockAlignment; } } }