Esempio n. 1
0
        public static object Update(object obj)
        {
            Hashtable args = Utils.GetSetupParameters(obj);

            var setupVariables = new SetupVariables
            {
                ComponentId     = Utils.GetStringSetupParameter(args, Global.Parameters.ComponentId),
                SetupAction     = SetupActions.Update,
                BaseDirectory   = Utils.GetStringSetupParameter(args, Global.Parameters.BaseDirectory),
                UpdateVersion   = Utils.GetStringSetupParameter(args, "UpdateVersion"),
                InstallerFolder = Utils.GetStringSetupParameter(args, Global.Parameters.InstallerFolder),
                Installer       = Utils.GetStringSetupParameter(args, Global.Parameters.Installer),
                InstallerType   = Utils.GetStringSetupParameter(args, Global.Parameters.InstallerType),
                InstallerPath   = Utils.GetStringSetupParameter(args, Global.Parameters.InstallerPath)
            };

            AppConfig.LoadConfiguration();

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

            //
            wizard.SetupVariables = setupVariables;
            //
            AppConfig.LoadComponentSettings(wizard.SetupVariables);

            IntroductionPage     introPage = new IntroductionPage();
            LicenseAgreementPage licPage   = new LicenseAgreementPage();
            ExpressInstallPage   page2     = new ExpressInstallPage();
            //create install currentScenario
            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.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
            IWin32Window owner = args[Global.Parameters.ParentForm] as IWin32Window;

            return(form.ShowModal(owner));
        }
Esempio n. 2
0
        public static DialogResult Update(object obj)
        {
            Hashtable args = Utils.GetSetupParameters(obj);

            var setupVariables = new SetupVariables
            {
                ComponentId = Utils.GetStringSetupParameter(args, Global.Parameters.ComponentId),
                SetupAction = SetupActions.Update,
                IISVersion  = Global.IISVersion
            };

            AppConfig.LoadConfiguration();

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

            wizard.SetupVariables = setupVariables;
            //
            AppConfig.LoadComponentSettings(wizard.SetupVariables);

            IntroductionPage     introPage = new IntroductionPage();
            LicenseAgreementPage licPage   = new LicenseAgreementPage();
            ExpressInstallPage   page2     = new ExpressInstallPage();
            //create install currentScenario
            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[Global.Parameters.ParentForm] as Form;

            return(form.ShowDialog(parentForm));
        }
Esempio n. 3
0
        public static DialogResult Setup(object obj)
        {
            Hashtable args         = Utils.GetSetupParameters(obj);
            string    shellVersion = Utils.GetStringSetupParameter(args, "ShellVersion");
            string    componentId  = Utils.GetStringSetupParameter(args, "ComponentId");

            AppConfig.LoadConfiguration();

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

            wizard.SetupVariables.SetupAction = SetupActions.Setup;
            LoadSetupVariablesFromConfig(wizard, componentId);
            wizard.SetupVariables.WebSiteId           = AppConfig.GetComponentSettingStringValue(componentId, "WebSiteId");
            wizard.SetupVariables.WebSiteIP           = AppConfig.GetComponentSettingStringValue(componentId, "WebSiteIP");
            wizard.SetupVariables.WebSitePort         = AppConfig.GetComponentSettingStringValue(componentId, "WebSitePort");
            wizard.SetupVariables.WebSiteDomain       = AppConfig.GetComponentSettingStringValue(componentId, "WebSiteDomain");
            wizard.SetupVariables.VirtualDirectory    = AppConfig.GetComponentSettingStringValue(componentId, "VirtualDirectory");
            wizard.SetupVariables.NewWebSite          = AppConfig.GetComponentSettingBooleanValue(componentId, "NewWebSite");
            wizard.SetupVariables.NewVirtualDirectory = AppConfig.GetComponentSettingBooleanValue(componentId, "NewVirtualDirectory");
            wizard.SetupVariables.VirtualDirectory    = AppConfig.GetComponentSettingStringValue(componentId, "VirtualDirectory");
            wizard.SetupVariables.IISVersion          = Utils.GetVersionSetupParameter(args, "IISVersion");

            //IntroductionPage page1 = new IntroductionPage();

            WebPage            page1 = new WebPage();
            UrlPage            page2 = new UrlPage();
            ExpressInstallPage page3 = new ExpressInstallPage();
            //create install actions
            InstallAction action = new InstallAction(ActionTypes.UpdateWebSite);

            action.Description = "Updating web site...";
            page3.Actions.Add(action);

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

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

            FinishPage page4 = new FinishPage();

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


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

            return(form.ShowModal(owner));
        }
Esempio n. 4
0
        public static object Setup(object obj)
        {
            var args         = Utils.GetSetupParameters(obj);
            var shellVersion = Utils.GetStringSetupParameter(args, Global.Parameters.ShellVersion);
            //
            var setupVariables = new SetupVariables
            {
                ComponentId       = Utils.GetStringSetupParameter(args, Global.Parameters.ComponentId),
                SetupAction       = SetupActions.Setup,
                IISVersion        = Global.IISVersion,
                ConfigurationFile = "web.config"
            };

            //
            AppConfig.LoadConfiguration();

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

            //
            wizard.SetupVariables = setupVariables;
            //
            AppConfig.LoadComponentSettings(wizard.SetupVariables);

            WebPage            page1 = new WebPage();
            ServerPasswordPage page2 = new ServerPasswordPage();
            ExpressInstallPage page3 = new ExpressInstallPage();
            //create install actions
            InstallAction action = new InstallAction(ActionTypes.UpdateWebSite);

            action.Description = "Updating web site...";
            page3.Actions.Add(action);

            action             = new InstallAction(ActionTypes.UpdateServerPassword);
            action.Description = "Updating server password...";
            page3.Actions.Add(action);

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

            FinishPage page4 = new FinishPage();

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

            //show wizard
            IWin32Window owner = args[Global.Parameters.ParentForm] as IWin32Window;

            return(form.ShowModal(owner));
        }
