Re-factoring / boilerplate code
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
All rights reserved.
|
All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
@@ -21,7 +22,7 @@ namespace Il2CppInspector.Reflection {
|
|||||||
public string FullName { get; }
|
public string FullName { get; }
|
||||||
|
|
||||||
// Entry point method for the assembly
|
// Entry point method for the assembly
|
||||||
//public MethodInfo EntryPoint { get; } // TODO
|
public MethodInfo EntryPoint => throw new NotImplementedException();
|
||||||
|
|
||||||
// List of types defined in the assembly
|
// List of types defined in the assembly
|
||||||
public List<TypeInfo> DefinedTypes { get; } = new List<TypeInfo>();
|
public List<TypeInfo> DefinedTypes { get; } = new List<TypeInfo>();
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
All rights reserved.
|
All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace Il2CppInspector.Reflection {
|
namespace Il2CppInspector.Reflection {
|
||||||
@@ -29,16 +30,16 @@ namespace Il2CppInspector.Reflection {
|
|||||||
// https://docs.microsoft.com/en-us/dotnet/api/system.reflection.fieldinfo.isfamilyandassembly?view=netframework-4.7.1#System_Reflection_FieldInfo_IsFamilyAndAssembly
|
// https://docs.microsoft.com/en-us/dotnet/api/system.reflection.fieldinfo.isfamilyandassembly?view=netframework-4.7.1#System_Reflection_FieldInfo_IsFamilyAndAssembly
|
||||||
|
|
||||||
// True if the field is declared as internal
|
// True if the field is declared as internal
|
||||||
public bool IsAssembly { get; } // TODO
|
public bool IsAssembly => throw new NotImplementedException();
|
||||||
|
|
||||||
// True if the field is declared as protected
|
// True if the field is declared as protected
|
||||||
public bool IsFamily { get; } // TODO
|
public bool IsFamily => throw new NotImplementedException();
|
||||||
|
|
||||||
// True if the field is declared as 'protected private' (always false)
|
// True if the field is declared as 'protected private' (always false)
|
||||||
public bool IsFamilyAndAssembly => false;
|
public bool IsFamilyAndAssembly => false;
|
||||||
|
|
||||||
// True if the field is declared as protected public
|
// True if the field is declared as protected public
|
||||||
public bool IsFamilyOrAssembly { get; } // TODO
|
public bool IsFamilyOrAssembly => throw new NotImplementedException();
|
||||||
|
|
||||||
// True if the field is declared as readonly
|
// True if the field is declared as readonly
|
||||||
public bool IsInitOnly => (Attributes & FieldAttributes.InitOnly) == FieldAttributes.InitOnly;
|
public bool IsInitOnly => (Attributes & FieldAttributes.InitOnly) == FieldAttributes.InitOnly;
|
||||||
@@ -52,7 +53,7 @@ namespace Il2CppInspector.Reflection {
|
|||||||
// True if the field is declared as static
|
// True if the field is declared as static
|
||||||
public bool IsStatic => (Attributes & FieldAttributes.Static) == FieldAttributes.Static;
|
public bool IsStatic => (Attributes & FieldAttributes.Static) == FieldAttributes.Static;
|
||||||
|
|
||||||
public override MemberTypes MemberType { get; }
|
public override MemberTypes MemberType => MemberTypes.Field;
|
||||||
|
|
||||||
public FieldInfo(Il2CppInspector pkg, int fieldIndex, TypeInfo declaringType) :
|
public FieldInfo(Il2CppInspector pkg, int fieldIndex, TypeInfo declaringType) :
|
||||||
base(declaringType) {
|
base(declaringType) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
All rights reserved.
|
All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ namespace Il2CppInspector.Reflection {
|
|||||||
public Assembly Assembly { get; }
|
public Assembly Assembly { get; }
|
||||||
|
|
||||||
// Custom attributes for this member
|
// Custom attributes for this member
|
||||||
public IEnumerable<CustomAttributeData> CustomAttributes { get; } // TODO
|
public IEnumerable<CustomAttributeData> CustomAttributes => throw new NotImplementedException();
|
||||||
|
|
||||||
// Type that this type is declared in for nested types
|
// Type that this type is declared in for nested types
|
||||||
public TypeInfo DeclaringType { get; }
|
public TypeInfo DeclaringType { get; }
|
||||||
|
|||||||
20
Il2CppInspector/Reflection/MethodBase.cs
Normal file
20
Il2CppInspector/Reflection/MethodBase.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Katy Coe - http://www.hearthcode.org - http://www.djkaty.com
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Il2CppInspector.Reflection
|
||||||
|
{
|
||||||
|
public abstract class MethodBase : MemberInfo
|
||||||
|
{
|
||||||
|
// (not code attributes)
|
||||||
|
public MethodAttributes Attributes { get; set; }
|
||||||
|
|
||||||
|
// TODO: ContainsGenericParameters
|
||||||
|
|
||||||
|
protected MethodBase(TypeInfo declaringType) : base(declaringType) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
19
Il2CppInspector/Reflection/MethodInfo.cs
Normal file
19
Il2CppInspector/Reflection/MethodInfo.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Katy Coe - http://www.hearthcode.org - http://www.djkaty.com
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Il2CppInspector.Reflection
|
||||||
|
{
|
||||||
|
public class MethodInfo : MethodBase
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
public override MemberTypes MemberType => MemberTypes.Method;
|
||||||
|
|
||||||
|
public MethodInfo(Il2CppInspector pkg, int methodIndex, TypeInfo declaringType) :
|
||||||
|
base(declaringType) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,35 +4,29 @@
|
|||||||
All rights reserved.
|
All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
namespace Il2CppInspector.Reflection
|
namespace Il2CppInspector.Reflection
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
public abstract class MethodBase : MemberInfo
|
|
||||||
{
|
|
||||||
// (not code attributes)
|
|
||||||
public MethodAttributes Attributes { get; set; }
|
|
||||||
|
|
||||||
// TODO: ContainsGenericParameters
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ConstructorInfo : MethodBase
|
public class ConstructorInfo : MethodBase
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
public override MemberTypes MemberType => MemberTypes.Constructor | MemberTypes.Method;
|
||||||
|
|
||||||
public class MethodInfo : MethodBase
|
public ConstructorInfo(Il2CppInspector pkg, int methodIndex, TypeInfo declaringType) :
|
||||||
{
|
base(declaringType) { }
|
||||||
// TODO
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PropertyInfo : MemberInfo
|
public class PropertyInfo : MemberInfo
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
|
public override MemberTypes MemberType => MemberTypes.Property | MemberTypes.Method;
|
||||||
|
public PropertyInfo(Il2CppInspector pkg, int methodIndex, TypeInfo declaringType) :
|
||||||
|
base(declaringType) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CustomAttributeData
|
public class CustomAttributeData
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ namespace Il2CppInspector.Reflection {
|
|||||||
|
|
||||||
// Information/flags about the type
|
// Information/flags about the type
|
||||||
// Undefined if the Type represents a generic type parameter
|
// Undefined if the Type represents a generic type parameter
|
||||||
public TypeAttributes Attributes { get; } // TODO
|
public TypeAttributes Attributes => throw new NotImplementedException();
|
||||||
|
|
||||||
// Type that this type inherits from
|
// Type that this type inherits from
|
||||||
public TypeInfo BaseType { get; } // TODO
|
public TypeInfo BaseType => throw new NotImplementedException();
|
||||||
|
|
||||||
// True if the type contains unresolved generic type parameters
|
// True if the type contains unresolved generic type parameters
|
||||||
public bool ContainsGenericParameters { get; }
|
public bool ContainsGenericParameters { get; }
|
||||||
@@ -39,16 +39,16 @@ namespace Il2CppInspector.Reflection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ConstructorInfo> DeclaredConstructors { get; } // TODO
|
public List<ConstructorInfo> DeclaredConstructors => throw new NotImplementedException();
|
||||||
public List<EventInfo> DeclaredEvents { get; } // TODO
|
public List<EventInfo> DeclaredEvents => throw new NotImplementedException();
|
||||||
public List<FieldInfo> DeclaredFields { get; } = new List<FieldInfo>();
|
public List<FieldInfo> DeclaredFields { get; } = new List<FieldInfo>();
|
||||||
public List<MemberInfo> DeclaredMembers { get; } // TODO
|
public List<MemberInfo> DeclaredMembers => throw new NotImplementedException();
|
||||||
public List<MethodInfo> DeclaredMethods { get; } // TODO
|
public List<MethodInfo> DeclaredMethods => throw new NotImplementedException();
|
||||||
public List<TypeInfo> DeclaredNestedTypes { get; } // TODO
|
public List<TypeInfo> DeclaredNestedTypes => throw new NotImplementedException();
|
||||||
public List<PropertyInfo> DeclaredProperties { get; } // TODO
|
public List<PropertyInfo> DeclaredProperties => throw new NotImplementedException();
|
||||||
|
|
||||||
// Method that the type is declared in if this is a type parameter of a generic method
|
// Method that the type is declared in if this is a type parameter of a generic method
|
||||||
public MethodBase DeclaringMethod { get; } // TODO
|
public MethodBase DeclaringMethod => throw new NotImplementedException();
|
||||||
|
|
||||||
// Gets the type of the object encompassed or referred to by the current array, pointer or reference type
|
// Gets the type of the object encompassed or referred to by the current array, pointer or reference type
|
||||||
public TypeInfo ElementType { get; }
|
public TypeInfo ElementType { get; }
|
||||||
@@ -68,22 +68,22 @@ namespace Il2CppInspector.Reflection {
|
|||||||
public bool HasElementType => ElementType != null;
|
public bool HasElementType => ElementType != null;
|
||||||
public bool IsAbstract { get; }
|
public bool IsAbstract { get; }
|
||||||
public bool IsArray { get; }
|
public bool IsArray { get; }
|
||||||
public bool IsByRef { get; } // TODO
|
public bool IsByRef => throw new NotImplementedException();
|
||||||
public bool IsClass { get; }
|
public bool IsClass { get; }
|
||||||
public bool IsEnum { get; } // TODO
|
public bool IsEnum => throw new NotImplementedException();
|
||||||
public bool IsGenericParameter { get; }
|
public bool IsGenericParameter { get; }
|
||||||
public bool IsGenericType { get; } // TODO
|
public bool IsGenericType => throw new NotImplementedException();
|
||||||
public bool IsGenericTypeDefinition { get; } // TODO
|
public bool IsGenericTypeDefinition => throw new NotImplementedException();
|
||||||
public bool IsInterface { get; }
|
public bool IsInterface { get; }
|
||||||
public bool IsNested { get; } // TODO
|
public bool IsNested { get; } // TODO: Partially implemented
|
||||||
public bool IsNestedPrivate { get; } // TODO
|
public bool IsNestedPrivate => throw new NotImplementedException();
|
||||||
public bool IsNestedPublic { get; } // TODO
|
public bool IsNestedPublic => throw new NotImplementedException();
|
||||||
public bool IsPointer { get; } // TODO
|
public bool IsPointer { get; }
|
||||||
public bool IsPrimitive { get; } // TODO
|
public bool IsPrimitive => throw new NotImplementedException();
|
||||||
public bool IsPublic { get; }
|
public bool IsPublic { get; }
|
||||||
public bool IsSealed { get; }
|
public bool IsSealed { get; }
|
||||||
public bool IsSerializable { get; }
|
public bool IsSerializable { get; }
|
||||||
public bool IsValueType { get; } // TODO
|
public bool IsValueType => throw new NotImplementedException();
|
||||||
|
|
||||||
public override MemberTypes MemberType { get; }
|
public override MemberTypes MemberType { get; }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user