#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 SystemReflectionPropertyInfoWrap { public static void __Register(RealStatePtr L) { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Type type = typeof(System.Reflection.PropertyInfo); Utils.BeginObjectRegister(type, L, translator, 1, 12, 8, 0); Utils.RegisterFunc(L, Utils.OBJ_META_IDX, "__eq", __EqMeta); Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetIndexParameters", _m_GetIndexParameters); Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetAccessors", _m_GetAccessors); Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetGetMethod", _m_GetGetMethod); Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetSetMethod", _m_GetSetMethod); Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetOptionalCustomModifiers", _m_GetOptionalCustomModifiers); Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetRequiredCustomModifiers", _m_GetRequiredCustomModifiers); Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetValue", _m_GetValue); Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetConstantValue", _m_GetConstantValue); Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetRawConstantValue", _m_GetRawConstantValue); Utils.RegisterFunc(L, Utils.METHOD_IDX, "SetValue", _m_SetValue); 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, "PropertyType", _g_get_PropertyType); Utils.RegisterFunc(L, Utils.GETTER_IDX, "Attributes", _g_get_Attributes); Utils.RegisterFunc(L, Utils.GETTER_IDX, "IsSpecialName", _g_get_IsSpecialName); Utils.RegisterFunc(L, Utils.GETTER_IDX, "CanRead", _g_get_CanRead); Utils.RegisterFunc(L, Utils.GETTER_IDX, "CanWrite", _g_get_CanWrite); Utils.RegisterFunc(L, Utils.GETTER_IDX, "GetMethod", _g_get_GetMethod); Utils.RegisterFunc(L, Utils.GETTER_IDX, "SetMethod", _g_get_SetMethod); 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.PropertyInfo 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.PropertyInfo>(L, 1) && translator.Assignable<System.Reflection.PropertyInfo>(L, 2)) { System.Reflection.PropertyInfo leftside = (System.Reflection.PropertyInfo)translator.GetObject(L, 1, typeof(System.Reflection.PropertyInfo)); System.Reflection.PropertyInfo rightside = (System.Reflection.PropertyInfo)translator.GetObject(L, 2, typeof(System.Reflection.PropertyInfo)); 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.PropertyInfo!"); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_GetIndexParameters(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.PropertyInfo gen_to_be_invoked = (System.Reflection.PropertyInfo)translator.FastGetCSObj(L, 1); { System.Reflection.ParameterInfo[] gen_ret = gen_to_be_invoked.GetIndexParameters( ); translator.Push(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_GetAccessors(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.PropertyInfo gen_to_be_invoked = (System.Reflection.PropertyInfo)translator.FastGetCSObj(L, 1); int gen_param_count = LuaAPI.lua_gettop(L); if(gen_param_count == 1) { System.Reflection.MethodInfo[] gen_ret = gen_to_be_invoked.GetAccessors( ); translator.Push(L, gen_ret); return 1; } if(gen_param_count == 2&& LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 2)) { bool _nonPublic = LuaAPI.lua_toboolean(L, 2); System.Reflection.MethodInfo[] gen_ret = gen_to_be_invoked.GetAccessors( _nonPublic ); 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.PropertyInfo.GetAccessors!"); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_GetGetMethod(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.PropertyInfo gen_to_be_invoked = (System.Reflection.PropertyInfo)translator.FastGetCSObj(L, 1); int gen_param_count = LuaAPI.lua_gettop(L); if(gen_param_count == 1) { System.Reflection.MethodInfo gen_ret = gen_to_be_invoked.GetGetMethod( ); translator.Push(L, gen_ret); return 1; } if(gen_param_count == 2&& LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 2)) { bool _nonPublic = LuaAPI.lua_toboolean(L, 2); System.Reflection.MethodInfo gen_ret = gen_to_be_invoked.GetGetMethod( _nonPublic ); 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.PropertyInfo.GetGetMethod!"); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_GetSetMethod(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.PropertyInfo gen_to_be_invoked = (System.Reflection.PropertyInfo)translator.FastGetCSObj(L, 1); int gen_param_count = LuaAPI.lua_gettop(L); if(gen_param_count == 1) { System.Reflection.MethodInfo gen_ret = gen_to_be_invoked.GetSetMethod( ); translator.Push(L, gen_ret); return 1; } if(gen_param_count == 2&& LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 2)) { bool _nonPublic = LuaAPI.lua_toboolean(L, 2); System.Reflection.MethodInfo gen_ret = gen_to_be_invoked.GetSetMethod( _nonPublic ); 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.PropertyInfo.GetSetMethod!"); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_GetOptionalCustomModifiers(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.PropertyInfo gen_to_be_invoked = (System.Reflection.PropertyInfo)translator.FastGetCSObj(L, 1); { System.Type[] gen_ret = gen_to_be_invoked.GetOptionalCustomModifiers( ); translator.Push(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_GetRequiredCustomModifiers(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.PropertyInfo gen_to_be_invoked = (System.Reflection.PropertyInfo)translator.FastGetCSObj(L, 1); { System.Type[] gen_ret = gen_to_be_invoked.GetRequiredCustomModifiers( ); translator.Push(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_GetValue(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.PropertyInfo gen_to_be_invoked = (System.Reflection.PropertyInfo)translator.FastGetCSObj(L, 1); int gen_param_count = LuaAPI.lua_gettop(L); if(gen_param_count == 2&& translator.Assignable<object>(L, 2)) { object _obj = translator.GetObject(L, 2, typeof(object)); object gen_ret = gen_to_be_invoked.GetValue( _obj ); translator.PushAny(L, gen_ret); return 1; } if(gen_param_count == 3&& translator.Assignable<object>(L, 2)&& translator.Assignable<object[]>(L, 3)) { object _obj = translator.GetObject(L, 2, typeof(object)); object[] _index = (object[])translator.GetObject(L, 3, typeof(object[])); object gen_ret = gen_to_be_invoked.GetValue( _obj, _index ); translator.PushAny(L, gen_ret); return 1; } if(gen_param_count == 6&& translator.Assignable<object>(L, 2)&& (translator.Assignable<System.Reflection.BindingFlags>(L, 3)||LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3))&& translator.Assignable<System.Reflection.Binder>(L, 4)&& translator.Assignable<object[]>(L, 5)&& translator.Assignable<System.Globalization.CultureInfo>(L, 6)) { object _obj = translator.GetObject(L, 2, typeof(object)); System.Reflection.BindingFlags _invokeAttr;if (LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TNUMBER)_invokeAttr = (System.Reflection.BindingFlags)LuaAPI.lua_tonumber(L, 3);else translator.Get(L, 3, out _invokeAttr); System.Reflection.Binder _binder = (System.Reflection.Binder)translator.GetObject(L, 4, typeof(System.Reflection.Binder)); object[] _index = (object[])translator.GetObject(L, 5, typeof(object[])); System.Globalization.CultureInfo _culture = (System.Globalization.CultureInfo)translator.GetObject(L, 6, typeof(System.Globalization.CultureInfo)); object gen_ret = gen_to_be_invoked.GetValue( _obj, _invokeAttr, _binder, _index, _culture ); translator.PushAny(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.PropertyInfo.GetValue!"); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_GetConstantValue(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.PropertyInfo gen_to_be_invoked = (System.Reflection.PropertyInfo)translator.FastGetCSObj(L, 1); { object gen_ret = gen_to_be_invoked.GetConstantValue( ); 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_GetRawConstantValue(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.PropertyInfo gen_to_be_invoked = (System.Reflection.PropertyInfo)translator.FastGetCSObj(L, 1); { object gen_ret = gen_to_be_invoked.GetRawConstantValue( ); 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_SetValue(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.PropertyInfo gen_to_be_invoked = (System.Reflection.PropertyInfo)translator.FastGetCSObj(L, 1); int gen_param_count = LuaAPI.lua_gettop(L); if(gen_param_count == 3&& translator.Assignable<object>(L, 2)&& translator.Assignable<object>(L, 3)) { object _obj = translator.GetObject(L, 2, typeof(object)); object _value = translator.GetObject(L, 3, typeof(object)); gen_to_be_invoked.SetValue( _obj, _value ); return 0; } if(gen_param_count == 4&& translator.Assignable<object>(L, 2)&& translator.Assignable<object>(L, 3)&& translator.Assignable<object[]>(L, 4)) { object _obj = translator.GetObject(L, 2, typeof(object)); object _value = translator.GetObject(L, 3, typeof(object)); object[] _index = (object[])translator.GetObject(L, 4, typeof(object[])); gen_to_be_invoked.SetValue( _obj, _value, _index ); return 0; } if(gen_param_count == 7&& translator.Assignable<object>(L, 2)&& translator.Assignable<object>(L, 3)&& (translator.Assignable<System.Reflection.BindingFlags>(L, 4)||LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4))&& translator.Assignable<System.Reflection.Binder>(L, 5)&& translator.Assignable<object[]>(L, 6)&& translator.Assignable<System.Globalization.CultureInfo>(L, 7)) { object _obj = translator.GetObject(L, 2, typeof(object)); object _value = translator.GetObject(L, 3, typeof(object)); System.Reflection.BindingFlags _invokeAttr;if (LuaAPI.lua_type(L, 4) == LuaTypes.LUA_TNUMBER)_invokeAttr = (System.Reflection.BindingFlags)LuaAPI.lua_tonumber(L, 4);else translator.Get(L, 4, out _invokeAttr); System.Reflection.Binder _binder = (System.Reflection.Binder)translator.GetObject(L, 5, typeof(System.Reflection.Binder)); object[] _index = (object[])translator.GetObject(L, 6, typeof(object[])); System.Globalization.CultureInfo _culture = (System.Globalization.CultureInfo)translator.GetObject(L, 7, typeof(System.Globalization.CultureInfo)); gen_to_be_invoked.SetValue( _obj, _value, _invokeAttr, _binder, _index, _culture ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return LuaAPI.luaL_error(L, "invalid arguments to System.Reflection.PropertyInfo.SetValue!"); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_Equals(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.PropertyInfo gen_to_be_invoked = (System.Reflection.PropertyInfo)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.PropertyInfo gen_to_be_invoked = (System.Reflection.PropertyInfo)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.PropertyInfo gen_to_be_invoked = (System.Reflection.PropertyInfo)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_PropertyType(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.PropertyInfo gen_to_be_invoked = (System.Reflection.PropertyInfo)translator.FastGetCSObj(L, 1); translator.Push(L, gen_to_be_invoked.PropertyType); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_Attributes(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.PropertyInfo gen_to_be_invoked = (System.Reflection.PropertyInfo)translator.FastGetCSObj(L, 1); translator.Push(L, gen_to_be_invoked.Attributes); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_IsSpecialName(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.PropertyInfo gen_to_be_invoked = (System.Reflection.PropertyInfo)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.IsSpecialName); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_CanRead(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.PropertyInfo gen_to_be_invoked = (System.Reflection.PropertyInfo)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.CanRead); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_CanWrite(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.PropertyInfo gen_to_be_invoked = (System.Reflection.PropertyInfo)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.CanWrite); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_GetMethod(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.PropertyInfo gen_to_be_invoked = (System.Reflection.PropertyInfo)translator.FastGetCSObj(L, 1); translator.Push(L, gen_to_be_invoked.GetMethod); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_SetMethod(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.PropertyInfo gen_to_be_invoked = (System.Reflection.PropertyInfo)translator.FastGetCSObj(L, 1); translator.Push(L, gen_to_be_invoked.SetMethod); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } } }