mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-06-16 06:08:16 +08:00
3.1.12: store Il2CppToMonoType key as string AssemblyQualifiedName instead of Type object
This commit is contained in:
parent
995e2a3e93
commit
12cd718f12
@ -15,7 +15,7 @@ namespace UnityExplorer
|
|||||||
public class ExplorerCore
|
public class ExplorerCore
|
||||||
{
|
{
|
||||||
public const string NAME = "UnityExplorer";
|
public const string NAME = "UnityExplorer";
|
||||||
public const string VERSION = "3.1.11";
|
public const string VERSION = "3.1.12";
|
||||||
public const string AUTHOR = "Sinai";
|
public const string AUTHOR = "Sinai";
|
||||||
public const string GUID = "com.sinai.unityexplorer";
|
public const string GUID = "com.sinai.unityexplorer";
|
||||||
|
|
||||||
|
@ -93,18 +93,18 @@ namespace UnityExplorer.Helpers
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if CPP
|
#if CPP
|
||||||
private static readonly Dictionary<CppType, Type> Il2CppToMonoType = new Dictionary<CppType, Type>();
|
private static readonly Dictionary<string, Type> Il2CppToMonoType = new Dictionary<string, Type>();
|
||||||
|
|
||||||
public static Type GetMonoType(CppType cppType)
|
public static Type GetMonoType(CppType cppType)
|
||||||
{
|
{
|
||||||
if (Il2CppToMonoType.ContainsKey(cppType))
|
if (Il2CppToMonoType.ContainsKey(cppType.AssemblyQualifiedName))
|
||||||
return Il2CppToMonoType[cppType];
|
return Il2CppToMonoType[cppType.AssemblyQualifiedName];
|
||||||
|
|
||||||
var getType = Type.GetType(cppType.AssemblyQualifiedName);
|
var getType = Type.GetType(cppType.AssemblyQualifiedName);
|
||||||
|
|
||||||
if (getType != null)
|
if (getType != null)
|
||||||
{
|
{
|
||||||
Il2CppToMonoType.Add(cppType, getType);
|
Il2CppToMonoType.Add(cppType.AssemblyQualifiedName, getType);
|
||||||
return getType;
|
return getType;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -112,11 +112,17 @@ namespace UnityExplorer.Helpers
|
|||||||
string baseName = cppType.FullName;
|
string baseName = cppType.FullName;
|
||||||
string baseAssembly = cppType.Assembly.GetName().name;
|
string baseAssembly = cppType.Assembly.GetName().name;
|
||||||
|
|
||||||
Type unhollowedType = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(a => a.GetName().Name == baseAssembly)?.GetTypes().FirstOrDefault(t =>
|
Type unhollowedType = AppDomain.CurrentDomain
|
||||||
t.CustomAttributes.Any(ca =>
|
.GetAssemblies()
|
||||||
ca.AttributeType.Name == "ObfuscatedNameAttribute" && (string)ca.ConstructorArguments[0].Value == baseName));
|
.FirstOrDefault(a => a.GetName().Name == baseAssembly)?
|
||||||
|
.TryGetTypes()
|
||||||
|
.FirstOrDefault(t =>
|
||||||
|
t.CustomAttributes.Any(ca
|
||||||
|
=> ca.AttributeType.Name == "ObfuscatedNameAttribute"
|
||||||
|
&& (string)ca.ConstructorArguments[0].Value == baseName));
|
||||||
|
|
||||||
|
Il2CppToMonoType.Add(cppType.AssemblyQualifiedName, unhollowedType);
|
||||||
|
|
||||||
Il2CppToMonoType.Add(cppType, unhollowedType);
|
|
||||||
return unhollowedType;
|
return unhollowedType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user