Пример #1
0
        public AssemblyDataType(Type type)
        {
            Name = type.Name;
            accessModificator = DataAccessModificator.GetTypeModifiers(type);
            typeAttribute     = DataAttribute.GetTypeAtributes(type);
            typeClass         = DataTypeClass.GetTypeClass(type);
            this.type         = type;

            Fields      = new List <AssemblyTypeMember>();
            IsGenerated = IsCompilerGenerated(type);

            var flags = BindingFlags.Instance |
                        BindingFlags.Static |
                        BindingFlags.NonPublic |
                        BindingFlags.Public |
                        BindingFlags.DeclaredOnly;

            foreach (var fieldInfo in type.GetFields(flags))
            {
                Fields.Add(new AssemblyTypeMember(fieldInfo, IsCompilerGenerated(fieldInfo)));
            }

            foreach (var properyInfo in type.GetProperties(flags))
            {
                Fields.Add(new AssemblyTypeMember(properyInfo, IsCompilerGenerated(properyInfo)));
            }

            foreach (var methodInfo in type.GetMethods(flags))
            {
                if (!methodInfo.IsDefined(typeof(ExtensionAttribute), false))
                {
                    Fields.Add(new AssemblyTypeMember(methodInfo, IsCompilerGenerated(methodInfo)));
                }
            }
        }
Пример #2
0
        public TypeField(FieldInfo fieldInfo)
        {
            name           = fieldInfo.Name;
            this.fieldInfo = fieldInfo;

            accessModificator = DataAccessModificator.GetTypeModifiers(fieldInfo);
        }
Пример #3
0
        public TypeMethod(MethodInfo methodInfo, bool isExtension = false)
        {
            name = methodInfo.Name;
            IsExtensionMethod = isExtension;
            this.methodInfo   = methodInfo;

            accessModificator = DataAccessModificator.GetTypeModifiers(methodInfo);
            typeAttribute     = DataAttribute.GetAttributes(methodInfo);
        }
Пример #4
0
        public AssemblyDataType(Type extendedType, MethodInfo[] extensionMethods)
        {
            Name = extendedType.Name;
            accessModificator = DataAccessModificator.GetTypeModifiers(extendedType);
            typeAttribute     = DataAttribute.GetTypeAtributes(extendedType);
            typeClass         = DataTypeClass.GetTypeClass(extendedType);
            this.type         = extendedType;

            Fields = new List <AssemblyTypeMember>();
            foreach (var methodInfo in extensionMethods)
            {
                Fields.Add(new AssemblyTypeMember(methodInfo, IsCompilerGenerated(methodInfo), true));
            }
        }