예제 #1
0
 public static void FullExit()
 {
     FilteringSystem.StopDefenceCheck();
     InternetBlocker.Block(false);
     CustomNotifyIcon.Hide();
     ServiceAdapter.CustomCommend((int)ServiceAdapter.CustomCommends._pause);
     Environment.Exit(Environment.ExitCode);
 }
예제 #2
0
 public static void Load()
 {
     HostsFileAdapter.Write(GetCurrentFilteringSettings());
     CustomNotifyIcon.SetupNotificationIcon();
     ServiceAdapter.CustomCommend((int)ServiceAdapter.CustomCommends._continue);
     ServiceAdapter.CustomCommend((int)ServiceAdapter.CustomCommends.startCatchFiles);
     SetSystemStatus(true);
     StartDefenceCheck();
 }
예제 #3
0
        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();
            }
        }