Esempio n. 5
0
        public static DialogResult Uninstall(object obj)
        {
            Hashtable args         = Utils.GetSetupParameters(obj);
            string    shellVersion = Utils.GetStringSetupParameter(args, Global.Parameters.ShellVersion);
            //
            var setupVariables = new SetupVariables
            {
                ComponentId = Utils.GetStringSetupParameter(args, Global.Parameters.ComponentId),
                IISVersion  = Global.IISVersion,
                SetupAction = SetupActions.Uninstall
            };

            //
            AppConfig.LoadConfiguration();

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

            wizard.SetupVariables = setupVariables;
            //
            AppConfig.LoadComponentSettings(wizard.SetupVariables);
            //
            IntroductionPage     page1 = new IntroductionPage();
            ConfirmUninstallPage page2 = new ConfirmUninstallPage();
            UninstallPage        page3 = new UninstallPage();
            //create uninstall currentScenario
            InstallAction action = new InstallAction(ActionTypes.DeleteShortcuts);

            action.Description = "Deleting shortcuts...";
            action.Log         = "- Delete shortcuts";
            action.Name        = "Login to WebsitePanel.url";
            page3.Actions.Add(action);
            page2.UninstallPage = page3;

            FinishPage page4 = new FinishPage();

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

            //show wizard
            IWin32Window owner = args[Global.Parameters.ParentForm] as IWin32Window;

            return(form.ShowModal(owner));
        }
Esempio n. 6
0
        public static DialogResult Uninstall(object obj)
        {
            Hashtable args         = Utils.GetSetupParameters(obj);
            string    shellVersion = Utils.GetStringSetupParameter(args, "ShellVersion");
            string    componentId  = Utils.GetStringSetupParameter(args, "ComponentId");

            AppConfig.LoadConfiguration();

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

            wizard.SetupVariables.SetupAction    = SetupActions.Uninstall;
            wizard.SetupVariables.IISVersion     = Utils.GetVersionSetupParameter(args, "IISVersion");
            wizard.SetupVariables.UserMembership = (wizard.SetupVariables.IISVersion.Major == 7) ?
                                                   new string[] { "IIS_IUSRS" } :
            new string[] { "IIS_WPG" };
            LoadSetupVariablesFromConfig(wizard, componentId);

            IntroductionPage     page1 = new IntroductionPage();
            ConfirmUninstallPage page2 = new ConfirmUninstallPage();
            UninstallPage        page3 = new UninstallPage();
            //create uninstall actions
            InstallAction action = new InstallAction(ActionTypes.DeleteShortcuts);

            action.Description = "Deleting shortcuts...";
            action.Log         = "- Delete shortcuts";
            action.Name        = "Login to WebsitePanel.url";
            page3.Actions.Add(action);
            page2.UninstallPage = page3;

            FinishPage page4 = new FinishPage();

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

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

            return(form.ShowModal(owner));
        }
Esempio n. 7
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);
		}
		private void SwitchServer2AspNet40(InstallAction action, Setup.SetupVariables setupVariables)
		{
			var sam = new ServerActionManager(setupVariables);
			sam.AddAction(new RegisterAspNet40Action());
			sam.AddAction(new EnableAspNetWebExtensionAction());
			sam.AddAction(new MigrateServerWebConfigAction());
			sam.AddAction(new AdjustHttpRuntimeRequestLengthAction());
			sam.AddAction(new SwitchAppPoolAspNetVersion());
			//
			sam.ActionError += new EventHandler<ActionErrorEventArgs>((object sender, ActionErrorEventArgs e) =>
			{
				throw e.OriginalException;
			});
			//
			sam.Start();
		}
