コード例 #1
0
ファイル: Portal.cs プロジェクト: lwhitelock/Websitepanel
		internal static object InstallBase(object obj, string minimalInstallerVersion)
		{
			Hashtable args = Utils.GetSetupParameters(obj);
			//check CS version
			var shellMode = Utils.GetStringSetupParameter(args, Global.Parameters.ShellMode);
			var version = new Version(Utils.GetStringSetupParameter(args, Global.Parameters.ShellVersion));
			var setupVariables = new SetupVariables
			{
				SetupAction = SetupActions.Install,
				ConfigurationFile = "web.config",
				WebSiteIP = Global.WebPortal.DefaultIP, //empty - to detect IP 
				WebSitePort = Global.WebPortal.DefaultPort,
				WebSiteDomain = String.Empty,
				NewWebSite = true,
				NewVirtualDirectory = false,
				EnterpriseServerURL = Global.WebPortal.DefaultEntServURL
			};
			//
			InitInstall(args, setupVariables);
			//
			var wam = new WebPortalActionManager(setupVariables);
			//
			wam.PrepareDistributiveDefaults();
			//
			if (shellMode.Equals(Global.SilentInstallerShell, StringComparison.OrdinalIgnoreCase))
			{
				if (version < new Version(minimalInstallerVersion))
				{
					Utils.ShowConsoleErrorMessage(Global.Messages.InstallerVersionIsObsolete, minimalInstallerVersion);
					//
					return false;
				}

				try
				{
					var success = true;
					//
					setupVariables.EnterpriseServerURL = Utils.GetStringSetupParameter(args, Global.Parameters.EnterpriseServerUrl);
					//
					wam.ActionError += new EventHandler<ActionErrorEventArgs>((object sender, ActionErrorEventArgs e) =>
					{
						Utils.ShowConsoleErrorMessage(e.ErrorMessage);
						//
						Log.WriteError(e.ErrorMessage);
						//
						success = false;
					});
					//
					wam.Start();
					//
					return success;
				}
				catch (Exception ex)
				{
					Log.WriteError("Failed to install the component", ex);
					//
					return false;
				}
			}
			else
			{
				if (version < new Version(minimalInstallerVersion))
				{
					//
					MessageBox.Show(String.Format(Global.Messages.InstallerVersionIsObsolete, minimalInstallerVersion), "Setup Wizard", MessageBoxButtons.OK, MessageBoxIcon.Warning);
					//
					return DialogResult.Cancel;
				}
				//
				InstallerForm form = new InstallerForm();
				Wizard wizard = form.Wizard;
				wizard.SetupVariables = setupVariables;
				wizard.ActionManager = wam;
				//Unattended setup
				LoadSetupVariablesFromSetupXml(wizard.SetupVariables.SetupXml, wizard.SetupVariables);

				//create wizard pages
				var introPage = new IntroductionPage();
				var licPage = new LicenseAgreementPage();
				var page1 = new ConfigurationCheckPage();
                ConfigurationCheck check1 = new ConfigurationCheck(CheckTypes.OperationSystem, "Operating System Requirement") { SetupVariables = setupVariables };
                ConfigurationCheck check2 = new ConfigurationCheck(CheckTypes.IISVersion, "IIS Requirement") { SetupVariables = setupVariables };
                ConfigurationCheck check3 = new ConfigurationCheck(CheckTypes.ASPNET, "ASP.NET Requirement") { SetupVariables = setupVariables };
				page1.Checks.AddRange(new ConfigurationCheck[] { check1, check2, check3 });
				var page2 = new InstallFolderPage();
				var page3 = new WebPage();
				var page4 = new UserAccountPage();
				var page5 = new UrlPage();
				var page6 = new ExpressInstallPage2();

				var 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[Global.Parameters.ParentForm] as IWin32Window;
				return form.ShowModal(owner);
			}
		}
コード例 #2
0
ファイル: Adapter.cs プロジェクト: lwhitelock/Websitepanel
 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();
 }