internal static IList <CustomAttributeTypedArgument> ExtractListOfValues(Type elementType, ITypeUniverse universe, Module module, uint size, byte[] blob, ref int index) { System.Reflection.Adds.CorElementType typeId = SignatureUtil.GetTypeId(elementType); List <CustomAttributeTypedArgument> customAttributeTypedArguments = new List <CustomAttributeTypedArgument>((int)size); if (typeId == System.Reflection.Adds.CorElementType.Object) { for (int i = 0; (long)i < (ulong)size; i++) { System.Reflection.Adds.CorElementType corElementType = SignatureUtil.ExtractElementType(blob, ref index); SignatureUtil.VerifyElementType(corElementType); Type builtInType = null; object obj = null; if (corElementType == System.Reflection.Adds.CorElementType.SzArray) { throw new NotImplementedException(MetadataStringTable.ArrayInsideArrayInAttributeNotSupported); } if (corElementType != System.Reflection.Adds.CorElementType.Enum) { builtInType = universe.GetBuiltInType(corElementType); obj = SignatureUtil.ExtractValue(corElementType, blob, ref index); } else { builtInType = SignatureUtil.ExtractTypeValue(universe, module, blob, ref index); if (builtInType == null) { throw new ArgumentException(MetadataStringTable.InvalidCustomAttributeFormatForEnum); } System.Reflection.Adds.CorElementType typeId1 = SignatureUtil.GetTypeId(MetadataOnlyModule.GetUnderlyingType(builtInType)); obj = SignatureUtil.ExtractValue(typeId1, blob, ref index); } customAttributeTypedArguments.Add(new CustomAttributeTypedArgument(builtInType, obj)); } } else if (typeId != System.Reflection.Adds.CorElementType.Type) { if (typeId == System.Reflection.Adds.CorElementType.SzArray) { throw new ArgumentException(MetadataStringTable.JaggedArrayInAttributeNotSupported); } for (int j = 0; (long)j < (ulong)size; j++) { object obj1 = SignatureUtil.ExtractValue(typeId, blob, ref index); customAttributeTypedArguments.Add(new CustomAttributeTypedArgument(elementType, obj1)); } } else { for (int k = 0; (long)k < (ulong)size; k++) { object obj2 = SignatureUtil.ExtractTypeValue(universe, module, blob, ref index); customAttributeTypedArguments.Add(new CustomAttributeTypedArgument(elementType, obj2)); } } return(customAttributeTypedArguments.AsReadOnly()); }
internal static NamedArgumentType ExtractNamedArgumentType(byte[] customAttributeBlob, ref int index) { byte num = (byte)SignatureUtil.ExtractValue(System.Reflection.Adds.CorElementType.Byte, customAttributeBlob, ref index); if (num == 84) { return(NamedArgumentType.Property); } if (num != 83) { CultureInfo invariantCulture = CultureInfo.InvariantCulture; object[] invalidCustomAttributeFormat = new object[] { MetadataStringTable.InvalidCustomAttributeFormat, MetadataStringTable.ExpectedPropertyOrFieldId }; throw new ArgumentException(string.Format(invariantCulture, "{0} {1}", invalidCustomAttributeFormat)); } return(NamedArgumentType.Field); }
internal static uint ExtractUIntValue(byte[] blob, ref int index) { return((uint)SignatureUtil.ExtractValue(System.Reflection.Adds.CorElementType.UInt, blob, ref index)); }
internal static string ExtractStringValue(byte[] blob, ref int index) { return((string)SignatureUtil.ExtractValue(System.Reflection.Adds.CorElementType.String, blob, ref index)); }