/// <summary> /// Get all types of IComponentInstaller from the list of <paramref name="assemblies"/>. /// </summary> /// <param name="assemblies">Assemblies to look for types of IComponentInstaller.</param> /// <returns>Return list of IComponentInstaller found in the assemblies.</returns> private static IList <IComponentInstaller> GetIoCInstallersFromAssemblies(IList <Assembly> assemblies) { List <IComponentInstaller> iocInstallers = new List <IComponentInstaller>(); foreach (var a in assemblies) { Logger.DebugFormat("GetIoCInstallersFromAssemblies[{0}] processing {1}", ContainerName, a.FullName); if (IsDynamicAssembly(a)) { continue; } var types = GetInstallerTypesFromAssembly(a); if (types == null) { continue; } foreach (var t in types) { try { Object o = Activator.CreateInstance(t); IComponentInstaller installer = o as IComponentInstaller; Logger.InfoFormat("IoCsetup::GetIoCInstallers[{0}] - Found IoC Installer [type = {1}] from assembly [{2}]", ContainerName, t.FullName, a.Location); iocInstallers.Add(installer); } catch (Exception ex) { Logger.InfoFormat("IoCsetup::GetIoCInstallers[{0}] - Unexpected error [type = {1}] and assembly [{2}]: {3}", ContainerName, t.Name, a.Location, ex.ToString()); } } } return(iocInstallers); }
public void ImportFromArgumentString(Command command) { string[] components = command["-components"].Split(','); foreach (string component in components) { IComponentInstaller installer = null; switch (component) { case "Client": { installer = new Components.ClientInstaller(); } break; case "MapEditor": { installer = new Components.MapEditorInstaller(); } break; } if (installer != null) { installer.ParseConfigString(command); this.components.Add(installer); } } }
public void AddComponent(IComponentInstaller componentInstaller) { components.Add(componentInstaller); }