Model: Add MemberInfo.GetCustomAttributes(string)
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace Il2CppInspector.Reflection {
|
namespace Il2CppInspector.Reflection {
|
||||||
@@ -16,6 +17,8 @@ namespace Il2CppInspector.Reflection {
|
|||||||
// Custom attributes for this member
|
// Custom attributes for this member
|
||||||
public abstract IEnumerable<CustomAttributeData> CustomAttributes { get; }
|
public abstract IEnumerable<CustomAttributeData> CustomAttributes { get; }
|
||||||
|
|
||||||
|
public TypeInfo[] GetCustomAttributes(string fullTypeName) => CustomAttributes.Where(a => a.AttributeType.FullName == fullTypeName).Select(x => x.AttributeType).ToArray();
|
||||||
|
|
||||||
// Type that this type is declared in for nested types
|
// Type that this type is declared in for nested types
|
||||||
protected int declaringTypeDefinitionIndex { private get; set; } = -1;
|
protected int declaringTypeDefinitionIndex { private get; set; } = -1;
|
||||||
public TypeInfo DeclaringType => declaringTypeDefinitionIndex != -1? Assembly.Model.TypesByDefinitionIndex[declaringTypeDefinitionIndex] : null;
|
public TypeInfo DeclaringType => declaringTypeDefinitionIndex != -1? Assembly.Model.TypesByDefinitionIndex[declaringTypeDefinitionIndex] : null;
|
||||||
|
|||||||
Reference in New Issue
Block a user