Esempio n. 1
0
 private PropertyModel(PropertyInfo prop, TypeModel typeModel) : this(prop.Name)
 {
     //TypeModel = typeModel;
     Getter     = prop.GetMethod == null ? null : new MethodModel(prop.GetMethod);
     Setter     = prop.SetMethod == null ? null : new MethodModel(prop.SetMethod);
     Type       = typeModel;
     Attributes = prop.GetCustomAttributes(false).Select(x => TypeModel.GetType(x.GetType())).ToList();
     Access     = SetAccessLevel();
 }
Esempio n. 2
0
        private TypeModel EmitReturnType(MethodBase method)
        {
            MethodInfo methodInfo = method as MethodInfo;

            if (methodInfo == null)
            {
                return(null);
            }
            return(TypeModel.GetType(methodInfo.ReturnType));
        }
Esempio n. 3
0
        private IEnumerable <TypeModel> EmitAttributes(MethodBase method)
        {
            List <TypeModel> attributes = new List <TypeModel>();

            foreach (var methodAttribute in method.GetCustomAttributes(false))
            {
                attributes.Add(TypeModel.GetType(methodAttribute.GetType()));
            }

            return(attributes);
        }
Esempio n. 4
0
 public FieldModel(object[] attributes, string name, bool _private, bool _readonly, TypeModel typeModel)
 {
     Name       = name;
     TypeModel  = typeModel;
     Attributes = attributes.Select(x => TypeModel.GetType(x.GetType())).ToList();
     if (_private)
     {
         Access = AccessLevel.Private;
     }
     else if (typeModel.Modifiers != null)
     {
         Access = typeModel.Modifiers.Item1;
     }
     IsReadOnly = _readonly;
 }
Esempio n. 5
0
 private IEnumerable <FieldModel> EmitParameters(IEnumerable <ParameterInfo> parms)
 {
     return(from parm in parms
            select new FieldModel(parm.GetCustomAttributes(false), parm.Name, false, false, TypeModel.GetType(parm.ParameterType)));
 }
Esempio n. 6
0
 public static IEnumerable <PropertyModel> EmitProperties(PropertyInfo[] props)
 {
     return(from prop in props
            //where prop.GetGetMethod().GetVisible() || prop.GetSetMethod().GetVisible()
            select new PropertyModel(prop, TypeModel.GetType(prop.PropertyType)));
 }