Пример #1
0
 public static BaseNetProp GetNetProp(IHasNetProps instance, NetPropertyAttributeData propAttr)
 {
     if (propAttr.PropertyType.IsUnmanaged())
     {
         var genericType = typeof(UnmanagedNetProp <>).MakeGenericType(propAttr.PropertyType);
         return(Activator.CreateInstance(genericType, instance, propAttr) as BaseNetProp);
     }
     return(null);
 }
Пример #2
0
 public static List <NetPropertyAttributeData> GetAttributeData(Type t)
 {
     if (!_attributeCache.ContainsKey(t))
     {
         _attributeCache[t] = new List <NetPropertyAttributeData>();
         foreach (PropertyInfo p in t.GetProperties())
         {
             foreach (Attribute a in p.GetCustomAttributes(true))
             {
                 if (a is NetPropertyAttribute np)
                 {
                     var attrData = new NetPropertyAttributeData(p, np);
                     _attributeCache[t].Add(attrData);
                 }
             }
         }
     }
     return(_attributeCache[t]);
 }
Пример #3
0
 public UnmanagedNetProp(IHasNetProps instance, NetPropertyAttributeData data)
     : base(instance, data)
 {
     _get = data.Getter.CreateDelegate(typeof(Func <T>), instance) as Func <T>;
     _set = data.Setter.CreateDelegate(typeof(Action <T>), instance) as Action <T>;
 }
Пример #4
0
 public BaseNetProp(IHasNetProps instance, NetPropertyAttributeData propAttr)
 {
     Entity   = instance;
     PropAttr = propAttr;
 }