private static void AddModuleAndDependenciesResursively(List <Type> moduleTypes, Type moduleType) { AcwModule.IsAcwModule(moduleType); if (moduleTypes.Contains(moduleType)) { return; } moduleTypes.Add(moduleType); foreach (var dependedModuleType in FindDependedModuleTypes(moduleType)) { AddModuleAndDependenciesResursively(moduleTypes, dependedModuleType); } }
public static List <Type> FindDependedModuleTypes(Type moduleType) { AcwModule.IsAcwModule(moduleType); var dependencies = new List <Type>(); var dependencyDescriptors = moduleType .GetCustomAttributes() .OfType <IDependedTypesProvider>(); foreach (var descriptor in dependencyDescriptors) { foreach (var dependedModuleType in descriptor.GetDependedTypes()) { dependencies.AddIfNotContains(dependedModuleType); } } return(dependencies); }