Esempio n. 9
0
        /// <summary>
        /// Displays process progress.
        /// </summary>
        public void Start()
        {
            this.progressBar.Value = 0;

            string  component   = Wizard.SetupVariables.ComponentFullName;
            string  componentId = Wizard.SetupVariables.ComponentId;
            Version iisVersion  = Wizard.SetupVariables.IISVersion;
            bool    iis7        = (iisVersion.Major >= 7);

            try
            {
                this.lblProcess.Text = "Creating uninstall script...";
                this.Update();

                //default actions
                List <InstallAction> actions = GetUninstallActions(componentId);

                //add external actions
                foreach (InstallAction extAction in Actions)
                {
                    actions.Add(extAction);
                }

                //process actions
                for (int i = 0, progress = 1; i < actions.Count; i++, progress++)
                {
                    InstallAction action = actions[i];
                    this.lblProcess.Text   = action.Description;
                    this.progressBar.Value = progress * 100 / actions.Count;
                    this.Update();

                    try
                    {
                        switch (action.ActionType)
                        {
                        case ActionTypes.DeleteRegistryKey:
                            DeleteRegistryKey(action.Key, action.Empty);
                            break;

                        case ActionTypes.DeleteDirectory:
                            DeleteDirectory(action.Path);
                            break;

                        case ActionTypes.DeleteDatabase:
                            DeleteDatabase(
                                action.ConnectionString,
                                action.Name);
                            break;

                        case ActionTypes.DeleteDatabaseUser:
                            DeleteDatabaseUser(
                                action.ConnectionString,
                                action.UserName);
                            break;

                        case ActionTypes.DeleteDatabaseLogin:
                            DeleteDatabaseLogin(
                                action.ConnectionString,
                                action.UserName);
                            break;

                        case ActionTypes.DeleteWebSite:
                            if (iis7)
                            {
                                DeleteIIS7WebSite(action.SiteId);
                            }
                            else
                            {
                                DeleteWebSite(action.SiteId);
                            }
                            break;

                        case ActionTypes.DeleteVirtualDirectory:
                            DeleteVirtualDirectory(
                                action.SiteId,
                                action.Name);
                            break;

                        case ActionTypes.DeleteUserMembership:
                            DeleteUserMembership(action.Domain, action.Name, action.Membership);
                            break;

                        case ActionTypes.DeleteUserAccount:
                            DeleteUserAccount(action.Domain, action.Name);
                            break;

                        case ActionTypes.DeleteApplicationPool:
                            if (iis7)
                            {
                                DeleteIIS7ApplicationPool(action.Name);
                            }
                            else
                            {
                                DeleteApplicationPool(action.Name);
                            }
                            break;

                        case ActionTypes.UpdateConfig:
                            UpdateSystemConfiguration(action.Key);
                            break;

                        case ActionTypes.DeleteShortcuts:
                            DeleteShortcuts(action.Name);
                            break;

                        case ActionTypes.UnregisterWindowsService:
                            UnregisterWindowsService(action.Path, action.Name);
                            break;
                        }
                    }
                    catch (Exception ex)
                    {
                        if (!Utils.IsThreadAbortException(ex))
                        {
                            Log.WriteError("Uninstall error", ex);
                        }
                    }
                }
                this.progressBar.Value = 100;
            }
            catch (Exception ex)
            {
                if (Utils.IsThreadAbortException(ex))
                {
                    return;
                }

                ShowError();
                this.Wizard.Close();
            }

            this.lblProcess.Text = "Completed. Click Next to continue.";
            this.AllowMoveNext   = true;
            this.AllowCancel     = true;
        }
Esempio n. 10
0
		public static object Update(object obj)
		{
			Hashtable args = Utils.GetSetupParameters(obj);

			var setupVariables = new SetupVariables
			{
				ComponentId = Utils.GetStringSetupParameter(args, Global.Parameters.ComponentId),
				SetupAction = SetupActions.Update,
				BaseDirectory = Utils.GetStringSetupParameter(args, Global.Parameters.BaseDirectory),
				UpdateVersion = Utils.GetStringSetupParameter(args, "UpdateVersion"),
				InstallerFolder = Utils.GetStringSetupParameter(args, Global.Parameters.InstallerFolder),
				Installer = Utils.GetStringSetupParameter(args, Global.Parameters.Installer),
				InstallerType = Utils.GetStringSetupParameter(args, Global.Parameters.InstallerType),
				InstallerPath = Utils.GetStringSetupParameter(args, Global.Parameters.InstallerPath)
			};

			AppConfig.LoadConfiguration();

			InstallerForm form = new InstallerForm();
			Wizard wizard = form.Wizard;
			//
			wizard.SetupVariables = setupVariables;
			//
			AppConfig.LoadComponentSettings(wizard.SetupVariables);

			IntroductionPage introPage = new IntroductionPage();
			LicenseAgreementPage licPage = new LicenseAgreementPage();
			ExpressInstallPage page2 = new ExpressInstallPage();
			//create install currentScenario
			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.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
			IWin32Window owner = args[Global.Parameters.ParentForm] as IWin32Window;
			return form.ShowModal(owner);
		}
