#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 SystemReflectionFieldInfoWrap { public static void __Register(RealStatePtr L) { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Type type = typeof(System.Reflection.FieldInfo); Utils.BeginObjectRegister(type, L, translator, 1, 7, 19, 0); Utils.RegisterFunc(L, Utils.OBJ_META_IDX, "__eq", __EqMeta); Utils.RegisterFunc(L, Utils.METHOD_IDX, "Equals", _m_Equals); Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetHashCode", _m_GetHashCode); Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetValue", _m_GetValue); Utils.RegisterFunc(L, Utils.METHOD_IDX, "SetValue", _m_SetValue); Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetRawConstantValue", _m_GetRawConstantValue); Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetOptionalCustomModifiers", _m_GetOptionalCustomModifiers); Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetRequiredCustomModifiers", _m_GetRequiredCustomModifiers); Utils.RegisterFunc(L, Utils.GETTER_IDX, "MemberType", _g_get_MemberType); Utils.RegisterFunc(L, Utils.GETTER_IDX, "Attributes", _g_get_Attributes); Utils.RegisterFunc(L, Utils.GETTER_IDX, "FieldType", _g_get_FieldType); Utils.RegisterFunc(L, Utils.GETTER_IDX, "IsInitOnly", _g_get_IsInitOnly); Utils.RegisterFunc(L, Utils.GETTER_IDX, "IsLiteral", _g_get_IsLiteral); Utils.RegisterFunc(L, Utils.GETTER_IDX, "IsNotSerialized", _g_get_IsNotSerialized); Utils.RegisterFunc(L, Utils.GETTER_IDX, "IsPinvokeImpl", _g_get_IsPinvokeImpl); Utils.RegisterFunc(L, Utils.GETTER_IDX, "IsSpecialName", _g_get_IsSpecialName); Utils.RegisterFunc(L, Utils.GETTER_IDX, "IsStatic", _g_get_IsStatic); Utils.RegisterFunc(L, Utils.GETTER_IDX, "IsAssembly", _g_get_IsAssembly); Utils.RegisterFunc(L, Utils.GETTER_IDX, "IsFamily", _g_get_IsFamily); Utils.RegisterFunc(L, Utils.GETTER_IDX, "IsFamilyAndAssembly", _g_get_IsFamilyAndAssembly); Utils.RegisterFunc(L, Utils.GETTER_IDX, "IsFamilyOrAssembly", _g_get_IsFamilyOrAssembly); Utils.RegisterFunc(L, Utils.GETTER_IDX, "IsPrivate", _g_get_IsPrivate); Utils.RegisterFunc(L, Utils.GETTER_IDX, "IsPublic", _g_get_IsPublic); Utils.RegisterFunc(L, Utils.GETTER_IDX, "IsSecurityCritical", _g_get_IsSecurityCritical); Utils.RegisterFunc(L, Utils.GETTER_IDX, "IsSecuritySafeCritical", _g_get_IsSecuritySafeCritical); Utils.RegisterFunc(L, Utils.GETTER_IDX, "IsSecurityTransparent", _g_get_IsSecurityTransparent); Utils.RegisterFunc(L, Utils.GETTER_IDX, "FieldHandle", _g_get_FieldHandle); Utils.EndObjectRegister(type, L, translator, null, null, null, null, null); Utils.BeginClassRegister(type, L, __CreateInstance, 2, 0, 0); Utils.RegisterFunc(L, Utils.CLS_IDX, "GetFieldFromHandle", _m_GetFieldFromHandle_xlua_st_); Utils.EndClassRegister(type, L, translator); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int __CreateInstance(RealStatePtr L) { return LuaAPI.luaL_error(L, "System.Reflection.FieldInfo does not have a constructor!"); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int __EqMeta(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); if (translator.Assignable(L, 1) && translator.Assignable(L, 2)) { System.Reflection.FieldInfo leftside = (System.Reflection.FieldInfo)translator.GetObject(L, 1, typeof(System.Reflection.FieldInfo)); System.Reflection.FieldInfo rightside = (System.Reflection.FieldInfo)translator.GetObject(L, 2, typeof(System.Reflection.FieldInfo)); 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.FieldInfo!"); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_Equals(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.FieldInfo gen_to_be_invoked = (System.Reflection.FieldInfo)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.FieldInfo gen_to_be_invoked = (System.Reflection.FieldInfo)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 _m_GetValue(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.FieldInfo gen_to_be_invoked = (System.Reflection.FieldInfo)translator.FastGetCSObj(L, 1); { object _obj = translator.GetObject(L, 2, typeof(object)); object gen_ret = gen_to_be_invoked.GetValue( _obj ); 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.FieldInfo gen_to_be_invoked = (System.Reflection.FieldInfo)translator.FastGetCSObj(L, 1); int gen_param_count = LuaAPI.lua_gettop(L); if(gen_param_count == 3&& translator.Assignable(L, 2)&& translator.Assignable(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 == 6&& translator.Assignable(L, 2)&& translator.Assignable(L, 3)&& (translator.Assignable(L, 4)||LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4))&& translator.Assignable(L, 5)&& translator.Assignable(L, 6)) { 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)); System.Globalization.CultureInfo _culture = (System.Globalization.CultureInfo)translator.GetObject(L, 6, typeof(System.Globalization.CultureInfo)); gen_to_be_invoked.SetValue( _obj, _value, _invokeAttr, _binder, _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.FieldInfo.SetValue!"); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_GetRawConstantValue(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.FieldInfo gen_to_be_invoked = (System.Reflection.FieldInfo)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_GetOptionalCustomModifiers(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.FieldInfo gen_to_be_invoked = (System.Reflection.FieldInfo)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.FieldInfo gen_to_be_invoked = (System.Reflection.FieldInfo)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_GetFieldFromHandle_xlua_st_(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); int gen_param_count = LuaAPI.lua_gettop(L); if(gen_param_count == 1&& translator.Assignable(L, 1)) { System.RuntimeFieldHandle _handle;translator.Get(L, 1, out _handle); System.Reflection.FieldInfo gen_ret = System.Reflection.FieldInfo.GetFieldFromHandle( _handle ); translator.Push(L, gen_ret); return 1; } if(gen_param_count == 2&& translator.Assignable(L, 1)&& translator.Assignable(L, 2)) { System.RuntimeFieldHandle _handle;translator.Get(L, 1, out _handle); System.RuntimeTypeHandle _declaringType;translator.Get(L, 2, out _declaringType); System.Reflection.FieldInfo gen_ret = System.Reflection.FieldInfo.GetFieldFromHandle( _handle, _declaringType ); 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.FieldInfo.GetFieldFromHandle!"); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_MemberType(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.FieldInfo gen_to_be_invoked = (System.Reflection.FieldInfo)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_Attributes(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.FieldInfo gen_to_be_invoked = (System.Reflection.FieldInfo)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_FieldType(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.FieldInfo gen_to_be_invoked = (System.Reflection.FieldInfo)translator.FastGetCSObj(L, 1); translator.Push(L, gen_to_be_invoked.FieldType); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_IsInitOnly(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.FieldInfo gen_to_be_invoked = (System.Reflection.FieldInfo)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.IsInitOnly); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_IsLiteral(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.FieldInfo gen_to_be_invoked = (System.Reflection.FieldInfo)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.IsLiteral); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_IsNotSerialized(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.FieldInfo gen_to_be_invoked = (System.Reflection.FieldInfo)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.IsNotSerialized); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_IsPinvokeImpl(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.FieldInfo gen_to_be_invoked = (System.Reflection.FieldInfo)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.IsPinvokeImpl); } 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.FieldInfo gen_to_be_invoked = (System.Reflection.FieldInfo)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_IsStatic(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.FieldInfo gen_to_be_invoked = (System.Reflection.FieldInfo)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.IsStatic); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_IsAssembly(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.FieldInfo gen_to_be_invoked = (System.Reflection.FieldInfo)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.IsAssembly); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_IsFamily(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.FieldInfo gen_to_be_invoked = (System.Reflection.FieldInfo)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.IsFamily); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_IsFamilyAndAssembly(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.FieldInfo gen_to_be_invoked = (System.Reflection.FieldInfo)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.IsFamilyAndAssembly); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_IsFamilyOrAssembly(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.FieldInfo gen_to_be_invoked = (System.Reflection.FieldInfo)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.IsFamilyOrAssembly); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_IsPrivate(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.FieldInfo gen_to_be_invoked = (System.Reflection.FieldInfo)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.IsPrivate); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_IsPublic(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.FieldInfo gen_to_be_invoked = (System.Reflection.FieldInfo)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.IsPublic); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_IsSecurityCritical(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.FieldInfo gen_to_be_invoked = (System.Reflection.FieldInfo)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.IsSecurityCritical); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_IsSecuritySafeCritical(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.FieldInfo gen_to_be_invoked = (System.Reflection.FieldInfo)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.IsSecuritySafeCritical); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_IsSecurityTransparent(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.FieldInfo gen_to_be_invoked = (System.Reflection.FieldInfo)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.IsSecurityTransparent); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_FieldHandle(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Reflection.FieldInfo gen_to_be_invoked = (System.Reflection.FieldInfo)translator.FastGetCSObj(L, 1); translator.Push(L, gen_to_be_invoked.FieldHandle); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } } }