mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-06-15 22:07:48 +08:00

* Added Max Results option to Search (default 5000) * Fixed a TypeInitializationException which can happen when inspecting some classes with Dictionary members * Fixed an issue which could prevent Input support from initializating * Improved and fixed the display of TextAsset objects * A few other minor fixes
54 lines
1.4 KiB
C#
54 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Reflection;
|
|
using Explorer.UI;
|
|
|
|
namespace Explorer.CacheObject
|
|
{
|
|
public class CacheField : CacheMember
|
|
{
|
|
public override bool IsStatic => (MemInfo as FieldInfo).IsStatic;
|
|
|
|
public override void InitMember(MemberInfo member, object declaringInstance)
|
|
{
|
|
base.InitMember(member, declaringInstance);
|
|
|
|
base.Init(null, (member as FieldInfo).FieldType);
|
|
|
|
UpdateValue();
|
|
}
|
|
|
|
public override void UpdateValue()
|
|
{
|
|
if (IValue is InteractiveDictionary iDict)
|
|
{
|
|
if (!iDict.EnsureDictionaryIsSupported())
|
|
{
|
|
ReflectionException = "Not supported due to TypeInitializationException";
|
|
return;
|
|
}
|
|
}
|
|
|
|
try
|
|
{
|
|
var fi = MemInfo as FieldInfo;
|
|
IValue.Value = fi.GetValue(fi.IsStatic ? null : DeclaringInstance);
|
|
|
|
base.UpdateValue();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
ReflectionException = ReflectionHelpers.ExceptionToString(e);
|
|
}
|
|
}
|
|
|
|
public override void SetValue()
|
|
{
|
|
var fi = MemInfo as FieldInfo;
|
|
fi.SetValue(fi.IsStatic ? null : DeclaringInstance, IValue.Value);
|
|
}
|
|
}
|
|
}
|