Esempio n. 11
0
		internal List<InstallAction> GetUninstallActions(string componentId)
		{
			List<InstallAction> list = new List<InstallAction>();
			InstallAction action = null;

			//windows service
			string serviceName = AppConfig.GetComponentSettingStringValue(componentId, "ServiceName");
			string serviceFile = AppConfig.GetComponentSettingStringValue(componentId, "ServiceFile");
			string installFolder = AppConfig.GetComponentSettingStringValue(componentId, "InstallFolder");
			if (!string.IsNullOrEmpty(serviceName) && !string.IsNullOrEmpty(serviceFile))
			{
				action = new InstallAction(ActionTypes.UnregisterWindowsService);
				action.Path = Path.Combine(installFolder, serviceFile);
				action.Name = serviceName;
				action.Description = "Removing Windows service...";
				action.Log = string.Format("- Remove {0} Windows service", serviceName);
				list.Add(action);
			}


			//database
			bool deleteDatabase = AppConfig.GetComponentSettingBooleanValue(componentId, "NewDatabase");
			if (deleteDatabase)
			{
				string connectionString = AppConfig.GetComponentSettingStringValue(componentId, "InstallConnectionString");
				string database = AppConfig.GetComponentSettingStringValue(componentId, "Database");
				action = new InstallAction(ActionTypes.DeleteDatabase);
				action.ConnectionString = connectionString;
				action.Name = database;
				action.Description = "Deleting database...";
				action.Log = string.Format("- Delete {0} database", database);
				list.Add(action);
			}
			//database user
			bool deleteDatabaseUser = AppConfig.GetComponentSettingBooleanValue(componentId, "NewDatabaseUser");
			if (deleteDatabaseUser)
			{
				string connectionString = AppConfig.GetComponentSettingStringValue(componentId, "InstallConnectionString");
				string username = AppConfig.GetComponentSettingStringValue(componentId, "DatabaseUser");
				action = new InstallAction(ActionTypes.DeleteDatabaseUser);
				action.ConnectionString = connectionString;
				action.UserName = username;
				action.Description = "Deleting database user...";
				action.Log = string.Format("- Delete {0} database user", username);
				list.Add(action);
			}
			//database login (from standalone setup)
			string loginName = AppConfig.GetComponentSettingStringValue(componentId, "DatabaseLogin");
			if (!string.IsNullOrEmpty(loginName))
			{
				string connectionString = AppConfig.GetComponentSettingStringValue(componentId, "InstallConnectionString");
				action = new InstallAction(ActionTypes.DeleteDatabaseLogin);
				action.ConnectionString = connectionString;
				action.UserName = loginName;
				action.Description = "Deleting database login...";
				action.Log = string.Format("- Delete {0} database login", loginName);
				list.Add(action);
			}



			//virtual directory
			bool deleteVirtualDirectory = AppConfig.GetComponentSettingBooleanValue(componentId, "NewVirtualDirectory");
			if (deleteVirtualDirectory)
			{
				string virtualDirectory = AppConfig.GetComponentSettingStringValue(componentId, "VirtualDirectory");
				string virtualDirectorySiteId = AppConfig.GetComponentSettingStringValue(componentId, "WebSiteId");
				action = new InstallAction(ActionTypes.DeleteVirtualDirectory);
				action.SiteId = virtualDirectorySiteId;
				action.Name = virtualDirectory;
				action.Description = "Deleting virtual directory...";
				action.Log = string.Format("- Delete {0} virtual directory...", virtualDirectory);
				list.Add(action);
			}

			//web site
			bool deleteWebSite = AppConfig.GetComponentSettingBooleanValue(componentId, "NewWebSite");
			if (deleteWebSite)
			{
				string siteId = AppConfig.GetComponentSettingStringValue(componentId, "WebSiteId");
				action = new InstallAction(ActionTypes.DeleteWebSite);
				action.SiteId = siteId;
				action.Description = "Deleting web site...";
				action.Log = string.Format("- Delete {0} web site", siteId);
				list.Add(action);
			}

			//application pool
			bool deleteAppPool = AppConfig.GetComponentSettingBooleanValue(componentId, "NewApplicationPool");
			if (deleteAppPool)
			{
				string appPoolName = AppConfig.GetComponentSettingStringValue(componentId, "ApplicationPool");
				if ( string.IsNullOrEmpty(appPoolName))
					appPoolName = WebUtils.WEBSITEPANEL_ADMIN_POOL;
				action = new InstallAction(ActionTypes.DeleteApplicationPool);
				action.Name = appPoolName;
				action.Description = "Deleting application pool...";
				action.Log = string.Format("- Delete {0} application pool", appPoolName);
				list.Add(action);
			}

			//user account
			bool deleteUserAccount = AppConfig.GetComponentSettingBooleanValue(componentId, "NewUserAccount");
			if (deleteUserAccount)
			{
				string username = AppConfig.GetComponentSettingStringValue(componentId, "UserAccount");
				string domain = AppConfig.GetComponentSettingStringValue(componentId, "Domain");
				//membership
				if (Wizard.SetupVariables.UserMembership != null &&
					Wizard.SetupVariables.UserMembership.Length > 0)
				{
					action = new InstallAction(ActionTypes.DeleteUserMembership);
					action.Name = username;
					action.Domain = domain;
					action.Membership = Wizard.SetupVariables.UserMembership;
					action.Description = "Removing user account membership...";
					action.Log = string.Format("- Remove {0} user account membership", username);
					list.Add(action);
				}

				action = new InstallAction(ActionTypes.DeleteUserAccount);
				action.Name = username;
				action.Domain = domain;
				action.Description = "Deleting user account...";
				action.Log = string.Format("- Delete {0} user account", username);
				list.Add(action);
			}

			//directory
			string path = AppConfig.GetComponentSettingStringValue(componentId, "InstallFolder");
			if (!string.IsNullOrEmpty(path))
			{
				action = new InstallAction(ActionTypes.DeleteDirectory);
				action.Path = path;
				action.Description = "Deleting application folder...";
				action.Log = string.Format("- Delete {0} folder", path);
				list.Add(action);
			}

			//config
			action = new InstallAction(ActionTypes.UpdateConfig);
			action.Key = componentId;
			action.Description = "Updating configuration settings...";
			action.Log = "- Update configuration settings";
			list.Add(action);
			return list;
		}
