2021-03-18 17:17:29 +11:00
|
|
|
|
using System;
|
2021-04-07 17:20:09 +10:00
|
|
|
|
using System.Collections;
|
2021-03-18 17:17:29 +11:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace UnityExplorer.Core.Runtime
|
|
|
|
|
{
|
|
|
|
|
public abstract class ReflectionProvider
|
|
|
|
|
{
|
|
|
|
|
public static ReflectionProvider Instance;
|
|
|
|
|
|
|
|
|
|
public ReflectionProvider()
|
|
|
|
|
{
|
|
|
|
|
Instance = this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public abstract Type GetActualType(object obj);
|
|
|
|
|
|
|
|
|
|
public abstract object Cast(object obj, Type castTo);
|
|
|
|
|
|
2021-04-07 17:20:09 +10:00
|
|
|
|
public abstract T TryCast<T>(object obj);
|
|
|
|
|
|
2021-03-18 17:17:29 +11:00
|
|
|
|
public abstract bool IsAssignableFrom(Type toAssignTo, Type toAssignFrom);
|
|
|
|
|
|
|
|
|
|
public abstract bool IsReflectionSupported(Type type);
|
|
|
|
|
|
|
|
|
|
public abstract string ProcessTypeNameInString(Type type, string theString, ref string typeName);
|
|
|
|
|
|
|
|
|
|
public abstract bool LoadModule(string module);
|
2021-04-04 13:44:58 +10:00
|
|
|
|
|
|
|
|
|
public abstract void BoxStringToType(ref object _string, Type castTo);
|
2021-04-07 17:20:09 +10:00
|
|
|
|
|
|
|
|
|
public virtual string UnboxString(object value) => (string)value;
|
|
|
|
|
|
|
|
|
|
public virtual IDictionary EnumerateDictionary(object value, Type typeOfKeys, Type typeOfValues)
|
|
|
|
|
=> null;
|
|
|
|
|
|
|
|
|
|
public virtual IEnumerable EnumerateEnumerable(object value)
|
|
|
|
|
=> null;
|
2021-03-18 17:17:29 +11:00
|
|
|
|
}
|
|
|
|
|
}
|