示例#1
0
        /// <summary>
        /// Removing Oracle VirtualBox - short version.
        /// Using official msi uninstall
        /// </summary>
        /// <param name="app_name">Name of the application.</param>
        public static void remove_app_vbox_short(string app_name)
        {
            if (AP.app_installed("Oracle\\VirtualBox") == 0)
            {
                MessageBox.Show("Oracle VirtualBox is not installed on Your machine", "Removing Oracle VirtualBox", MessageBoxButtons.OK);
                return;
            }

            string mesg = string.Format("Remove {0}? \n\nPlease do not try to remove {1} if uninstalling from Control Panel. \n\nNote: it is better to remove {2} separately.", app_name, app_name, app_name);
            //DialogResult drs = MessageBox.Show($"Remove {app_name}? Please do not try to remove {app_name} if uninstalling from Control Panel. Note: it is better to remove {app_name} separately.", $"Removing {app_name}",
            string res = "";

            //VirtualBox Manager, VirtualBox Interface
            //Stop VMs

            //Remove all host-only interfaces
            remove_host_only();
            //Stop Processes/Services
            clean.StageReporter("", "Stopping VirtualBox processes");
            Process[] vboxProcesses = Process.GetProcesses();
            foreach (Process process in vboxProcesses)
            {
                if (process.ProcessName.Contains("VBox") || process.ProcessName.Contains("VirtualBox"))
                {
                    //MessageBox.Show($"Process: {process.ProcessName}", "Removing processes", MessageBoxButtons.OK);
                    try
                    {
                        process.Kill();
                        Thread.Sleep(2000);
                    }
                    catch (Exception e)
                    {
                        string tmp = e.Message;
                    }
                }
            }
            clean.StageReporter("", "Removing VirtualBox software");
            //HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\6FBF3FE4D796A044AAADF7D5937BE326\InstallProperties
            string subkey        = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Products";
            string uninstall_str = RG.find_and_get_value(subkey, "VirtualBox", "UninstallString", RegistryHive.LocalMachine);

            res = "";
            if (uninstall_str != "")
            {
                string[] uninst = uninstall_str.Split(' ');
                res = SCP.LaunchCommandLineApp(uninst[0], uninst[1], true, false);
            }
            //MessageBox.Show(res, "Uninstalling VirtualBox", MessageBoxButtons.OK);

            mesg = "";
            if (AP.app_installed("Oracle\\VirtualBox") == 0)
            {
                mesg = string.Format("Oracle VirtualBox removed from Your machine. \n\n Please do not forget to RESTART windows before new installation!");
            }
            else
            {
                mesg = string.Format("Oracle VirtualBox was not removed from Your machine");
            }
            MessageBox.Show(mesg, "Removing Oracle VirtualBox", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
示例#2
0
        /// <summary>
        /// Removes the application.
        /// </summary>
        /// <param name="app_name">Name of the application.</param>
        /// <param name="cmd">The command.</param>
        /// <param name="args">The arguments.</param>
        /// <param name="app_path">The application path.</param>
        public static void remove_app(string app_name, string cmd, string args, string app_path)
        {
            string mess = "";

            if (File.Exists(cmd))
            {
                string res = SCP.LaunchCommandLineApp(cmd, args, false, false, 480000);
                if (res.Contains("|Error") || res.ToLower().Contains("error"))
                {
                    mess = $"{app_name} was not removed, please uninstall manually";
                }
                else
                {
                    mess = $"{app_name} uninstalled";
                }
            }
            else
            {
                mess = $"Probably {app_name} was not installed, please check and uninstall manually";
            }
            //MessageBox.Show(mess, $"Uninstalling {app_name}", MessageBoxButtons.OK);
            if (app_path != "" || app_path != null)
            {
                FD.remove_from_Path(app_path);
            }
        }
示例#3
0
        /// <summary>
        /// Removes Google Chrome usefull when Chrome is not visible in Control Panel
        /// </summary>
        public static void remove_chrome()
        {
            if (AP.app_installed("Clients\\StartMenuInternet\\Google Chrome") == 0)
            {
                MessageBox.Show("Google Chrome is not installed on Your machine", "Removing Google Chrome", MessageBoxButtons.OK);
                return;
            }

            //Check if Chrome is running
            SCP.stop_process("chrome.exe");
            SCP.stop_process("Google Chrome");
            SCP.stop_process("Google Chrome (32 bit)");
            //Unpin from taskbar
            if (clean.toLog)
            {
                MessageBox.Show("Google Chrome processes stopped", "Removing Google Chrome", MessageBoxButtons.OK);
            }
            RG.rg_clean_chrome();
            if (clean.toLog)
            {
                MessageBox.Show("Google Chrome register cleaned", "Removing Google Chrome", MessageBoxButtons.OK);
            }
            FD.fd_clean_chrome();
            if (clean.toLog)
            {
                MessageBox.Show("Google Chrome files cleaned", "Removing Google Chrome", MessageBoxButtons.OK);
            }
        }
示例#4
0
        /// <summary>
        /// Deleting TAP software.
        /// </summary>
        public static void del_TAP()
        {
            string binPath = Path.Combine(clean.sysDrive, "Program Files", "TAP-Windows", "bin", "tapinstall.exe");
            string res     = "";

            if (File.Exists(binPath))
            {
                res = SCP.LaunchCommandLineApp(binPath, "remove tap0901", true, false, 480000);
            }
            binPath = Path.Combine(clean.sysDrive, "Program Files", "TAP-Windows", "Uninstall.exe");
            string pathPath = Path.Combine(clean.sysDrive, "Program Files", "TAP-Windows", "bin");

            if (clean.bTAP)
            {
                remove_app("TAP-Windows", binPath, "/S", "TAP-Windows");
            }
        }
示例#5
0
        /// <summary>
        /// Remove host only interfaces.
        /// </summary>
        public static void remove_host_only()
        {
            string res = SCP.LaunchCommandLineApp("cmd.exe", " /C vboxmanage list hostonlyifs| findstr /b \"Name:\"", true, false, 300000);

            string[] splitted = res.Split('|');
            //res = res.Remove(0, res.IndexOf("stdout"));
            //res = res.Substring(0, res.IndexOf("stderr"));
            //res = res.Replace("stdout:","");
            res = splitted[2].Replace("Name:", "");
            string[] ifaces = res.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            foreach (string iface in ifaces)
            {
                string tmp = iface.Trim(' ');
                if (tmp == "" || iface == null)
                {
                    continue;
                }
                clean.StageReporter("", $"Removing {tmp}");
                res = SCP.LaunchCommandLineApp("vboxmanage ", $" hostonlyif remove \"{tmp}\"", true, false, 420000);
            }
        }
示例#6
0
        /// <summary>
        /// Removing virtual machines containing "snappy" or "subutai" in names.
        /// </summary>
        public static bool remove_vm()
        {
            string outputList = SCP.LaunchCommandLineApp("vboxmanage", $"list vms", true, false, 420000);

            string[] outputListSplitted = outputList.Split('|');
            string   outputVms          = outputListSplitted[1];

            if (outputVms.ToLower().Contains("error") || outputVms.ToLower().Contains("can not"))
            {
                return(false);
            }
            string msg = "";

            string[] rows = Regex.Split(outputVms, "\n");
            foreach (string row in rows)
            {
                if (row.Contains("subutai") || row.Contains("snappy"))
                {
                    string[] wrds = row.Split('{');
                    foreach (string wrd in wrds)
                    {
                        if (wrd.Contains("subutai") || wrd.Contains("snappy"))
                        {
                            string vmName = wrd.Replace("\"", "");
                            vmName = vmName.Trim();
                            string res1 = SCP.LaunchCommandLineApp("vboxmanage", $"controlvm \"{vmName}\" poweroff ", true, false, 420000);
                            string res2 = SCP.LaunchCommandLineApp("vboxmanage", $"unregistervm  --delete \"{vmName}\"", true, false, 420000);
                            if (res2.ToLower().Contains("error"))
                            {
                                msg = string.Format("VM {0} was not removed, please delete VM {1} and it's files manually \n and check logs in <SystemDrive>:\\Users\\<UserName>\\.Virtualbox folfer", vmName, vmName);
                                MessageBox.Show(msg, "Deleting Virtual Machine", MessageBoxButtons.OK);
                            }
                        }
                    }
                }
            }
            return(true);
        }
示例#7
0
        /// <summary>
        /// Removes the Oracle VirtualBox application.
        /// Problematic for now
        /// </summary>
        /// <param name="app_name">Name of the application.</param>
        public static void remove_app_vbox(string app_name)
        {
            string mesg = string.Format("Remove {0}? \n\nPlease do not try to remove {1} if uninstalling from Control Panel. \n\nNote: it is better to remove {2} separately.", app_name, app_name, app_name);
            //DialogResult drs = MessageBox.Show($"Remove {app_name}? Please, do not remove if uninstalling from Control Panel. Uninstall {app_name} separately."  , $"Removing {app_name}",
            DialogResult drs = MessageBox.Show(mesg, $"Removing {app_name}",
                                               MessageBoxButtons.YesNo,
                                               MessageBoxIcon.Question,
                                               MessageBoxDefaultButton.Button1);

            if (drs == DialogResult.No)
            {
                return;
            }
            string res = "";

            //VirtualBox Manager, VirtualBox Interface
            //Stop VMs

            //Remove all host-only interfaces
            remove_host_only();
            //Stop Processes/Services
            clean.StageReporter("", "Stopping VirtualBox processes");
            Process[] vboxProcesses = Process.GetProcesses();
            foreach (Process process in vboxProcesses)
            {
                if (process.ProcessName.Contains("VBox") || process.ProcessName.Contains("VirtualBox"))
                {
                    MessageBox.Show($"Process: {process.ProcessName}", "Removing processes", MessageBoxButtons.OK);
                    try
                    {
                        process.Kill();
                        Thread.Sleep(2000);
                    }
                    catch (Exception e)
                    {
                        string tmp = e.Message;
                    }
                }
            }

            //Stopping services

            //Remove drivers C:\Windows\System32\drivers
            //C:\Windows\System32\drivers\VBoxDrv.sys, VBoxNetAdp6.sys, VBoxNetLwf.sys, VBoxUSBMon.sys

            clean.StageReporter("", "Removing VirtualBox drivers ");

            string dirStart = Path.Combine(clean.sysDrive, "Windows", "System32", "drivers");

            string[] vbDrv = { "VBoxDrv.sys", "VBoxNetAdp6.sys", "VBoxNetLwf.sys", "VBoxUSBMon.sys" };
            foreach (string drvName in vbDrv)
            {
                res = SCP.LaunchCommandLineApp("sc", $"stop {drvName.Replace(".sys","")}",
                                               true, false, 420000);

                string drvPath = Path.Combine(dirStart, drvName);

                bool b_res = FD.del_sysfile(drvPath);
            }

            clean.StageReporter("", "Removing VirtualBox directory");
            dirStart = AP.get_env_var("VBOX_MSI_INSTALL_PATH");
            if (dirStart == null || dirStart == "")
            {
                dirStart = Path.Combine(clean.sysDrive, "Program Files", "Oracle", "VirtualBox");
            }

            //MessageBox.Show($"Dir: {dirStart}", "Removing Oracle Dir", MessageBoxButtons.OK);
            if (Directory.Exists(dirStart))
            {
                Directory.Delete(dirStart, true);
            }

            //Clear Registry: VBoxDrv, VBoxNetAdp, VBoxUSBMon
            vb_clean_reg();

            //Remove Env VBOX_MSI_INSTALL_PATH
            Environment.SetEnvironmentVariable("VBOX_MSI_INSTALL_PATH", "", EnvironmentVariableTarget.Machine);
            Environment.SetEnvironmentVariable("VBOX_MSI_INSTALL_PATH", "", EnvironmentVariableTarget.User);
            Environment.SetEnvironmentVariable("VBOX_MSI_INSTALL_PATH", "", EnvironmentVariableTarget.Process);
            clean.StageReporter("", "Removing shortcuts");
            //Remove shortcuts
            var shcutPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonDesktopDirectory);
            //    Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            //delete_Shortcut(shcutPath, appName);
            string appName = "Oracle VM VirtualBox";

            FD.delete_Shortcut(shcutPath, appName, false);
            shcutPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonDesktopDirectory);

            var shcutStartPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonStartMenu);

            //Folder files
            shcutPath = Path.Combine(shcutStartPath, "Programs");
            //Uninstall.lnk
            FD.delete_Shortcut(shcutPath, appName, false);
            //Remove folder
            FD.delete_Shortcut(shcutPath, appName, true);
            clean.StageReporter("", "Removing from %Path%");
            FD.remove_from_Path(dirStart);
            mesg = string.Format("Oracle VirtualBox removed from Your machine. \n\n Please do not forget to RESTART windows before new installation!");
            MessageBox.Show(mesg, "Removing Oracle VirtualBox", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
示例#8
0
        /// <summary>
        /// Task factory actually perfoeming cleaning
        /// </summary>
        private void runCleaning()
        {
            string mess = "";

            SetIndeterminate(false);
            UpdateProgress(0);
            logger.Info("sysDrive: {0}; SubutaiDir: {1}; isSilent: {2}; removeAll: {3}", sysDrive, SubutaiDir, isSilent, removeAll);
            Task.Factory.StartNew(() =>
            {
                StageReporter("", "Starting uninstall");
                if (toLog)
                {
                    logger.Info("sysDrive: {0}; SubutaiDir: {1}; isSilent: {2}; removeAll: {3}", sysDrive, SubutaiDir, isSilent, removeAll);
                    logger.Info("Will delete: TAP software: {0}; Chrome: {1}; VBox: {2}; Subutai Directory: {3}", bTAP, bChrome, bVBox, bFolder);
                    mess = string.Format("Will delete: TAP software: {0}; Chrome: {1}; VBox: {2}; Subutai Directory: {3}", bTAP, bChrome, bVBox, bFolder);
                    MessageBox.Show(mess, "Start", MessageBoxButtons.OK);
                    mess = "";
                }
                SetIndeterminate(true);
            })

            .ContinueWith((prevTask) =>
            {
                Exception ex = prevTask.Exception;
                if (prevTask.IsFaulted)
                {
                    while (ex is AggregateException && ex.InnerException != null)
                    {
                        ex = ex.InnerException;
                        if (toLog)
                        {
                            logger.Info("Exception on start: {0}", ex.Message);
                        }
                        MessageBox.Show(ex.Message, "Start", MessageBoxButtons.OK);
                    }
                }
                StageReporter("", "Removing firewall rules");
                if (toLog)
                {
                    logger.Info("Removing firewall rules");
                    MessageBox.Show("Removing firewall rules", "Removing", MessageBoxButtons.OK);
                }
                SetIndeterminate(true);
                SCP.remove_fw_rules(SubutaiDir);
                //UpdateProgress(10);
            }, TaskContinuationOptions.OnlyOnRanToCompletion)

            .ContinueWith((prevTask) =>
            {
                Exception ex = prevTask.Exception;
                if (prevTask.IsFaulted)
                {
                    while (ex is AggregateException && ex.InnerException != null)
                    {
                        ex = ex.InnerException;
                        if (toLog)
                        {
                            logger.Info("Exception on Firewall rules: {0}", ex.Message);
                        }
                        MessageBox.Show(ex.Message, "Firewall rules", MessageBoxButtons.OK);
                    }
                }
                StageReporter("", "Removing Subutai Social P2P service");
                if (toLog)
                {
                    logger.Info("Removing Subutai Social P2P service");
                    MessageBox.Show("Removing Subutai Social P2P service", "Removing", MessageBoxButtons.OK);
                }
                mess = SCP.stop_process("p2p");
                mess = "";
                mess = SCP.stop_service("Subutai Social P2P", 5000);
                mess = "";
                mess = SCP.remove_service("Subutai Social P2P");
                //UpdateProgress(20);
                StageReporter("", "Stopping SubutaiTray processes");
                if (toLog)
                {
                    logger.Info("Stopping SubutaiTray processes");
                    MessageBox.Show("Stopping SubutaiTray processes", "Removing", MessageBoxButtons.OK);
                }
                mess = SCP.stop_process("SubutaiTray");
                //UpdateProgress(30);
            }, TaskContinuationOptions.OnlyOnRanToCompletion)

            .ContinueWith((prevTask) =>
            {
                Exception ex = prevTask.Exception;
                if (prevTask.IsFaulted)
                {
                    while (ex is AggregateException && ex.InnerException != null)
                    {
                        ex = ex.InnerException;
                        if (toLog)
                        {
                            logger.Info("Exception on Removing Subutai Social P2P service and tray: {0}", ex.Message);
                        }
                        MessageBox.Show(ex.Message, "Subutai P2P service and SubutaiTray", MessageBoxButtons.OK);
                    }
                }
                StageReporter("", "Removing /home directory link");
                if (toLog)
                {
                    logger.Info("Removing //home directory link");
                    MessageBox.Show("Removing //home directory link", "Removing", MessageBoxButtons.OK);
                }
                //Remove /home shortcut
                if (SubutaiDir != "")
                {
                    mess = FD.remove_from_home(SubutaiDir);
                    mess = FD.remove_home(SubutaiDir);
                }
                //Remove Subutai dirs from Path
                //UpdateProgress(55);

                StageReporter("", "Removing Subutai dirs from %Path%");
                if (toLog)
                {
                    logger.Info("Removing Subutai dirs from %Path%");
                    MessageBox.Show("Removing Subutai dirs from %Path%", "Removing", MessageBoxButtons.OK);
                }
                //Remove Subutai dirs from Path
                mess = FD.remove_from_Path("Subutai");
                //Remove %Subutai%
                Environment.SetEnvironmentVariable("Subutai", "", EnvironmentVariableTarget.Machine);
                Environment.SetEnvironmentVariable("Subutai", "", EnvironmentVariableTarget.User);
                Environment.SetEnvironmentVariable("Subutai", "", EnvironmentVariableTarget.Process);
                //UpdateProgress(60);
            }, TaskContinuationOptions.OnlyOnRanToCompletion)

            .ContinueWith((prevTask) =>
            {
                Exception ex = prevTask.Exception;
                if (prevTask.IsFaulted)
                {
                    while (ex is AggregateException && ex.InnerException != null)
                    {
                        ex = ex.InnerException;
                        if (toLog)
                        {
                            logger.Info("Exception on Removing link, Subutai dirs from %Path% and envs: {0}", ex.Message);
                        }
                        MessageBox.Show(ex.Message, "Subutai dirs", MessageBoxButtons.OK);
                    }
                }
                StageReporter("", "Cleaning Registry");
                if (toLog)
                {
                    logger.Info("Cleaning Registry");
                    MessageBox.Show("Cleaning Registry", "Removing", MessageBoxButtons.OK);
                }
                //Clean registry
                RG.delete_from_reg();
                //UpdateProgress(70);
            }, TaskContinuationOptions.OnlyOnRanToCompletion)

            .ContinueWith((prevTask) =>
            {
                Exception ex = prevTask.Exception;
                if (prevTask.IsFaulted)
                {
                    while (ex is AggregateException && ex.InnerException != null)
                    {
                        ex = ex.InnerException;
                        if (toLog)
                        {
                            logger.Info("Exception on Cleaning Registry: {0}", ex.Message);
                        }
                        MessageBox.Show(ex.Message, "Cleaning Registry", MessageBoxButtons.OK);
                    }
                }
                StageReporter("", "Removing TAP interfaces");
                if (toLog)
                {
                    logger.Info("Removing TAP interfaces");
                    MessageBox.Show("Removing TAP interfaces", "Removing", MessageBoxButtons.OK);
                }
                AP.del_TAP();
                //UpdateProgress(80);
            }, TaskContinuationOptions.OnlyOnRanToCompletion)

            .ContinueWith((prevTask) =>
            {
                Exception ex = prevTask.Exception;
                if (prevTask.IsFaulted)
                {
                    while (ex is AggregateException && ex.InnerException != null)
                    {
                        ex = ex.InnerException;
                        if (toLog)
                        {
                            logger.Info("Exception on Removing TAP interfaces: {0}", ex.Message);
                        }
                        MessageBox.Show(ex.Message, "Removing TAP interfaces", MessageBoxButtons.OK);
                    }
                }
                StageReporter("", "Removing old logs");
                if (toLog)
                {
                    logger.Info("Removing old logs");
                    MessageBox.Show("Removing old logs", "Removing", MessageBoxButtons.OK);
                }
                //Remove log dir
                FD.remove_log_dir();
            }, TaskContinuationOptions.OnlyOnRanToCompletion)

            .ContinueWith((prevTask) =>
            {
                Exception ex = prevTask.Exception;
                if (prevTask.IsFaulted)
                {
                    while (ex is AggregateException && ex.InnerException != null)
                    {
                        ex = ex.InnerException;
                        if (toLog)
                        {
                            logger.Info("Exception on Removing old logs: {0}", ex.Message);
                        }
                        MessageBox.Show(ex.Message, "Removing old logs", MessageBoxButtons.OK);
                    }
                }
                StageReporter("", "Removing Subutai Virtual Machines");
                if (toLog)
                {
                    logger.Info("Removing Subutai Virtual Machines");
                    MessageBox.Show("Removing Subutai Virtual Machines", "Removing", MessageBoxButtons.OK);
                }
                //Remove snappy and subutai machines
                VBx.remove_vm();
                //Remove Oracle VirtualBox
                StageReporter("", "Removing Oracle Virtual Box software");
                if (toLog)
                {
                    logger.Info("Removing Subutai Virtual  Box software");
                    MessageBox.Show("Removing Subutai Virtual  Box software", "Removing", MessageBoxButtons.OK);
                }
                if (!isSilent && bVBox)
                {
                    if (toLog)
                    {
                        logger.Info("Removing Subutai Virtual Box software - yes");
                        MessageBox.Show("Removing Subutai Virtual Box software - yes", "Removing", MessageBoxButtons.OK);
                    }
                    VBx.remove_app_vbox_short("Oracle VirtualBox");
                }
            }, TaskContinuationOptions.OnlyOnRanToCompletion)

            .ContinueWith((prevTask) =>
            {
                Exception ex = prevTask.Exception;
                if (prevTask.IsFaulted)
                {
                    while (ex is AggregateException && ex.InnerException != null)
                    {
                        ex = ex.InnerException;
                        if (toLog)
                        {
                            logger.Info("Exception on Removing virtual machines: {0}", ex.Message);
                        }
                        MessageBox.Show(ex.Message, "VirtualBox", MessageBoxButtons.OK);
                    }
                }
                StageReporter("", "Removing Google Chrome");
                if (toLog)
                {
                    logger.Info("Removing Google Chrome");
                    MessageBox.Show("Removing Google Chrome", "Removing", MessageBoxButtons.OK);
                }
                if (!isSilent && bChrome)
                {
                    if (toLog)
                    {
                        logger.Info("Removing Google Chrome - yes");
                        MessageBox.Show("Removing Google Chrome - yes", "Removing", MessageBoxButtons.OK);
                    }
                    AP.remove_chrome();
                }
            }, TaskContinuationOptions.OnlyOnRanToCompletion)



            .ContinueWith((prevTask) =>
            {
                Exception ex = prevTask.Exception;
                if (prevTask.IsFaulted)
                {
                    while (ex is AggregateException && ex.InnerException != null)
                    {
                        ex = ex.InnerException;
                        if (toLog)
                        {
                            logger.Info("Exception on Removing Google Chrome:{0}", ex.Message);
                        }
                        MessageBox.Show(ex.Message, "Chrome", MessageBoxButtons.OK);
                    }
                }
                //Remove service if was installed during cancelling
                if (toLog)
                {
                    logger.Info("Removing Subutai P2P service if was installed after uninstall started");
                    MessageBox.Show("Removing Subutai P2P service if was installed after uninstall started", "Removing", MessageBoxButtons.OK);
                }
                mess = SCP.stop_process("p2p");
                mess = "";
                mess = SCP.stop_service("Subutai Social P2P", 5000);
                mess = "";
                mess = SCP.remove_service("Subutai Social P2P");
            }, TaskContinuationOptions.OnlyOnRanToCompletion)

            .ContinueWith((prevTask) =>
            {
                Exception ex = prevTask.Exception;
                if (prevTask.IsFaulted)
                {
                    while (ex is AggregateException && ex.InnerException != null)
                    {
                        ex = ex.InnerException;
                        if (toLog)
                        {
                            logger.Info("Exception on Removing Subutai P2P Service: {0}", ex.Message);
                        }
                        MessageBox.Show(ex.Message, "Subutai P2P Service", MessageBoxButtons.OK);
                    }
                }
                StageReporter("", "Removing Subutai shortcuts");
                if (toLog)
                {
                    logger.Info("Removing Subutai shortcuts");
                    MessageBox.Show("Removing Subutai shortcuts", "Removing", MessageBoxButtons.OK);
                }
                FD.delete_Shortcuts("Subutai");
                //UpdateProgress(80);
                StageReporter("", "Removing Subutai directories");
                if (toLog)
                {
                    logger.Info("Removing Subutai directories");
                    MessageBox.Show("Removing Subutai directories", "Removing", MessageBoxButtons.OK);
                }
                mess        = "";
                string mesg = "";
                if (SubutaiDir != "" && SubutaiDir != null && SubutaiDir != "C:\\" && SubutaiDir != "D:\\" && SubutaiDir != "E:\\" && !(SubutaiDir.Length < 4))
                {
                    if (!isSilent)
                    {
                        if (bFolder)
                        {
                            if (toLog)
                            {
                                logger.Info("Not silent, Removing Subutai directories completely");
                                MessageBox.Show("Not silent, Removing Subutai directories completely", "Removing", MessageBoxButtons.OK);
                            }
                            //checked, need to remove
                            mess = FD.delete_dir(SubutaiDir);
                        }
                        else
                        {
                            if (toLog)
                            {
                                logger.Info("Not silent, Removing Subutai bin directory");
                                MessageBox.Show("Not silent, Removing Subutai bin directory", "Removing", MessageBoxButtons.OK);
                            }

                            mess = FD.delete_dir_bin(SubutaiDir);
                        }
                    }
                    else     //silent
                    {
                        if (removeAll)
                        {
                            if (toLog)
                            {
                                logger.Info("Silent, Removing Subutai directories completely");
                                MessageBox.Show("Silent, Removing Subutai directories completely", "Removing", MessageBoxButtons.OK);
                            }
                            mess = FD.delete_dir(SubutaiDir);
                        }
                        else
                        {
                            if (toLog)
                            {
                                logger.Info("Silent, Removing Subutai bin directory");
                                MessageBox.Show("Silent, Removing Subutai bin directory", "Removing", MessageBoxButtons.OK);
                            }
                            mess = FD.delete_dir_bin(SubutaiDir);
                        }
                    }

                    if (mess.Contains("Can not"))
                    {
                        mesg = string.Format("Folder {0}\\bin can not be removed.\n\n Please close running applications that can lock files (ssh sessions, file manager windows, stop p2p service if running etc) and delete it manually", SubutaiDir);
                        if (toLog)
                        {
                            logger.Info("Failed to remove Subutai directory");
                            MessageBox.Show("Failed to remove Subutai directory", "Removing", MessageBoxButtons.OK);
                        }
                        MessageBox.Show(mesg, "Removing Subutai folder", MessageBoxButtons.OK);
                    }
                }

                //Remove Subutai dir from ApplicationData
                string appUserDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
                //MessageBox.Show($"AppData: {appUserDir}", "AppData", MessageBoxButtons.OK);
                appUserDir = Path.Combine(appUserDir, "Subutai Social");
                if (Directory.Exists(appUserDir))
                {
                    try
                    {
                        Directory.Delete(appUserDir, true);
                    }
                    catch (Exception exx)
                    {
                        mesg = exx.Message;
                    }
                }
                SetIndeterminate(false);
                UpdateProgress(100);
                StageReporter("", "Finished");
                string mes  = "Subutai Social uninstalled. \n";
                string mes1 = "\nPlease delete ";
                string mes2 = "";
                string mes3 = " software manually from Control Panel if You are not going to use it";
                if (AP.app_installed("Clients\\StartMenuInternet\\Google Chrome") == 1)
                {
                    mes1 += "Google Chrome ";
                    mes  += $"{mes1}{mes2}";
                }
                if (AP.app_installed("Oracle\\VirtualBox") == 1)
                {
                    if (mes.Contains("Chrome"))
                    {
                        mes += " and Oracle VirtualBox ";
                    }
                    else
                    {
                        mes += "\nPlease delete Oracle VirtualBox ";
                    }
                }

                if (mes.Contains("Chrome") || mes.Contains("VirtualBox"))
                {
                    mes += mes3;
                }
                mesg = string.Format($"{mes}");
                if (toLog)
                {
                    logger.Info("Subutai Social uninstalled");
                }
                MessageBox.Show(mesg, "Uninstall Subutai Social", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Environment.Exit(0);
            });
        }