Model and Output: Retrieve fully qualified assembly names
This commit is contained in:
@@ -48,8 +48,8 @@ namespace Il2CppInspector.Reflection
|
||||
Assemblies.Add(new Assembly(this, image));
|
||||
}
|
||||
|
||||
// Get an assembly by its name
|
||||
public Assembly GetAssembly(string name) => Assemblies.FirstOrDefault(a => a.FullName == name);
|
||||
// Get an assembly by its image name
|
||||
public Assembly GetAssembly(string name) => Assemblies.FirstOrDefault(a => a.ShortName == name);
|
||||
|
||||
private TypeInfo getNewTypeUsage(Il2CppType usage, MemberTypes memberType) {
|
||||
switch (usage.type) {
|
||||
|
||||
@@ -203,10 +203,10 @@ namespace Il2CppInspector
|
||||
// They moved the position of publicKeyToken in v16 from the middle to the bottom of the struct
|
||||
public byte[] publicKeyToken => publicKeyToken_post16;
|
||||
|
||||
public uint nameIndex;
|
||||
public uint cultureIndex;
|
||||
public uint hashValueIndex;
|
||||
public uint publicKeyIndex;
|
||||
public int nameIndex;
|
||||
public int cultureIndex;
|
||||
public int hashValueIndex;
|
||||
public int publicKeyIndex;
|
||||
[Version(Max = 15), ArrayLength(FixedSize = 8)]
|
||||
public byte[] publicKeyToken_pre16;
|
||||
public uint hash_alg;
|
||||
|
||||
@@ -21,9 +21,12 @@ namespace Il2CppInspector.Reflection {
|
||||
// Custom attributes for this assembly
|
||||
public IEnumerable<CustomAttributeData> CustomAttributes => CustomAttributeData.GetCustomAttributes(this);
|
||||
|
||||
// Name of the assembly
|
||||
// Fully qualified name of the assembly
|
||||
public string FullName { get; }
|
||||
|
||||
// Display name of the assembly
|
||||
public string ShortName { get; }
|
||||
|
||||
// Entry point method for the assembly
|
||||
public MethodInfo EntryPoint => throw new NotImplementedException();
|
||||
|
||||
@@ -43,14 +46,27 @@ namespace Il2CppInspector.Reflection {
|
||||
throw new InvalidOperationException("Assembly/image index mismatch");
|
||||
|
||||
Index = ImageDefinition.assemblyIndex;
|
||||
FullName = Model.Package.Strings[ImageDefinition.nameIndex];
|
||||
ShortName = Model.Package.Strings[ImageDefinition.nameIndex];
|
||||
|
||||
// Get full assembly name
|
||||
var nameDef = AssemblyDefinition.aname;
|
||||
var name = Model.Package.Strings[nameDef.nameIndex];
|
||||
var culture = Model.Package.Strings[nameDef.cultureIndex];
|
||||
if (string.IsNullOrEmpty(culture))
|
||||
culture = "neutral";
|
||||
var pkt = BitConverter.ToString(nameDef.publicKeyToken).Replace("-", "");
|
||||
if (pkt == "0000000000000000")
|
||||
pkt = "null";
|
||||
var version = string.Format($"{nameDef.major}.{nameDef.minor}.{nameDef.build}.{nameDef.revision}");
|
||||
|
||||
FullName = string.Format($"{name}, Version={version}, Culture={culture}, PublicKeyToken={pkt.ToLower()}");
|
||||
|
||||
if (ImageDefinition.entryPointIndex != -1) {
|
||||
// TODO: Generate EntryPoint method from entryPointIndex
|
||||
}
|
||||
|
||||
// Find corresponding module (we'll need this for method pointers)
|
||||
ModuleDefinition = Model.Package.Modules?[FullName];
|
||||
ModuleDefinition = Model.Package.Modules?[ShortName];
|
||||
|
||||
// Generate types in DefinedTypes from typeStart to typeStart+typeCount-1
|
||||
for (var t = ImageDefinition.typeStart; t < ImageDefinition.typeStart + ImageDefinition.typeCount; t++) {
|
||||
|
||||
Reference in New Issue
Block a user