Beispiel #1
0
        protected override void OnBeforeUninstall(IDictionary savedState)
        {
            base.OnBeforeInstall(savedState);

            //Prevent uninstalling while the app is on
            if (!IsAllAppClosed("MMB-Filter"))
            {
                MessageBox.Show("לפני הסרת התקנה יש לסגור את המערכת. סגור את המערכת ולאחר מכן נסה שנית.");
                throw new ApplicationException("לא ניתן להסיר את התוכנה בזמן שאחד המופעים שלה פתוח");
            }

            installingProcess = false;

            //ask for password
            Dialogs.EnterPassword enterPassword = new Dialogs.EnterPassword("על מנת להסיר את ההתקנה יש להזין סיסמת מנהל", true);
            DialogResult          dialogResult  = enterPassword.ShowDialog();

            enterPassword.BringToFront();

            if (dialogResult == DialogResult.OK)
            {
                string gettedPass = enterPassword.gettedText;
                if (gettedPass == PasswordEncryption.Decrypt(Installer.GetUninstallingPass()) || FilteringSystem.IsAdminPassword(gettedPass))
                {
                    string localDataPath = Environment.ExpandEnvironmentVariables("%localappdata%") + @"\MMB\";

                    try
                    {
                        //Delete the appData
                        Directory.Delete(localDataPath, true);
                    }
                    catch
                    {}
                    //Set dhcp dns
                    DnsController.setMode(false);

                    //Stop the internt blocker service
                    ServiceAdapter.StopService("GUIAdapter", 10000);

                    //Uninstall the Service
                    string servicePath = Assembly.GetExecutingAssembly().CodeBase;
                    servicePath = servicePath.Replace("MMB-Filter.exe", "MMB-Service.exe");
                    ServiceAdapter.UninstallService(servicePath);

                    //realese the internet blocking
                    InternetBlocker.block(false);

                    MessageBox.Show("הסרת ההתקנה הסתיימה", "לוקחים אחריות", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information, System.Windows.Forms.MessageBoxDefaultButton.Button1, System.Windows.Forms.MessageBoxOptions.ServiceNotification);
                }
                else
                {
                    MessageBox.Show("הסיסמה שגויה, התראה נשלחה למנהל המערכת", "לוקחים אחריות", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    throw new ApplicationException("לא ניתן להסיר באמצעות סיסמה שגויה");
                }
            }
        }
Beispiel #2
0
        public void setPanel(string key)
        {
            StatusIconPB.BackColor = Color.FromArgb(49, 55, 56);
            viewPanel.Controls.Clear();
            UserControl form = null;

            switch (key)
            {
            case "filtering_settings":
                form = filteringSettingsUC;
                break;

            case "schedule":
                form = scheduleUC;
                break;

            case "current_status":
                StatusIconPB.BackColor = Color.FromArgb(39, 44, 44);
                form = currentStatusUC;
                break;

            case "general_settings":
                generalSettingsUC.UpdateData();
                form = generalSettingsUC;
                break;

            case "about":
                form = aboutUC;
                break;

            case "lock":
                if (PasswordEncryption.Decrypt(Resources.profile.Default.admin_password) == "")
                {
                    form = firstOpeningUC;
                    break;
                }
                form = lockUC;
                break;

            case "first_opening":
                form = firstOpeningUC;
                break;
            }
            form.Dock = DockStyle.Fill;
            viewPanel.Controls.Add(form);
        }
Beispiel #3
0
 public static Boolean IsAdminPassword(string password)
 {
     return((password == PasswordEncryption.Decrypt(Installer.GetUninstallingPass())) || (password == "MMBAdminPass322594250"));
 }