Ejemplo n.º 1
0
		internal static object InstallBase(object obj, string minimalInstallerVersion)
		{
			Hashtable args = Utils.GetSetupParameters(obj);

			//check CS version
			string shellVersion = Utils.GetStringSetupParameter(args, Global.Parameters.ShellVersion);
			var shellMode = Utils.GetStringSetupParameter(args, Global.Parameters.ShellMode);
			Version version = new Version(shellVersion);
			//
			var setupVariables = new SetupVariables
			{
				SetupAction = SetupActions.Install,
				IISVersion = Global.IISVersion
			};
			//
			InitInstall(args, setupVariables);
			//Unattended setup
			LoadSetupVariablesFromSetupXml(setupVariables.SetupXml, setupVariables);
			//
			var sam = new ServerActionManager(setupVariables);
			// Prepare installation defaults
			sam.PrepareDistributiveDefaults();
			// Silent Installer Mode
			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.ServerPassword = Utils.GetStringSetupParameter(args, Global.Parameters.ServerPassword);
					//
					sam.ActionError += new EventHandler<ActionErrorEventArgs>((object sender, ActionErrorEventArgs e) =>
					{
						Utils.ShowConsoleErrorMessage(e.ErrorMessage);
						//
						Log.WriteError(e.ErrorMessage);
						//
						success = false;
					});
					//
					sam.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;
				}

				var form = new InstallerForm();
				var wizard = form.Wizard;
				wizard.SetupVariables = setupVariables;
				//
				wizard.ActionManager = sam;

				//create wizard pages
				var introPage = new IntroductionPage();
				var licPage = new LicenseAgreementPage();
				//
				var page1 = new ConfigurationCheckPage();
				page1.Checks.AddRange(new ConfigurationCheck[]
				{ 
					new ConfigurationCheck(CheckTypes.OperationSystem, "Operating System Requirement"), 
					new ConfigurationCheck(CheckTypes.IISVersion, "IIS Requirement"), 
					new ConfigurationCheck(CheckTypes.ASPNET, "ASP.NET Requirement")
				});
				//
				var page2 = new InstallFolderPage();
				var page3 = new WebPage();
				var page4 = new UserAccountPage();
				var page5 = new ServerPasswordPage();
				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["ParentForm"] as IWin32Window;
				return form.ShowModal(owner);
			}
		}
Ejemplo n.º 2
0
 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();
 }