static int AddEvent(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); LuaFramework.ThreadManager obj = (LuaFramework.ThreadManager)ToLua.CheckObject(L, 1, typeof(LuaFramework.ThreadManager)); ThreadEvent arg0 = (ThreadEvent)ToLua.CheckObject(L, 2, typeof(ThreadEvent)); System.Action <NotiData> arg1 = null; LuaTypes funcType3 = LuaDLL.lua_type(L, 3); if (funcType3 != LuaTypes.LUA_TFUNCTION) { arg1 = (System.Action <NotiData>)ToLua.CheckObject(L, 3, typeof(System.Action <NotiData>)); } else { LuaFunction func = ToLua.ToLuaFunction(L, 3); arg1 = DelegateFactory.CreateDelegate(typeof(System.Action <NotiData>), func) as System.Action <NotiData>; } obj.AddEvent(arg0, arg1); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
/// <summary> /// 线程下载 /// </summary> void BeginDownload(string url, string file) //线程下载 { object[] param = new object[2] { url, file }; ThreadEvent ev = new ThreadEvent(); ev.Key = NotiConst.UPDATE_DOWNLOAD; ev.evParams.AddRange(param); ThreadManager.AddEvent(ev, OnThreadCompleted); //线程下载 }
static int AddEvent(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); LuaFramework.ThreadManager obj = (LuaFramework.ThreadManager)ToLua.CheckObject(L, 1, typeof(LuaFramework.ThreadManager)); ThreadEvent arg0 = (ThreadEvent)ToLua.CheckObject(L, 2, typeof(ThreadEvent)); obj.AddEvent(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int AddEvent(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); LuaFramework.ThreadManager obj = (LuaFramework.ThreadManager)ToLua.CheckObject <LuaFramework.ThreadManager>(L, 1); ThreadEvent arg0 = (ThreadEvent)ToLua.CheckObject <ThreadEvent>(L, 2); System.Action <NotiData> arg1 = (System.Action <NotiData>)ToLua.CheckDelegate <System.Action <NotiData> >(L, 3); obj.AddEvent(arg0, arg1); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
void BeginDownloadExtract(string dataPath, string dataName, byte[] buffer) { totalExtractCount += 1; if (!extractFiles.Contains(dataName)) { extractFiles.Add(dataName); } object[] param = new object[3] { dataPath, dataName, buffer }; ThreadEvent ev = new ThreadEvent(); ev.Key = NotiConst.DOWNLOAD_EXTRACT; ev.evParams.AddRange(param); ev.func = OnThreadCompleted; ThreadManager.AddEvent(ev); //线程解压 }