public void SetUp () { ins = new TransactedInstaller (); state = new Hashtable (); sub1 = new SucceedInstaller (); sub2 = new FailureInstaller (); sub3 = new SucceedInstaller (); BfInstEvt = new CallInfo (); AfInstEvt = new CallInfo (); CommittingEvt = new CallInfo (); CommittedEvt = new CallInfo (); BfRbackEvt = new CallInfo (); AfRbackEvt = new CallInfo (); BfUninsEvt = new CallInfo (); AfUninsEvt = new CallInfo (); ins.Installers.Add (sub1); string [] cmdLine = new string [] { "/logToConsole=false" }; ins.Context = new InstallContext ("", cmdLine); // no log file ins.BeforeInstall += new InstallEventHandler (onBeforeInstall); ins.AfterInstall += new InstallEventHandler (onAfterInstall); ins.Committing += new InstallEventHandler (onCommitting); ins.Committed += new InstallEventHandler (onCommitted); ins.BeforeRollback += new InstallEventHandler (onBeforeRollback); ins.AfterRollback += new InstallEventHandler (onAfterRollback); ins.BeforeUninstall += new InstallEventHandler (onBeforeUninstall); ins.AfterUninstall += new InstallEventHandler (onAfterUninstall); }
private static System.Configuration.Install.Installer CreateInstaller(ServiceInfo serviceInfo) { System.Configuration.Install.Installer installer = new System.Configuration.Install.Installer(); ServiceInstaller serviceInstaller = new ServiceInstaller(); ServiceProcessInstaller serviceProcessInstaller = new ServiceProcessInstaller(); serviceInstaller.Description = serviceInfo.Description; serviceInstaller.StartType = serviceInfo.ServiceStartMode; serviceInstaller.DisplayName = serviceInfo.DisplayName; serviceInstaller.ServiceName = serviceInfo.ServiceName; if (serviceInfo.DependsOn != null && serviceInfo.DependsOn.Length > 0) { serviceInstaller.ServicesDependedOn = serviceInfo.DependsOn; } serviceProcessInstaller.Account = serviceInfo.ServiceAccount; serviceProcessInstaller.Username = serviceInfo.UserName; serviceProcessInstaller.Password = serviceInfo.Password; installer.Installers.Add(serviceProcessInstaller); installer.Installers.Add(serviceInstaller); return(installer); }
public void SetUp () { ins = new Installer (); state = new Hashtable (); sub1 = new MyInstaller (); sub2 = new MyInstaller (); BfInstEvt = new CallInfo (); AfInstEvt = new CallInfo (); CommittingEvt = new CallInfo (); CommittedEvt = new CallInfo (); BfRbackEvt = new CallInfo (); AfRbackEvt = new CallInfo (); BfUninsEvt = new CallInfo (); AfUninsEvt = new CallInfo ();; ins.Installers.Add (sub1); ins.Installers.Add (sub2); ins.BeforeInstall += new InstallEventHandler (onBeforeInstall); ins.AfterInstall += new InstallEventHandler (onAfterInstall); ins.Committing += new InstallEventHandler (onCommitting); ins.Committed += new InstallEventHandler (onCommitted); ins.BeforeRollback += new InstallEventHandler (onBeforeRollback); ins.AfterRollback += new InstallEventHandler (onAfterRollback); ins.BeforeUninstall += new InstallEventHandler (onBeforeUninstall); ins.AfterUninstall += new InstallEventHandler (onAfterUninstall); }
public void Fill(Installer installer) { foreach (Installer installer2 in this.CreateInstallers(this.InstrumentedTypes)) { installer.Installers.Add(installer2); } }
private static void DoCommitInstall(System.Configuration.Install.Installer installer) { Hashtable savedData = new Hashtable(); installer.Install(savedData); installer.Commit(savedData); }
public SpHostServiceInstaller(HostSettings settings, HostConfigurator configurator) { _hostConfigurator = configurator; _installer = CreateInstaller(settings); _transactedInstaller = CreateTransactedInstaller(_installer); }
public ProjectInstaller(Assembly appAssembly) { _installer = new Installer(); _appAssembly = appAssembly; CreateSubInstallers(); SetInstallerContext(); }
public void TypeWithNoEventLogsReturnsUnchangedInstaller() { Installer parentInstaller = new Installer(); EventLogInstallerBuilder builder = new EventLogInstallerBuilder(new Type[] { typeof(NoLogsType) }); builder.Fill(parentInstaller); Assert.AreEqual(0, parentInstaller.Installers.Count); }
public DBForm(Installer pInstallerP) { InitializeComponent(); LoadProvider(); normalClose = false; pInstaller = pInstallerP; dbName = ""; }
/// <summary> /// Fills the given installer with other, more specific kinds of installers that have been /// filled with the appropriate kinds of installable resources /// </summary> /// <param name="installer">Outer installer to be filled with nested installers for specific resources</param> public void Fill(Installer installer) { ICollection<Installer> installers = CreateInstallers(InstrumentedTypes); foreach (Installer childInstaller in installers) { installer.Installers.Add(childInstaller); } }
public void TypeWithNoCountersReturnsEmptyInstallers() { Installer parentInstaller = new Installer(); PerformanceCounterInstallerBuilder builder = new PerformanceCounterInstallerBuilder(new Type[] { typeof(NoCountersType) }); builder.Fill(parentInstaller); Assert.AreEqual(0, parentInstaller.Installers.Count); }
/// <summary> /// UnInstalls the Windows service with the given "installer" object. /// </summary> /// <param name="pi"></param> /// <param name="pathToService"></param> public static void uninstallService(Installer pi, string pathToService) { TransactedInstaller ti = new TransactedInstaller (); ti.Installers.Add (pi); string[] cmdline = {pathToService}; InstallContext ctx = new InstallContext ("Uninstall.log", cmdline ); ti.Context = ctx; ti.Uninstall ( null ); }
/// <summary> /// Installs the Windows service with the given "installer" object. /// </summary> /// <param name="installer">The installer.</param> /// <param name="pathToService">The path to service.</param> public static void InstallService(Installer installer, string pathToService) { TransactedInstaller ti = new TransactedInstaller(); ti.Installers.Add(installer); string[] cmdline = { pathToService }; InstallContext ctx = new InstallContext("Install.log", cmdline); ti.Context = ctx; ti.Install(new Hashtable()); }
public static Installer[] BuildInstallers(WinServiceSettings settings) { var result = new Installer[] { ConfigureServiceInstaller(settings), ConfigureServiceProcessInstaller(settings) }; return result; }
public void AddRange (Installer[] value) { if (value == null) { throw new ArgumentNullException ("value"); } for (int counter = 0; counter < value.Length; counter++) { Add (value[counter]); } }
// Add a range of installers to this collection. public void AddRange(Installer[] value) { if(value == null) { throw new ArgumentNullException("value"); } foreach(Installer inst in value) { Add(inst); } }
private void InitializeComponent() { this.serviceProcessInstaller1 = new ServiceProcessInstaller(); this.serviceInstaller1 = new ServiceInstaller(); this.serviceProcessInstaller1.Password = null; this.serviceProcessInstaller1.Username = null; this.serviceInstaller1.ServiceName = "Service1"; InstallerCollection installers = base.Installers; Installer[] installerArray = new Installer[] { this.serviceProcessInstaller1, this.serviceInstaller1 }; installers.AddRange(installerArray); }
public void AddRange(Installer[] value) { if (value == null) { throw new ArgumentNullException("value"); } for (int i = 0; i < value.Length; i++) { this.Add(value[i]); } }
public void BuilderWillFillInstallerWithCreatedChildInstallers() { Type[] candidateTypes = new Type[] { typeof(InstrumentedTypeWithAAttribute), typeof(InstrumentedTypeWithAAndBAttributes) }; MockInstallerBuilder builder = new MockInstallerBuilder(candidateTypes, typeof(InstrumentationAAttribute)); Installer parentInstaller = new Installer(); }
protected override Installer CreateUninstaller(HostSettings settings, string commandLine) { var baseInstallers = new Installer[] { CreateServiceInstaller(settings, new string[] {}, HostStartMode.Automatic), CreateServiceProcessInstaller(ServiceAccount.LocalService, "", "") }; var mainInstaller = new HostInstaller(settings, commandLine, baseInstallers); return CreateTransactedInstaller(mainInstaller); }
public void WillFindSingleEventLogTypeInListOfTypes() { Installer parentInstaller = new Installer(); EventLogInstallerBuilder builder = new EventLogInstallerBuilder(new Type[] { typeof(NoLogsType), typeof(SimpleLogType) }); builder.Fill(parentInstaller); Assert.AreEqual(1, parentInstaller.Installers.Count); Assert.AreSame(typeof(EventLogInstaller), parentInstaller.Installers[0].GetType()); EventLogInstaller installer = (EventLogInstaller)parentInstaller.Installers[0]; Assert.AreEqual("FooLog", installer.Log); }
internal static void installService() { ServiceInstaller serviceInstaller = null; ServiceProcessInstaller serviceProcessInstaller = null; Installer projectInstaller = null; TransactedInstaller transactedInstaller = null; try { serviceInstaller = new ServiceInstaller(); serviceInstaller.ServiceName = "OpenVPNManager"; serviceInstaller.StartType = ServiceStartMode.Automatic; serviceProcessInstaller = new ServiceProcessInstaller(); serviceProcessInstaller.Account = System.ServiceProcess.ServiceAccount.LocalSystem; serviceProcessInstaller.Password = null; serviceProcessInstaller.Username = null; projectInstaller = new Installer(); projectInstaller.Installers.Add(serviceInstaller); projectInstaller.Installers.Add(serviceProcessInstaller); transactedInstaller = new TransactedInstaller(); transactedInstaller.Installers.Add(projectInstaller); transactedInstaller.Context = new InstallContext(); transactedInstaller.Context.Parameters["assemblypath"] = Assembly.GetExecutingAssembly().Location + "\" \"/EXECUTESERVICE"; transactedInstaller.Install(new Hashtable()); } catch (InvalidOperationException e) { if (e.InnerException != null && e.InnerException is Win32Exception)// Probably: "Service already exists." MessageBox.Show("Error: " + e.InnerException.Message); else if (e.InnerException != null && e.InnerException is InvalidOperationException && e.InnerException.InnerException != null && e.InnerException.InnerException is Win32Exception)// Probably: "Permission denied" { String MSG_ServiceInstallPermissionErrorAdvice = Program.res.GetString("MSG_ServiceInstallPermissionErrorAdvice"); MessageBox.Show("Error: " + e.InnerException.InnerException.Message + "\r\n\r\n" + MSG_ServiceInstallPermissionErrorAdvice); } else throw; } finally { if (serviceInstaller != null) serviceInstaller.Dispose(); if (serviceProcessInstaller != null) serviceProcessInstaller.Dispose(); if (projectInstaller != null) projectInstaller.Dispose(); if (transactedInstaller != null) transactedInstaller.Dispose(); } }
static void DoCommitInstall(System.Configuration.Install.Installer installer) { Hashtable savedData = new Hashtable(); try { installer.Install(savedData); } catch (SecurityException ex) { Assert.Inconclusive("In order to run the tests, please run Visual Studio as Administrator.\r\n{0}", ex.ToString()); } installer.Commit(savedData); }
public LsbLinuxHostInstaller(LinuxServiceSettings settings, Installer[] installers, LinuxServiceLogWriter logWriter) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } _settings = settings; _installers = installers; _logWriter = logWriter; _installTransaction = new TransactionManager<LinuxServiceSettings>(_logWriter) .Stage(Properties.Resources.CreateServiceFileStage, CreateServiceFile, DeleteServiceFile) .Stage(Properties.Resources.SetServiceFileAsExecutableStage, SetServiceFileAsExecutable) .Stage(Properties.Resources.RegisterServiceFileStage, RegisterServiceFile, UnregisterServiceFile); }
public void ExecuteInternal(HostArguments args) { var serviceInstaller = new ServiceInstaller { ServiceName = args.ServiceName, Description = args.Description, DisplayName = args.DisplayName, }; SetStartMode(serviceInstaller, args.StartMode); var serviceProcessInstaller = new ServiceProcessInstaller { Username = args.Username, Password = args.Password, Account = args.ServiceAccount, }; var installers = new Installer[] { serviceInstaller, serviceProcessInstaller }; var arguments = String.Empty; if (!String.IsNullOrEmpty(args.Url)) { arguments += string.Format(" --url=\"{0}\"", args.Url); } using (var hostInstaller = new HostInstaller(args, arguments, installers)) using (var transactedInstaller = new TransactedInstaller()) { transactedInstaller.Installers.Add(hostInstaller); var assembly = Assembly.GetEntryAssembly(); var path = String.Format("/assemblypath={0}", assembly.Location); string[] commandLine = {path}; var context = new InstallContext(null, commandLine); transactedInstaller.Context = context; Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory); action(transactedInstaller); } }
public void SingleCounterIsAddedToInstaller() { Installer parentInstaller = new Installer(); PerformanceCounterInstallerBuilder builder = new PerformanceCounterInstallerBuilder(new Type[] { typeof(SingleCounterType) }); builder.Fill(parentInstaller); Assert.AreEqual(1, parentInstaller.Installers.Count); Assert.AreSame(typeof(PerformanceCounterInstaller), parentInstaller.Installers[0].GetType()); PerformanceCounterInstaller installer = (PerformanceCounterInstaller)parentInstaller.Installers[0]; CounterCreationData createdCounterData = installer.Counters[0]; Assert.AreEqual("Bill", createdCounterData.CounterName); Assert.AreEqual("Help Bill", createdCounterData.CounterHelp); Assert.AreEqual(PerformanceCounterType.CounterMultiTimer, createdCounterData.CounterType); }
public void MultipleCountersInSingleTypeAreAllAddedToInstaller() { Installer parentInstaller = new Installer(); PerformanceCounterInstallerBuilder builder = new PerformanceCounterInstallerBuilder(new Type[] { typeof(MultipleCounterTypeForCategoryA) }); builder.Fill(parentInstaller); Assert.AreEqual(1, parentInstaller.Installers.Count); Assert.AreSame(typeof(PerformanceCounterInstaller), parentInstaller.Installers[0].GetType()); PerformanceCounterInstaller installer = (PerformanceCounterInstaller)parentInstaller.Installers[0]; Assert.AreEqual(2, installer.Counters.Count); CounterCreationData firstCounter = installer.Counters[0]; CounterCreationData secondCounter = installer.Counters[1]; Assert.IsFalse(ReferenceEquals(firstCounter, secondCounter)); Assert.IsFalse(firstCounter.Equals(secondCounter)); }
public void LogIsAddedToInstaller() { Installer parentInstaller = new Installer(); EventLogInstallerBuilder builder = new EventLogInstallerBuilder(new Type[] { typeof(SimpleLogType) }); builder.Fill(parentInstaller); Assert.AreEqual(1, parentInstaller.Installers.Count); Assert.AreSame(typeof(EventLogInstaller), parentInstaller.Installers[0].GetType()); EventLogInstaller installer = (EventLogInstaller)parentInstaller.Installers[0]; Assert.AreEqual("FooLog", installer.Log); Assert.AreEqual("FooSource", installer.Source); Assert.AreEqual(0, installer.CategoryCount); Assert.IsNull(installer.CategoryResourceFile); Assert.IsNull(installer.MessageResourceFile); Assert.IsNull(installer.ParameterResourceFile); }
public void OptionalAttributesCanBeSet() { Installer parentInstaller = new Installer(); EventLogInstallerBuilder builder = new EventLogInstallerBuilder(new Type[] { typeof(ComplexLogType) }); builder.Fill(parentInstaller); Assert.AreEqual(1, parentInstaller.Installers.Count); Assert.AreSame(typeof(EventLogInstaller), parentInstaller.Installers[0].GetType()); EventLogInstaller installer = (EventLogInstaller)parentInstaller.Installers[0]; Assert.AreEqual("BarLog", installer.Log); Assert.AreEqual("BarSource", installer.Source); Assert.AreEqual(7, installer.CategoryCount); Assert.AreEqual("Bar.resources", installer.CategoryResourceFile); Assert.AreEqual("BarMessages.resources", installer.MessageResourceFile); Assert.AreEqual("BarResources.resources", installer.ParameterResourceFile); }
private static TransactedInstaller CreateTransactedInstaller(Installer installer) { var transactedInstaller = new TransactedInstaller(); transactedInstaller.Installers.Add(installer); var assembly = Assembly.GetEntryAssembly(); if (assembly == null) { throw new TopshelfException(Resources.ServiceMustBeExecutableFile); } var path = string.Format("/assemblypath={0}", assembly.Location); var commandLine = new[] { path }; var context = new InstallContext(null, commandLine); transactedInstaller.Context = context; return transactedInstaller; }
protected override Installer CreateInstaller(InstallHostSettings settings, string commandLine) { var baseInstallers = new Installer[] { CreateServiceInstaller(settings, settings.Dependencies, settings.StartMode), CreateServiceProcessInstaller(settings.Account, settings.Username, settings.Password) }; foreach (var installer in baseInstallers) { var eventLogInstallers = installer.Installers.OfType<EventLogInstaller>().ToArray(); foreach (var eventLogInstaller in eventLogInstallers) { installer.Installers.Remove(eventLogInstaller); } } var mainInstaller = new HostInstaller(settings, commandLine, baseInstallers); return CreateTransactedInstaller(mainInstaller); }
private static void Install(bool install, ServiceInfo serviceInfo) { using (TransactedInstaller transactedInstaller = new TransactedInstaller()) { using (System.Configuration.Install.Installer installer = CreateInstaller(serviceInfo)) { transactedInstaller.Installers.Add(installer); string path = string.Format("/assemblypath={0}", Assembly.GetEntryAssembly().Location); transactedInstaller.Context = new InstallContext("", new[] { path }); if (install) { transactedInstaller.Install(new Hashtable()); } else { transactedInstaller.Uninstall(null); } } } }
private static System.Configuration.Install.Installer CreateInstaller(ServiceInfo serviceInfo) { System.Configuration.Install.Installer installer = new System.Configuration.Install.Installer(); ServiceInstaller serviceInstaller = new ServiceInstaller(); ServiceProcessInstaller serviceProcessInstaller = new ServiceProcessInstaller(); serviceInstaller.Description = serviceInfo.Description; serviceInstaller.StartType = serviceInfo.ServiceStartMode; serviceInstaller.DisplayName = serviceInfo.DisplayName; serviceInstaller.ServiceName = serviceInfo.ServiceName; if (serviceInfo.DependsOn != null && serviceInfo.DependsOn.Length > 0) serviceInstaller.ServicesDependedOn = serviceInfo.DependsOn; serviceProcessInstaller.Account = serviceInfo.ServiceAccount; serviceProcessInstaller.Username = serviceInfo.UserName; serviceProcessInstaller.Password = serviceInfo.Password; installer.Installers.Add(serviceProcessInstaller); installer.Installers.Add(serviceInstaller); return installer; }
private void WriteEventHandlerError(string severity, string eventName, Exception e) { this.Context.LogMessage(Res.GetString("InstallLogError", (object)severity, (object)eventName, (object)this.GetType().FullName)); Installer.LogException(e, this.Context); }
internal InstallerCollection(Installer owner) => _owner = owner;
public virtual void Uninstall(IDictionary savedState) { Exception ex = null; try { this.OnBeforeUninstall(savedState); } catch (Exception ex2) { this.WriteEventHandlerError(Res.GetString("InstallSeverityWarning"), "OnBeforeUninstall", ex2); this.Context.LogMessage(Res.GetString("InstallUninstallException")); ex = ex2; } IDictionary[] array; if (savedState != null) { array = (IDictionary[])savedState["_reserved_nestedSavedStates"]; if (array != null && array.Length == this.Installers.Count) { goto IL_0091; } throw new ArgumentException(Res.GetString("InstallDictionaryCorrupted", "savedState")); } array = new IDictionary[this.Installers.Count]; goto IL_0091; IL_0091: for (int num = this.Installers.Count - 1; num >= 0; num--) { this.Installers[num].Context = this.Context; } for (int num2 = this.Installers.Count - 1; num2 >= 0; num2--) { try { this.Installers[num2].Uninstall(array[num2]); } catch (Exception ex3) { if (!this.IsWrappedException(ex3)) { this.Context.LogMessage(Res.GetString("InstallLogUninstallException", this.Installers[num2].ToString())); Installer.LogException(ex3, this.Context); this.Context.LogMessage(Res.GetString("InstallUninstallException")); } ex = ex3; } } try { this.OnAfterUninstall(savedState); } catch (Exception ex4) { this.WriteEventHandlerError(Res.GetString("InstallSeverityWarning"), "OnAfterUninstall", ex4); this.Context.LogMessage(Res.GetString("InstallUninstallException")); ex = ex4; } if (ex == null) { return; } Exception ex5 = ex; if (!this.IsWrappedException(ex)) { ex5 = new InstallException(Res.GetString("InstallUninstallException"), ex); ex5.Source = "WrappedExceptionSource"; } throw ex5; }
public virtual void Rollback(IDictionary savedState) { if (savedState == null) { throw new ArgumentException(Res.GetString("InstallNullParameter", "savedState")); } if (savedState["_reserved_lastInstallerAttempted"] != null && savedState["_reserved_nestedSavedStates"] != null) { Exception ex = null; try { this.OnBeforeRollback(savedState); } catch (Exception ex2) { this.WriteEventHandlerError(Res.GetString("InstallSeverityWarning"), "OnBeforeRollback", ex2); this.Context.LogMessage(Res.GetString("InstallRollbackException")); ex = ex2; } int num = (int)savedState["_reserved_lastInstallerAttempted"]; IDictionary[] array = (IDictionary[])savedState["_reserved_nestedSavedStates"]; if (num + 1 == array.Length && num < this.Installers.Count) { for (int num2 = this.Installers.Count - 1; num2 >= 0; num2--) { this.Installers[num2].Context = this.Context; } for (int num3 = num; num3 >= 0; num3--) { try { this.Installers[num3].Rollback(array[num3]); } catch (Exception ex3) { if (!this.IsWrappedException(ex3)) { this.Context.LogMessage(Res.GetString("InstallLogRollbackException", this.Installers[num3].ToString())); Installer.LogException(ex3, this.Context); this.Context.LogMessage(Res.GetString("InstallRollbackException")); } ex = ex3; } } try { this.OnAfterRollback(savedState); } catch (Exception ex4) { this.WriteEventHandlerError(Res.GetString("InstallSeverityWarning"), "OnAfterRollback", ex4); this.Context.LogMessage(Res.GetString("InstallRollbackException")); ex = ex4; } if (ex == null) { return; } Exception ex5 = ex; if (!this.IsWrappedException(ex)) { ex5 = new InstallException(Res.GetString("InstallRollbackException"), ex); ex5.Source = "WrappedExceptionSource"; } throw ex5; } throw new ArgumentException(Res.GetString("InstallDictionaryCorrupted", "savedState")); } throw new ArgumentException(Res.GetString("InstallDictionaryMissingValues", "savedState")); }
static void CommitInstall(System.Configuration.Install.Installer installer, params string[] args) { installer.Context = new InstallContext(null, args); DoCommitInstall(installer); }
// Constructor. internal InstallerCollection(Installer parent) { this.parent = parent; }
public void Remove(Installer value) { }
public void Insert(int index, Installer value) { base.List.Insert(index, value); }
// Insert an installer into this collection. public void Insert(int index, Installer value) { ((IList)this).Insert(index, value); }
public void Remove(Installer value) { base.List.Remove(value); }
public void Remove (Installer value) { }
// Determine if a particular installer is contained in this collection. public bool Contains(Installer value) { return(((IList)this).Contains(value)); }
// Add an installer to this collection. public int Add(Installer value) { return(((IList)this).Add(value)); }
public int Add(Installer value) { return(base.List.Add(value)); }
public virtual void Commit(IDictionary savedState) { if (savedState == null) { throw new ArgumentException(Res.GetString("InstallNullParameter", "savedState")); } if (savedState["_reserved_lastInstallerAttempted"] != null && savedState["_reserved_nestedSavedStates"] != null) { Exception ex = null; try { this.OnCommitting(savedState); } catch (Exception ex2) { this.WriteEventHandlerError(Res.GetString("InstallSeverityWarning"), "OnCommitting", ex2); this.Context.LogMessage(Res.GetString("InstallCommitException")); ex = ex2; } int num = (int)savedState["_reserved_lastInstallerAttempted"]; IDictionary[] array = (IDictionary[])savedState["_reserved_nestedSavedStates"]; if (num + 1 == array.Length && num < this.Installers.Count) { for (int i = 0; i < this.Installers.Count; i++) { this.Installers[i].Context = this.Context; } for (int j = 0; j <= num; j++) { try { this.Installers[j].Commit(array[j]); } catch (Exception ex3) { if (!this.IsWrappedException(ex3)) { this.Context.LogMessage(Res.GetString("InstallLogCommitException", this.Installers[j].ToString())); Installer.LogException(ex3, this.Context); this.Context.LogMessage(Res.GetString("InstallCommitException")); } ex = ex3; } } savedState["_reserved_nestedSavedStates"] = array; savedState.Remove("_reserved_lastInstallerAttempted"); try { this.OnCommitted(savedState); } catch (Exception ex4) { this.WriteEventHandlerError(Res.GetString("InstallSeverityWarning"), "OnCommitted", ex4); this.Context.LogMessage(Res.GetString("InstallCommitException")); ex = ex4; } if (ex == null) { return; } Exception ex5 = ex; if (!this.IsWrappedException(ex)) { ex5 = new InstallException(Res.GetString("InstallCommitException"), ex); ex5.Source = "WrappedExceptionSource"; } throw ex5; } throw new ArgumentException(Res.GetString("InstallDictionaryCorrupted", "savedState")); } throw new ArgumentException(Res.GetString("InstallDictionaryMissingValues", "savedState")); }
internal InstallerCollection(Installer owner) { this.owner = owner; }
public int IndexOf(Installer value) { Contract.Ensures(Contract.Result <int>() >= -1); return(default(int)); }
static void CommitInstall(System.Configuration.Install.Installer installer) { installer.Context = new InstallContext(); DoCommitInstall(installer); }
public virtual void Uninstall(IDictionary savedState) { Exception exception1 = (Exception)null; try { this.OnBeforeUninstall(savedState); } catch (Exception ex) { this.WriteEventHandlerError(Res.GetString("InstallSeverityWarning"), "OnBeforeUninstall", ex); this.Context.LogMessage(Res.GetString("InstallUninstallException")); exception1 = ex; } IDictionary[] dictionaryArray; if (savedState != null) { dictionaryArray = (IDictionary[])savedState[(object)"_reserved_nestedSavedStates"]; if (dictionaryArray == null || dictionaryArray.Length != this.Installers.Count) { throw new ArgumentException(Res.GetString("InstallDictionaryCorrupted", new object[1] { (object)"savedState" })); } } else { dictionaryArray = new IDictionary[this.Installers.Count]; } for (int index = this.Installers.Count - 1; index >= 0; --index) { this.Installers[index].Context = this.Context; } for (int index = this.Installers.Count - 1; index >= 0; --index) { try { this.Installers[index].Uninstall(dictionaryArray[index]); } catch (Exception ex) { if (!this.IsWrappedException(ex)) { this.Context.LogMessage(Res.GetString("InstallLogUninstallException", new object[1] { (object)this.Installers[index].ToString() })); Installer.LogException(ex, this.Context); this.Context.LogMessage(Res.GetString("InstallUninstallException")); } exception1 = ex; } } try { this.OnAfterUninstall(savedState); } catch (Exception ex) { this.WriteEventHandlerError(Res.GetString("InstallSeverityWarning"), "OnAfterUninstall", ex); this.Context.LogMessage(Res.GetString("InstallUninstallException")); exception1 = ex; } if (exception1 == null) { return; } Exception exception2 = exception1; if (!this.IsWrappedException(exception1)) { exception2 = (Exception) new InstallException(Res.GetString("InstallUninstallException"), exception1); exception2.Source = "WrappedExceptionSource"; } throw exception2; }
public bool Contains(Installer value) { return(base.List.Contains(value)); }
// Remove an installer from this collection. public void Remove(Installer value) { ((IList)this).Remove(value); }
private static string GetHelp(Installer installerWithHelp) { return(Res.GetString("InstallHelpMessageStart") + Environment.NewLine + installerWithHelp.HelpText + Environment.NewLine + Res.GetString("InstallHelpMessageEnd") + Environment.NewLine); }
public bool Contains(Installer value) { return(default(bool)); }
// Get the index of a specific installer within this collection public int IndexOf(Installer value) { return(((IList)this).IndexOf(value)); }
public void Insert(int index, Installer value) { Contract.Requires(index >= 0); }
public virtual void Rollback(IDictionary savedState) { if (savedState == null) { throw new ArgumentException(Res.GetString("InstallNullParameter", new object[1] { (object)"savedState" })); } else if (savedState[(object)"_reserved_lastInstallerAttempted"] == null || savedState[(object)"_reserved_nestedSavedStates"] == null) { throw new ArgumentException(Res.GetString("InstallDictionaryMissingValues", new object[1] { (object)"savedState" })); } else { Exception exception1 = (Exception)null; try { this.OnBeforeRollback(savedState); } catch (Exception ex) { this.WriteEventHandlerError(Res.GetString("InstallSeverityWarning"), "OnBeforeRollback", ex); this.Context.LogMessage(Res.GetString("InstallRollbackException")); exception1 = ex; } int num = (int)savedState[(object)"_reserved_lastInstallerAttempted"]; IDictionary[] dictionaryArray = (IDictionary[])savedState[(object)"_reserved_nestedSavedStates"]; if (num + 1 != dictionaryArray.Length || num >= this.Installers.Count) { throw new ArgumentException(Res.GetString("InstallDictionaryCorrupted", new object[1] { (object)"savedState" })); } else { for (int index = this.Installers.Count - 1; index >= 0; --index) { this.Installers[index].Context = this.Context; } for (int index = num; index >= 0; --index) { try { this.Installers[index].Rollback(dictionaryArray[index]); } catch (Exception ex) { if (!this.IsWrappedException(ex)) { this.Context.LogMessage(Res.GetString("InstallLogRollbackException", new object[1] { (object)this.Installers[index].ToString() })); Installer.LogException(ex, this.Context); this.Context.LogMessage(Res.GetString("InstallRollbackException")); } exception1 = ex; } } try { this.OnAfterRollback(savedState); } catch (Exception ex) { this.WriteEventHandlerError(Res.GetString("InstallSeverityWarning"), "OnAfterRollback", ex); this.Context.LogMessage(Res.GetString("InstallRollbackException")); exception1 = ex; } if (exception1 == null) { return; } Exception exception2 = exception1; if (!this.IsWrappedException(exception1)) { exception2 = (Exception) new InstallException(Res.GetString("InstallRollbackException"), exception1); exception2.Source = "WrappedExceptionSource"; } throw exception2; } } }
public int IndexOf(Installer value) { return(base.List.IndexOf(value)); }