Implement Reflection.Assembly
This commit is contained in:
@@ -7,15 +7,10 @@ namespace Il2CppInspector.Reflection
|
||||
{
|
||||
public List<Assembly> Assemblies { get; } = new List<Assembly>();
|
||||
|
||||
// Factory instantiation via Il2CppReflector.Parse only
|
||||
private Il2CppReflector() { }
|
||||
|
||||
public static Il2CppReflector Parse(Il2CppInspector package) {
|
||||
var r = new Il2CppReflector();
|
||||
|
||||
// TODO: Populate reflection classes
|
||||
|
||||
return r;
|
||||
public Il2CppReflector(Il2CppInspector package) {
|
||||
// Create Assembly objects from Il2Cpp package
|
||||
for (var image = 0; image < package.Metadata.Images.Length; image++)
|
||||
Assemblies.Add(new Assembly(package, image));
|
||||
}
|
||||
|
||||
// Get the assembly in which a type is defined
|
||||
|
||||
40
Il2CppInspector/Reflection/Assembly.cs
Normal file
40
Il2CppInspector/Reflection/Assembly.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Il2CppInspector.Reflection {
|
||||
public class Assembly
|
||||
{
|
||||
// IL2CPP-specific data
|
||||
public Il2CppImageDefinition Definition { get; }
|
||||
public int Index { get; }
|
||||
|
||||
// TODO: CustomAttributes
|
||||
|
||||
// Name of the assembly
|
||||
public string FullName { get; }
|
||||
|
||||
// Entry point method for the assembly
|
||||
public MethodInfo EntryPoint { get; }
|
||||
|
||||
// List of types defined in the assembly
|
||||
public List<Type> DefinedTypes { get; } = new List<Type>();
|
||||
|
||||
// Get a type from its string name
|
||||
public Type GetType(string typeName) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
// Initialize from specified assembly index in package
|
||||
public Assembly(Il2CppInspector pkg, int imageIndex) {
|
||||
Definition = pkg.Metadata.Images[imageIndex];
|
||||
Index = Definition.assemblyIndex;
|
||||
FullName = pkg.Metadata.Strings[Definition.nameIndex];
|
||||
|
||||
if (Definition.entryPointIndex != -1) {
|
||||
// TODO: Generate EntryPoint method from entryPointIndex
|
||||
}
|
||||
|
||||
// TODO: Generate types in DefinedTypes from typeStart to typeStart+typeCount-1
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,25 +4,6 @@ using System.Reflection;
|
||||
|
||||
namespace Il2CppInspector.Reflection
|
||||
{
|
||||
public class Assembly
|
||||
{
|
||||
// TODO: CustomAttributes
|
||||
|
||||
// Name of the assembly
|
||||
public string FullName { get; set; }
|
||||
|
||||
// Entry point method for the assembly
|
||||
public MethodInfo EntryPoint { get; set; }
|
||||
|
||||
// List of types defined in the assembly
|
||||
public List<Type> DefinedTypes { get; } = new List<Type>();
|
||||
|
||||
// Get a type from its string name
|
||||
public Type GetType(string typeName) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class MemberInfo
|
||||
{
|
||||
// Assembly that this member is defined in
|
||||
|
||||
Reference in New Issue
Block a user