Re-factoring / boilerplate code
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
All rights reserved.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@@ -21,7 +22,7 @@ namespace Il2CppInspector.Reflection {
|
||||
public string FullName { get; }
|
||||
|
||||
// Entry point method for the assembly
|
||||
//public MethodInfo EntryPoint { get; } // TODO
|
||||
public MethodInfo EntryPoint => throw new NotImplementedException();
|
||||
|
||||
// List of types defined in the assembly
|
||||
public List<TypeInfo> DefinedTypes { get; } = new List<TypeInfo>();
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
All rights reserved.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.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
|
||||
|
||||
// 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
|
||||
public bool IsFamily { get; } // TODO
|
||||
public bool IsFamily => throw new NotImplementedException();
|
||||
|
||||
// True if the field is declared as 'protected private' (always false)
|
||||
public bool IsFamilyAndAssembly => false;
|
||||
|
||||
// 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
|
||||
public bool IsInitOnly => (Attributes & FieldAttributes.InitOnly) == FieldAttributes.InitOnly;
|
||||
@@ -52,7 +53,7 @@ namespace Il2CppInspector.Reflection {
|
||||
// True if the field is declared as 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) :
|
||||
base(declaringType) {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
All rights reserved.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
@@ -14,7 +15,7 @@ namespace Il2CppInspector.Reflection {
|
||||
public Assembly Assembly { get; }
|
||||
|
||||
// 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
|
||||
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.
|
||||
*/
|
||||
|
||||
using System.Reflection;
|
||||
|
||||
namespace Il2CppInspector.Reflection
|
||||
{
|
||||
/*
|
||||
public abstract class MethodBase : MemberInfo
|
||||
{
|
||||
// (not code attributes)
|
||||
public MethodAttributes Attributes { get; set; }
|
||||
|
||||
// TODO: ContainsGenericParameters
|
||||
}
|
||||
|
||||
public class ConstructorInfo : MethodBase
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
public override MemberTypes MemberType => MemberTypes.Constructor | MemberTypes.Method;
|
||||
|
||||
public class MethodInfo : MethodBase
|
||||
{
|
||||
// TODO
|
||||
public ConstructorInfo(Il2CppInspector pkg, int methodIndex, TypeInfo declaringType) :
|
||||
base(declaringType) { }
|
||||
}
|
||||
|
||||
public class PropertyInfo : MemberInfo
|
||||
{
|
||||
// TODO
|
||||
public override MemberTypes MemberType => MemberTypes.Property | MemberTypes.Method;
|
||||
public PropertyInfo(Il2CppInspector pkg, int methodIndex, TypeInfo declaringType) :
|
||||
base(declaringType) { }
|
||||
}
|
||||
|
||||
public class CustomAttributeData
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -18,10 +18,10 @@ namespace Il2CppInspector.Reflection {
|
||||
|
||||
// Information/flags about the type
|
||||
// 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
|
||||
public TypeInfo BaseType { get; } // TODO
|
||||
public TypeInfo BaseType => throw new NotImplementedException();
|
||||
|
||||
// True if the type contains unresolved generic type parameters
|
||||
public bool ContainsGenericParameters { get; }
|
||||
@@ -39,16 +39,16 @@ namespace Il2CppInspector.Reflection {
|
||||
}
|
||||
}
|
||||
|
||||
public List<ConstructorInfo> DeclaredConstructors { get; } // TODO
|
||||
public List<EventInfo> DeclaredEvents { get; } // TODO
|
||||
public List<ConstructorInfo> DeclaredConstructors => throw new NotImplementedException();
|
||||
public List<EventInfo> DeclaredEvents => throw new NotImplementedException();
|
||||
public List<FieldInfo> DeclaredFields { get; } = new List<FieldInfo>();
|
||||
public List<MemberInfo> DeclaredMembers { get; } // TODO
|
||||
public List<MethodInfo> DeclaredMethods { get; } // TODO
|
||||
public List<TypeInfo> DeclaredNestedTypes { get; } // TODO
|
||||
public List<PropertyInfo> DeclaredProperties { get; } // TODO
|
||||
public List<MemberInfo> DeclaredMembers => throw new NotImplementedException();
|
||||
public List<MethodInfo> DeclaredMethods => throw new NotImplementedException();
|
||||
public List<TypeInfo> DeclaredNestedTypes => throw new NotImplementedException();
|
||||
public List<PropertyInfo> DeclaredProperties => throw new NotImplementedException();
|
||||
|
||||
// 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
|
||||
public TypeInfo ElementType { get; }
|
||||
@@ -68,22 +68,22 @@ namespace Il2CppInspector.Reflection {
|
||||
public bool HasElementType => ElementType != null;
|
||||
public bool IsAbstract { get; }
|
||||
public bool IsArray { get; }
|
||||
public bool IsByRef { get; } // TODO
|
||||
public bool IsByRef => throw new NotImplementedException();
|
||||
public bool IsClass { get; }
|
||||
public bool IsEnum { get; } // TODO
|
||||
public bool IsEnum => throw new NotImplementedException();
|
||||
public bool IsGenericParameter { get; }
|
||||
public bool IsGenericType { get; } // TODO
|
||||
public bool IsGenericTypeDefinition { get; } // TODO
|
||||
public bool IsGenericType => throw new NotImplementedException();
|
||||
public bool IsGenericTypeDefinition => throw new NotImplementedException();
|
||||
public bool IsInterface { get; }
|
||||
public bool IsNested { get; } // TODO
|
||||
public bool IsNestedPrivate { get; } // TODO
|
||||
public bool IsNestedPublic { get; } // TODO
|
||||
public bool IsPointer { get; } // TODO
|
||||
public bool IsPrimitive { get; } // TODO
|
||||
public bool IsNested { get; } // TODO: Partially implemented
|
||||
public bool IsNestedPrivate => throw new NotImplementedException();
|
||||
public bool IsNestedPublic => throw new NotImplementedException();
|
||||
public bool IsPointer { get; }
|
||||
public bool IsPrimitive => throw new NotImplementedException();
|
||||
public bool IsPublic { get; }
|
||||
public bool IsSealed { get; }
|
||||
public bool IsSerializable { get; }
|
||||
public bool IsValueType { get; } // TODO
|
||||
public bool IsValueType => throw new NotImplementedException();
|
||||
|
||||
public override MemberTypes MemberType { get; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user