Ejemplo n.º 1
0
		public static void InitInstall(Hashtable args, Wizard wizard)
		{
			AppConfig.LoadConfiguration();

			LoadSetupVariablesFromParameters(wizard, args);

			wizard.SetupVariables.SetupAction = SetupActions.Install;
			wizard.SetupVariables.InstallationFolder = Path.Combine("C:\\WebsitePanel", wizard.SetupVariables.ComponentName);
			string componentId = Guid.NewGuid().ToString();
			wizard.SetupVariables.ComponentId = componentId;
			wizard.SetupVariables.Instance = string.Empty;

			//create component settings node
			wizard.SetupVariables.ComponentConfig = AppConfig.CreateComponentConfig(componentId);
			//add default component settings
			CreateComponentSettingsFromSetupVariables(wizard.SetupVariables, componentId);
		}
Ejemplo n.º 2
0
 private void OnWizardCancel(object sender, EventArgs e)
 {
     AbortProcess();
     this.CustomCancelHandler = false;
     Wizard.Close();
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Displays process progress.
        /// </summary>
        public void Start()
        {
            bool pass = true;

            try
            {
                lvCheck.Items.Clear();
                this.imgError.Visible  = false;
                this.imgOk.Visible     = false;
                this.lblResult.Visible = false;

                foreach (ConfigurationCheck check in Checks)
                {
                    AddListViewItem(check);
                }
                this.Update();
                CheckStatuses status  = CheckStatuses.Success;
                string        details = string.Empty;
                //
                foreach (ListViewItem item in lvCheck.Items)
                {
                    ConfigurationCheck check = (ConfigurationCheck)item.Tag;
                    item.ImageIndex       = 0;
                    item.SubItems[2].Text = "Running";
                    this.Update();

                    #region Previous Prereq Verification
                    switch (check.CheckType)
                    {
                    case CheckTypes.OperationSystem:
                        status = CheckOS(out details);
                        break;

                    case CheckTypes.IISVersion:
                        status = CheckIISVersion(out details);
                        break;

                    case CheckTypes.ASPNET:
                        status = CheckASPNET(out details);
                        break;

                    case CheckTypes.WPServer:
                        status = CheckWPServer(check.SetupVariables, out details);
                        break;

                    case CheckTypes.WPEnterpriseServer:
                        status = CheckWPEnterpriseServer(check.SetupVariables, out details);
                        break;

                    case CheckTypes.WPPortal:
                        status = CheckWPPortal(check.SetupVariables, out details);
                        break;

                    default:
                        status = CheckStatuses.Warning;
                        break;
                    }

                    #endregion

                    switch (status)
                    {
                    case CheckStatuses.Success:
                        item.ImageIndex       = 1;
                        item.SubItems[2].Text = "Success";
                        break;

                    case CheckStatuses.Warning:
                        item.ImageIndex       = 2;
                        item.SubItems[2].Text = "Warning";
                        break;

                    case CheckStatuses.Error:
                        item.ImageIndex       = 3;
                        item.SubItems[2].Text = "Error";
                        pass = false;
                        break;
                    }
                    item.SubItems[3].Text = details;
                    this.Update();
                }
                //
                //actionManager.PrerequisiteComplete += new EventHandler<ActionProgressEventArgs<bool>>((object sender, ActionProgressEventArgs<bool> e) =>
                //{
                //
                //});
                //
                //actionManager.VerifyDistributivePrerequisites();

                ShowResult(pass);
                if (pass)
                {
                    //unattended setup
                    if (!string.IsNullOrEmpty(Wizard.SetupVariables.SetupXml) && AllowMoveNext)
                    {
                        Wizard.GoNext();
                    }
                }
            }
            catch (Exception ex)
            {
                if (Utils.IsThreadAbortException(ex))
                {
                    return;
                }

                ShowError();
                return;
            }
        }
Ejemplo n.º 4
0
        internal static DialogResult InstallBase(object obj, string minimalInstallerVersion)
        {
            Hashtable args = Utils.GetSetupParameters(obj);

            //check CS version
            string  shellVersion = Utils.GetStringSetupParameter(args, "ShellVersion");
            Version version      = new Version(shellVersion);

            if (version < new Version(minimalInstallerVersion))
            {
                MessageBox.Show(
                    string.Format("WebsitePanel Installer {0} or higher required.", minimalInstallerVersion),
                    "Setup Wizard", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(DialogResult.Cancel);
            }

            InstallerForm form   = new InstallerForm();
            Wizard        wizard = form.Wizard;

            InitInstall(args, wizard);

            //db settings
            wizard.SetupVariables.DatabaseServer = "localhost\\sqlexpress";
            wizard.SetupVariables.Database       = "WebsitePanel";
            wizard.SetupVariables.CreateDatabase = true;
            //web settings
            wizard.SetupVariables.WebSiteIP           = "127.0.0.1";
            wizard.SetupVariables.WebSitePort         = "9002";
            wizard.SetupVariables.WebSiteDomain       = string.Empty;
            wizard.SetupVariables.NewWebSite          = true;
            wizard.SetupVariables.NewVirtualDirectory = false;
            wizard.SetupVariables.UserMembership      = (wizard.SetupVariables.IISVersion.Major == 7)?
                                                        new string[] { "IIS_IUSRS" } :
            new string[] { "IIS_WPG" };
            wizard.SetupVariables.ConfigurationFile = "web.config";
            //serveradmin settings
            wizard.SetupVariables.UpdateServerAdminPassword = true;
            wizard.SetupVariables.ServerAdminPassword       = "";

            //Unattended setup
            LoadSetupVariablesFromSetupXml(wizard.SetupVariables.SetupXml, wizard.SetupVariables);

            //create wizard pages
            IntroductionPage       introPage = new IntroductionPage();
            LicenseAgreementPage   licPage   = new LicenseAgreementPage();
            ConfigurationCheckPage page1     = new ConfigurationCheckPage();
            ConfigurationCheck     check1    = new ConfigurationCheck(CheckTypes.OperationSystem, "Operating System Requirement");
            ConfigurationCheck     check2    = new ConfigurationCheck(CheckTypes.IISVersion, "IIS Requirement");
            ConfigurationCheck     check3    = new ConfigurationCheck(CheckTypes.ASPNET, "ASP.NET Requirement");

            page1.Checks.AddRange(new ConfigurationCheck[] { check1, check2, check3 });
            InstallFolderPage       page2        = new InstallFolderPage();
            WebPage                 page3        = new WebPage();
            UserAccountPage         page4        = new UserAccountPage();
            DatabasePage            page5        = new DatabasePage();
            ServerAdminPasswordPage passwordPage = new ServerAdminPasswordPage();

            ExpressInstallPage page6 = new ExpressInstallPage();

            //create install actions
            InstallAction action = new InstallAction(ActionTypes.CopyFiles);

            action.Description = "Copying files...";
            page6.Actions.Add(action);

            action             = new InstallAction(ActionTypes.CreateWebSite);
            action.Description = "Creating web site...";
            page6.Actions.Add(action);

            action             = new InstallAction(ActionTypes.FolderPermissions);
            action.Description = "Configuring folder permissions...";
            page6.Actions.Add(action);

            action             = new InstallAction(ActionTypes.CryptoKey);
            action.Description = "Generating crypto key...";
            page6.Actions.Add(action);

            action             = new InstallAction(ActionTypes.CreateDatabase);
            action.Description = "Creating SQL Server database...";
            page6.Actions.Add(action);

            action             = new InstallAction(ActionTypes.CreateDatabaseUser);
            action.Description = "Creating SQL Server user...";
            page6.Actions.Add(action);

            action             = new InstallAction(ActionTypes.ExecuteSql);
            action.Description = "Creating database objects...";
            action.Path        = "setup\\install_db.sql";
            page6.Actions.Add(action);

            action             = new InstallAction(ActionTypes.UpdateServerAdminPassword);
            action.Description = "Updating serveradmin password...";
            page6.Actions.Add(action);

            action             = new InstallAction(ActionTypes.UpdateLicenseInformation);
            action.Description = "Updating license information...";
            page6.Actions.Add(action);

            action             = new InstallAction(ActionTypes.UpdateConfig);
            action.Description = "Updating system configuration...";
            page6.Actions.Add(action);

            FinishPage page7 = new FinishPage();

            wizard.Controls.AddRange(new Control[] { introPage, licPage, page1, page2, page3, page4, page5, passwordPage, page6, page7 });
            wizard.LinkPages();
            wizard.SelectedPage = introPage;

            //show wizard
            IWin32Window owner = args["ParentForm"] as IWin32Window;

            return(form.ShowModal(owner));
        }
Ejemplo n.º 5
0
        public static DialogResult Update(object obj)
        {
            Hashtable args         = Utils.GetSetupParameters(obj);
            string    shellVersion = Utils.GetStringSetupParameter(args, "ShellVersion");

            Version version = new Version(shellVersion);

            if (version < new Version("1.0.1"))
            {
                MessageBox.Show("WebsitePanel Installer 1.0.1 or higher required.", "Setup Wizard", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(DialogResult.Cancel);
            }
            string componentId = Utils.GetStringSetupParameter(args, "ComponentId");

            AppConfig.LoadConfiguration();

            InstallerForm form   = new InstallerForm();
            Wizard        wizard = form.Wizard;

            LoadSetupVariablesFromConfig(wizard, componentId);
            if (wizard.SetupVariables.Version != "1.5.3")
            {
                MessageBox.Show("Please update to version 1.5.3", "Setup Wizard", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(DialogResult.Cancel);
            }

            wizard.SetupVariables.SetupAction     = SetupActions.Update;
            wizard.SetupVariables.BaseDirectory   = Utils.GetStringSetupParameter(args, "BaseDirectory");
            wizard.SetupVariables.UpdateVersion   = Utils.GetStringSetupParameter(args, "UpdateVersion");
            wizard.SetupVariables.InstallerFolder = Utils.GetStringSetupParameter(args, "InstallerFolder");
            wizard.SetupVariables.Installer       = Utils.GetStringSetupParameter(args, "Installer");
            wizard.SetupVariables.InstallerType   = Utils.GetStringSetupParameter(args, "InstallerType");
            wizard.SetupVariables.InstallerPath   = Utils.GetStringSetupParameter(args, "InstallerPath");
            wizard.SetupVariables.IISVersion      = Utils.GetVersionSetupParameter(args, "IISVersion");

            IntroductionPage     introPage = new IntroductionPage();
            LicenseAgreementPage licPage   = new LicenseAgreementPage();
            ExpressInstallPage   page2     = new ExpressInstallPage();
            //create install actions
            InstallAction action = new InstallAction(ActionTypes.Backup);

            action.Description = "Backing up...";
            page2.Actions.Add(action);

            action             = new InstallAction(ActionTypes.DeleteFiles);
            action.Description = "Deleting files...";
            action.Path        = "setup\\delete.txt";
            page2.Actions.Add(action);

            action             = new InstallAction(ActionTypes.CopyFiles);
            action.Description = "Copying files...";
            page2.Actions.Add(action);

            action             = new InstallAction(ActionTypes.ExecuteSql);
            action.Description = "Updating database...";
            action.Path        = "setup\\update_db.sql";
            page2.Actions.Add(action);


            action             = new InstallAction(ActionTypes.UpdateConfig);
            action.Description = "Updating system configuration...";
            page2.Actions.Add(action);

            FinishPage page3 = new FinishPage();

            wizard.Controls.AddRange(new Control[] { introPage, licPage, page2, page3 });
            wizard.LinkPages();
            wizard.SelectedPage = introPage;

            //show wizard
            Form parentForm = args["ParentForm"] as Form;

            return(form.ShowDialog(parentForm));
        }
Ejemplo n.º 6
0
        public static DialogResult UpdateBase(object obj, string minimalInstallerVersion,
                                              string versionToUpgrade, bool updateSql, InstallAction versionSpecificAction)
        {
            Hashtable args         = Utils.GetSetupParameters(obj);
            string    shellVersion = Utils.GetStringSetupParameter(args, "ShellVersion");

            Version version = new Version(shellVersion);

            if (version < new Version(minimalInstallerVersion))
            {
                MessageBox.Show(
                    string.Format("WebsitePanel Installer {0} or higher required.", minimalInstallerVersion),
                    "Setup Wizard", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(DialogResult.Cancel);
            }
            string componentId = Utils.GetStringSetupParameter(args, "ComponentId");

            AppConfig.LoadConfiguration();

            InstallerForm form   = new InstallerForm();
            Wizard        wizard = form.Wizard;

            LoadSetupVariablesFromConfig(wizard.SetupVariables, componentId);
            if (!VersionEquals(wizard.SetupVariables.Version, versionToUpgrade))
            {
                MessageBox.Show(
                    string.Format("Please update to version {0}", versionToUpgrade),
                    "Setup Wizard", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(DialogResult.Cancel);
            }

            wizard.SetupVariables.SetupAction     = SetupActions.Update;
            wizard.SetupVariables.BaseDirectory   = Utils.GetStringSetupParameter(args, "BaseDirectory");
            wizard.SetupVariables.UpdateVersion   = Utils.GetStringSetupParameter(args, "UpdateVersion");
            wizard.SetupVariables.InstallerFolder = Utils.GetStringSetupParameter(args, "InstallerFolder");
            wizard.SetupVariables.Installer       = Utils.GetStringSetupParameter(args, "Installer");
            wizard.SetupVariables.InstallerType   = Utils.GetStringSetupParameter(args, "InstallerType");
            wizard.SetupVariables.InstallerPath   = Utils.GetStringSetupParameter(args, "InstallerPath");
            wizard.SetupVariables.IISVersion      = Utils.GetVersionSetupParameter(args, "IISVersion");

            IntroductionPage     introPage = new IntroductionPage();
            LicenseAgreementPage licPage   = new LicenseAgreementPage();
            ExpressInstallPage   page2     = new ExpressInstallPage();
            //create install currentScenario
            InstallAction action = new InstallAction(ActionTypes.StopApplicationPool);

            action.Description = "Stopping IIS Application Pool...";
            page2.Actions.Add(action);

            action             = new InstallAction(ActionTypes.Backup);
            action.Description = "Backing up...";
            page2.Actions.Add(action);

            action             = new InstallAction(ActionTypes.DeleteFiles);
            action.Description = "Deleting files...";
            action.Path        = "setup\\delete.txt";
            page2.Actions.Add(action);

            action             = new InstallAction(ActionTypes.CopyFiles);
            action.Description = "Copying files...";
            page2.Actions.Add(action);

            if (versionSpecificAction != null)
            {
                page2.Actions.Add(versionSpecificAction);
            }

            if (updateSql)
            {
                action             = new InstallAction(ActionTypes.ExecuteSql);
                action.Description = "Updating database...";
                action.Path        = "setup\\update_db.sql";
                page2.Actions.Add(action);
            }

            action             = new InstallAction(ActionTypes.UpdateConfig);
            action.Description = "Updating system configuration...";
            page2.Actions.Add(action);

            action             = new InstallAction(ActionTypes.StartApplicationPool);
            action.Description = "Starting IIS Application Pool...";
            page2.Actions.Add(action);

            FinishPage page3 = new FinishPage();

            wizard.Controls.AddRange(new Control[] { introPage, licPage, page2, page3 });
            wizard.LinkPages();
            wizard.SelectedPage = introPage;

            //show wizard
            IWin32Window owner = args["ParentForm"] as IWin32Window;

            return(form.ShowModal(owner));
        }
        internal static object InstallBase(object obj, string minimalInstallerVersion)
        {
            Hashtable args = Utils.GetSetupParameters(obj);

            //check CS version
            string  shellVersion = Utils.GetStringSetupParameter(args, Global.Parameters.ShellVersion);
            var     shellMode    = Utils.GetStringSetupParameter(args, Global.Parameters.ShellMode);
            Version version      = new Version(shellVersion);

            //********************  Server ****************
            var serverSetup = new SetupVariables
            {
                ComponentId          = Guid.NewGuid().ToString(),
                Instance             = String.Empty,
                ComponentName        = Global.Server.ComponentName,
                ComponentCode        = Global.Server.ComponentCode,
                ComponentDescription = Global.Server.ComponentDescription,
                //
                ServerPassword = Guid.NewGuid().ToString("N").Substring(0, 10),
                //
                SetupAction     = SetupActions.Install,
                IISVersion      = Global.IISVersion,
                ApplicationName = Utils.GetStringSetupParameter(args, Global.Parameters.ApplicationName),
                Version         = Utils.GetStringSetupParameter(args, Global.Parameters.Version),
                Installer       = Utils.GetStringSetupParameter(args, Global.Parameters.Installer),
                InstallerPath   = Utils.GetStringSetupParameter(args, Global.Parameters.InstallerPath),
                SetupXml        = Utils.GetStringSetupParameter(args, Global.Parameters.SetupXml),
                //
                InstallerFolder    = Path.Combine(Utils.GetStringSetupParameter(args, Global.Parameters.InstallerFolder), Global.Server.ComponentName),
                InstallerType      = Utils.GetStringSetupParameter(args, Global.Parameters.InstallerType).Replace(Global.StandaloneServer.SetupController, Global.Server.SetupController),
                InstallationFolder = Path.Combine(Path.Combine(Utils.GetSystemDrive(), "WebsitePanel"), Global.Server.ComponentName),
                ConfigurationFile  = "web.config",
            };

            // Load config file
            AppConfig.LoadConfiguration();
            //
            LoadComponentVariablesFromSetupXml(serverSetup.ComponentCode, serverSetup.SetupXml, serverSetup);
            //
            //serverSetup.ComponentConfig = AppConfig.CreateComponentConfig(serverSetup.ComponentId);
            //serverSetup.RemoteServerUrl = GetUrl(serverSetup.WebSiteDomain, serverSetup.WebSiteIP, serverSetup.WebSitePort);
            //
            //CreateComponentSettingsFromSetupVariables(serverSetup, serverSetup.ComponentId);

            //********************  Enterprise Server ****************
            var esServerSetup = new SetupVariables
            {
                ComponentId = Guid.NewGuid().ToString(),
                SetupAction = SetupActions.Install,
                IISVersion  = Global.IISVersion,
                //
                Instance             = String.Empty,
                ComponentName        = Global.EntServer.ComponentName,
                ComponentCode        = Global.EntServer.ComponentCode,
                ApplicationName      = Utils.GetStringSetupParameter(args, Global.Parameters.ApplicationName),
                Version              = Utils.GetStringSetupParameter(args, Global.Parameters.Version),
                ComponentDescription = Global.EntServer.ComponentDescription,
                Installer            = Utils.GetStringSetupParameter(args, Global.Parameters.Installer),
                InstallerFolder      = Path.Combine(Utils.GetStringSetupParameter(args, Global.Parameters.InstallerFolder), Global.EntServer.ComponentName),
                InstallerType        = Utils.GetStringSetupParameter(args, Global.Parameters.InstallerType).Replace(Global.StandaloneServer.SetupController, Global.EntServer.SetupController),
                InstallationFolder   = Path.Combine(Path.Combine(Utils.GetSystemDrive(), "WebsitePanel"), Global.EntServer.ComponentName),
                InstallerPath        = Utils.GetStringSetupParameter(args, Global.Parameters.InstallerPath),
                SetupXml             = Utils.GetStringSetupParameter(args, Global.Parameters.SetupXml),
                //
                ConfigurationFile         = "web.config",
                ConnectionString          = Global.EntServer.AspNetConnectionStringFormat,
                DatabaseServer            = Global.EntServer.DefaultDbServer,
                Database                  = Global.EntServer.DefaultDatabase,
                CreateDatabase            = true,
                UpdateServerAdminPassword = true,
                //
                WebSiteIP     = Global.EntServer.DefaultIP,
                WebSitePort   = Global.EntServer.DefaultPort,
                WebSiteDomain = String.Empty,
            };

            //
            LoadComponentVariablesFromSetupXml(esServerSetup.ComponentCode, esServerSetup.SetupXml, esServerSetup);
            //
            //esServerSetup.ComponentConfig = AppConfig.CreateComponentConfig(esServerSetup.ComponentId);
            //
            //CreateComponentSettingsFromSetupVariables(esServerSetup, esServerSetup.ComponentId);

            //********************  Portal ****************
            #region Portal Setup Variables
            var portalSetup = new SetupVariables
            {
                ComponentId = Guid.NewGuid().ToString(),
                SetupAction = SetupActions.Install,
                IISVersion  = Global.IISVersion,
                //
                Instance             = String.Empty,
                ComponentName        = Global.WebPortal.ComponentName,
                ComponentCode        = Global.WebPortal.ComponentCode,
                ApplicationName      = Utils.GetStringSetupParameter(args, Global.Parameters.ApplicationName),
                Version              = Utils.GetStringSetupParameter(args, Global.Parameters.Version),
                ComponentDescription = Global.WebPortal.ComponentDescription,
                Installer            = Utils.GetStringSetupParameter(args, Global.Parameters.Installer),
                InstallerFolder      = Path.Combine(Utils.GetStringSetupParameter(args, Global.Parameters.InstallerFolder), Global.WebPortal.ComponentName),
                InstallerType        = Utils.GetStringSetupParameter(args, Global.Parameters.InstallerType).Replace(Global.StandaloneServer.SetupController, Global.WebPortal.SetupController),
                InstallationFolder   = Path.Combine(Path.Combine(Utils.GetSystemDrive(), "WebsitePanel"), Global.WebPortal.ComponentName),
                InstallerPath        = Utils.GetStringSetupParameter(args, Global.Parameters.InstallerPath),
                SetupXml             = Utils.GetStringSetupParameter(args, Global.Parameters.SetupXml),
                //
                ConfigurationFile   = "web.config",
                EnterpriseServerURL = Global.WebPortal.DefaultEntServURL,
            };
            //
            LoadComponentVariablesFromSetupXml(portalSetup.ComponentCode, portalSetup.SetupXml, portalSetup);
            //
            //portalSetup.ComponentConfig = AppConfig.CreateComponentConfig(portalSetup.ComponentId);
            //
            //CreateComponentSettingsFromSetupVariables(portalSetup, portalSetup.ComponentId);
            #endregion

            //
            var stdssam = new StandaloneServerActionManager(serverSetup, esServerSetup, portalSetup);
            //
            stdssam.PrepareDistributiveDefaults();

            //
            if (shellMode.Equals(Global.SilentInstallerShell, StringComparison.OrdinalIgnoreCase))
            {
                // Validate the setup controller's bootstrapper version
                if (version < new Version(minimalInstallerVersion))
                {
                    Utils.ShowConsoleErrorMessage(Global.Messages.InstallerVersionIsObsolete, minimalInstallerVersion);
                    //
                    return(false);
                }

                try
                {
                    var success = true;

                    // Retrieve WebsitePanel Enterprise Server component's settings from the command-line
                    var adminPassword = Utils.GetStringSetupParameter(args, Global.Parameters.ServerAdminPassword);
                    // This has been designed to make an installation process via Web PI more secure
                    if (String.IsNullOrEmpty(adminPassword))
                    {
                        // Set serveradmin password
                        esServerSetup.ServerAdminPassword = Guid.NewGuid().ToString();
                        // Set peer admin password
                        esServerSetup.PeerAdminPassword = Guid.NewGuid().ToString();
                        // Instruct provisioning scenario to enter the application in SCPA mode (Setup Control Panel Acounts)
                        esServerSetup.EnableScpaMode = true;
                    }
                    else
                    {
                        esServerSetup.ServerAdminPassword = esServerSetup.PeerAdminPassword = adminPassword;
                    }
                    //
                    esServerSetup.Database                  = Utils.GetStringSetupParameter(args, Global.Parameters.DatabaseName);
                    esServerSetup.DatabaseServer            = Utils.GetStringSetupParameter(args, Global.Parameters.DatabaseServer);
                    esServerSetup.DbInstallConnectionString = SqlUtils.BuildDbServerMasterConnectionString(
                        esServerSetup.DatabaseServer,
                        Utils.GetStringSetupParameter(args, Global.Parameters.DbServerAdmin),
                        Utils.GetStringSetupParameter(args, Global.Parameters.DbServerAdminPassword)
                        );

                    //
                    stdssam.ActionError += new EventHandler <ActionErrorEventArgs>((object sender, ActionErrorEventArgs e) =>
                    {
                        Utils.ShowConsoleErrorMessage(e.ErrorMessage);
                        //
                        Log.WriteError(e.ErrorMessage);
                        //
                        success = false;
                    });
                    //
                    stdssam.Start();
                    //
                    return(success);
                }
                catch (Exception ex)
                {
                    Log.WriteError("Failed to install the component", ex);
                    //
                    return(false);
                }
            }
            else
            {
                // Validate the setup controller's bootstrapper version
                if (version < new Version(minimalInstallerVersion))
                {
                    MessageBox.Show(String.Format(Global.Messages.InstallerVersionIsObsolete, minimalInstallerVersion),
                                    "Setup Wizard", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    //
                    return(DialogResult.Cancel);
                }

                // NOTE: there is no assignment to SetupVariables property of the wizard as usually because we have three components
                // to setup here and thus we have created SwapSetupVariablesAction setup action to swap corresponding variables
                // back and forth while executing the installation scenario.
                InstallerForm form   = new InstallerForm();
                Wizard        wizard = form.Wizard;
                wizard.SetupVariables = serverSetup;
                // Assign corresponding action manager to the wizard.
                wizard.ActionManager = stdssam;
                // Initialize wizard pages and their properties
                var introPage = new IntroductionPage();
                var licPage   = new LicenseAgreementPage();
                var page2     = new ConfigurationCheckPage();
                // Setup prerequisites validation
                page2.Checks.AddRange(new ConfigurationCheck[] {
                    new ConfigurationCheck(CheckTypes.OperationSystem, "Operating System Requirement"),
                    new ConfigurationCheck(CheckTypes.IISVersion, "IIS Requirement"),
                    new ConfigurationCheck(CheckTypes.ASPNET, "ASP.NET Requirement"),
                    // Validate Server installation prerequisites
                    new ConfigurationCheck(CheckTypes.WPServer, "WebsitePanel Server Requirement")
                    {
                        SetupVariables = serverSetup
                    },
                    // Validate EnterpriseServer installation prerequisites
                    new ConfigurationCheck(CheckTypes.WPEnterpriseServer, "WebsitePanel Enterprise Server Requirement")
                    {
                        SetupVariables = esServerSetup
                    },
                    // Validate WebPortal installation prerequisites
                    new ConfigurationCheck(CheckTypes.WPPortal, "WebsitePanel Portal Requirement")
                    {
                        SetupVariables = portalSetup
                    }
                });
                // Assign WebPortal setup variables set to acquire corresponding settings
                var page3 = new WebPage {
                    SetupVariables = portalSetup
                };
                // Assign EnterpriseServer setup variables set to acquire corresponding settings
                var page4 = new DatabasePage {
                    SetupVariables = esServerSetup
                };
                // Assign EnterpriseServer setup variables set to acquire corresponding settings
                var page5 = new ServerAdminPasswordPage
                {
                    SetupVariables = esServerSetup,
                    NoteText       = "Note: Both serveradmin and admin accounts will use this password. You can always change password for serveradmin or admin accounts through control panel."
                };
                //
                var page6 = new ExpressInstallPage2();
                // Assign WebPortal setup variables set to acquire corresponding settings
                var page7 = new SetupCompletePage {
                    SetupVariables = portalSetup
                };
                //
                wizard.Controls.AddRange(new Control[] { introPage, licPage, page2, page3, page4, page5, page6, page7 });
                wizard.LinkPages();
                wizard.SelectedPage = introPage;
                // Run wizard
                IWin32Window owner = args[Global.Parameters.ParentForm] as IWin32Window;
                return(form.ShowModal(owner));
            }
        }
Ejemplo n.º 8
0
        internal static object InstallBase(object obj, string minimalInstallerVersion)
        {
            var args = Utils.GetSetupParameters(obj);
            //check CS version
            var shellVersion = Utils.GetStringSetupParameter(args, "ShellVersion");
            var shellMode    = Utils.GetStringSetupParameter(args, Global.Parameters.ShellMode);
            var version      = new Version(shellVersion);

            var setupVariables = new SetupVariables
            {
                ConnectionString          = Global.EntServer.AspNetConnectionStringFormat,
                DatabaseServer            = Global.EntServer.DefaultDbServer,
                Database                  = Global.EntServer.DefaultDatabase,
                CreateDatabase            = true,
                WebSiteIP                 = Global.EntServer.DefaultIP,
                WebSitePort               = Global.EntServer.DefaultPort,
                WebSiteDomain             = String.Empty,
                NewWebSite                = true,
                NewVirtualDirectory       = false,
                ConfigurationFile         = "web.config",
                UpdateServerAdminPassword = true,
                ServerAdminPassword       = "",
            };

            //
            InitInstall(args, setupVariables);
            //
            var eam = new EntServerActionManager(setupVariables);

            //
            eam.PrepareDistributiveDefaults();
            //
            if (shellMode.Equals(Global.SilentInstallerShell, StringComparison.OrdinalIgnoreCase))
            {
                if (version < new Version(minimalInstallerVersion))
                {
                    Utils.ShowConsoleErrorMessage(Global.Messages.InstallerVersionIsObsolete, minimalInstallerVersion);
                    //
                    return(false);
                }

                try
                {
                    var success = true;
                    //
                    setupVariables.ServerAdminPassword = Utils.GetStringSetupParameter(args, Global.Parameters.ServerAdminPassword);
                    setupVariables.Database            = Utils.GetStringSetupParameter(args, Global.Parameters.DatabaseName);
                    setupVariables.DatabaseServer      = Utils.GetStringSetupParameter(args, Global.Parameters.DatabaseServer);
                    //
                    setupVariables.DbInstallConnectionString = SqlUtils.BuildDbServerMasterConnectionString(
                        setupVariables.DatabaseServer,
                        Utils.GetStringSetupParameter(args, Global.Parameters.DbServerAdmin),
                        Utils.GetStringSetupParameter(args, Global.Parameters.DbServerAdminPassword)
                        );
                    //
                    eam.ActionError += new EventHandler <ActionErrorEventArgs>((object sender, ActionErrorEventArgs e) =>
                    {
                        Utils.ShowConsoleErrorMessage(e.ErrorMessage);
                        //
                        Log.WriteError(e.ErrorMessage);
                        //
                        success = false;
                    });
                    //
                    eam.Start();
                    //
                    return(success);
                }
                catch (Exception ex)
                {
                    Log.WriteError("Failed to install the component", ex);
                    //
                    return(false);
                }
            }
            else
            {
                if (version < new Version(minimalInstallerVersion))
                {
                    MessageBox.Show(string.Format(Global.Messages.InstallerVersionIsObsolete, minimalInstallerVersion), "Setup Wizard", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return(DialogResult.Cancel);
                }

                InstallerForm form   = new InstallerForm();
                Wizard        wizard = form.Wizard;
                wizard.SetupVariables = setupVariables;
                wizard.ActionManager  = eam;

                //Unattended setup
                LoadSetupVariablesFromSetupXml(wizard.SetupVariables.SetupXml, wizard.SetupVariables);
                //create wizard pages
                var introPage = new IntroductionPage();
                var licPage   = new LicenseAgreementPage();
                var page1     = new ConfigurationCheckPage();
                //
                ConfigurationCheck check1 = new ConfigurationCheck(CheckTypes.OperationSystem, "Operating System Requirement")
                {
                    SetupVariables = setupVariables
                };
                ConfigurationCheck check2 = new ConfigurationCheck(CheckTypes.IISVersion, "IIS Requirement")
                {
                    SetupVariables = setupVariables
                };
                ConfigurationCheck check3 = new ConfigurationCheck(CheckTypes.ASPNET, "ASP.NET Requirement")
                {
                    SetupVariables = setupVariables
                };
                //
                page1.Checks.AddRange(new ConfigurationCheck[] { check1, check2, check3 });
                //
                var page2        = new InstallFolderPage();
                var page3        = new WebPage();
                var page4        = new UserAccountPage();
                var page5        = new DatabasePage();
                var passwordPage = new ServerAdminPasswordPage();
                //
                var page6 = new ExpressInstallPage2();
                //
                var page7 = new FinishPage();
                wizard.Controls.AddRange(new Control[] { introPage, licPage, page1, page2, page3, page4, page5, passwordPage, page6, page7 });
                wizard.LinkPages();
                wizard.SelectedPage = introPage;

                //show wizard
                IWin32Window owner = args[Global.Parameters.ParentForm] as IWin32Window;
                return(form.ShowModal(owner));
            }
        }
        /// <summary>
        /// Displays process progress.
        /// </summary>
        public void Start()
        {
            bool pass = true;

            try
            {
                lvCheck.Items.Clear();
                this.imgError.Visible  = false;
                this.imgOk.Visible     = false;
                this.lblResult.Visible = false;

                foreach (ConfigurationCheck check in Checks)
                {
                    AddListViewItem(check);
                }
                this.Update();
                CheckStatuses status  = CheckStatuses.Success;
                string        details = string.Empty;
                foreach (ListViewItem item in lvCheck.Items)
                {
                    ConfigurationCheck check = (ConfigurationCheck)item.Tag;
                    item.ImageIndex       = 0;
                    item.SubItems[2].Text = "Running";
                    this.Update();

                    switch (check.CheckType)
                    {
                    case CheckTypes.OperationSystem:
                        status = CheckOS(out details);
                        break;

                    case CheckTypes.IISVersion:
                        status = CheckIISVersion(out details);
                        break;

                    case CheckTypes.ASPNET:
                        status = CheckASPNET(out details);
                        break;

                    case CheckTypes.WPServer:
                        status = CheckWPServer(check.SetupVariables, out details);
                        break;

                    case CheckTypes.WPEnterpriseServer:
                        status = CheckWPEnterpriseServer(check.SetupVariables, out details);
                        break;

                    case CheckTypes.WPPortal:
                        status = CheckWPPortal(check.SetupVariables, out details);
                        break;

                    default:
                        status = CheckStatuses.Warning;
                        break;
                    }
                    switch (status)
                    {
                    case CheckStatuses.Success:
                        item.ImageIndex       = 1;
                        item.SubItems[2].Text = "Success";
                        break;

                    case CheckStatuses.Warning:
                        item.ImageIndex       = 2;
                        item.SubItems[2].Text = "Warning";
                        break;

                    case CheckStatuses.Error:
                        item.ImageIndex       = 3;
                        item.SubItems[2].Text = "Error";
                        pass = false;
                        break;
                    }
                    item.SubItems[3].Text = details;
                    this.Update();
                }
                ShowResult(pass);
                if (pass)
                {
                    //unattended setup
                    if (!string.IsNullOrEmpty(Wizard.SetupVariables.SetupXml) && AllowMoveNext)
                    {
                        Wizard.GoNext();
                    }
                }
            }
            catch (Exception ex)
            {
                if (Utils.IsThreadAbortException(ex))
                {
                    return;
                }

                ShowError();
                return;
            }
        }
Ejemplo n.º 10
0
        public static DialogResult UpdateBase(object obj, string minimalInstallerVersion,
                                              string versionsToUpgrade, bool updateSql, InstallAction versionSpecificAction)
        {
            Hashtable args         = Utils.GetSetupParameters(obj);
            string    shellVersion = Utils.GetStringSetupParameter(args, "ShellVersion");

            Version version = new Version(shellVersion);

            if (version < new Version(minimalInstallerVersion))
            {
                MessageBox.Show(
                    string.Format("WebsitePanel Installer {0} or higher required.", minimalInstallerVersion),
                    "Setup Wizard", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(DialogResult.Cancel);
            }
            // Load application configuration
            AppConfig.LoadConfiguration();
            //
            var setupVariables = new SetupVariables
            {
                SetupAction = SetupActions.Update,
                ComponentId = Utils.GetStringSetupParameter(args, "ComponentId"),
                IISVersion  = Global.IISVersion,
            };

            // Load setup variables from app.config
            AppConfig.LoadComponentSettings(setupVariables);
            //
            InstallerForm form = new InstallerForm();

            form.Wizard.SetupVariables = setupVariables;
            Wizard wizard = form.Wizard;

            // Initialize setup variables with the data received from update procedure
            wizard.SetupVariables.BaseDirectory   = Utils.GetStringSetupParameter(args, "BaseDirectory");
            wizard.SetupVariables.UpdateVersion   = Utils.GetStringSetupParameter(args, "UpdateVersion");
            wizard.SetupVariables.InstallerFolder = Utils.GetStringSetupParameter(args, "InstallerFolder");
            wizard.SetupVariables.Installer       = Utils.GetStringSetupParameter(args, "Installer");
            wizard.SetupVariables.InstallerType   = Utils.GetStringSetupParameter(args, "InstallerType");
            wizard.SetupVariables.InstallerPath   = Utils.GetStringSetupParameter(args, "InstallerPath");

            #region Support for multiple versions to upgrade from
            // Find out whether the version(s) are supported in that upgrade
            var upgradeSupported = versionsToUpgrade.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
                                   .Any(x => { return(VersionEquals(wizard.SetupVariables.Version, x.Trim())); });
            //
            if (upgradeSupported == false)
            {
                Log.WriteInfo(
                    String.Format("Could not find a suitable version to upgrade. Current version: {0}; Versions supported: {1};", wizard.SetupVariables.Version, versionsToUpgrade));
                //
                MessageBox.Show(
                    "Your current software version either is not supported or could not be upgraded at this time. Please send log file from the installer to the software vendor for further research on the issue.", "Setup Wizard", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                //
                return(DialogResult.Cancel);
            }
            #endregion

            //
            IntroductionPage     introPage = new IntroductionPage();
            LicenseAgreementPage licPage   = new LicenseAgreementPage();
            ExpressInstallPage   page2     = new ExpressInstallPage();
            //create install currentScenario
            InstallAction action = new InstallAction(ActionTypes.StopApplicationPool);
            action.Description = "Stopping IIS Application Pool...";
            page2.Actions.Add(action);

            action             = new InstallAction(ActionTypes.Backup);
            action.Description = "Backing up...";
            page2.Actions.Add(action);

            action             = new InstallAction(ActionTypes.DeleteFiles);
            action.Description = "Deleting files...";
            action.Path        = "setup\\delete.txt";
            page2.Actions.Add(action);

            action             = new InstallAction(ActionTypes.CopyFiles);
            action.Description = "Copying files...";
            page2.Actions.Add(action);

            if (versionSpecificAction != null)
            {
                page2.Actions.Add(versionSpecificAction);
            }

            if (updateSql)
            {
                action             = new InstallAction(ActionTypes.ExecuteSql);
                action.Description = "Updating database...";
                action.Path        = "setup\\update_db.sql";
                page2.Actions.Add(action);
            }

            action             = new InstallAction(ActionTypes.UpdateConfig);
            action.Description = "Updating system configuration...";
            page2.Actions.Add(action);

            action             = new InstallAction(ActionTypes.StartApplicationPool);
            action.Description = "Starting IIS Application Pool...";
            page2.Actions.Add(action);

            FinishPage page3 = new FinishPage();
            wizard.Controls.AddRange(new Control[] { introPage, licPage, page2, page3 });
            wizard.LinkPages();
            wizard.SelectedPage = introPage;

            //show wizard
            IWin32Window owner = args["ParentForm"] as IWin32Window;
            return(form.ShowModal(owner));
        }
        internal static DialogResult InstallBase(object obj, string minimalInstallerVersion)
        {
            Hashtable args = Utils.GetSetupParameters(obj);

            //check CS version
            string  shellVersion = Utils.GetStringSetupParameter(args, "ShellVersion");
            Version version      = new Version(shellVersion);

            if (version < new Version(minimalInstallerVersion))
            {
                MessageBox.Show(
                    string.Format("WebsitePanel Installer {0} or higher required.", minimalInstallerVersion),
                    "Setup Wizard", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(DialogResult.Cancel);
            }

            InstallerForm form   = new InstallerForm();
            Wizard        wizard = form.Wizard;

            //load config file
            AppConfig.LoadConfiguration();

            //general settings
            wizard.SetupVariables.ApplicationName = Utils.GetStringSetupParameter(args, "ApplicationName");
            wizard.SetupVariables.Version         = Utils.GetStringSetupParameter(args, "Version");
            wizard.SetupVariables.Installer       = Utils.GetStringSetupParameter(args, "Installer");
            wizard.SetupVariables.InstallerPath   = Utils.GetStringSetupParameter(args, "InstallerPath");
            wizard.SetupVariables.IISVersion      = Utils.GetVersionSetupParameter(args, "IISVersion");
            wizard.SetupVariables.SetupAction     = SetupActions.Install;
            wizard.SetupVariables.SetupXml        = Utils.GetStringSetupParameter(args, "SetupXml");


            //********************  Server ****************
            //general settings
            string serverId = Guid.NewGuid().ToString();

            wizard.SetupVariables.ServerComponentId    = serverId;
            wizard.SetupVariables.ComponentId          = serverId;
            wizard.SetupVariables.Instance             = string.Empty;
            wizard.SetupVariables.ComponentName        = "Server";
            wizard.SetupVariables.ComponentCode        = "server";
            wizard.SetupVariables.ComponentDescription = "WebsitePanel Server is a set of services running on the remote server to be controlled. Server application should be reachable from Enterprise Server one.";
            wizard.SetupVariables.InstallerFolder      = Path.Combine(Utils.GetStringSetupParameter(args, "InstallerFolder"), "Server");
            wizard.SetupVariables.InstallerType        = Utils.GetStringSetupParameter(args, "InstallerType").Replace("StandaloneServerSetup", "Server");
            wizard.SetupVariables.InstallationFolder   = Path.Combine(Utils.GetSystemDrive(), "WebsitePanel\\Server");
            //web settings
            wizard.SetupVariables.UserAccount         = "WPServer";
            wizard.SetupVariables.UserPassword        = Guid.NewGuid().ToString("P");
            wizard.SetupVariables.UserDomain          = null;
            wizard.SetupVariables.WebSiteIP           = "127.0.0.1";
            wizard.SetupVariables.WebSitePort         = "9003";
            wizard.SetupVariables.WebSiteDomain       = string.Empty;
            wizard.SetupVariables.NewWebSite          = true;
            wizard.SetupVariables.NewVirtualDirectory = false;
            wizard.SetupVariables.UserMembership      = (wizard.SetupVariables.IISVersion.Major == 7) ?
                                                        new string[] { "AD:Domain Admins", "SID:" + SystemSID.ADMINISTRATORS, "IIS_IUSRS" } :
            new string[] { "AD:Domain Admins", "SID:" + SystemSID.ADMINISTRATORS, "IIS_WPG" };
            wizard.SetupVariables.ConfigurationFile = "web.config";

            wizard.SetupVariables.UpdateServerPassword = true;

            //Unattended setup
            LoadComponentVariablesFromSetupXml(wizard.SetupVariables.ComponentCode, wizard.SetupVariables.SetupXml, wizard.SetupVariables);

            //create component settings node
            wizard.SetupVariables.ComponentConfig = AppConfig.CreateComponentConfig(serverId);
            //write component settings to xml
            CreateComponentSettingsFromSetupVariables(wizard.SetupVariables, serverId);
            //save settings
            SetupVariables serverSetupVariables = wizard.SetupVariables.Clone();

            //server password
            string serverPassword = serverSetupVariables.ServerPassword;

            if (string.IsNullOrEmpty(serverPassword))
            {
                serverPassword = Guid.NewGuid().ToString("N").Substring(0, 10);
            }
            serverSetupVariables.ServerPassword = Utils.ComputeSHA1(serverPassword);
            //add password to config
            AppConfig.SetComponentSettingStringValue(serverSetupVariables.ComponentId, "Password", serverSetupVariables.ServerPassword);
            wizard.SetupVariables.RemoteServerPassword = serverPassword;
            //server url
            wizard.SetupVariables.RemoteServerUrl = GetUrl(serverSetupVariables.WebSiteDomain, serverSetupVariables.WebSiteIP, serverSetupVariables.WebSitePort);

            //********************  Portal ****************
            //general settings
            string portalId = Guid.NewGuid().ToString();

            wizard.SetupVariables.PortalComponentId    = portalId;
            wizard.SetupVariables.ComponentId          = portalId;
            wizard.SetupVariables.Instance             = string.Empty;
            wizard.SetupVariables.ComponentName        = "Portal";
            wizard.SetupVariables.ComponentCode        = "portal";
            wizard.SetupVariables.ComponentDescription = "WebsitePanel Portal is a control panel itself with user interface which allows managing user accounts, hosting spaces, web sites, FTP accounts, files, etc.";
            wizard.SetupVariables.InstallerFolder      = Path.Combine(Utils.GetStringSetupParameter(args, "InstallerFolder"), "Portal");
            wizard.SetupVariables.InstallerType        = Utils.GetStringSetupParameter(args, "InstallerType").Replace("StandaloneServerSetup", "Portal");
            wizard.SetupVariables.InstallationFolder   = Path.Combine(Utils.GetSystemDrive(), "WebsitePanel\\Portal");
            //web settings
            wizard.SetupVariables.UserAccount         = "WPPortal";
            wizard.SetupVariables.UserPassword        = Guid.NewGuid().ToString("P");
            wizard.SetupVariables.UserDomain          = null;
            wizard.SetupVariables.WebSiteIP           = string.Empty;   //empty - to detect IP
            wizard.SetupVariables.WebSitePort         = "9001";
            wizard.SetupVariables.WebSiteDomain       = string.Empty;
            wizard.SetupVariables.NewWebSite          = true;
            wizard.SetupVariables.NewVirtualDirectory = false;
            wizard.SetupVariables.UserMembership      = (wizard.SetupVariables.IISVersion.Major == 7) ?
                                                        new string[] { "IIS_IUSRS" } :
            new string[] { "IIS_WPG" };
            wizard.SetupVariables.ConfigurationFile = "web.config";
            //ES url
            wizard.SetupVariables.EnterpriseServerURL = "http://127.0.0.1:9002";

            //Unattended setup
            LoadComponentVariablesFromSetupXml(wizard.SetupVariables.ComponentCode, wizard.SetupVariables.SetupXml, wizard.SetupVariables);

            //create component settings node
            wizard.SetupVariables.ComponentConfig = AppConfig.CreateComponentConfig(portalId);
            //add default component settings
            CreateComponentSettingsFromSetupVariables(wizard.SetupVariables, portalId);
            //save settings
            SetupVariables portalSetupVariables = wizard.SetupVariables.Clone();

            //********************  Enterprise Server ****************
            //general settings
            string enterpriseServerId = Guid.NewGuid().ToString();

            wizard.SetupVariables.EnterpriseServerComponentId = enterpriseServerId;
            wizard.SetupVariables.ComponentId          = enterpriseServerId;
            wizard.SetupVariables.Instance             = string.Empty;
            wizard.SetupVariables.ComponentName        = "Enterprise Server";
            wizard.SetupVariables.ComponentCode        = "enterprise server";
            wizard.SetupVariables.ComponentDescription = "Enterprise Server is the heart of WebsitePanel system. It includes all business logic of the application. Enterprise Server should have access to Server and be accessible from Portal applications.";
            wizard.SetupVariables.InstallerFolder      = Path.Combine(Utils.GetStringSetupParameter(args, "InstallerFolder"), "Enterprise Server");
            wizard.SetupVariables.InstallerType        = Utils.GetStringSetupParameter(args, "InstallerType").Replace("StandaloneServerSetup", "EnterpriseServer");
            wizard.SetupVariables.InstallationFolder   = Path.Combine(Utils.GetSystemDrive(), "WebsitePanel\\Enterprise Server");
            //web settings
            wizard.SetupVariables.UserAccount         = "WPEnterpriseServer";
            wizard.SetupVariables.UserPassword        = Guid.NewGuid().ToString("P");
            wizard.SetupVariables.UserDomain          = null;
            wizard.SetupVariables.WebSiteIP           = "127.0.0.1";
            wizard.SetupVariables.WebSitePort         = "9002";
            wizard.SetupVariables.WebSiteDomain       = string.Empty;
            wizard.SetupVariables.NewWebSite          = true;
            wizard.SetupVariables.NewVirtualDirectory = false;
            wizard.SetupVariables.UserMembership      = (wizard.SetupVariables.IISVersion.Major == 7) ?
                                                        new string[] { "IIS_IUSRS" } :
            new string[] { "IIS_WPG" };
            wizard.SetupVariables.ConfigurationFile = "web.config";
            //db settings
            wizard.SetupVariables.DatabaseServer = "localhost\\sqlexpress";
            wizard.SetupVariables.Database       = "WebsitePanel";
            wizard.SetupVariables.CreateDatabase = true;
            //serveradmin settings
            wizard.SetupVariables.UpdateServerAdminPassword = true;
            wizard.SetupVariables.ServerAdminPassword       = string.Empty;

            //Unattended setup
            LoadComponentVariablesFromSetupXml(wizard.SetupVariables.ComponentCode, wizard.SetupVariables.SetupXml, wizard.SetupVariables);

            //create component settings node
            wizard.SetupVariables.ComponentConfig = AppConfig.CreateComponentConfig(enterpriseServerId);
            //add default component settings
            CreateComponentSettingsFromSetupVariables(wizard.SetupVariables, enterpriseServerId);
            //save settings
            SetupVariables enterpiseServerSetupVariables = wizard.SetupVariables.Clone();
            ///////////////////////

            //create wizard pages
            IntroductionPage       introPage = new IntroductionPage();
            LicenseAgreementPage   licPage   = new LicenseAgreementPage();
            ConfigurationCheckPage page2     = new ConfigurationCheckPage();
            ConfigurationCheck     check1    = new ConfigurationCheck(CheckTypes.OperationSystem, "Operating System Requirement");
            ConfigurationCheck     check2    = new ConfigurationCheck(CheckTypes.IISVersion, "IIS Requirement");
            ConfigurationCheck     check3    = new ConfigurationCheck(CheckTypes.ASPNET, "ASP.NET Requirement");
            ConfigurationCheck     check4    = new ConfigurationCheck(CheckTypes.WPServer, "WebsitePanel Server Requirement");

            check4.SetupVariables = serverSetupVariables;
            ConfigurationCheck check5 = new ConfigurationCheck(CheckTypes.WPEnterpriseServer, "WebsitePanel Enterprise Server Requirement");

            check5.SetupVariables = enterpiseServerSetupVariables;
            ConfigurationCheck check6 = new ConfigurationCheck(CheckTypes.WPPortal, "WebsitePanel Portal Requirement");

            check6.SetupVariables = portalSetupVariables;

            page2.Checks.AddRange(new ConfigurationCheck[] { check1, check2, check3, check4, check5, check6 });
            WebPage page3 = new WebPage();

            //use portal settings for this page
            page3.SetupVariables = portalSetupVariables;
            DatabasePage page4 = new DatabasePage();

            //use ES settings for this page
            page4.SetupVariables = enterpiseServerSetupVariables;
            ServerAdminPasswordPage page5 = new ServerAdminPasswordPage();

            page5.SetupVariables = enterpiseServerSetupVariables;
            page5.NoteText       = "Note: Both serveradmin and admin accounts will use this password. You can always change password for serveradmin or admin accounts through control panel.";
            ExpressInstallPage page6 = new ExpressInstallPage();

            wizard.SetupVariables.ComponentName = string.Empty;

            //create install actions

            //************ Server **************
            InstallAction action = new InstallAction(ActionTypes.InitSetupVariables);

            action.Description    = "Installing WebsitePanel Server...";
            action.SetupVariables = serverSetupVariables;
            page6.Actions.Add(action);

            action             = new InstallAction(ActionTypes.CopyFiles);
            action.Description = "Copying files...";
            page6.Actions.Add(action);

            action             = new InstallAction(ActionTypes.CreateWebSite);
            action.Description = "Creating web site...";
            page6.Actions.Add(action);

            action             = new InstallAction(ActionTypes.FolderPermissions);
            action.Description = "Configuring folder permissions...";
            page6.Actions.Add(action);

            action             = new InstallAction(ActionTypes.ServerPassword);
            action.Description = "Setting server password...";
            page6.Actions.Add(action);

            //************* Enterprise server *********
            action                = new InstallAction(ActionTypes.InitSetupVariables);
            action.Description    = "Installing WebsitePanel Enterprise Server...";
            action.SetupVariables = enterpiseServerSetupVariables;
            page6.Actions.Add(action);

            action             = new InstallAction(ActionTypes.CopyFiles);
            action.Description = "Copying files...";
            page6.Actions.Add(action);

            action             = new InstallAction(ActionTypes.CreateWebSite);
            action.Description = "Creating web site...";
            page6.Actions.Add(action);

            action             = new InstallAction(ActionTypes.CryptoKey);
            action.Description = "Generating crypto key...";
            page6.Actions.Add(action);

            action             = new InstallAction(ActionTypes.CreateDatabase);
            action.Description = "Creating SQL Server database...";
            page6.Actions.Add(action);

            action             = new InstallAction(ActionTypes.CreateDatabaseUser);
            action.Description = "Creating SQL Server user...";
            page6.Actions.Add(action);

            action             = new InstallAction(ActionTypes.ExecuteSql);
            action.Description = "Creating database objects...";
            action.Path        = "setup\\install_db.sql";
            page6.Actions.Add(action);

            action             = new InstallAction(ActionTypes.CreateWPServerLogin);
            action.Description = "Creating WebsitePanel login...";
            page6.Actions.Add(action);

            action             = new InstallAction(ActionTypes.UpdateServerAdminPassword);
            action.Description = "Updating serveradmin password...";
            page6.Actions.Add(action);

            action             = new InstallAction(ActionTypes.UpdateLicenseInformation);
            action.Description = "Updating license information...";
            page6.Actions.Add(action);

            //************* Portal *********
            action                = new InstallAction(ActionTypes.InitSetupVariables);
            action.Description    = "Installing WebsitePanel Portal...";
            action.SetupVariables = portalSetupVariables;
            page6.Actions.Add(action);

            action             = new InstallAction(ActionTypes.CopyFiles);
            action.Description = "Copying files...";
            page6.Actions.Add(action);

            action             = new InstallAction(ActionTypes.CopyWebConfig);
            action.Description = "Copying web.config...";
            page6.Actions.Add(action);

            action             = new InstallAction(ActionTypes.CreateWebSite);
            action.Description = "Creating web site...";
            page6.Actions.Add(action);

            action             = new InstallAction(ActionTypes.UpdateEnterpriseServerUrl);
            action.Description = "Updating site settings...";
            page6.Actions.Add(action);

            action             = new InstallAction(ActionTypes.UpdateConfig);
            action.Description = "Updating system configuration...";
            page6.Actions.Add(action);

            action             = new InstallAction(ActionTypes.CreateShortcuts);
            action.Description = "Creating shortcut...";
            page6.Actions.Add(action);

            //************* Standalone server provisioning *********
            action = new InstallAction(ActionTypes.InitSetupVariables);
            action.SetupVariables = enterpiseServerSetupVariables;
            page6.Actions.Add(action);

            action             = new InstallAction(ActionTypes.ConfigureStandaloneServerData);
            action.Description = "Configuring server data...";
            action.Url         = portalSetupVariables.EnterpriseServerURL;
            page6.Actions.Add(action);

            SetupCompletePage page7 = new SetupCompletePage();

            page7.SetupVariables = portalSetupVariables;
            wizard.Controls.AddRange(new Control[] { introPage, licPage, page2, page3, page4, page5, page6, page7 });
            wizard.LinkPages();
            wizard.SelectedPage = introPage;

            //show wizard
            IWin32Window owner = args["ParentForm"] as IWin32Window;

            return(form.ShowModal(owner));
        }
Ejemplo n.º 12
0
		public static void LoadSetupVariablesFromParameters(Wizard wizard, Hashtable args)
		{
			wizard.SetupVariables.ApplicationName = Utils.GetStringSetupParameter(args, "ApplicationName");
			wizard.SetupVariables.ComponentName = Utils.GetStringSetupParameter(args, "ComponentName");
			wizard.SetupVariables.ComponentCode = Utils.GetStringSetupParameter(args, "ComponentCode");
			wizard.SetupVariables.ComponentDescription = Utils.GetStringSetupParameter(args, "ComponentDescription");
			wizard.SetupVariables.Version = Utils.GetStringSetupParameter(args, "Version");
			wizard.SetupVariables.InstallerFolder = Utils.GetStringSetupParameter(args, "InstallerFolder");
			wizard.SetupVariables.Installer = Utils.GetStringSetupParameter(args, "Installer");
			wizard.SetupVariables.InstallerType = Utils.GetStringSetupParameter(args, "InstallerType");
			wizard.SetupVariables.InstallerPath = Utils.GetStringSetupParameter(args, "InstallerPath");
			wizard.SetupVariables.IISVersion = Utils.GetVersionSetupParameter(args, "IISVersion");
			wizard.SetupVariables.SetupXml = Utils.GetStringSetupParameter(args, "SetupXml");
		}
Ejemplo n.º 13
0
		public static void LoadSetupVariablesFromConfig(Wizard wizard, string componentId)
		{
			wizard.SetupVariables.InstallationFolder = AppConfig.GetComponentSettingStringValue(componentId, "InstallFolder");
			wizard.SetupVariables.ComponentName = AppConfig.GetComponentSettingStringValue(componentId, "ComponentName");
			wizard.SetupVariables.ComponentCode = AppConfig.GetComponentSettingStringValue(componentId, "ComponentCode");
			wizard.SetupVariables.ComponentDescription = AppConfig.GetComponentSettingStringValue(componentId, "ComponentDescription");
			wizard.SetupVariables.ComponentId = componentId;
			wizard.SetupVariables.ApplicationName = AppConfig.GetComponentSettingStringValue(componentId, "ApplicationName");
			wizard.SetupVariables.Version = AppConfig.GetComponentSettingStringValue(componentId, "Release");
			wizard.SetupVariables.Instance = AppConfig.GetComponentSettingStringValue(componentId, "Instance");
		}