Example #1
0
        private void BeginInstall()
        {
            InstallFlags flags = new InstallFlags();

            flags.SetConditionally(pepperBox.Checked, InstallFlags.PEPPER);
            flags.SetConditionally(netscapeBox.Checked, InstallFlags.NETSCAPE);
            flags.SetConditionally(activeXBox.Checked, InstallFlags.ACTIVEX);
            flags.SetConditionally(playerBox.Checked, InstallFlags.PLAYER);
            flags.SetConditionally(playerDesktopBox.Checked, InstallFlags.PLAYER_DESKTOP);
            flags.SetConditionally(playerStartMenuBox.Checked, InstallFlags.PLAYER_START_MENU);

            progressBar.Value   = 0;
            progressBar.Maximum = flags.GetTicks();

            new Task(new Action(() => {
                IntPtr redirection = RedirectionManager.DisableRedirection();

                try {
                    Uninstaller.Uninstall(this);
                    Installer.Install(this, flags);
                    Complete();
                } catch (Exception e) {
                    Failure(e);
                } finally {
                    RedirectionManager.EnableRedirection(redirection);
                }
            })).Start();
        }
Example #2
0
        public static void Install(IProgressForm form, InstallFlags flags)
        {
            if (flags.IsNoneSet())
            {
                // No packages should be installed.
                return;
            }

            string        flash32Path        = SystemInfo.GetFlash32Path();
            string        flash64Path        = SystemInfo.GetFlash64Path();
            string        system32Path       = SystemInfo.GetSystem32Path();
            string        flashProgram32Path = SystemInfo.GetProgramFlash32Path();
            List <string> registryToApply    = new List <string>()
            {
                Properties.Resources.installGeneral
            };

            if (Environment.Is64BitOperatingSystem)
            {
                registryToApply.Add(Properties.Resources.installGeneral64);
            }

            form.UpdateProgressLabel("Installing Flash Player utilities...", true);
            ExtractArchive("flash_gen_32.zip", system32Path);
            form.UpdateProgressLabel("Extracting uninstaller..", true);
            ExtractArchive("flash_uninstaller.zip", flashProgram32Path);

            if (flags.IsSet(InstallFlags.PEPPER))
            {
                form.UpdateProgressLabel("Installing 32-bit Flash Player for Chrome...", true);
                ExtractArchive("flash_pp_32.zip", flash32Path);
                registryToApply.Add(Properties.Resources.installPP);
            }
            if (flags.IsSet(InstallFlags.NETSCAPE))
            {
                form.UpdateProgressLabel("Installing 32-bit Flash Player for Firefox...", true);
                ExtractArchive("flash_np_32.zip", flash32Path);
                registryToApply.Add(Properties.Resources.installNP);
            }
            if (flags.IsSet(InstallFlags.ACTIVEX))
            {
                form.UpdateProgressLabel("Installing 32-bit Flash Player for Internet Explorer...", true);
                ExtractArchive("flash_ocx_32.zip", flash32Path);
            }
            if (flags.IsSet(InstallFlags.PLAYER))
            {
                form.UpdateProgressLabel("Installing 32-bit Standalone Flash Player...", true);
                ExtractArchive("flash_player_32.zip", flashProgram32Path);

                string name        = "Flash Player";
                string description = "Standalone Flash Player " + UpdateChecker.GetFlashVersion();
                string executable  = Path.Combine(flashProgram32Path, UpdateChecker.GetFlashPlayerExecutable());

                if (UpdateChecker.IsDebug())
                {
                    name        += " (Debug)";
                    description += " (Debug)";
                }

                if (flags.IsSet(InstallFlags.PLAYER_START_MENU))
                {
                    CreateShortcut(Environment.GetFolderPath(Environment.SpecialFolder.StartMenu), executable, name, description);
                }

                if (flags.IsSet(InstallFlags.PLAYER_DESKTOP))
                {
                    CreateShortcut(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), executable, name, description);
                }
            }

            if (Environment.Is64BitOperatingSystem)
            {
                if (flags.IsSet(InstallFlags.PEPPER))
                {
                    form.UpdateProgressLabel("Installing 64-bit Flash Player for Chrome...", true);
                    ExtractArchive("flash_pp_64.zip", flash64Path);
                    registryToApply.Add(Properties.Resources.installPP64);
                }
                if (flags.IsSet(InstallFlags.NETSCAPE))
                {
                    form.UpdateProgressLabel("Installing 64-bit Flash Player for Firefox...", true);
                    ExtractArchive("flash_np_64.zip", flash64Path);
                    registryToApply.Add(Properties.Resources.installNP64);
                }
                if (flags.IsSet(InstallFlags.ACTIVEX))
                {
                    form.UpdateProgressLabel("Installing 64-bit Flash Player for Internet Explorer...", true);
                    ExtractArchive("flash_ocx_64.zip", flash64Path);
                }
            }

            form.UpdateProgressLabel("Applying registry changes...", true);
            RegistryManager.ApplyRegistry(registryToApply);

            if (flags.IsSet(InstallFlags.ACTIVEX))
            {
                form.UpdateProgressLabel("Activating 32-bit Flash Player for Internet Explorer...", true);
                RegisterActiveX(Path.Combine(flash32Path, string.Format("Flash32_{0}.ocx", SystemInfo.GetVersionPath())));

                if (Environment.Is64BitOperatingSystem)
                {
                    form.UpdateProgressLabel("Activating 64-bit Flash Player for Internet Explorer...", true);
                    RegisterActiveX(Path.Combine(flash64Path, string.Format("Flash64_{0}.ocx", SystemInfo.GetVersionPath())));
                }
            }
        }