Esempio n. 12
0
        internal List <InstallAction> GetUninstallActions(string componentId)
        {
            var           list   = new List <InstallAction>();
            InstallAction action = null;

            //windows service
            string serviceName   = AppConfig.GetComponentSettingStringValue(componentId, "ServiceName");
            string serviceFile   = AppConfig.GetComponentSettingStringValue(componentId, "ServiceFile");
            string installFolder = AppConfig.GetComponentSettingStringValue(componentId, "InstallFolder");

            if (!string.IsNullOrEmpty(serviceName) && !string.IsNullOrEmpty(serviceFile))
            {
                action             = new InstallAction(ActionTypes.UnregisterWindowsService);
                action.Path        = Path.Combine(installFolder, serviceFile);
                action.Name        = serviceName;
                action.Description = "Removing Windows service...";
                action.Log         = string.Format("- Remove {0} Windows service", serviceName);
                list.Add(action);
            }

            if (ServiceController.GetServices().Any(s => s.DisplayName.Equals(Global.Parameters.SchedulerServiceName, StringComparison.CurrentCultureIgnoreCase)))
            {
                action = new InstallAction(ActionTypes.UnregisterWindowsService)
                {
                    Path = Path.Combine(installFolder, "bin", Global.Parameters.SchedulerServiceFileName), Name = Global.Parameters.SchedulerServiceName, Description = "Removing Windows service..."
                };
                action.Log = string.Format("- Remove {0} Windows service", action.Name);
                list.Add(action);
            }

            //database
            bool deleteDatabase = AppConfig.GetComponentSettingBooleanValue(componentId, "NewDatabase");

            if (deleteDatabase)
            {
                string connectionString = AppConfig.GetComponentSettingStringValue(componentId, "InstallConnectionString");
                string database         = AppConfig.GetComponentSettingStringValue(componentId, "Database");
                action = new InstallAction(ActionTypes.DeleteDatabase);
                action.ConnectionString = connectionString;
                action.Name             = database;
                action.Description      = "Deleting database...";
                action.Log = string.Format("- Delete {0} database", database);
                list.Add(action);
            }
            //database user
            bool deleteDatabaseUser = AppConfig.GetComponentSettingBooleanValue(componentId, "NewDatabaseUser");

            if (deleteDatabaseUser)
            {
                string connectionString = AppConfig.GetComponentSettingStringValue(componentId, "InstallConnectionString");
                string username         = AppConfig.GetComponentSettingStringValue(componentId, "DatabaseUser");
                action = new InstallAction(ActionTypes.DeleteDatabaseUser);
                action.ConnectionString = connectionString;
                action.UserName         = username;
                action.Description      = "Deleting database user...";
                action.Log = string.Format("- Delete {0} database user", username);
                list.Add(action);
            }
            //database login (from standalone setup)
            string loginName = AppConfig.GetComponentSettingStringValue(componentId, "DatabaseLogin");

            if (!string.IsNullOrEmpty(loginName))
            {
                string connectionString = AppConfig.GetComponentSettingStringValue(componentId, "InstallConnectionString");
                action = new InstallAction(ActionTypes.DeleteDatabaseLogin);
                action.ConnectionString = connectionString;
                action.UserName         = loginName;
                action.Description      = "Deleting database login...";
                action.Log = string.Format("- Delete {0} database login", loginName);
                list.Add(action);
            }



            //virtual directory
            bool deleteVirtualDirectory = AppConfig.GetComponentSettingBooleanValue(componentId, "NewVirtualDirectory");

            if (deleteVirtualDirectory)
            {
                string virtualDirectory       = AppConfig.GetComponentSettingStringValue(componentId, "VirtualDirectory");
                string virtualDirectorySiteId = AppConfig.GetComponentSettingStringValue(componentId, "WebSiteId");
                action             = new InstallAction(ActionTypes.DeleteVirtualDirectory);
                action.SiteId      = virtualDirectorySiteId;
                action.Name        = virtualDirectory;
                action.Description = "Deleting virtual directory...";
                action.Log         = string.Format("- Delete {0} virtual directory...", virtualDirectory);
                list.Add(action);
            }

            //web site
            bool deleteWebSite = AppConfig.GetComponentSettingBooleanValue(componentId, "NewWebSite");

            if (deleteWebSite)
            {
                string siteId = AppConfig.GetComponentSettingStringValue(componentId, "WebSiteId");
                action             = new InstallAction(ActionTypes.DeleteWebSite);
                action.SiteId      = siteId;
                action.Description = "Deleting web site...";
                action.Log         = string.Format("- Delete {0} web site", siteId);
                list.Add(action);
            }

            //application pool
            bool deleteAppPool = AppConfig.GetComponentSettingBooleanValue(componentId, "NewApplicationPool");

            if (deleteAppPool)
            {
                string appPoolName = AppConfig.GetComponentSettingStringValue(componentId, "ApplicationPool");
                if (string.IsNullOrEmpty(appPoolName))
                {
                    appPoolName = WebUtils.WEBSITEPANEL_ADMIN_POOL;
                }
                action             = new InstallAction(ActionTypes.DeleteApplicationPool);
                action.Name        = appPoolName;
                action.Description = "Deleting application pool...";
                action.Log         = string.Format("- Delete {0} application pool", appPoolName);
                list.Add(action);
            }

            //user account
            bool deleteUserAccount = AppConfig.GetComponentSettingBooleanValue(componentId, "NewUserAccount");

            if (deleteUserAccount)
            {
                string username = AppConfig.GetComponentSettingStringValue(componentId, "UserAccount");
                string domain   = AppConfig.GetComponentSettingStringValue(componentId, "Domain");
                //membership
                if (Wizard.SetupVariables.UserMembership != null && Wizard.SetupVariables.UserMembership.Length > 0)
                {
                    action             = new InstallAction(ActionTypes.DeleteUserMembership);
                    action.Name        = username;
                    action.Domain      = domain;
                    action.Membership  = Wizard.SetupVariables.UserMembership;
                    action.Description = "Removing user account membership...";
                    action.Log         = string.Format("- Remove {0} user account membership", username);
                    list.Add(action);
                }

                action             = new InstallAction(ActionTypes.DeleteUserAccount);
                action.Name        = username;
                action.Domain      = domain;
                action.Description = "Deleting user account...";
                action.Log         = string.Format("- Delete {0} user account", username);
                list.Add(action);
            }

            //directory
            string path = AppConfig.GetComponentSettingStringValue(componentId, "InstallFolder");

            if (!string.IsNullOrEmpty(path))
            {
                action             = new InstallAction(ActionTypes.DeleteDirectory);
                action.Path        = path;
                action.Description = "Deleting application folder...";
                action.Log         = string.Format("- Delete {0} folder", path);
                list.Add(action);
            }

            //config
            action             = new InstallAction(ActionTypes.UpdateConfig);
            action.Key         = componentId;
            action.Description = "Updating configuration settings...";
            action.Log         = "- Update configuration settings";
            list.Add(action);
            return(list);
        }
