/// <summary> /// Creates a new StudioXModuleInfo object. /// </summary> public StudioXModuleInfo([NotNull] Type type, [NotNull] StudioXModule instance, bool isLoadedAsPlugIn) { Check.NotNull(type, nameof(type)); Check.NotNull(instance, nameof(instance)); Type = type; Instance = instance; IsLoadedAsPlugIn = isLoadedAsPlugIn; Assembly = Type.GetTypeInfo().Assembly; Dependencies = new List <StudioXModuleInfo>(); }
private List <Type> FindAllModuleTypes(out List <Type> plugInModuleTypes) { plugInModuleTypes = new List <Type>(); var modules = StudioXModule.FindDependedModuleTypesRecursivelyIncludingGivenModule(this.modules.StartupModuleType); foreach (var plugInModuleType in studioXPlugInManager.PlugInSources.GetAllModules()) { if (modules.AddIfNotContains(plugInModuleType)) { plugInModuleTypes.Add(plugInModuleType); } } return(modules); }
private void SetDependencies() { foreach (var moduleInfo in modules) { moduleInfo.Dependencies.Clear(); //Set dependencies for defined DependsOnAttribute attribute(s). foreach (var dependedModuleType in StudioXModule.FindDependedModuleTypes(moduleInfo.Type)) { var dependedModuleInfo = modules.FirstOrDefault(m => m.Type == dependedModuleType); if (dependedModuleInfo == null) { throw new StudioXInitializationException("Could not find a depended module " + dependedModuleType.AssemblyQualifiedName + " for " + moduleInfo.Type.AssemblyQualifiedName); } if (moduleInfo.Dependencies.FirstOrDefault(dm => dm.Type == dependedModuleType) == null) { moduleInfo.Dependencies.Add(dependedModuleInfo); } } } }