mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-06-16 22:27:45 +08:00
1.7.31
* Added support for Il2Cpp Hashtable (non-generic Dict) * Dictionaries should now display CacheOther values better (smaller buttons) * Cleaned up and improved some of CacheDictionary performance
This commit is contained in:
parent
eea581f8d5
commit
5d58993b07
@ -172,7 +172,7 @@ namespace Explorer
|
|||||||
{
|
{
|
||||||
holder = new CacheDictionary();
|
holder = new CacheDictionary();
|
||||||
}
|
}
|
||||||
else if (ReflectionHelpers.IsEnumerable(valueType) || ReflectionHelpers.IsCppEnumerable(valueType))
|
else if (ReflectionHelpers.IsEnumerable(valueType))
|
||||||
{
|
{
|
||||||
holder = new CacheList();
|
holder = new CacheList();
|
||||||
}
|
}
|
||||||
|
@ -98,37 +98,16 @@ namespace Explorer
|
|||||||
|
|
||||||
private void GetGenericArguments()
|
private void GetGenericArguments()
|
||||||
{
|
{
|
||||||
if (this.MemInfo != null)
|
if (ValueType.IsGenericType)
|
||||||
{
|
{
|
||||||
Type memberType = null;
|
m_keysType = ValueType.GetGenericArguments()[0];
|
||||||
switch (this.MemInfo.MemberType)
|
m_valuesType = ValueType.GetGenericArguments()[1];
|
||||||
{
|
|
||||||
case MemberTypes.Field:
|
|
||||||
memberType = (MemInfo as FieldInfo).FieldType;
|
|
||||||
break;
|
|
||||||
case MemberTypes.Property:
|
|
||||||
memberType = (MemInfo as PropertyInfo).PropertyType;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (memberType != null && memberType.IsGenericType)
|
|
||||||
{
|
|
||||||
m_keysType = memberType.GetGenericArguments()[0];
|
|
||||||
m_valuesType = memberType.GetGenericArguments()[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (Value != null)
|
|
||||||
{
|
|
||||||
var type = Value.GetType();
|
|
||||||
if (type.IsGenericType)
|
|
||||||
{
|
|
||||||
m_keysType = type.GetGenericArguments()[0];
|
|
||||||
m_valuesType = type.GetGenericArguments()[1];
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MelonLogger.Log("TODO? Dictionary is of type: " + Value.GetType().FullName);
|
// It's non-generic, just use System.Object to allow for anything.
|
||||||
}
|
m_keysType = typeof(object);
|
||||||
|
m_valuesType = typeof(object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,10 +267,10 @@ namespace Explorer
|
|||||||
GUILayout.Label($"[{i}]", new GUILayoutOption[] { GUILayout.Width(30) });
|
GUILayout.Label($"[{i}]", new GUILayoutOption[] { GUILayout.Width(30) });
|
||||||
|
|
||||||
GUILayout.Label("Key:", new GUILayoutOption[] { GUILayout.Width(40) });
|
GUILayout.Label("Key:", new GUILayoutOption[] { GUILayout.Width(40) });
|
||||||
key.DrawValue(window, (window.width / 2) - 30f);
|
key.DrawValue(window, (window.width / 2) - 80f);
|
||||||
|
|
||||||
GUILayout.Label("Value:", new GUILayoutOption[] { GUILayout.Width(40) });
|
GUILayout.Label("Value:", new GUILayoutOption[] { GUILayout.Width(40) });
|
||||||
val.DrawValue(window, (window.width / 2) - 30f);
|
val.DrawValue(window, (window.width / 2) - 80f);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ namespace Explorer
|
|||||||
public class CppExplorer : MelonMod
|
public class CppExplorer : MelonMod
|
||||||
{
|
{
|
||||||
public const string NAME = "CppExplorer";
|
public const string NAME = "CppExplorer";
|
||||||
public const string VERSION = "1.7.3";
|
public const string VERSION = "1.7.31";
|
||||||
public const string AUTHOR = "Sinai";
|
public const string AUTHOR = "Sinai";
|
||||||
public const string GUID = "com.sinai.cppexplorer";
|
public const string GUID = "com.sinai.cppexplorer";
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ namespace Explorer
|
|||||||
|
|
||||||
public static bool IsEnumerable(Type t)
|
public static bool IsEnumerable(Type t)
|
||||||
{
|
{
|
||||||
return typeof(IEnumerable).IsAssignableFrom(t);
|
return typeof(IEnumerable).IsAssignableFrom(t) || IsCppEnumerable(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks for Il2Cpp List or HashSet.
|
// Checks for Il2Cpp List or HashSet.
|
||||||
@ -68,7 +68,8 @@ namespace Explorer
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return typeof(Il2CppSystem.Collections.IDictionary).IsAssignableFrom(t);
|
return typeof(Il2CppSystem.Collections.IDictionary).IsAssignableFrom(t)
|
||||||
|
|| typeof(Il2CppSystem.Collections.Hashtable).IsAssignableFrom(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,7 +428,7 @@ namespace Explorer
|
|||||||
{
|
{
|
||||||
var t = ReflectionHelpers.GetActualType(obj);
|
var t = ReflectionHelpers.GetActualType(obj);
|
||||||
|
|
||||||
if (!FilterName(t.FullName) || ReflectionHelpers.IsEnumerable(t) || ReflectionHelpers.IsCppEnumerable(t))
|
if (!FilterName(t.FullName) || ReflectionHelpers.IsEnumerable(t))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,30 @@ namespace Explorer.Tests
|
|||||||
ILHashSetTest.Add("3");
|
ILHashSetTest.Add("3");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// test a non-generic dictionary
|
||||||
|
|
||||||
|
public Hashtable TestNonGenericDict()
|
||||||
|
{
|
||||||
|
return new Hashtable
|
||||||
|
{
|
||||||
|
{ "One", 1 },
|
||||||
|
{ "Two", 2 },
|
||||||
|
{ "Three", 3 },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// IL2CPP HASHTABLE NOT SUPPORTED! Cannot assign Il2CppSystem.Object from primitive struct / string.
|
||||||
|
// Technically they are "supported" but if they contain System types they will not work.
|
||||||
|
|
||||||
|
//public Il2CppSystem.Collections.Hashtable TestIl2CppNonGenericDict()
|
||||||
|
//{
|
||||||
|
// var table = new Il2CppSystem.Collections.Hashtable();
|
||||||
|
// table.Add("One", 1);
|
||||||
|
// table.Add("One", 2);
|
||||||
|
// table.Add("One", 3);
|
||||||
|
// return table;
|
||||||
|
//}
|
||||||
|
|
||||||
// test HashSets
|
// test HashSets
|
||||||
|
|
||||||
public static HashSet<string> HashSetTest = new HashSet<string>
|
public static HashSet<string> HashSetTest = new HashSet<string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user