390 lines
15 KiB
C#
390 lines
15 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 SystemNetHttpWebResponseWrap
|
|
{
|
|
public static void __Register(RealStatePtr L)
|
|
{
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
System.Type type = typeof(System.Net.HttpWebResponse);
|
|
Utils.BeginObjectRegister(type, L, translator, 0, 3, 15, 1);
|
|
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetResponseHeader", _m_GetResponseHeader);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetResponseStream", _m_GetResponseStream);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Close", _m_Close);
|
|
|
|
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "CharacterSet", _g_get_CharacterSet);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "ContentEncoding", _g_get_ContentEncoding);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "ContentLength", _g_get_ContentLength);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "ContentType", _g_get_ContentType);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "Cookies", _g_get_Cookies);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "Headers", _g_get_Headers);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "IsMutuallyAuthenticated", _g_get_IsMutuallyAuthenticated);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "LastModified", _g_get_LastModified);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "Method", _g_get_Method);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "ProtocolVersion", _g_get_ProtocolVersion);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "ResponseUri", _g_get_ResponseUri);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "Server", _g_get_Server);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "StatusCode", _g_get_StatusCode);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "StatusDescription", _g_get_StatusDescription);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "SupportsHeaders", _g_get_SupportsHeaders);
|
|
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "Cookies", _s_set_Cookies);
|
|
|
|
|
|
Utils.EndObjectRegister(type, L, translator, null, null,
|
|
null, null, null);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Utils.EndClassRegister(type, L, translator);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_GetResponseHeader(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.Net.HttpWebResponse gen_to_be_invoked = (System.Net.HttpWebResponse)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
string _headerName = LuaAPI.lua_tostring(L, 2);
|
|
|
|
string gen_ret = gen_to_be_invoked.GetResponseHeader( _headerName );
|
|
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_GetResponseStream(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.Net.HttpWebResponse gen_to_be_invoked = (System.Net.HttpWebResponse)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
|
|
System.IO.Stream gen_ret = gen_to_be_invoked.GetResponseStream( );
|
|
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_Close(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.Net.HttpWebResponse gen_to_be_invoked = (System.Net.HttpWebResponse)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
|
|
gen_to_be_invoked.Close( );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_CharacterSet(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.Net.HttpWebResponse gen_to_be_invoked = (System.Net.HttpWebResponse)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.lua_pushstring(L, gen_to_be_invoked.CharacterSet);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_ContentEncoding(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.Net.HttpWebResponse gen_to_be_invoked = (System.Net.HttpWebResponse)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.lua_pushstring(L, gen_to_be_invoked.ContentEncoding);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_ContentLength(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.Net.HttpWebResponse gen_to_be_invoked = (System.Net.HttpWebResponse)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.lua_pushint64(L, gen_to_be_invoked.ContentLength);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_ContentType(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.Net.HttpWebResponse gen_to_be_invoked = (System.Net.HttpWebResponse)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.lua_pushstring(L, gen_to_be_invoked.ContentType);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_Cookies(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.Net.HttpWebResponse gen_to_be_invoked = (System.Net.HttpWebResponse)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.Cookies);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_Headers(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.Net.HttpWebResponse gen_to_be_invoked = (System.Net.HttpWebResponse)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.Headers);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_IsMutuallyAuthenticated(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.Net.HttpWebResponse gen_to_be_invoked = (System.Net.HttpWebResponse)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.lua_pushboolean(L, gen_to_be_invoked.IsMutuallyAuthenticated);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_LastModified(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.Net.HttpWebResponse gen_to_be_invoked = (System.Net.HttpWebResponse)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.LastModified);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_Method(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.Net.HttpWebResponse gen_to_be_invoked = (System.Net.HttpWebResponse)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.lua_pushstring(L, gen_to_be_invoked.Method);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_ProtocolVersion(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.Net.HttpWebResponse gen_to_be_invoked = (System.Net.HttpWebResponse)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.ProtocolVersion);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_ResponseUri(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.Net.HttpWebResponse gen_to_be_invoked = (System.Net.HttpWebResponse)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.ResponseUri);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_Server(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.Net.HttpWebResponse gen_to_be_invoked = (System.Net.HttpWebResponse)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.lua_pushstring(L, gen_to_be_invoked.Server);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_StatusCode(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.Net.HttpWebResponse gen_to_be_invoked = (System.Net.HttpWebResponse)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.StatusCode);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_StatusDescription(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.Net.HttpWebResponse gen_to_be_invoked = (System.Net.HttpWebResponse)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.lua_pushstring(L, gen_to_be_invoked.StatusDescription);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_SupportsHeaders(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.Net.HttpWebResponse gen_to_be_invoked = (System.Net.HttpWebResponse)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.lua_pushboolean(L, gen_to_be_invoked.SupportsHeaders);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _s_set_Cookies(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.Net.HttpWebResponse gen_to_be_invoked = (System.Net.HttpWebResponse)translator.FastGetCSObj(L, 1);
|
|
gen_to_be_invoked.Cookies = (System.Net.CookieCollection)translator.GetObject(L, 2, typeof(System.Net.CookieCollection));
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|