Exemple #1
0
        public void Uninstall()
        {
            RegistryEditor reg     = new RegistryEditor();
            string         regPath = @"Software\Microsoft\Windows\CurrentVersion\Uninstall\Pokemon Mystery Universe Map Editor";

            reg.SetPath(regPath);
            if (reg.SubKeyExists())  //if (reg.Read("Installed") == "1") {
            {
                UpdateStatus("Found previous installed version, uninstalling...");
                string path = reg.Read("InstallPath");
                if (System.IO.Directory.Exists(path))
                {
                    System.IO.Directory.Delete(path, true);
                }

                bool installAllUsers;
                if (reg.Read("AllUsers") == "1")
                {
                    installAllUsers = true;
                }
                else
                {
                    installAllUsers = false;
                }
                string desktopPath;
                string startMenuPath;

                if (installAllUsers)
                {
                    desktopPath   = System.Environment.GetFolderPath(System.Environment.SpecialFolder.CommonDesktopDirectory);
                    startMenuPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.CommonStartMenu);
                }
                else
                {
                    desktopPath   = System.Environment.GetFolderPath(System.Environment.SpecialFolder.DesktopDirectory);
                    startMenuPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Startup);
                }

                if (System.IO.File.Exists(desktopPath + "\\PMU Map Editor.lnk"))
                {
                    System.IO.File.Delete(desktopPath + "\\PMU Map Editor.lnk");
                }

                if (System.IO.File.Exists(startMenuPath + "\\PMU Map Editor.lnk"))
                {
                    System.IO.File.Delete(startMenuPath + "\\PMU Map Editor.lnk");
                }

                reg.DeleteSubKey();
            }
        }
        public void Uninstall()
        {
            RegistryEditor reg = new RegistryEditor();
            string regPath = @"Software\Microsoft\Windows\CurrentVersion\Uninstall\Pokemon Mystery Universe Client";
            reg.SetPath(regPath);
            if (reg.SubKeyExists()) {//if (reg.Read("Installed") == "1") {
                UpdateStatus("Found previous installed version, uninstalling...");
                string path = reg.Read("InstallPath");
                if (System.IO.Directory.Exists(path)) {
                    System.IO.Directory.Delete(path, true);
                }

                bool installAllUsers;
                if (reg.Read("AllUsers") == "1") {
                    installAllUsers = true;
                } else {
                    installAllUsers = false;
                }

                string desktopPath;
                string startMenuPath;

                if (installAllUsers) {
                    desktopPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.CommonDesktopDirectory);
                    startMenuPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.CommonStartMenu);
                } else {
                    desktopPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.DesktopDirectory);
                    startMenuPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Startup);
                }

                if (System.IO.File.Exists(desktopPath + "\\Pokemon Mystery Universe.lnk")) {
                    System.IO.File.Delete(desktopPath + "\\Pokemon Mystery Universe.lnk");
                }

                if (System.IO.File.Exists(startMenuPath + "\\Pokemon Mystery Universe.lnk")) {
                    System.IO.File.Delete(startMenuPath + "\\Pokemon Mystery Universe.lnk");
                }

                reg.DeleteSubKey();
            }
            // Uninstall the version installed by the old installer
            regPath = @"Software\Microsoft\Windows\CurrentVersion\Uninstall\Pokemon Mystery Universe";
            reg.SetPath(regPath);
            if (reg.SubKeyExists()) {//if (reg.Read("Installed") == "1") {
                UpdateStatus("Found previous installed version, uninstalling...");
                string path = reg.Read("InstallPath");
                if (System.IO.Directory.Exists(path)) {
                    System.IO.Directory.Delete(path, true);
                }

                bool installAllUsers;
                if (reg.Read("AllUsers") == "1") {
                    installAllUsers = true;
                } else {
                    installAllUsers = false;
                }

                string desktopPath;
                string startMenuPath;

                if (installAllUsers) {
                    desktopPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.CommonDesktopDirectory);
                    startMenuPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.CommonStartMenu);
                } else {
                    desktopPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.DesktopDirectory);
                    startMenuPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Startup);
                }

                if (System.IO.File.Exists(desktopPath + "\\Pokemon Mystery Universe.lnk")) {
                    System.IO.File.Delete(desktopPath + "\\Pokemon Mystery Universe.lnk");
                }

                if (System.IO.File.Exists(startMenuPath + "\\Pokemon Mystery Universe.lnk")) {
                    System.IO.File.Delete(startMenuPath + "\\Pokemon Mystery Universe.lnk");
                }

                reg.DeleteSubKey();
            }
        }