Ejemplo n.º 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();
        }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 4
0
        public static void Setup()
        {
            if (!File.Exists(uninstallPassPath))
            {
                File.Create(uninstallPassPath);
            }

            /*
             * this part of the code shouldn't be in the debuging version because it lock the exe file and prevent the next debeguing...
             *  DeleteServiceInstallationLog();
             *  HideEXE();
             *  HideAppFolder();
             */

            HostsFileCatcher.AddPath(Environment.SystemDirectory + @"\drivers\etc\hosts");
            HostsFileCatcher.AddPath(uninstallPassPath);
            HostsFileCatcher.StartCatching();
            UpdateSettings();
            HideAppDataFolder();
        }