#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 DeviceUtilityWrap
|
{
|
public static void __Register(RealStatePtr L)
|
{
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
System.Type type = typeof(DeviceUtility);
|
Utils.BeginObjectRegister(type, L, translator, 0, 0, 0, 0);
|
|
|
|
|
|
|
Utils.EndObjectRegister(type, L, translator, null, null,
|
null, null, null);
|
|
Utils.BeginClassRegister(type, L, __CreateInstance, 9, 2, 2);
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "GetMac", _m_GetMac_xlua_st_);
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "GetIp", _m_GetIp_xlua_st_);
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "GetDeviceUniquenessIdentify", _m_GetDeviceUniquenessIdentify_xlua_st_);
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "GetDeviceOSLevel", _m_GetDeviceOSLevel_xlua_st_);
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "GetDeviceName", _m_GetDeviceName_xlua_st_);
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "GetDeviceModel", _m_GetDeviceModel_xlua_st_);
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "IsLowMemory", _m_IsLowMemory_xlua_st_);
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "GetCpuAndMemory", _m_GetCpuAndMemory_xlua_st_);
|
|
|
|
Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "cpu", _g_get_cpu);
|
Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "memory", _g_get_memory);
|
|
Utils.RegisterFunc(L, Utils.CLS_SETTER_IDX, "cpu", _s_set_cpu);
|
Utils.RegisterFunc(L, Utils.CLS_SETTER_IDX, "memory", _s_set_memory);
|
|
|
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)
|
{
|
|
DeviceUtility gen_ret = new DeviceUtility();
|
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 DeviceUtility constructor!");
|
|
}
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
static int _m_GetMac_xlua_st_(RealStatePtr L)
|
{
|
try {
|
|
|
|
|
{
|
|
string gen_ret = DeviceUtility.GetMac( );
|
LuaAPI.lua_pushstring(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_GetIp_xlua_st_(RealStatePtr L)
|
{
|
try {
|
|
|
|
|
{
|
|
string gen_ret = DeviceUtility.GetIp( );
|
LuaAPI.lua_pushstring(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_GetDeviceUniquenessIdentify_xlua_st_(RealStatePtr L)
|
{
|
try {
|
|
|
|
|
{
|
|
string gen_ret = DeviceUtility.GetDeviceUniquenessIdentify( );
|
LuaAPI.lua_pushstring(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_GetDeviceOSLevel_xlua_st_(RealStatePtr L)
|
{
|
try {
|
|
|
|
|
{
|
|
string gen_ret = DeviceUtility.GetDeviceOSLevel( );
|
LuaAPI.lua_pushstring(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_GetDeviceName_xlua_st_(RealStatePtr L)
|
{
|
try {
|
|
|
|
|
{
|
|
string gen_ret = DeviceUtility.GetDeviceName( );
|
LuaAPI.lua_pushstring(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_GetDeviceModel_xlua_st_(RealStatePtr L)
|
{
|
try {
|
|
|
|
|
{
|
|
string gen_ret = DeviceUtility.GetDeviceModel( );
|
LuaAPI.lua_pushstring(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_IsLowMemory_xlua_st_(RealStatePtr L)
|
{
|
try {
|
|
|
|
|
{
|
|
bool gen_ret = DeviceUtility.IsLowMemory( );
|
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_GetCpuAndMemory_xlua_st_(RealStatePtr L)
|
{
|
try {
|
|
|
|
|
{
|
int __cpu;
|
int __memory;
|
|
DeviceUtility.GetCpuAndMemory( out __cpu, out __memory );
|
LuaAPI.xlua_pushinteger(L, __cpu);
|
|
LuaAPI.xlua_pushinteger(L, __memory);
|
|
|
|
|
return 2;
|
}
|
|
} catch(System.Exception gen_e) {
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
}
|
|
}
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
static int _g_get_cpu(RealStatePtr L)
|
{
|
try {
|
|
LuaAPI.xlua_pushinteger(L, DeviceUtility.cpu);
|
} catch(System.Exception gen_e) {
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
}
|
return 1;
|
}
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
static int _g_get_memory(RealStatePtr L)
|
{
|
try {
|
|
LuaAPI.xlua_pushinteger(L, DeviceUtility.memory);
|
} catch(System.Exception gen_e) {
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
}
|
return 1;
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
static int _s_set_cpu(RealStatePtr L)
|
{
|
try {
|
|
DeviceUtility.cpu = LuaAPI.xlua_tointeger(L, 1);
|
|
} catch(System.Exception gen_e) {
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
}
|
return 0;
|
}
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
static int _s_set_memory(RealStatePtr L)
|
{
|
try {
|
|
DeviceUtility.memory = LuaAPI.xlua_tointeger(L, 1);
|
|
} catch(System.Exception gen_e) {
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
}
|
return 0;
|
}
|
|
|
|
|
|
}
|
}
|