Пример #1
0
        public static void SetUninstallingPass(string pass)
        {
            int    attempts = 0;
            string path     = FilteringSystem.uninstallPassPath;

            HostsFileCatcher.ReleaseCatch();
            while (attempts < 5)
            {
                try
                {
                    File.SetAttributes(path, FileAttributes.Normal);
                    File.WriteAllText(path, pass);
                    File.SetAttributes(path, FileAttributes.Hidden | FileAttributes.ReadOnly | FileAttributes.System | FileAttributes.Encrypted);
                    HostsFileCatcher.StartCatching();
                    break;
                }
                catch
                {
                    HostsFileCatcher.ReleaseCatch();
                    attempts++;
                    System.Threading.Thread.Sleep(250);
                }
            }
            if (attempts == 5)
            {
                MessageBox.Show("השינויים לא נשמרו כראוי");
            }
            HostsFileCatcher.StartCatching();
        }
Пример #2
0
 private static void UpdateSettingsFunction()
 {
     HostsFileCatcher.WriteSettings();
     if (IsOn())
     {
         DnsController.setMode(Resources.profile.Default.safe_server);
         HostsFileCatcher.StartCatching();
     }
     else
     {
         HostsFileCatcher.ReleaseCatch();
         DnsController.setMode(false);
     }
 }
Пример #3
0
 public static void UpdateSettings()
 {
     //Thread thr = new Thread(new ThreadStart(UpdateSettingsFunction));
     //thr.Start();
     HostsFileCatcher.WriteSettings();
     if (IsOn())
     {
         DnsController.setMode(Resources.profile.Default.safe_server);
         HostsFileCatcher.StartCatching();
     }
     else
     {
         HostsFileCatcher.ReleaseCatch();
         DnsController.setMode(false);
     }
 }