public static void FullExit() { FilteringSystem.StopDefenceCheck(); InternetBlocker.Block(false); CustomNotifyIcon.Hide(); ServiceAdapter.CustomCommend((int)ServiceAdapter.CustomCommends._pause); Environment.Exit(Environment.ExitCode); }
public static void KeepServiceOn() { new Thread(() => { if (ServiceAdapter.GetServiceStatus("GUIAdapter") == "Running") { isServiceIsOn = true; serviceHasDetected = true; prevent_close_attempts = 0; } else { if (prevent_close_attempts == 0) { MailsSender.SendUnusualActivityAlert(); } prevent_close_attempts++; ServiceAdapter.StartService("GUIAdapter", 10000); if (InternetBlocker.IsInternetReachable()) { InternetBlocker.Block(true); } if (ServiceAdapter.GetServiceStatus("GUIAdapter") == "Stopped") { if (serviceHasDetected) { BootController.DoExitWin(BootController.EWX_REBOOT); } } isServiceIsOn = false; } }).Start(); }
private static void DefenceChecker_Elapsed(object sender, ElapsedEventArgs e) { KeepServiceOn(); RunInSafeMode(); RunInStartUp(); PreventSystemFilesEdit(); ProblematicAppsBlocker.Block(); tick_count++; if (isServiceIsOn == true) { if (runInSafeModeStatus == false || preventSystemFilesEditStatus == false || runInStartUpStatus == false) { if (!runInSafeModeStatus) { RunInSafeMode(); } if (!preventSystemFilesEditStatus) { PreventSystemFilesEdit(); } if (!runInStartUpStatus) { RunInStartUp(); } if (tick_count > 1200) { CustomNotifyIcon.ShowNotificationMessage(500, "המערכת זיהתה חריגה", "המערכת זיהתה כי אחת ממערכות ההגנה אינה פעילה. לחץ כאן לפרטים", System.Windows.Forms.ToolTipIcon.Error); tick_count = 0; } } } else { if (tick_count > 1200) { CustomNotifyIcon.ShowNotificationMessage(500, "הסינון אינו יציב", "אחת מהמערכות הקריטיות לפעילות הסינון אינה פעילה, הודעה נשלחה למנהל המערכת.", System.Windows.Forms.ToolTipIcon.Error); tick_count = 0; } } scheduelUpdate++; if (scheduelUpdate == 60) { new Thread(() => { Application.Current.Dispatcher.Invoke((Action) delegate { if (GetBlockSchedulingStatus() == true) { if (SchedulePage.Instance.IsBlockNow()) { if (InternetBlocker.IsInternetReachable() == true) { InternetBlocker.Block(true); } } else { if (InternetBlocker.IsInternetReachable() == false) { InternetBlocker.Block(false); } } } }); }).Start(); } }