示例#1
0
        public static List <PropertyModel> EmitProperties(Type type)
        {
            List <PropertyInfo> props = type
                                        .GetProperties(BindingFlags.NonPublic | BindingFlags.DeclaredOnly | BindingFlags.Public |
                                                       BindingFlags.Static | BindingFlags.Instance).ToList();

            return(props.Where(t => t.GetGetMethod().GetVisible() || t.GetSetMethod().GetVisible())
                   .Select(t => new PropertyModel(t.Name, TypeModel.GetOrAdd(t.PropertyType))).ToList());
        }
示例#2
0
        private static TypeModel EmitReturnType(MethodBase method)
        {
            MethodInfo methodInfo = method as MethodInfo;

            if (methodInfo == null)
            {
                return(null);
            }
            TypeModel.StoreType(methodInfo.ReturnType);
            return(TypeModel.GetOrAdd(methodInfo.ReturnType));
        }
示例#3
0
        public MethodModel(BaseCore.Model.MethodBase baseMethod)
        {
            this.Name          = baseMethod.Name;
            this.IsAbstract    = baseMethod.IsAbstract.ToLogicEnum();
            this.Accessibility = baseMethod.Accessibility.ToLogicEnum();
            this.Extension     = baseMethod.Extension;
            this.ReturnType    = TypeModel.GetOrAdd(baseMethod.ReturnType);
            this.IsStatic      = baseMethod.IsStatic.ToLogicEnum();
            this.IsVirtual     = baseMethod.VirtualEnum.ToLogicEnum();

            GenericArguments = baseMethod.GenericArguments?.Select(TypeModel.GetOrAdd).ToList();

            Parameters = baseMethod.Parameters?.Select(t => new ParameterModel(t)).ToList();
        }
示例#4
0
 private static List <ParameterModel> EmitParameters(MethodBase method)
 {
     return(method.GetParameters().Select(t => new ParameterModel(t.Name, TypeModel.GetOrAdd(t.ParameterType))).ToList());
 }
示例#5
0
 private List <TypeModel> EmitGenericArguments(MethodBase method)
 {
     return(method.GetGenericArguments().Select(t => TypeModel.GetOrAdd(t)).ToList());
 }
 public NamespaceModel(NamespaceBase namespaceBase)
 {
     this.Name  = namespaceBase.Name;
     this.Types = namespaceBase.Types?.Select(t => TypeModel.GetOrAdd(t)).ToList();
 }
 public NamespaceModel(string name, List <Type> types)
 {
     Name  = name;
     Types = types.OrderBy(t => t.Name).Select(t => TypeModel.GetOrAdd(t)).ToList();
 }
示例#8
0
 public FieldModel(FieldBase baseProperty)
 {
     Name = baseProperty.Name;
     Type = TypeModel.GetOrAdd(baseProperty.Type);
 }
示例#9
0
 public PropertyModel(PropertyBase baseProperty)
 {
     Name = baseProperty.Name;
     Type = TypeModel.GetOrAdd(baseProperty.Type);
 }
 public ParameterModel(ParameterBase baseElement)
 {
     Name = baseElement.Name;
     Type = TypeModel.GetOrAdd(baseElement.Type);
 }