Esempio n. 13
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));
        }
Esempio n. 14
0
		public static DialogResult Uninstall(object obj)
		{
			Hashtable args = Utils.GetSetupParameters(obj);
			string shellVersion = Utils.GetStringSetupParameter(args, "ShellVersion");
			string componentId = Utils.GetStringSetupParameter(args, "ComponentId");
			AppConfig.LoadConfiguration();

			InstallerForm form = new InstallerForm();
			Wizard wizard = form.Wizard;
			wizard.SetupVariables.SetupAction = SetupActions.Uninstall;
			wizard.SetupVariables.IISVersion = Utils.GetVersionSetupParameter(args, "IISVersion");
			wizard.SetupVariables.UserMembership = (wizard.SetupVariables.IISVersion.Major == 7) ?
				new string[] { "IIS_IUSRS" } :
				new string[] { "IIS_WPG" };
			LoadSetupVariablesFromConfig(wizard, componentId);

			IntroductionPage page1 = new IntroductionPage();
			ConfirmUninstallPage page2 = new ConfirmUninstallPage();
			UninstallPage page3 = new UninstallPage();
			//create uninstall actions
			InstallAction action = new InstallAction(ActionTypes.DeleteShortcuts);
			action.Description = "Deleting shortcuts...";
			action.Log = "- Delete shortcuts";
			action.Name = "Login to WebsitePanel.url";
			page3.Actions.Add(action);
			page2.UninstallPage = page3;

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

			//show wizard
			IWin32Window owner = args["ParentForm"] as IWin32Window;
			return form.ShowModal(owner);
		}
Esempio n. 15
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);

            //ES url
            wizard.SetupVariables.EnterpriseServerURL = "http://127.0.0.1:9002";
            //web settings
            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";

            //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();
            UrlPage            page5 = new UrlPage();
            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.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.FolderPermissions);
            action.Description = "Configuring folder permissions...";
            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);

            FinishPage page7 = new FinishPage();

            wizard.Controls.AddRange(new Control[] { introPage, licPage, page1, page2, page3, page4, page5, page6, page7 });
            wizard.LinkPages();
            wizard.SelectedPage = introPage;
            //show wizard
            IWin32Window owner = args["ParentForm"] as IWin32Window;

            return(form.ShowModal(owner));
        }
Esempio n. 16
0
		public static DialogResult Update(object obj)
		{
			Hashtable args = Utils.GetSetupParameters(obj);

			var setupVariables = new SetupVariables
			{
				ComponentId = Utils.GetStringSetupParameter(args, Global.Parameters.ComponentId),
				SetupAction = SetupActions.Update,
				IISVersion = Global.IISVersion
			};

			AppConfig.LoadConfiguration();

			InstallerForm form = new InstallerForm();
			Wizard wizard = form.Wizard;
			wizard.SetupVariables = setupVariables;
			//
			AppConfig.LoadComponentSettings(wizard.SetupVariables);

			IntroductionPage introPage = new IntroductionPage();
			LicenseAgreementPage licPage = new LicenseAgreementPage();
			ExpressInstallPage page2 = new ExpressInstallPage();
			//create install currentScenario
			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[Global.Parameters.ParentForm] as Form;
			return form.ShowDialog(parentForm);
		}
		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);
		}
Esempio n. 18
0
		private void SwitchWebPortal2AspNet40(InstallAction action, Setup.SetupVariables setupVariables)
		{
			var sam = new WebPortalActionManager(setupVariables);
			sam.AddAction(new RegisterAspNet40Action());
			sam.AddAction(new EnableAspNetWebExtensionAction());
			sam.AddAction(new MigrateWebPortalWebConfigAction());
			sam.AddAction(new SwitchAppPoolAspNetVersion());
			sam.AddAction(new CleanupWebsitePanelModulesListAction());
			//
			sam.ActionError += new EventHandler<ActionErrorEventArgs>((object sender, ActionErrorEventArgs e) =>
			{
				throw e.OriginalException;
			});
			//
			sam.Start();
		}
Esempio n. 19
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);

			//web settings
			wizard.SetupVariables.WebSiteIP = "127.0.0.1";
			wizard.SetupVariables.WebSitePort = "9003";
			wizard.SetupVariables.WebSiteDomain = string.Empty;
			wizard.SetupVariables.NewWebSite = true;
			wizard.SetupVariables.NewVirtualDirectory = false;
			if(wizard.SetupVariables.IISVersion.Major == 7)
				wizard.SetupVariables.UserMembership = new string[] { "AD:Domain Admins", "SID:" + SystemSID.ADMINISTRATORS, "IIS_IUSRS" };
			else
				wizard.SetupVariables.UserMembership = new string[] { "AD:Domain Admins", "SID:" + SystemSID.ADMINISTRATORS, "IIS_WPG" };
			wizard.SetupVariables.ConfigurationFile = "web.config";

			//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();
			ServerPasswordPage page5 = new ServerPasswordPage();
			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.ServerPassword);
			action.Description = "Updating server password...";
			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, page6, page7 });
			wizard.LinkPages();
			wizard.SelectedPage = introPage;
			
			//show wizard
			IWin32Window owner = args["ParentForm"] as IWin32Window;
			return form.ShowModal(owner);
		}
