示例#1
0
        private List <Type> FindAllModuleTypes(out List <Type> plugInModuleTypes)
        {
            plugInModuleTypes = new List <Type>();

            var modules = WindModule.FindDependedModuleTypesRecursivelyIncludingGivenModule(_modules.StartupModuleType);

            foreach (var plugInModuleType in _windPlugInManager.PlugInSources.GetAllModules())
            {
                if (modules.AddIfNotContains(plugInModuleType))
                {
                    plugInModuleTypes.Add(plugInModuleType);
                }
            }

            return(modules);
        }
示例#2
0
        /// <summary>
        /// Creates a new WindModuleInfo object.
        /// </summary>
        public WindModuleInfo(Type type, WindModule instance, bool isLoadedAsPlugIn)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            if (instance == null)
            {
                throw new ArgumentNullException("instance");
            }

            Type             = type;
            Instance         = instance;
            IsLoadedAsPlugIn = isLoadedAsPlugIn;
            Assembly         = Type.Assembly;

            Dependencies = new List <WindModuleInfo>();
        }
示例#3
0
        private void SetDependencies()
        {
            foreach (var moduleInfo in _modules)
            {
                moduleInfo.Dependencies.Clear();

                //Set dependencies for defined DependsOnAttribute attribute(s).
                foreach (var dependedModuleType in WindModule.FindDependedModuleTypes(moduleInfo.Type))
                {
                    var dependedModuleInfo = _modules.FirstOrDefault(m => m.Type == dependedModuleType);
                    if (dependedModuleInfo == null)
                    {
                        throw new WindException("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);
                    }
                }
            }
        }