413 lines
13 KiB
C#
413 lines
13 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 comadjustsdkJSONClassWrap
|
|
{
|
|
public static void __Register(RealStatePtr L)
|
|
{
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
System.Type type = typeof(com.adjust.sdk.JSONClass);
|
|
Utils.BeginObjectRegister(type, L, translator, 0, 7, 2, 0);
|
|
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "get_Item", _m_get_Item);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "set_Item", _m_set_Item);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Add", _m_Add);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Remove", _m_Remove);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetEnumerator", _m_GetEnumerator);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "ToString", _m_ToString);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Serialize", _m_Serialize);
|
|
|
|
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "Count", _g_get_Count);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "Childs", _g_get_Childs);
|
|
|
|
|
|
|
|
Utils.EndObjectRegister(type, L, translator, __CSIndexer, __NewIndexer,
|
|
null, null, null);
|
|
|
|
Utils.BeginClassRegister(type, L, __CreateInstance, 1, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Utils.EndClassRegister(type, L, translator);
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int __CreateInstance(RealStatePtr L)
|
|
{
|
|
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
if(LuaAPI.lua_gettop(L) == 1)
|
|
{
|
|
|
|
var gen_ret = new com.adjust.sdk.JSONClass();
|
|
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 com.adjust.sdk.JSONClass constructor!");
|
|
|
|
}
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
public static int __CSIndexer(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
if (translator.Assignable<com.adjust.sdk.JSONClass>(L, 1) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2))
|
|
{
|
|
|
|
com.adjust.sdk.JSONClass gen_to_be_invoked = (com.adjust.sdk.JSONClass)translator.FastGetCSObj(L, 1);
|
|
int index = LuaAPI.xlua_tointeger(L, 2);
|
|
LuaAPI.lua_pushboolean(L, true);
|
|
translator.Push(L, gen_to_be_invoked[index]);
|
|
return 2;
|
|
}
|
|
|
|
}
|
|
catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
LuaAPI.lua_pushboolean(L, false);
|
|
return 1;
|
|
}
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
public static int __NewIndexer(RealStatePtr L)
|
|
{
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
try {
|
|
|
|
if (translator.Assignable<com.adjust.sdk.JSONClass>(L, 1) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && translator.Assignable<com.adjust.sdk.JSONNode>(L, 3))
|
|
{
|
|
|
|
com.adjust.sdk.JSONClass gen_to_be_invoked = (com.adjust.sdk.JSONClass)translator.FastGetCSObj(L, 1);
|
|
int key = LuaAPI.xlua_tointeger(L, 2);
|
|
gen_to_be_invoked[key] = (com.adjust.sdk.JSONNode)translator.GetObject(L, 3, typeof(com.adjust.sdk.JSONNode));
|
|
LuaAPI.lua_pushboolean(L, true);
|
|
return 1;
|
|
}
|
|
|
|
}
|
|
catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
LuaAPI.lua_pushboolean(L, false);
|
|
return 1;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_get_Item(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
com.adjust.sdk.JSONClass gen_to_be_invoked = (com.adjust.sdk.JSONClass)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
|
|
string key = LuaAPI.lua_tostring(L, 2);
|
|
translator.Push(L, gen_to_be_invoked[key]);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_set_Item(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
com.adjust.sdk.JSONClass gen_to_be_invoked = (com.adjust.sdk.JSONClass)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
|
|
string key = LuaAPI.lua_tostring(L, 2);
|
|
com.adjust.sdk.JSONNode gen_value = (com.adjust.sdk.JSONNode)translator.GetObject(L, 3, typeof(com.adjust.sdk.JSONNode));
|
|
gen_to_be_invoked[key] = gen_value;
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_Add(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
com.adjust.sdk.JSONClass gen_to_be_invoked = (com.adjust.sdk.JSONClass)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
string _aKey = LuaAPI.lua_tostring(L, 2);
|
|
com.adjust.sdk.JSONNode _aItem = (com.adjust.sdk.JSONNode)translator.GetObject(L, 3, typeof(com.adjust.sdk.JSONNode));
|
|
|
|
gen_to_be_invoked.Add( _aKey, _aItem );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_Remove(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
com.adjust.sdk.JSONClass gen_to_be_invoked = (com.adjust.sdk.JSONClass)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
|
|
if(gen_param_count == 2&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2))
|
|
{
|
|
int _aIndex = LuaAPI.xlua_tointeger(L, 2);
|
|
|
|
var gen_ret = gen_to_be_invoked.Remove( _aIndex );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
if(gen_param_count == 2&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING))
|
|
{
|
|
string _aKey = LuaAPI.lua_tostring(L, 2);
|
|
|
|
var gen_ret = gen_to_be_invoked.Remove( _aKey );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
if(gen_param_count == 2&& translator.Assignable<com.adjust.sdk.JSONNode>(L, 2))
|
|
{
|
|
com.adjust.sdk.JSONNode _aNode = (com.adjust.sdk.JSONNode)translator.GetObject(L, 2, typeof(com.adjust.sdk.JSONNode));
|
|
|
|
var gen_ret = gen_to_be_invoked.Remove( _aNode );
|
|
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 com.adjust.sdk.JSONClass.Remove!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_GetEnumerator(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
com.adjust.sdk.JSONClass gen_to_be_invoked = (com.adjust.sdk.JSONClass)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
|
|
var gen_ret = gen_to_be_invoked.GetEnumerator( );
|
|
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_ToString(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
com.adjust.sdk.JSONClass gen_to_be_invoked = (com.adjust.sdk.JSONClass)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
|
|
if(gen_param_count == 1)
|
|
{
|
|
|
|
var gen_ret = gen_to_be_invoked.ToString( );
|
|
LuaAPI.lua_pushstring(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
if(gen_param_count == 2&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING))
|
|
{
|
|
string _aPrefix = LuaAPI.lua_tostring(L, 2);
|
|
|
|
var gen_ret = gen_to_be_invoked.ToString( _aPrefix );
|
|
LuaAPI.lua_pushstring(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 com.adjust.sdk.JSONClass.ToString!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_Serialize(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
com.adjust.sdk.JSONClass gen_to_be_invoked = (com.adjust.sdk.JSONClass)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
System.IO.BinaryWriter _aWriter = (System.IO.BinaryWriter)translator.GetObject(L, 2, typeof(System.IO.BinaryWriter));
|
|
|
|
gen_to_be_invoked.Serialize( _aWriter );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_Count(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
com.adjust.sdk.JSONClass gen_to_be_invoked = (com.adjust.sdk.JSONClass)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.Count);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_Childs(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
com.adjust.sdk.JSONClass gen_to_be_invoked = (com.adjust.sdk.JSONClass)translator.FastGetCSObj(L, 1);
|
|
translator.PushAny(L, gen_to_be_invoked.Childs);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|