Esempio n. 20
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");

			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.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
			IWin32Window owner = args["ParentForm"] as IWin32Window;
			return form.ShowModal(owner);
		}
Esempio n. 21
0
        public static ActionResult InstallRollback(Session Ctx)
        {
            PopUpDebugger();
            Ctx.AttachToSetupLog();
            const string Title = "Rolling back component";
            Log.WriteStart(Title);
            Log.WriteInfo("It is normal that here occurs error.");
            try
            {
                SetupVariables SetupVar = new SetupVariables();
                WiXSetup.FillFromSession(Ctx.CustomActionData, SetupVar);
                SetupVar.IISVersion = Tool.GetWebServerVersion();
                SetupVar.ComponentId = GetProperty(Ctx, "ComponentId");

                SetupVar.WebSiteId = SetupVar.ComponentFullName;
                SetupVar.WebApplicationPoolName = string.Format("{0} Pool", SetupVar.ComponentFullName);
                SetupVar.DatabaseUser = SetupVar.Database;

                SetupScript Script = new ExpressScript(SetupVar);
                InstallAction Act = null;

                Act = new InstallAction(ActionTypes.DeleteWebSite);
                Act.SiteId = SetupVar.WebSiteId;
                Act.Description = "Deleting web site...";
                Act.Log = string.Format("- Delete {0} web site", SetupVar.WebSiteId);
                Script.Actions.Add(Act);

                Act = new InstallAction(ActionTypes.DeleteApplicationPool);
                Act.Name = SetupVar.ApplicationPool;
                Act.Description = "Deleting application pool...";
                Act.Log = string.Format("- Delete {0} application pool", SetupVar.ApplicationPool);
                Script.Actions.Add(Act);

                if (SetupVar.UserMembership != null && SetupVar.UserMembership.Length > 0)
                {
                    Act = new InstallAction(ActionTypes.DeleteUserMembership);
                    Act.Name = SetupVar.UserAccount;
                    Act.Domain = SetupVar.UserDomain;
                    Act.Membership = SetupVar.UserMembership;
                    Act.Description = "Removing user account membership...";
                    Act.Log = string.Format("- Remove {0} user account membership", SetupVar.UserAccount);
                    Script.Actions.Add(Act);
                }

                if (SetupVar.NewUserAccount)
                {
                    Act = new InstallAction(ActionTypes.DeleteUserAccount);
                    Act.Name = SetupVar.UserAccount;
                    Act.Domain = SetupVar.UserDomain;
                    Act.Description = "Deleting user account...";
                    Act.Log = string.Format("- Delete {0} user account", SetupVar.UserAccount);
                    Script.Actions.Add(Act);
                }

                if (SetupVar.ComponentCode == Global.EntServer.ComponentCode)
                {
                    Act = new InstallAction(ActionTypes.DeleteDatabaseUser);
                    Act.ConnectionString = SetupVar.InstallConnectionString;
                    Act.UserName = SetupVar.DatabaseUser;
                    Act.Description = "Deleting database user...";
                    Act.Log = string.Format("- Delete {0} database user", SetupVar.DatabaseUser);
                    Script.Actions.Add(Act);

                    Act = new InstallAction(ActionTypes.DeleteDatabaseLogin);
                    Act.ConnectionString = SetupVar.InstallConnectionString;
                    Act.UserName = SetupVar.DatabaseUser;
                    Act.Description = "Deleting database login...";
                    Act.Log = string.Format("- Delete {0} database login", SetupVar.DatabaseUser);
                    Script.Actions.Add(Act);
                }

                if (SetupVar.ComponentCode == Global.WebPortal.ComponentCode)
                {
                    Act = new InstallAction(ActionTypes.DeleteShortcuts);
                    Act.Description = "Deleting shortcuts...";
                    Act.Log = "- Delete shortcuts";
                    Act.Name = "Login to MSPControl.url";
                    Script.Actions.Add(Act);
                }

                Script.Run();
            }
            catch (Exception ex)
            {
                Log.WriteError(ex.ToString());
            }
            Log.WriteEnd(Title);
            return ActionResult.Success;
        }
Esempio n. 22
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");

            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.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
            IWin32Window owner = args["ParentForm"] as IWin32Window;

            return(form.ShowModal(owner));
        }
Esempio n. 23
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);
		}
