private static ICollection<TypeReference> GetCustomAttributeUsedTypes(CustomAttribute attribute) { V_0 = new List<TypeReference>(); attribute.Resolve(); V_0.AddRange(Utilities.GetTypeReferenceTypesDepedningOn(attribute.get_AttributeType())); V_1 = 0; while (V_1 < attribute.get_ConstructorArguments().get_Count()) { V_0.AddRange(AttributesUtilities.GetAttributeArgumentValueUsedTypes(attribute.get_ConstructorArguments().get_Item(V_1))); V_1 = V_1 + 1; } if (attribute.get_HasConstructorArguments() || attribute.get_HasFields() || attribute.get_HasProperties()) { if (attribute.get_HasProperties()) { V_2 = attribute.get_AttributeType().Resolve(); V_0.AddRange(AttributesUtilities.GetAttributeNamedArgsUsedTypes(V_2, attribute.get_Properties(), false)); } if (attribute.get_HasFields()) { V_3 = attribute.get_AttributeType().Resolve(); V_0.AddRange(AttributesUtilities.GetAttributeNamedArgsUsedTypes(V_3, attribute.get_Fields(), true)); } } return V_0; }
private static ICollection<TypeReference> GetAttributeNamedArgsUsedTypes(TypeDefinition attributeType, Collection<CustomAttributeNamedArgument> namedArguments, bool fields) { V_0 = new List<TypeReference>(); V_1 = 0; while (V_1 < namedArguments.get_Count()) { if (attributeType != null) { if (fields) { stackVariable19 = attributeType.get_Fields(); } else { stackVariable19 = attributeType.get_Properties(); } V_2 = null; V_3 = stackVariable19; V_4 = attributeType; do { V_2 = Utilities.FindMemberArgumentRefersTo(V_3, namedArguments.get_Item(V_1)); if (V_4.get_BaseType() == null) { break; } V_4 = V_4.get_BaseType().Resolve(); if (V_4 == null) { break; } if (fields) { stackVariable40 = V_4.get_Fields(); } else { stackVariable40 = V_4.get_Properties(); } V_3 = stackVariable40; } while (V_2 == null); if (V_2 != null) { V_0.Add(V_2.get_DeclaringType()); } } V_6 = namedArguments.get_Item(V_1); V_0.AddRange(AttributesUtilities.GetAttributeArgumentValueUsedTypes(V_6.get_Argument())); V_1 = V_1 + 1; } return V_0; }
private static ICollection<TypeReference> GetAttributeArgumentArrayUsedTypes(CustomAttributeArgument argument) { V_0 = new List<TypeReference>(); V_1 = argument.get_Value() as CustomAttributeArgument[]; V_0.Add(argument.get_Type()); V_2 = 0; while (V_2 < (int)V_1.Length) { V_0.AddRange(AttributesUtilities.GetAttributeArgumentValueUsedTypes(V_1[V_2])); V_2 = V_2 + 1; } return V_0; }
private static ICollection<TypeReference> GetAttributeArgumentValueUsedTypes(CustomAttributeArgument argument) { if (argument.get_Value() as CustomAttributeArgument != null) { return AttributesUtilities.GetAttributeArgumentValueUsedTypes((CustomAttributeArgument)argument.get_Value()); } if (argument.get_Value() as CustomAttributeArgument[] != null) { return AttributesUtilities.GetAttributeArgumentArrayUsedTypes(argument); } V_0 = new List<TypeReference>(); if (argument.get_Type().get_IsDefinition()) { stackVariable12 = argument.get_Type() as TypeDefinition; } else { stackVariable12 = argument.get_Type().Resolve(); } V_1 = stackVariable12; if (V_1 == null || !V_1.get_IsEnum()) { if (String.op_Equality(argument.get_Type().get_Name(), "Type") && String.op_Equality(argument.get_Type().get_Namespace(), "System")) { V_0.AddRange(Utilities.GetTypeReferenceTypesDepedningOn(argument.get_Value() as TypeReference)); } } else { V_2 = EnumValueToFieldCombinationMatcher.GetEnumFieldDefinitionByValue(V_1.get_Fields(), argument.get_Value(), V_1.get_CustomAttributes()); if (V_2.get_Count() != 0) { V_3 = 0; while (V_3 < V_2.get_Count()) { V_0.AddRange(Utilities.GetTypeReferenceTypesDepedningOn(V_2.get_Item(V_3).get_DeclaringType())); V_3 = V_3 + 1; } } } return V_0; }