2080 lines
78 KiB
C#
2080 lines
78 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 SystemDateTimeWrap
|
|
{
|
|
public static void __Register(RealStatePtr L)
|
|
{
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
System.Type type = typeof(System.DateTime);
|
|
Utils.BeginObjectRegister(type, L, translator, 5, 27, 13, 0);
|
|
Utils.RegisterFunc(L, Utils.OBJ_META_IDX, "__add", __AddMeta);
|
|
Utils.RegisterFunc(L, Utils.OBJ_META_IDX, "__sub", __SubMeta);
|
|
Utils.RegisterFunc(L, Utils.OBJ_META_IDX, "__eq", __EqMeta);
|
|
Utils.RegisterFunc(L, Utils.OBJ_META_IDX, "__lt", __LTMeta);
|
|
Utils.RegisterFunc(L, Utils.OBJ_META_IDX, "__le", __LEMeta);
|
|
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Add", _m_Add);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "AddDays", _m_AddDays);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "AddHours", _m_AddHours);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "AddMilliseconds", _m_AddMilliseconds);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "AddMinutes", _m_AddMinutes);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "AddMonths", _m_AddMonths);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "AddSeconds", _m_AddSeconds);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "AddTicks", _m_AddTicks);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "AddYears", _m_AddYears);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "CompareTo", _m_CompareTo);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Equals", _m_Equals);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "IsDaylightSavingTime", _m_IsDaylightSavingTime);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "ToBinary", _m_ToBinary);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetHashCode", _m_GetHashCode);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Subtract", _m_Subtract);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "ToOADate", _m_ToOADate);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "ToFileTime", _m_ToFileTime);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "ToFileTimeUtc", _m_ToFileTimeUtc);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "ToLocalTime", _m_ToLocalTime);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "ToLongDateString", _m_ToLongDateString);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "ToLongTimeString", _m_ToLongTimeString);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "ToShortDateString", _m_ToShortDateString);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "ToShortTimeString", _m_ToShortTimeString);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "ToString", _m_ToString);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "ToUniversalTime", _m_ToUniversalTime);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetDateTimeFormats", _m_GetDateTimeFormats);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetTypeCode", _m_GetTypeCode);
|
|
|
|
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "Date", _g_get_Date);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "Day", _g_get_Day);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "DayOfWeek", _g_get_DayOfWeek);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "DayOfYear", _g_get_DayOfYear);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "Hour", _g_get_Hour);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "Kind", _g_get_Kind);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "Millisecond", _g_get_Millisecond);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "Minute", _g_get_Minute);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "Month", _g_get_Month);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "Second", _g_get_Second);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "Ticks", _g_get_Ticks);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "TimeOfDay", _g_get_TimeOfDay);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "Year", _g_get_Year);
|
|
|
|
|
|
|
|
Utils.EndObjectRegister(type, L, translator, null, null,
|
|
null, null, null);
|
|
|
|
Utils.BeginClassRegister(type, L, __CreateInstance, 16, 3, 0);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "Compare", _m_Compare_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "DaysInMonth", _m_DaysInMonth_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "Equals", _m_Equals_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "FromBinary", _m_FromBinary_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "FromFileTime", _m_FromFileTime_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "FromFileTimeUtc", _m_FromFileTimeUtc_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "FromOADate", _m_FromOADate_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "SpecifyKind", _m_SpecifyKind_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "IsLeapYear", _m_IsLeapYear_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "Parse", _m_Parse_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "ParseExact", _m_ParseExact_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "TryParse", _m_TryParse_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "TryParseExact", _m_TryParseExact_xlua_st_);
|
|
|
|
|
|
Utils.RegisterObject(L, translator, Utils.CLS_IDX, "MinValue", System.DateTime.MinValue);
|
|
Utils.RegisterObject(L, translator, Utils.CLS_IDX, "MaxValue", System.DateTime.MaxValue);
|
|
|
|
Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "Now", _g_get_Now);
|
|
Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "UtcNow", _g_get_UtcNow);
|
|
Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "Today", _g_get_Today);
|
|
|
|
|
|
|
|
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) == 2 && (LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) || LuaAPI.lua_isint64(L, 2)))
|
|
{
|
|
long _ticks = LuaAPI.lua_toint64(L, 2);
|
|
|
|
var gen_ret = new System.DateTime(_ticks);
|
|
translator.Push(L, gen_ret);
|
|
|
|
return 1;
|
|
}
|
|
if(LuaAPI.lua_gettop(L) == 3 && (LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) || LuaAPI.lua_isint64(L, 2)) && translator.Assignable<System.DateTimeKind>(L, 3))
|
|
{
|
|
long _ticks = LuaAPI.lua_toint64(L, 2);
|
|
System.DateTimeKind _kind;translator.Get(L, 3, out _kind);
|
|
|
|
var gen_ret = new System.DateTime(_ticks, _kind);
|
|
translator.Push(L, gen_ret);
|
|
|
|
return 1;
|
|
}
|
|
if(LuaAPI.lua_gettop(L) == 4 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4))
|
|
{
|
|
int _year = LuaAPI.xlua_tointeger(L, 2);
|
|
int _month = LuaAPI.xlua_tointeger(L, 3);
|
|
int _day = LuaAPI.xlua_tointeger(L, 4);
|
|
|
|
var gen_ret = new System.DateTime(_year, _month, _day);
|
|
translator.Push(L, gen_ret);
|
|
|
|
return 1;
|
|
}
|
|
if(LuaAPI.lua_gettop(L) == 5 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4) && translator.Assignable<System.Globalization.Calendar>(L, 5))
|
|
{
|
|
int _year = LuaAPI.xlua_tointeger(L, 2);
|
|
int _month = LuaAPI.xlua_tointeger(L, 3);
|
|
int _day = LuaAPI.xlua_tointeger(L, 4);
|
|
System.Globalization.Calendar _calendar = (System.Globalization.Calendar)translator.GetObject(L, 5, typeof(System.Globalization.Calendar));
|
|
|
|
var gen_ret = new System.DateTime(_year, _month, _day, _calendar);
|
|
translator.Push(L, gen_ret);
|
|
|
|
return 1;
|
|
}
|
|
if(LuaAPI.lua_gettop(L) == 7 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 5) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 6) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 7))
|
|
{
|
|
int _year = LuaAPI.xlua_tointeger(L, 2);
|
|
int _month = LuaAPI.xlua_tointeger(L, 3);
|
|
int _day = LuaAPI.xlua_tointeger(L, 4);
|
|
int _hour = LuaAPI.xlua_tointeger(L, 5);
|
|
int _minute = LuaAPI.xlua_tointeger(L, 6);
|
|
int _second = LuaAPI.xlua_tointeger(L, 7);
|
|
|
|
var gen_ret = new System.DateTime(_year, _month, _day, _hour, _minute, _second);
|
|
translator.Push(L, gen_ret);
|
|
|
|
return 1;
|
|
}
|
|
if(LuaAPI.lua_gettop(L) == 8 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 5) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 6) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 7) && translator.Assignable<System.DateTimeKind>(L, 8))
|
|
{
|
|
int _year = LuaAPI.xlua_tointeger(L, 2);
|
|
int _month = LuaAPI.xlua_tointeger(L, 3);
|
|
int _day = LuaAPI.xlua_tointeger(L, 4);
|
|
int _hour = LuaAPI.xlua_tointeger(L, 5);
|
|
int _minute = LuaAPI.xlua_tointeger(L, 6);
|
|
int _second = LuaAPI.xlua_tointeger(L, 7);
|
|
System.DateTimeKind _kind;translator.Get(L, 8, out _kind);
|
|
|
|
var gen_ret = new System.DateTime(_year, _month, _day, _hour, _minute, _second, _kind);
|
|
translator.Push(L, gen_ret);
|
|
|
|
return 1;
|
|
}
|
|
if(LuaAPI.lua_gettop(L) == 8 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 5) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 6) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 7) && translator.Assignable<System.Globalization.Calendar>(L, 8))
|
|
{
|
|
int _year = LuaAPI.xlua_tointeger(L, 2);
|
|
int _month = LuaAPI.xlua_tointeger(L, 3);
|
|
int _day = LuaAPI.xlua_tointeger(L, 4);
|
|
int _hour = LuaAPI.xlua_tointeger(L, 5);
|
|
int _minute = LuaAPI.xlua_tointeger(L, 6);
|
|
int _second = LuaAPI.xlua_tointeger(L, 7);
|
|
System.Globalization.Calendar _calendar = (System.Globalization.Calendar)translator.GetObject(L, 8, typeof(System.Globalization.Calendar));
|
|
|
|
var gen_ret = new System.DateTime(_year, _month, _day, _hour, _minute, _second, _calendar);
|
|
translator.Push(L, gen_ret);
|
|
|
|
return 1;
|
|
}
|
|
if(LuaAPI.lua_gettop(L) == 8 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 5) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 6) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 7) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 8))
|
|
{
|
|
int _year = LuaAPI.xlua_tointeger(L, 2);
|
|
int _month = LuaAPI.xlua_tointeger(L, 3);
|
|
int _day = LuaAPI.xlua_tointeger(L, 4);
|
|
int _hour = LuaAPI.xlua_tointeger(L, 5);
|
|
int _minute = LuaAPI.xlua_tointeger(L, 6);
|
|
int _second = LuaAPI.xlua_tointeger(L, 7);
|
|
int _millisecond = LuaAPI.xlua_tointeger(L, 8);
|
|
|
|
var gen_ret = new System.DateTime(_year, _month, _day, _hour, _minute, _second, _millisecond);
|
|
translator.Push(L, gen_ret);
|
|
|
|
return 1;
|
|
}
|
|
if(LuaAPI.lua_gettop(L) == 9 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 5) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 6) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 7) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 8) && translator.Assignable<System.DateTimeKind>(L, 9))
|
|
{
|
|
int _year = LuaAPI.xlua_tointeger(L, 2);
|
|
int _month = LuaAPI.xlua_tointeger(L, 3);
|
|
int _day = LuaAPI.xlua_tointeger(L, 4);
|
|
int _hour = LuaAPI.xlua_tointeger(L, 5);
|
|
int _minute = LuaAPI.xlua_tointeger(L, 6);
|
|
int _second = LuaAPI.xlua_tointeger(L, 7);
|
|
int _millisecond = LuaAPI.xlua_tointeger(L, 8);
|
|
System.DateTimeKind _kind;translator.Get(L, 9, out _kind);
|
|
|
|
var gen_ret = new System.DateTime(_year, _month, _day, _hour, _minute, _second, _millisecond, _kind);
|
|
translator.Push(L, gen_ret);
|
|
|
|
return 1;
|
|
}
|
|
if(LuaAPI.lua_gettop(L) == 9 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 5) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 6) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 7) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 8) && translator.Assignable<System.Globalization.Calendar>(L, 9))
|
|
{
|
|
int _year = LuaAPI.xlua_tointeger(L, 2);
|
|
int _month = LuaAPI.xlua_tointeger(L, 3);
|
|
int _day = LuaAPI.xlua_tointeger(L, 4);
|
|
int _hour = LuaAPI.xlua_tointeger(L, 5);
|
|
int _minute = LuaAPI.xlua_tointeger(L, 6);
|
|
int _second = LuaAPI.xlua_tointeger(L, 7);
|
|
int _millisecond = LuaAPI.xlua_tointeger(L, 8);
|
|
System.Globalization.Calendar _calendar = (System.Globalization.Calendar)translator.GetObject(L, 9, typeof(System.Globalization.Calendar));
|
|
|
|
var gen_ret = new System.DateTime(_year, _month, _day, _hour, _minute, _second, _millisecond, _calendar);
|
|
translator.Push(L, gen_ret);
|
|
|
|
return 1;
|
|
}
|
|
if(LuaAPI.lua_gettop(L) == 10 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 5) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 6) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 7) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 8) && translator.Assignable<System.Globalization.Calendar>(L, 9) && translator.Assignable<System.DateTimeKind>(L, 10))
|
|
{
|
|
int _year = LuaAPI.xlua_tointeger(L, 2);
|
|
int _month = LuaAPI.xlua_tointeger(L, 3);
|
|
int _day = LuaAPI.xlua_tointeger(L, 4);
|
|
int _hour = LuaAPI.xlua_tointeger(L, 5);
|
|
int _minute = LuaAPI.xlua_tointeger(L, 6);
|
|
int _second = LuaAPI.xlua_tointeger(L, 7);
|
|
int _millisecond = LuaAPI.xlua_tointeger(L, 8);
|
|
System.Globalization.Calendar _calendar = (System.Globalization.Calendar)translator.GetObject(L, 9, typeof(System.Globalization.Calendar));
|
|
System.DateTimeKind _kind;translator.Get(L, 10, out _kind);
|
|
|
|
var gen_ret = new System.DateTime(_year, _month, _day, _hour, _minute, _second, _millisecond, _calendar, _kind);
|
|
translator.Push(L, gen_ret);
|
|
|
|
return 1;
|
|
}
|
|
|
|
if (LuaAPI.lua_gettop(L) == 1)
|
|
{
|
|
translator.Push(L, default(System.DateTime));
|
|
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.DateTime constructor!");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int __AddMeta(RealStatePtr L)
|
|
{
|
|
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
if (translator.Assignable<System.DateTime>(L, 1) && translator.Assignable<System.TimeSpan>(L, 2))
|
|
{
|
|
System.DateTime leftside;translator.Get(L, 1, out leftside);
|
|
System.TimeSpan rightside;translator.Get(L, 2, out rightside);
|
|
|
|
translator.Push(L, leftside + rightside);
|
|
|
|
return 1;
|
|
}
|
|
|
|
}
|
|
catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return LuaAPI.luaL_error(L, "invalid arguments to right hand of + operator, need System.DateTime!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int __SubMeta(RealStatePtr L)
|
|
{
|
|
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
if (translator.Assignable<System.DateTime>(L, 1) && translator.Assignable<System.TimeSpan>(L, 2))
|
|
{
|
|
System.DateTime leftside;translator.Get(L, 1, out leftside);
|
|
System.TimeSpan rightside;translator.Get(L, 2, out rightside);
|
|
|
|
translator.Push(L, leftside - rightside);
|
|
|
|
return 1;
|
|
}
|
|
|
|
|
|
if (translator.Assignable<System.DateTime>(L, 1) && translator.Assignable<System.DateTime>(L, 2))
|
|
{
|
|
System.DateTime leftside;translator.Get(L, 1, out leftside);
|
|
System.DateTime rightside;translator.Get(L, 2, out rightside);
|
|
|
|
translator.Push(L, leftside - rightside);
|
|
|
|
return 1;
|
|
}
|
|
|
|
}
|
|
catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return LuaAPI.luaL_error(L, "invalid arguments to right hand of - operator, need System.DateTime!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int __EqMeta(RealStatePtr L)
|
|
{
|
|
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
if (translator.Assignable<System.DateTime>(L, 1) && translator.Assignable<System.DateTime>(L, 2))
|
|
{
|
|
System.DateTime leftside;translator.Get(L, 1, out leftside);
|
|
System.DateTime rightside;translator.Get(L, 2, out rightside);
|
|
|
|
LuaAPI.lua_pushboolean(L, leftside == rightside);
|
|
|
|
return 1;
|
|
}
|
|
|
|
}
|
|
catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return LuaAPI.luaL_error(L, "invalid arguments to right hand of == operator, need System.DateTime!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int __LTMeta(RealStatePtr L)
|
|
{
|
|
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
if (translator.Assignable<System.DateTime>(L, 1) && translator.Assignable<System.DateTime>(L, 2))
|
|
{
|
|
System.DateTime leftside;translator.Get(L, 1, out leftside);
|
|
System.DateTime rightside;translator.Get(L, 2, out rightside);
|
|
|
|
LuaAPI.lua_pushboolean(L, leftside < rightside);
|
|
|
|
return 1;
|
|
}
|
|
|
|
}
|
|
catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return LuaAPI.luaL_error(L, "invalid arguments to right hand of < operator, need System.DateTime!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int __LEMeta(RealStatePtr L)
|
|
{
|
|
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
if (translator.Assignable<System.DateTime>(L, 1) && translator.Assignable<System.DateTime>(L, 2))
|
|
{
|
|
System.DateTime leftside;translator.Get(L, 1, out leftside);
|
|
System.DateTime rightside;translator.Get(L, 2, out rightside);
|
|
|
|
LuaAPI.lua_pushboolean(L, leftside <= rightside);
|
|
|
|
return 1;
|
|
}
|
|
|
|
}
|
|
catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return LuaAPI.luaL_error(L, "invalid arguments to right hand of <= operator, need System.DateTime!");
|
|
|
|
}
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_Add(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
|
|
{
|
|
System.TimeSpan _value;translator.Get(L, 2, out _value);
|
|
|
|
var gen_ret = gen_to_be_invoked.Add( _value );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_AddDays(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
|
|
{
|
|
double _value = LuaAPI.lua_tonumber(L, 2);
|
|
|
|
var gen_ret = gen_to_be_invoked.AddDays( _value );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_AddHours(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
|
|
{
|
|
double _value = LuaAPI.lua_tonumber(L, 2);
|
|
|
|
var gen_ret = gen_to_be_invoked.AddHours( _value );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_AddMilliseconds(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
|
|
{
|
|
double _value = LuaAPI.lua_tonumber(L, 2);
|
|
|
|
var gen_ret = gen_to_be_invoked.AddMilliseconds( _value );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_AddMinutes(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
|
|
{
|
|
double _value = LuaAPI.lua_tonumber(L, 2);
|
|
|
|
var gen_ret = gen_to_be_invoked.AddMinutes( _value );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_AddMonths(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
|
|
{
|
|
int _months = LuaAPI.xlua_tointeger(L, 2);
|
|
|
|
var gen_ret = gen_to_be_invoked.AddMonths( _months );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_AddSeconds(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
|
|
{
|
|
double _value = LuaAPI.lua_tonumber(L, 2);
|
|
|
|
var gen_ret = gen_to_be_invoked.AddSeconds( _value );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_AddTicks(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
|
|
{
|
|
long _value = LuaAPI.lua_toint64(L, 2);
|
|
|
|
var gen_ret = gen_to_be_invoked.AddTicks( _value );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_AddYears(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
|
|
{
|
|
int _value = LuaAPI.xlua_tointeger(L, 2);
|
|
|
|
var gen_ret = gen_to_be_invoked.AddYears( _value );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_Compare_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
|
|
{
|
|
System.DateTime _t1;translator.Get(L, 1, out _t1);
|
|
System.DateTime _t2;translator.Get(L, 2, out _t2);
|
|
|
|
var gen_ret = System.DateTime.Compare( _t1, _t2 );
|
|
LuaAPI.xlua_pushinteger(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_CompareTo(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
|
|
if(gen_param_count == 2&& translator.Assignable<object>(L, 2))
|
|
{
|
|
object _value = translator.GetObject(L, 2, typeof(object));
|
|
|
|
var gen_ret = gen_to_be_invoked.CompareTo( _value );
|
|
LuaAPI.xlua_pushinteger(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
if(gen_param_count == 2&& translator.Assignable<System.DateTime>(L, 2))
|
|
{
|
|
System.DateTime _value;translator.Get(L, 2, out _value);
|
|
|
|
var gen_ret = gen_to_be_invoked.CompareTo( _value );
|
|
LuaAPI.xlua_pushinteger(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
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.DateTime.CompareTo!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_DaysInMonth_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
|
|
|
|
|
|
{
|
|
int _year = LuaAPI.xlua_tointeger(L, 1);
|
|
int _month = LuaAPI.xlua_tointeger(L, 2);
|
|
|
|
var gen_ret = System.DateTime.DaysInMonth( _year, _month );
|
|
LuaAPI.xlua_pushinteger(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_Equals(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
|
|
if(gen_param_count == 2&& translator.Assignable<object>(L, 2))
|
|
{
|
|
object _value = translator.GetObject(L, 2, typeof(object));
|
|
|
|
var gen_ret = gen_to_be_invoked.Equals( _value );
|
|
LuaAPI.lua_pushboolean(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
if(gen_param_count == 2&& translator.Assignable<System.DateTime>(L, 2))
|
|
{
|
|
System.DateTime _value;translator.Get(L, 2, out _value);
|
|
|
|
var gen_ret = gen_to_be_invoked.Equals( _value );
|
|
LuaAPI.lua_pushboolean(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
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.DateTime.Equals!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_Equals_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
|
|
{
|
|
System.DateTime _t1;translator.Get(L, 1, out _t1);
|
|
System.DateTime _t2;translator.Get(L, 2, out _t2);
|
|
|
|
var gen_ret = System.DateTime.Equals( _t1, _t2 );
|
|
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_FromBinary_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
|
|
{
|
|
long _dateData = LuaAPI.lua_toint64(L, 1);
|
|
|
|
var gen_ret = System.DateTime.FromBinary( _dateData );
|
|
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_FromFileTime_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
|
|
{
|
|
long _fileTime = LuaAPI.lua_toint64(L, 1);
|
|
|
|
var gen_ret = System.DateTime.FromFileTime( _fileTime );
|
|
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_FromFileTimeUtc_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
|
|
{
|
|
long _fileTime = LuaAPI.lua_toint64(L, 1);
|
|
|
|
var gen_ret = System.DateTime.FromFileTimeUtc( _fileTime );
|
|
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_FromOADate_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
|
|
{
|
|
double _d = LuaAPI.lua_tonumber(L, 1);
|
|
|
|
var gen_ret = System.DateTime.FromOADate( _d );
|
|
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_IsDaylightSavingTime(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
|
|
{
|
|
|
|
var gen_ret = gen_to_be_invoked.IsDaylightSavingTime( );
|
|
LuaAPI.lua_pushboolean(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_SpecifyKind_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
|
|
{
|
|
System.DateTime _value;translator.Get(L, 1, out _value);
|
|
System.DateTimeKind _kind;translator.Get(L, 2, out _kind);
|
|
|
|
var gen_ret = System.DateTime.SpecifyKind( _value, _kind );
|
|
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_ToBinary(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
|
|
{
|
|
|
|
var gen_ret = gen_to_be_invoked.ToBinary( );
|
|
LuaAPI.lua_pushint64(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_GetHashCode(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
|
|
{
|
|
|
|
var gen_ret = gen_to_be_invoked.GetHashCode( );
|
|
LuaAPI.xlua_pushinteger(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_IsLeapYear_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
|
|
|
|
|
|
{
|
|
int _year = LuaAPI.xlua_tointeger(L, 1);
|
|
|
|
var gen_ret = System.DateTime.IsLeapYear( _year );
|
|
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_Parse_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 _s = LuaAPI.lua_tostring(L, 1);
|
|
|
|
var gen_ret = System.DateTime.Parse( _s );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
if(gen_param_count == 2&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& translator.Assignable<System.IFormatProvider>(L, 2))
|
|
{
|
|
string _s = LuaAPI.lua_tostring(L, 1);
|
|
System.IFormatProvider _provider = (System.IFormatProvider)translator.GetObject(L, 2, typeof(System.IFormatProvider));
|
|
|
|
var gen_ret = System.DateTime.Parse( _s, _provider );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
if(gen_param_count == 3&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& translator.Assignable<System.IFormatProvider>(L, 2)&& translator.Assignable<System.Globalization.DateTimeStyles>(L, 3))
|
|
{
|
|
string _s = LuaAPI.lua_tostring(L, 1);
|
|
System.IFormatProvider _provider = (System.IFormatProvider)translator.GetObject(L, 2, typeof(System.IFormatProvider));
|
|
System.Globalization.DateTimeStyles _styles;translator.Get(L, 3, out _styles);
|
|
|
|
var gen_ret = System.DateTime.Parse( _s, _provider, _styles );
|
|
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.DateTime.Parse!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_ParseExact_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)&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)&& translator.Assignable<System.IFormatProvider>(L, 3))
|
|
{
|
|
string _s = LuaAPI.lua_tostring(L, 1);
|
|
string _format = LuaAPI.lua_tostring(L, 2);
|
|
System.IFormatProvider _provider = (System.IFormatProvider)translator.GetObject(L, 3, typeof(System.IFormatProvider));
|
|
|
|
var gen_ret = System.DateTime.ParseExact( _s, _format, _provider );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
if(gen_param_count == 4&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)&& translator.Assignable<System.IFormatProvider>(L, 3)&& translator.Assignable<System.Globalization.DateTimeStyles>(L, 4))
|
|
{
|
|
string _s = LuaAPI.lua_tostring(L, 1);
|
|
string _format = LuaAPI.lua_tostring(L, 2);
|
|
System.IFormatProvider _provider = (System.IFormatProvider)translator.GetObject(L, 3, typeof(System.IFormatProvider));
|
|
System.Globalization.DateTimeStyles _style;translator.Get(L, 4, out _style);
|
|
|
|
var gen_ret = System.DateTime.ParseExact( _s, _format, _provider, _style );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
if(gen_param_count == 4&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& translator.Assignable<string[]>(L, 2)&& translator.Assignable<System.IFormatProvider>(L, 3)&& translator.Assignable<System.Globalization.DateTimeStyles>(L, 4))
|
|
{
|
|
string _s = LuaAPI.lua_tostring(L, 1);
|
|
string[] _formats = (string[])translator.GetObject(L, 2, typeof(string[]));
|
|
System.IFormatProvider _provider = (System.IFormatProvider)translator.GetObject(L, 3, typeof(System.IFormatProvider));
|
|
System.Globalization.DateTimeStyles _style;translator.Get(L, 4, out _style);
|
|
|
|
var gen_ret = System.DateTime.ParseExact( _s, _formats, _provider, _style );
|
|
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.DateTime.ParseExact!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_Subtract(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
|
|
if(gen_param_count == 2&& translator.Assignable<System.DateTime>(L, 2))
|
|
{
|
|
System.DateTime _value;translator.Get(L, 2, out _value);
|
|
|
|
var gen_ret = gen_to_be_invoked.Subtract( _value );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
if(gen_param_count == 2&& translator.Assignable<System.TimeSpan>(L, 2))
|
|
{
|
|
System.TimeSpan _value;translator.Get(L, 2, out _value);
|
|
|
|
var gen_ret = gen_to_be_invoked.Subtract( _value );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
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.DateTime.Subtract!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_ToOADate(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
|
|
{
|
|
|
|
var gen_ret = gen_to_be_invoked.ToOADate( );
|
|
LuaAPI.lua_pushnumber(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_ToFileTime(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
|
|
{
|
|
|
|
var gen_ret = gen_to_be_invoked.ToFileTime( );
|
|
LuaAPI.lua_pushint64(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_ToFileTimeUtc(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
|
|
{
|
|
|
|
var gen_ret = gen_to_be_invoked.ToFileTimeUtc( );
|
|
LuaAPI.lua_pushint64(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_ToLocalTime(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
|
|
{
|
|
|
|
var gen_ret = gen_to_be_invoked.ToLocalTime( );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_ToLongDateString(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
|
|
{
|
|
|
|
var gen_ret = gen_to_be_invoked.ToLongDateString( );
|
|
LuaAPI.lua_pushstring(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_ToLongTimeString(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
|
|
{
|
|
|
|
var gen_ret = gen_to_be_invoked.ToLongTimeString( );
|
|
LuaAPI.lua_pushstring(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_ToShortDateString(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
|
|
{
|
|
|
|
var gen_ret = gen_to_be_invoked.ToShortDateString( );
|
|
LuaAPI.lua_pushstring(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_ToShortTimeString(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
|
|
{
|
|
|
|
var gen_ret = gen_to_be_invoked.ToShortTimeString( );
|
|
LuaAPI.lua_pushstring(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
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);
|
|
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
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);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
if(gen_param_count == 2&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING))
|
|
{
|
|
string _format = LuaAPI.lua_tostring(L, 2);
|
|
|
|
var gen_ret = gen_to_be_invoked.ToString( _format );
|
|
LuaAPI.lua_pushstring(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
if(gen_param_count == 2&& translator.Assignable<System.IFormatProvider>(L, 2))
|
|
{
|
|
System.IFormatProvider _provider = (System.IFormatProvider)translator.GetObject(L, 2, typeof(System.IFormatProvider));
|
|
|
|
var gen_ret = gen_to_be_invoked.ToString( _provider );
|
|
LuaAPI.lua_pushstring(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
if(gen_param_count == 3&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)&& translator.Assignable<System.IFormatProvider>(L, 3))
|
|
{
|
|
string _format = LuaAPI.lua_tostring(L, 2);
|
|
System.IFormatProvider _provider = (System.IFormatProvider)translator.GetObject(L, 3, typeof(System.IFormatProvider));
|
|
|
|
var gen_ret = gen_to_be_invoked.ToString( _format, _provider );
|
|
LuaAPI.lua_pushstring(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
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.DateTime.ToString!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_ToUniversalTime(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
|
|
{
|
|
|
|
var gen_ret = gen_to_be_invoked.ToUniversalTime( );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_TryParse_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 _s = LuaAPI.lua_tostring(L, 1);
|
|
System.DateTime _result;
|
|
|
|
var gen_ret = System.DateTime.TryParse( _s, out _result );
|
|
LuaAPI.lua_pushboolean(L, gen_ret);
|
|
translator.Push(L, _result);
|
|
|
|
|
|
|
|
|
|
return 2;
|
|
}
|
|
if(gen_param_count == 3&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& translator.Assignable<System.IFormatProvider>(L, 2)&& translator.Assignable<System.Globalization.DateTimeStyles>(L, 3))
|
|
{
|
|
string _s = LuaAPI.lua_tostring(L, 1);
|
|
System.IFormatProvider _provider = (System.IFormatProvider)translator.GetObject(L, 2, typeof(System.IFormatProvider));
|
|
System.Globalization.DateTimeStyles _styles;translator.Get(L, 3, out _styles);
|
|
System.DateTime _result;
|
|
|
|
var gen_ret = System.DateTime.TryParse( _s, _provider, _styles, out _result );
|
|
LuaAPI.lua_pushboolean(L, gen_ret);
|
|
translator.Push(L, _result);
|
|
|
|
|
|
|
|
|
|
return 2;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
return LuaAPI.luaL_error(L, "invalid arguments to System.DateTime.TryParse!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_TryParseExact_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
|
|
if(gen_param_count == 4&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)&& translator.Assignable<System.IFormatProvider>(L, 3)&& translator.Assignable<System.Globalization.DateTimeStyles>(L, 4))
|
|
{
|
|
string _s = LuaAPI.lua_tostring(L, 1);
|
|
string _format = LuaAPI.lua_tostring(L, 2);
|
|
System.IFormatProvider _provider = (System.IFormatProvider)translator.GetObject(L, 3, typeof(System.IFormatProvider));
|
|
System.Globalization.DateTimeStyles _style;translator.Get(L, 4, out _style);
|
|
System.DateTime _result;
|
|
|
|
var gen_ret = System.DateTime.TryParseExact( _s, _format, _provider, _style, out _result );
|
|
LuaAPI.lua_pushboolean(L, gen_ret);
|
|
translator.Push(L, _result);
|
|
|
|
|
|
|
|
|
|
return 2;
|
|
}
|
|
if(gen_param_count == 4&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& translator.Assignable<string[]>(L, 2)&& translator.Assignable<System.IFormatProvider>(L, 3)&& translator.Assignable<System.Globalization.DateTimeStyles>(L, 4))
|
|
{
|
|
string _s = LuaAPI.lua_tostring(L, 1);
|
|
string[] _formats = (string[])translator.GetObject(L, 2, typeof(string[]));
|
|
System.IFormatProvider _provider = (System.IFormatProvider)translator.GetObject(L, 3, typeof(System.IFormatProvider));
|
|
System.Globalization.DateTimeStyles _style;translator.Get(L, 4, out _style);
|
|
System.DateTime _result;
|
|
|
|
var gen_ret = System.DateTime.TryParseExact( _s, _formats, _provider, _style, out _result );
|
|
LuaAPI.lua_pushboolean(L, gen_ret);
|
|
translator.Push(L, _result);
|
|
|
|
|
|
|
|
|
|
return 2;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
return LuaAPI.luaL_error(L, "invalid arguments to System.DateTime.TryParseExact!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_GetDateTimeFormats(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
|
|
if(gen_param_count == 1)
|
|
{
|
|
|
|
var gen_ret = gen_to_be_invoked.GetDateTimeFormats( );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
if(gen_param_count == 2&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2))
|
|
{
|
|
char _format = (char)LuaAPI.xlua_tointeger(L, 2);
|
|
|
|
var gen_ret = gen_to_be_invoked.GetDateTimeFormats( _format );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
if(gen_param_count == 2&& translator.Assignable<System.IFormatProvider>(L, 2))
|
|
{
|
|
System.IFormatProvider _provider = (System.IFormatProvider)translator.GetObject(L, 2, typeof(System.IFormatProvider));
|
|
|
|
var gen_ret = gen_to_be_invoked.GetDateTimeFormats( _provider );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
if(gen_param_count == 3&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2)&& translator.Assignable<System.IFormatProvider>(L, 3))
|
|
{
|
|
char _format = (char)LuaAPI.xlua_tointeger(L, 2);
|
|
System.IFormatProvider _provider = (System.IFormatProvider)translator.GetObject(L, 3, typeof(System.IFormatProvider));
|
|
|
|
var gen_ret = gen_to_be_invoked.GetDateTimeFormats( _format, _provider );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
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.DateTime.GetDateTimeFormats!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_GetTypeCode(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
|
|
{
|
|
|
|
var gen_ret = gen_to_be_invoked.GetTypeCode( );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_Date(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
translator.Push(L, gen_to_be_invoked.Date);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_Day(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.Day);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_DayOfWeek(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
translator.PushSystemDayOfWeek(L, gen_to_be_invoked.DayOfWeek);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_DayOfYear(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.DayOfYear);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_Hour(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.Hour);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_Kind(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
translator.Push(L, gen_to_be_invoked.Kind);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_Millisecond(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.Millisecond);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_Minute(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.Minute);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_Month(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.Month);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_Now(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
translator.Push(L, System.DateTime.Now);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_UtcNow(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
translator.Push(L, System.DateTime.UtcNow);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_Second(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.Second);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_Ticks(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
LuaAPI.lua_pushint64(L, gen_to_be_invoked.Ticks);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_TimeOfDay(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
translator.Push(L, gen_to_be_invoked.TimeOfDay);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_Today(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
translator.Push(L, System.DateTime.Today);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_Year(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.DateTime gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.Year);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|