Esempio n. 24
0
		public static DialogResult Setup(object obj)
		{
			Hashtable args = Utils.GetSetupParameters(obj);
			string shellVersion = Utils.GetStringSetupParameter(args, "ShellVersion");
			//
			var setupVariables = new SetupVariables
			{
				ComponentId = Utils.GetStringSetupParameter(args, Global.Parameters.ComponentId),
				ConfigurationFile = "web.config",
				IISVersion = Global.IISVersion,
				SetupAction = SetupActions.Setup
			};
			//
			AppConfig.LoadConfiguration();

			InstallerForm form = new InstallerForm();
			Wizard wizard = form.Wizard;
			wizard.SetupVariables = setupVariables;
			//
			AppConfig.LoadComponentSettings(wizard.SetupVariables);

			//IntroductionPage page1 = new IntroductionPage();
			WebPage page1 = new WebPage();
			ServerAdminPasswordPage page2 = new ServerAdminPasswordPage();
			ExpressInstallPage page3 = new ExpressInstallPage();
			//create install currentScenario
			InstallAction action = new InstallAction(ActionTypes.UpdateWebSite);
			action.Description = "Updating web site...";
			page3.Actions.Add(action);

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

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

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

			//show wizard
			IWin32Window owner = args[Global.Parameters.ParentForm] as IWin32Window;
			return form.ShowModal(owner);
		}
Esempio n. 25
0
		public static DialogResult SetupBase(object obj)
		{
			Hashtable args = Utils.GetSetupParameters(obj);
			string shellVersion = Utils.GetStringSetupParameter(args, "ShellVersion");
			string componentId = Utils.GetStringSetupParameter(args, "ComponentId");
			AppConfig.LoadConfiguration();

			InstallerForm form = new InstallerForm();
			Wizard wizard = form.Wizard;
			wizard.SetupVariables.SetupAction = SetupActions.Setup;
			LoadSetupVariablesFromConfig(wizard.SetupVariables, componentId);
			wizard.SetupVariables.WebSiteId = AppConfig.GetComponentSettingStringValue(componentId, "WebSiteId");
			wizard.SetupVariables.WebSiteIP = AppConfig.GetComponentSettingStringValue(componentId, "WebSiteIP");
			wizard.SetupVariables.WebSitePort = AppConfig.GetComponentSettingStringValue(componentId, "WebSitePort");
			wizard.SetupVariables.WebSiteDomain = AppConfig.GetComponentSettingStringValue(componentId, "WebSiteDomain");
			wizard.SetupVariables.NewWebSite = AppConfig.GetComponentSettingBooleanValue(componentId, "NewWebSite");
			wizard.SetupVariables.NewVirtualDirectory = AppConfig.GetComponentSettingBooleanValue(componentId, "NewVirtualDirectory");
			wizard.SetupVariables.VirtualDirectory = AppConfig.GetComponentSettingStringValue(componentId, "VirtualDirectory");
			wizard.SetupVariables.IISVersion = Utils.GetVersionSetupParameter(args, "IISVersion");
			//IntroductionPage page1 = new IntroductionPage();
			WebPage page2 = new WebPage();
			ExpressInstallPage page3 = new ExpressInstallPage();
			//create install currentScenario
			InstallAction action = new InstallAction(ActionTypes.UpdateWebSite);
			action.Description = "Updating web site...";
			page3.Actions.Add(action);

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

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

			//show wizard
			IWin32Window owner = args["ParentForm"] as IWin32Window;
			return form.ShowModal(owner);
		}
Esempio n. 26
0
		private List<InstallAction> GenerateBackupActions(string componentId)
		{
			List<InstallAction> list = new List<InstallAction>();
			InstallAction action = null;

			//database
			string connectionString = AppConfig.GetComponentSettingStringValue(componentId, "InstallConnectionString");
			if (!String.IsNullOrEmpty(connectionString))
			{
				string database = AppConfig.GetComponentSettingStringValue(componentId, "Database");
				action = new InstallAction(ActionTypes.BackupDatabase);
				action.ConnectionString = connectionString;
				action.Name = database;
				action.Description = string.Format("Backing up database {0}...", database);
				list.Add(action);
			}
			
			//directory
			string path = AppConfig.GetComponentSettingStringValue(componentId, "InstallFolder");
			if (!string.IsNullOrEmpty(path))
			{
				action = new InstallAction(ActionTypes.BackupDirectory);
				action.Path = path;
				action.Description = string.Format("Backing up directory {0}...", path);
				list.Add(action);
			}

			//config
			action = new InstallAction(ActionTypes.BackupConfig);
			action.Description = "Backing up configuration settings...";
			action.Path = Wizard.SetupVariables.BaseDirectory;
			list.Add(action);

			return list;

		}
Esempio n. 27
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));
        }
Esempio n. 28
0
		public static DialogResult Uninstall(object obj)
		{
			Hashtable args = Utils.GetSetupParameters(obj);
			string shellVersion = Utils.GetStringSetupParameter(args, Global.Parameters.ShellVersion);
			//
			var setupVariables = new SetupVariables
			{
				ComponentId = Utils.GetStringSetupParameter(args, Global.Parameters.ComponentId),
				IISVersion = Global.IISVersion,
				SetupAction = SetupActions.Uninstall
			};
			//
			AppConfig.LoadConfiguration();

			InstallerForm form = new InstallerForm();
			Wizard wizard = form.Wizard;
			wizard.SetupVariables = setupVariables;
			//
			AppConfig.LoadComponentSettings(wizard.SetupVariables);
			//
			IntroductionPage page1 = new IntroductionPage();
			ConfirmUninstallPage page2 = new ConfirmUninstallPage();
			UninstallPage page3 = new UninstallPage();
			//create uninstall currentScenario
			InstallAction action = new InstallAction(ActionTypes.DeleteShortcuts);
			action.Description = "Deleting shortcuts...";
			action.Log = "- Delete shortcuts";
			action.Name = "Login to WebsitePanel.url";
			page3.Actions.Add(action);
			page2.UninstallPage = page3;

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

			//show wizard
			IWin32Window owner = args[Global.Parameters.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));
        }