368 lines
14 KiB
C#
368 lines
14 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 BestHTTPFormsHTTPFormBaseWrap
|
|
{
|
|
public static void __Register(RealStatePtr L)
|
|
{
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
System.Type type = typeof(BestHTTP.Forms.HTTPFormBase);
|
|
Utils.BeginObjectRegister(type, L, translator, 0, 5, 5, 1);
|
|
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "AddBinaryData", _m_AddBinaryData);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "AddField", _m_AddField);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "CopyFrom", _m_CopyFrom);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "PrepareRequest", _m_PrepareRequest);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetData", _m_GetData);
|
|
|
|
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "Fields", _g_get_Fields);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "IsEmpty", _g_get_IsEmpty);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "IsChanged", _g_get_IsChanged);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "HasBinary", _g_get_HasBinary);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "HasLongValue", _g_get_HasLongValue);
|
|
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "Fields", _s_set_Fields);
|
|
|
|
|
|
Utils.EndObjectRegister(type, L, translator, null, null,
|
|
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 BestHTTP.Forms.HTTPFormBase();
|
|
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 BestHTTP.Forms.HTTPFormBase constructor!");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_AddBinaryData(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BestHTTP.Forms.HTTPFormBase gen_to_be_invoked = (BestHTTP.Forms.HTTPFormBase)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
|
|
if(gen_param_count == 3&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)&& (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING))
|
|
{
|
|
string _fieldName = LuaAPI.lua_tostring(L, 2);
|
|
byte[] _content = LuaAPI.lua_tobytes(L, 3);
|
|
|
|
gen_to_be_invoked.AddBinaryData( _fieldName, _content );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
if(gen_param_count == 4&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)&& (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING)&& (LuaAPI.lua_isnil(L, 4) || LuaAPI.lua_type(L, 4) == LuaTypes.LUA_TSTRING))
|
|
{
|
|
string _fieldName = LuaAPI.lua_tostring(L, 2);
|
|
byte[] _content = LuaAPI.lua_tobytes(L, 3);
|
|
string _fileName = LuaAPI.lua_tostring(L, 4);
|
|
|
|
gen_to_be_invoked.AddBinaryData( _fieldName, _content, _fileName );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
if(gen_param_count == 5&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)&& (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING)&& (LuaAPI.lua_isnil(L, 4) || LuaAPI.lua_type(L, 4) == LuaTypes.LUA_TSTRING)&& (LuaAPI.lua_isnil(L, 5) || LuaAPI.lua_type(L, 5) == LuaTypes.LUA_TSTRING))
|
|
{
|
|
string _fieldName = LuaAPI.lua_tostring(L, 2);
|
|
byte[] _content = LuaAPI.lua_tobytes(L, 3);
|
|
string _fileName = LuaAPI.lua_tostring(L, 4);
|
|
string _mimeType = LuaAPI.lua_tostring(L, 5);
|
|
|
|
gen_to_be_invoked.AddBinaryData( _fieldName, _content, _fileName, _mimeType );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
return LuaAPI.luaL_error(L, "invalid arguments to BestHTTP.Forms.HTTPFormBase.AddBinaryData!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_AddField(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BestHTTP.Forms.HTTPFormBase gen_to_be_invoked = (BestHTTP.Forms.HTTPFormBase)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
|
|
if(gen_param_count == 3&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)&& (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING))
|
|
{
|
|
string _fieldName = LuaAPI.lua_tostring(L, 2);
|
|
string _value = LuaAPI.lua_tostring(L, 3);
|
|
|
|
gen_to_be_invoked.AddField( _fieldName, _value );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
if(gen_param_count == 4&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)&& (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING)&& translator.Assignable<System.Text.Encoding>(L, 4))
|
|
{
|
|
string _fieldName = LuaAPI.lua_tostring(L, 2);
|
|
string _value = LuaAPI.lua_tostring(L, 3);
|
|
System.Text.Encoding _e = (System.Text.Encoding)translator.GetObject(L, 4, typeof(System.Text.Encoding));
|
|
|
|
gen_to_be_invoked.AddField( _fieldName, _value, _e );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
return LuaAPI.luaL_error(L, "invalid arguments to BestHTTP.Forms.HTTPFormBase.AddField!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_CopyFrom(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BestHTTP.Forms.HTTPFormBase gen_to_be_invoked = (BestHTTP.Forms.HTTPFormBase)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
BestHTTP.Forms.HTTPFormBase _fields = (BestHTTP.Forms.HTTPFormBase)translator.GetObject(L, 2, typeof(BestHTTP.Forms.HTTPFormBase));
|
|
|
|
gen_to_be_invoked.CopyFrom( _fields );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_PrepareRequest(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BestHTTP.Forms.HTTPFormBase gen_to_be_invoked = (BestHTTP.Forms.HTTPFormBase)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
BestHTTP.HTTPRequest _request = (BestHTTP.HTTPRequest)translator.GetObject(L, 2, typeof(BestHTTP.HTTPRequest));
|
|
|
|
gen_to_be_invoked.PrepareRequest( _request );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_GetData(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BestHTTP.Forms.HTTPFormBase gen_to_be_invoked = (BestHTTP.Forms.HTTPFormBase)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
|
|
var gen_ret = gen_to_be_invoked.GetData( );
|
|
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 _g_get_Fields(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BestHTTP.Forms.HTTPFormBase gen_to_be_invoked = (BestHTTP.Forms.HTTPFormBase)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.Fields);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_IsEmpty(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BestHTTP.Forms.HTTPFormBase gen_to_be_invoked = (BestHTTP.Forms.HTTPFormBase)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.lua_pushboolean(L, gen_to_be_invoked.IsEmpty);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_IsChanged(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BestHTTP.Forms.HTTPFormBase gen_to_be_invoked = (BestHTTP.Forms.HTTPFormBase)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.lua_pushboolean(L, gen_to_be_invoked.IsChanged);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_HasBinary(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BestHTTP.Forms.HTTPFormBase gen_to_be_invoked = (BestHTTP.Forms.HTTPFormBase)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.lua_pushboolean(L, gen_to_be_invoked.HasBinary);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_HasLongValue(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BestHTTP.Forms.HTTPFormBase gen_to_be_invoked = (BestHTTP.Forms.HTTPFormBase)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.lua_pushboolean(L, gen_to_be_invoked.HasLongValue);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _s_set_Fields(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BestHTTP.Forms.HTTPFormBase gen_to_be_invoked = (BestHTTP.Forms.HTTPFormBase)translator.FastGetCSObj(L, 1);
|
|
gen_to_be_invoked.Fields = (System.Collections.Generic.List<BestHTTP.Forms.HTTPFieldData>)translator.GetObject(L, 2, typeof(System.Collections.Generic.List<BestHTTP.Forms.HTTPFieldData>));
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|