395 lines
15 KiB
C#
395 lines
15 KiB
C#
|
#if USE_UNI_LUA
|
|||
|
using LuaAPI = UniLua.Lua;
|
|||
|
using RealStatePtr = UniLua.ILuaState;
|
|||
|
using LuaCSFunction = UniLua.CSharpFunctionDelegate;
|
|||
|
#else
|
|||
|
using LuaAPI = XLua.LuaDLL.Lua;
|
|||
|
using RealStatePtr = System.IntPtr;
|
|||
|
using LuaCSFunction = XLua.LuaDLL.lua_CSFunction;
|
|||
|
#endif
|
|||
|
|
|||
|
using XLua;
|
|||
|
using System.Collections.Generic;
|
|||
|
|
|||
|
|
|||
|
namespace XLua.CSObjectWrap
|
|||
|
{
|
|||
|
using Utils = XLua.Utils;
|
|||
|
public class SystemReflectionMemberInfoWrap
|
|||
|
{
|
|||
|
public static void __Register(RealStatePtr L)
|
|||
|
{
|
|||
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|||
|
System.Type type = typeof(System.Reflection.MemberInfo);
|
|||
|
Utils.BeginObjectRegister(type, L, translator, 1, 6, 7, 0);
|
|||
|
Utils.RegisterFunc(L, Utils.OBJ_META_IDX, "__eq", __EqMeta);
|
|||
|
|
|||
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "HasSameMetadataDefinitionAs", _m_HasSameMetadataDefinitionAs);
|
|||
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "IsDefined", _m_IsDefined);
|
|||
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetCustomAttributes", _m_GetCustomAttributes);
|
|||
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetCustomAttributesData", _m_GetCustomAttributesData);
|
|||
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Equals", _m_Equals);
|
|||
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetHashCode", _m_GetHashCode);
|
|||
|
|
|||
|
|
|||
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "MemberType", _g_get_MemberType);
|
|||
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "Name", _g_get_Name);
|
|||
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "DeclaringType", _g_get_DeclaringType);
|
|||
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "ReflectedType", _g_get_ReflectedType);
|
|||
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "Module", _g_get_Module);
|
|||
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "CustomAttributes", _g_get_CustomAttributes);
|
|||
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "MetadataToken", _g_get_MetadataToken);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
Utils.EndObjectRegister(type, L, translator, null, null,
|
|||
|
null, null, null);
|
|||
|
|
|||
|
Utils.BeginClassRegister(type, L, __CreateInstance, 1, 0, 0);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
Utils.EndClassRegister(type, L, translator);
|
|||
|
}
|
|||
|
|
|||
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|||
|
static int __CreateInstance(RealStatePtr L)
|
|||
|
{
|
|||
|
return LuaAPI.luaL_error(L, "System.Reflection.MemberInfo does not have a constructor!");
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|||
|
static int __EqMeta(RealStatePtr L)
|
|||
|
{
|
|||
|
|
|||
|
try {
|
|||
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|||
|
|
|||
|
|
|||
|
if (translator.Assignable<System.Reflection.MemberInfo>(L, 1) && translator.Assignable<System.Reflection.MemberInfo>(L, 2))
|
|||
|
{
|
|||
|
System.Reflection.MemberInfo leftside = (System.Reflection.MemberInfo)translator.GetObject(L, 1, typeof(System.Reflection.MemberInfo));
|
|||
|
System.Reflection.MemberInfo rightside = (System.Reflection.MemberInfo)translator.GetObject(L, 2, typeof(System.Reflection.MemberInfo));
|
|||
|
|
|||
|
LuaAPI.lua_pushboolean(L, leftside == rightside);
|
|||
|
|
|||
|
return 1;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch(System.Exception gen_e) {
|
|||
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|||
|
}
|
|||
|
return LuaAPI.luaL_error(L, "invalid arguments to right hand of == operator, need System.Reflection.MemberInfo!");
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|||
|
static int _m_HasSameMetadataDefinitionAs(RealStatePtr L)
|
|||
|
{
|
|||
|
try {
|
|||
|
|
|||
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|||
|
|
|||
|
|
|||
|
System.Reflection.MemberInfo gen_to_be_invoked = (System.Reflection.MemberInfo)translator.FastGetCSObj(L, 1);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
{
|
|||
|
System.Reflection.MemberInfo _other = (System.Reflection.MemberInfo)translator.GetObject(L, 2, typeof(System.Reflection.MemberInfo));
|
|||
|
|
|||
|
bool gen_ret = gen_to_be_invoked.HasSameMetadataDefinitionAs( _other );
|
|||
|
LuaAPI.lua_pushboolean(L, gen_ret);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
return 1;
|
|||
|
}
|
|||
|
|
|||
|
} catch(System.Exception gen_e) {
|
|||
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|||
|
static int _m_IsDefined(RealStatePtr L)
|
|||
|
{
|
|||
|
try {
|
|||
|
|
|||
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|||
|
|
|||
|
|
|||
|
System.Reflection.MemberInfo gen_to_be_invoked = (System.Reflection.MemberInfo)translator.FastGetCSObj(L, 1);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
{
|
|||
|
System.Type _attributeType = (System.Type)translator.GetObject(L, 2, typeof(System.Type));
|
|||
|
bool _inherit = LuaAPI.lua_toboolean(L, 3);
|
|||
|
|
|||
|
bool gen_ret = gen_to_be_invoked.IsDefined( _attributeType, _inherit );
|
|||
|
LuaAPI.lua_pushboolean(L, gen_ret);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
return 1;
|
|||
|
}
|
|||
|
|
|||
|
} catch(System.Exception gen_e) {
|
|||
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|||
|
static int _m_GetCustomAttributes(RealStatePtr L)
|
|||
|
{
|
|||
|
try {
|
|||
|
|
|||
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|||
|
|
|||
|
|
|||
|
System.Reflection.MemberInfo gen_to_be_invoked = (System.Reflection.MemberInfo)translator.FastGetCSObj(L, 1);
|
|||
|
|
|||
|
|
|||
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|||
|
|
|||
|
if(gen_param_count == 2&& LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 2))
|
|||
|
{
|
|||
|
bool _inherit = LuaAPI.lua_toboolean(L, 2);
|
|||
|
|
|||
|
object[] gen_ret = gen_to_be_invoked.GetCustomAttributes( _inherit );
|
|||
|
translator.Push(L, gen_ret);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
return 1;
|
|||
|
}
|
|||
|
if(gen_param_count == 3&& translator.Assignable<System.Type>(L, 2)&& LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 3))
|
|||
|
{
|
|||
|
System.Type _attributeType = (System.Type)translator.GetObject(L, 2, typeof(System.Type));
|
|||
|
bool _inherit = LuaAPI.lua_toboolean(L, 3);
|
|||
|
|
|||
|
object[] gen_ret = gen_to_be_invoked.GetCustomAttributes( _attributeType, _inherit );
|
|||
|
translator.Push(L, gen_ret);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
return 1;
|
|||
|
}
|
|||
|
|
|||
|
} catch(System.Exception gen_e) {
|
|||
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|||
|
}
|
|||
|
|
|||
|
return LuaAPI.luaL_error(L, "invalid arguments to System.Reflection.MemberInfo.GetCustomAttributes!");
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|||
|
static int _m_GetCustomAttributesData(RealStatePtr L)
|
|||
|
{
|
|||
|
try {
|
|||
|
|
|||
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|||
|
|
|||
|
|
|||
|
System.Reflection.MemberInfo gen_to_be_invoked = (System.Reflection.MemberInfo)translator.FastGetCSObj(L, 1);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
{
|
|||
|
|
|||
|
System.Collections.Generic.IList<System.Reflection.CustomAttributeData> gen_ret = gen_to_be_invoked.GetCustomAttributesData( );
|
|||
|
translator.PushAny(L, gen_ret);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
return 1;
|
|||
|
}
|
|||
|
|
|||
|
} catch(System.Exception gen_e) {
|
|||
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|||
|
static int _m_Equals(RealStatePtr L)
|
|||
|
{
|
|||
|
try {
|
|||
|
|
|||
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|||
|
|
|||
|
|
|||
|
System.Reflection.MemberInfo gen_to_be_invoked = (System.Reflection.MemberInfo)translator.FastGetCSObj(L, 1);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
{
|
|||
|
object _obj = translator.GetObject(L, 2, typeof(object));
|
|||
|
|
|||
|
bool gen_ret = gen_to_be_invoked.Equals( _obj );
|
|||
|
LuaAPI.lua_pushboolean(L, gen_ret);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
return 1;
|
|||
|
}
|
|||
|
|
|||
|
} catch(System.Exception gen_e) {
|
|||
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|||
|
static int _m_GetHashCode(RealStatePtr L)
|
|||
|
{
|
|||
|
try {
|
|||
|
|
|||
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|||
|
|
|||
|
|
|||
|
System.Reflection.MemberInfo gen_to_be_invoked = (System.Reflection.MemberInfo)translator.FastGetCSObj(L, 1);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
{
|
|||
|
|
|||
|
int gen_ret = gen_to_be_invoked.GetHashCode( );
|
|||
|
LuaAPI.xlua_pushinteger(L, gen_ret);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
return 1;
|
|||
|
}
|
|||
|
|
|||
|
} catch(System.Exception gen_e) {
|
|||
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|||
|
static int _g_get_MemberType(RealStatePtr L)
|
|||
|
{
|
|||
|
try {
|
|||
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|||
|
|
|||
|
System.Reflection.MemberInfo gen_to_be_invoked = (System.Reflection.MemberInfo)translator.FastGetCSObj(L, 1);
|
|||
|
translator.Push(L, gen_to_be_invoked.MemberType);
|
|||
|
} catch(System.Exception gen_e) {
|
|||
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|||
|
}
|
|||
|
return 1;
|
|||
|
}
|
|||
|
|
|||
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|||
|
static int _g_get_Name(RealStatePtr L)
|
|||
|
{
|
|||
|
try {
|
|||
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|||
|
|
|||
|
System.Reflection.MemberInfo gen_to_be_invoked = (System.Reflection.MemberInfo)translator.FastGetCSObj(L, 1);
|
|||
|
LuaAPI.lua_pushstring(L, gen_to_be_invoked.Name);
|
|||
|
} catch(System.Exception gen_e) {
|
|||
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|||
|
}
|
|||
|
return 1;
|
|||
|
}
|
|||
|
|
|||
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|||
|
static int _g_get_DeclaringType(RealStatePtr L)
|
|||
|
{
|
|||
|
try {
|
|||
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|||
|
|
|||
|
System.Reflection.MemberInfo gen_to_be_invoked = (System.Reflection.MemberInfo)translator.FastGetCSObj(L, 1);
|
|||
|
translator.Push(L, gen_to_be_invoked.DeclaringType);
|
|||
|
} catch(System.Exception gen_e) {
|
|||
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|||
|
}
|
|||
|
return 1;
|
|||
|
}
|
|||
|
|
|||
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|||
|
static int _g_get_ReflectedType(RealStatePtr L)
|
|||
|
{
|
|||
|
try {
|
|||
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|||
|
|
|||
|
System.Reflection.MemberInfo gen_to_be_invoked = (System.Reflection.MemberInfo)translator.FastGetCSObj(L, 1);
|
|||
|
translator.Push(L, gen_to_be_invoked.ReflectedType);
|
|||
|
} catch(System.Exception gen_e) {
|
|||
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|||
|
}
|
|||
|
return 1;
|
|||
|
}
|
|||
|
|
|||
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|||
|
static int _g_get_Module(RealStatePtr L)
|
|||
|
{
|
|||
|
try {
|
|||
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|||
|
|
|||
|
System.Reflection.MemberInfo gen_to_be_invoked = (System.Reflection.MemberInfo)translator.FastGetCSObj(L, 1);
|
|||
|
translator.Push(L, gen_to_be_invoked.Module);
|
|||
|
} catch(System.Exception gen_e) {
|
|||
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|||
|
}
|
|||
|
return 1;
|
|||
|
}
|
|||
|
|
|||
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|||
|
static int _g_get_CustomAttributes(RealStatePtr L)
|
|||
|
{
|
|||
|
try {
|
|||
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|||
|
|
|||
|
System.Reflection.MemberInfo gen_to_be_invoked = (System.Reflection.MemberInfo)translator.FastGetCSObj(L, 1);
|
|||
|
translator.PushAny(L, gen_to_be_invoked.CustomAttributes);
|
|||
|
} catch(System.Exception gen_e) {
|
|||
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|||
|
}
|
|||
|
return 1;
|
|||
|
}
|
|||
|
|
|||
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|||
|
static int _g_get_MetadataToken(RealStatePtr L)
|
|||
|
{
|
|||
|
try {
|
|||
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|||
|
|
|||
|
System.Reflection.MemberInfo gen_to_be_invoked = (System.Reflection.MemberInfo)translator.FastGetCSObj(L, 1);
|
|||
|
LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.MetadataToken);
|
|||
|
} catch(System.Exception gen_e) {
|
|||
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|||
|
}
|
|||
|
return 1;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
}
|