Beispiel #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);
 }
Beispiel #2
0
        public void BuildNetProps(IHasNetProps objectInstance)
        {
            if (_props == null)
            {
                _props = new Dictionary <byte, BaseNetProp>();
            }

            var t            = objectInstance.GetType();
            var propAttrData = BaseNetProp.GetAttributeData(t);

            foreach (var propAttr in propAttrData)
            {
                var netProp = BaseNetProp.GetNetProp(objectInstance, propAttr);
                if (netProp != null)
                {
                    _props.Add(_netPropIndex++, netProp);
                }
            }
        }
Beispiel #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>;
 }
Beispiel #4
0
 public BaseNetProp(IHasNetProps instance, NetPropertyAttributeData propAttr)
 {
     Entity   = instance;
     PropAttr = propAttr;
 }