public static List <ParameterAttributeIndexedTopics> GetParameterIndexedTopics(Type type, object instanceValue) { var properties = PropertiesExtractor.GetPropertiesWithParameterAttribute(type); var parameterObjects = new List <ParameterAttributeIndexedTopics>(); foreach (var property in properties) { var parameterAttribute = property.GetCustomAttribute <ParameterAttribute>(true); if (parameterAttribute.Parameter.Indexed) { parameterObjects.Add(new ParameterAttributeIndexedTopics { ParameterAttribute = parameterAttribute, PropertyInfo = property }); } } return(parameterObjects); }
public void InitTupleComponentsFromTypeAttributes(Type type, ABIType abiType) { if (abiType is TupleType abiTupleType) { var properties = PropertiesExtractor.GetPropertiesWithParameterAttribute(type); var parameters = new List <Parameter>(); var parameterObjects = new List <Parameter>(); foreach (var property in properties) { var parameterAttribute = property.GetCustomAttribute <ParameterAttribute>(true); parameterAttribute.Parameter.DecodedType = property.PropertyType; InitTupleComponentsFromTypeAttributes(property.PropertyType, parameterAttribute.Parameter.ABIType); parameterObjects.Add(parameterAttribute.Parameter); } abiTupleType.SetComponents(parameterObjects.ToArray()); } var abiArrayType = abiType as ArrayType; while (abiArrayType != null) { var arrayListType = ArrayTypeDecoder.GetIListElementType(type); if (arrayListType == null) { throw new Exception("Only types that implement IList<T> are supported for encoding"); } if (abiArrayType.ElementType is TupleType arrayTupleType) { InitTupleComponentsFromTypeAttributes(arrayListType, arrayTupleType); abiArrayType = null; } else { abiArrayType = abiArrayType.ElementType as ArrayType; } } }