Exemple #1
0
        private void LoadBaseTask(Class cls, Type type, TypeDefinition typeDefinition)
        {
            if (typeDefinition == null)
            {
                return;
            }

            _loadTaskRegistry.Add(typeof(AddBaseClassDependency),
                                  new AddBaseClassDependency(cls, type, typeDefinition, this));
        }
Exemple #2
0
        public void LoadTypesForModule(ModuleDefinition module, string namespaceFilter)
        {
            _architectureCacheKey.Add(module.Name, namespaceFilter);

            var types = module.Types;

            var allTypes = types.Concat(types.SelectMany(typeDefinition => typeDefinition.NestedTypes));

            allTypes
            .Where(typeDefinition => RegexUtils.MatchNamespaces(namespaceFilter,
                                                                typeDefinition.Namespace))
            .ForEach(typeDefinition =>
            {
                var type = _typeFactory.GetOrCreateTypeFromTypeReference(typeDefinition);
                if (!_architectureTypes.Contains(type))
                {
                    _architectureTypes.Add(type);
                }
            });

            _namespaceRegistry.Namespaces
            .Where(ns => RegexUtils.MatchNamespaces(namespaceFilter, ns.FullName))
            .ForEach(ns =>
            {
                _loadTaskRegistry.Add(typeof(AddTypesToNamespace),
                                      new AddTypesToNamespace(ns, _architectureTypes));
            });
        }
        public void LoadTypesForModule(ModuleDefinition module, string namespaceFilter)
        {
            _architectureCacheKey.Add(module.Name, namespaceFilter);

            ICollection <TypeDefinition> types;

            if (module.Types.First().FullName.Contains("<Module>"))
            {
                types = module.Types.Skip(1).ToList();
            }
            else
            {
                types = module.Types;
            }


            var allTypes = types.Concat(types.SelectMany(typeDefinition =>
                                                         typeDefinition.NestedTypes.Where(type => !type.IsCompilerGenerated())));

            allTypes
            .Where(typeDefinition => RegexUtils.MatchNamespaces(namespaceFilter,
                                                                typeDefinition.Namespace))
            .ForEach(typeDefinition =>
            {
                var type = _typeFactory.GetOrCreateTypeFromTypeReference(typeDefinition);
                if (!_architectureTypes.Contains(type) && !type.IsCompilerGenerated)
                {
                    _architectureTypes.Add(type);
                }
            });

            _namespaceRegistry.Namespaces
            .Where(ns => RegexUtils.MatchNamespaces(namespaceFilter, ns.FullName))
            .ForEach(ns =>
            {
                _loadTaskRegistry.Add(typeof(AddTypesToNamespace),
                                      new AddTypesToNamespace(ns, _architectureTypes));
            });
        }