private static List <TcpProperty> GetTypeProperties(Type typeData, Func <int, byte[]> byteArrayFactory, BitConverterHelper bitConverterHelper, Type typeId = null) { var tcpProperties = new List <TcpProperty>(); foreach (var property in typeData.GetProperties()) { var attribute = GetTcpDataAttribute(property); if (attribute == null) { continue; } TcpProperty tcpProperty; if (attribute.TcpDataType == TcpDataType.Compose && !property.PropertyType.IsPrimitive) { var tcpComposition = new TcpComposition(property.PropertyType, byteArrayFactory, bitConverterHelper, typeId); tcpProperty = new TcpProperty(property, attribute, typeData, tcpComposition); } else { tcpProperty = new TcpProperty(property, attribute, typeData); } tcpProperties.Add(tcpProperty); } return(tcpProperties); }
public TcpProperty(PropertyInfo propertyInfo, TcpDataAttribute attribute, Type accessorType, TcpComposition composition = null) { Attribute = attribute; IsValueType = accessorType.IsValueType; PropertyType = propertyInfo.PropertyType; _propertyInfo = propertyInfo; if (attribute.TcpDataType == TcpDataType.Compose && !propertyInfo.PropertyType.IsPrimitive) { Composition = composition ?? throw new ArgumentNullException(nameof(composition)); } }