368 lines
13 KiB
C#
368 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 = XLuaBase.lua_CSFunction;
|
|
#endif
|
|
|
|
using XLua;
|
|
using System.Collections.Generic;
|
|
|
|
|
|
namespace XLua.CSObjectWrap
|
|
{
|
|
using Utils = XLua.Utils;
|
|
public class SystemNetDnsWrap
|
|
{
|
|
public static void __Register(RealStatePtr L)
|
|
{
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
System.Type type = typeof(System.Net.Dns);
|
|
Utils.BeginObjectRegister(type, L, translator, 0, 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Utils.EndObjectRegister(type, L, translator, null, null,
|
|
null, null, null);
|
|
|
|
Utils.BeginClassRegister(type, L, __CreateInstance, 10, 0, 0);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "BeginGetHostAddresses", _m_BeginGetHostAddresses_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "BeginGetHostEntry", _m_BeginGetHostEntry_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "EndGetHostAddresses", _m_EndGetHostAddresses_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "EndGetHostEntry", _m_EndGetHostEntry_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "GetHostEntry", _m_GetHostEntry_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "GetHostAddresses", _m_GetHostAddresses_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "GetHostName", _m_GetHostName_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "GetHostAddressesAsync", _m_GetHostAddressesAsync_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "GetHostEntryAsync", _m_GetHostEntryAsync_xlua_st_);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Utils.EndClassRegister(type, L, translator);
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int __CreateInstance(RealStatePtr L)
|
|
{
|
|
return LuaAPI.luaL_error(L, "System.Net.Dns does not have a constructor!");
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_BeginGetHostAddresses_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
|
|
{
|
|
string _hostNameOrAddress = LuaAPI.lua_tostring(L, 1);
|
|
System.AsyncCallback _requestCallback = translator.GetDelegate<System.AsyncCallback>(L, 2);
|
|
object _state = translator.GetObject(L, 3, typeof(object));
|
|
|
|
var gen_ret = System.Net.Dns.BeginGetHostAddresses( _hostNameOrAddress, _requestCallback, _state );
|
|
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_BeginGetHostEntry_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
|
|
if(gen_param_count == 3&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& translator.Assignable<System.AsyncCallback>(L, 2)&& translator.Assignable<object>(L, 3))
|
|
{
|
|
string _hostNameOrAddress = LuaAPI.lua_tostring(L, 1);
|
|
System.AsyncCallback _requestCallback = translator.GetDelegate<System.AsyncCallback>(L, 2);
|
|
object _stateObject = translator.GetObject(L, 3, typeof(object));
|
|
|
|
var gen_ret = System.Net.Dns.BeginGetHostEntry( _hostNameOrAddress, _requestCallback, _stateObject );
|
|
translator.PushAny(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
if(gen_param_count == 3&& translator.Assignable<System.Net.IPAddress>(L, 1)&& translator.Assignable<System.AsyncCallback>(L, 2)&& translator.Assignable<object>(L, 3))
|
|
{
|
|
System.Net.IPAddress _address = (System.Net.IPAddress)translator.GetObject(L, 1, typeof(System.Net.IPAddress));
|
|
System.AsyncCallback _requestCallback = translator.GetDelegate<System.AsyncCallback>(L, 2);
|
|
object _stateObject = translator.GetObject(L, 3, typeof(object));
|
|
|
|
var gen_ret = System.Net.Dns.BeginGetHostEntry( _address, _requestCallback, _stateObject );
|
|
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.Net.Dns.BeginGetHostEntry!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_EndGetHostAddresses_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
|
|
{
|
|
System.IAsyncResult _asyncResult = (System.IAsyncResult)translator.GetObject(L, 1, typeof(System.IAsyncResult));
|
|
|
|
var gen_ret = System.Net.Dns.EndGetHostAddresses( _asyncResult );
|
|
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_EndGetHostEntry_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
|
|
{
|
|
System.IAsyncResult _asyncResult = (System.IAsyncResult)translator.GetObject(L, 1, typeof(System.IAsyncResult));
|
|
|
|
var gen_ret = System.Net.Dns.EndGetHostEntry( _asyncResult );
|
|
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_GetHostEntry_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
|
|
if(gen_param_count == 1&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING))
|
|
{
|
|
string _hostNameOrAddress = LuaAPI.lua_tostring(L, 1);
|
|
|
|
var gen_ret = System.Net.Dns.GetHostEntry( _hostNameOrAddress );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
if(gen_param_count == 1&& translator.Assignable<System.Net.IPAddress>(L, 1))
|
|
{
|
|
System.Net.IPAddress _address = (System.Net.IPAddress)translator.GetObject(L, 1, typeof(System.Net.IPAddress));
|
|
|
|
var gen_ret = System.Net.Dns.GetHostEntry( _address );
|
|
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.Net.Dns.GetHostEntry!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_GetHostAddresses_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
|
|
{
|
|
string _hostNameOrAddress = LuaAPI.lua_tostring(L, 1);
|
|
|
|
var gen_ret = System.Net.Dns.GetHostAddresses( _hostNameOrAddress );
|
|
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_GetHostName_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
var gen_ret = System.Net.Dns.GetHostName( );
|
|
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_GetHostAddressesAsync_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
|
|
{
|
|
string _hostNameOrAddress = LuaAPI.lua_tostring(L, 1);
|
|
|
|
var gen_ret = System.Net.Dns.GetHostAddressesAsync( _hostNameOrAddress );
|
|
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_GetHostEntryAsync_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
|
|
if(gen_param_count == 1&& translator.Assignable<System.Net.IPAddress>(L, 1))
|
|
{
|
|
System.Net.IPAddress _address = (System.Net.IPAddress)translator.GetObject(L, 1, typeof(System.Net.IPAddress));
|
|
|
|
var gen_ret = System.Net.Dns.GetHostEntryAsync( _address );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
if(gen_param_count == 1&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING))
|
|
{
|
|
string _hostNameOrAddress = LuaAPI.lua_tostring(L, 1);
|
|
|
|
var gen_ret = System.Net.Dns.GetHostEntryAsync( _hostNameOrAddress );
|
|
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.Net.Dns.GetHostEntryAsync!");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|