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); }
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); } } }
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>; }
public BaseNetProp(IHasNetProps instance, NetPropertyAttributeData propAttr) { Entity = instance; PropAttr = propAttr; }