private IList <NetMethod> CreateMethods(TypeDefinition type, NetType typeModel)
        {
            var methodScanner = new MethodScanner(Module, Factory, Logger);

            return(type.Methods
                   .Where(IncludeMethod)
                   .Select(method => methodScanner.ScanMethod(method, typeModel))
                   .ToList());
        }
Esempio n. 2
0
        public NetType ScanType(TypeDefinition type)
        {
            Logger.LogTrace("  Scanning type '{0}'", type.Name.GetString(Reader));

            if (IncludeType(type) == false)
            {
                return(null);
            }

            var typeModel = Factory.CreateTypeModel(type.GetTypeKey(Reader));

            typeModel.Type         = GetTypeClass(type);
            typeModel.Name         = type.Name.GetString(Reader);
            typeModel.Namespace    = type.Namespace.GetString(Reader);
            typeModel.IsStatic     = IsStatic(type);
            typeModel.IsAbstract   = IsAbstract(type);
            typeModel.IsSealed     = IsSealed(type);
            typeModel.HasAttribute = HasAttribute(type);

            SetBaseType(type, typeModel);
            SetImplementedInterfaces(type, typeModel);
            SetAttributes(type, typeModel);

            var methodScanner = new MethodScanner(Reader, Factory, Logger);

            foreach (var method in type.GetMethods().Select(Reader.GetMethodDefinition))
            {
                var methodModel = methodScanner.ScanMethod(method, typeModel);

                if (methodModel == null)
                {
                    continue;
                }

                typeModel.Methods.Add(methodModel);
            }

            return(typeModel);
        }