public void SetLuaLoadSucc(string strFile) { try { Logger.d("读取成功:" + strFile); for (int i = 0; i < this.aryRes.Count; i++) { CRes res = this.aryRes[i] as CRes; bool flag = true; for (int j = 0; j < res.aryFileState.Count; j++) { CFileState state = res.aryFileState[j] as CFileState; if (state.strFileName.Equals(strFile)) { state.iLuaState = this.iLuaWaitInit; } else if (state.isLua && (state.iLuaState != this.iLuaWaitInit)) { flag = false; } } if (flag) { res.iLuaState = this.iLuaWaitInit; } } } catch (Exception exception) { Logger.LogNetError(Configer.iCodeCSException, exception.Message + exception.StackTrace.ToString()); } }
public void AddDownSuccFile(string strFile) { try { Logger.d("下载成功:" + strFile); if (strFile.IndexOf(",") > 0) { char[] separator = new char[] { ',' }; strFile = strFile.Split(separator)[0]; } if (strFile != string.Empty) { if (this.dicFileState.ContainsKey(strFile)) { this.dicFileState[strFile] = this.iSTATE_LOCAL; } else { this.dicFileState.Add(strFile, this.iSTATE_LOCAL); } } this.RefreshDownStatus(strFile); } catch (Exception exception) { Logger.LogNetError(Configer.iCodeCSException, exception.Message + exception.StackTrace.ToString()); } }
public void handleEvent(object[] args) { try { this.handler.Call(args); } catch (Exception exception) { Logger.LogNetError(Configer.iCodeCSException, exception.Message + exception.StackTrace); } }
public object[] Call(params object[] args) { try { return(this.call(args, null)); } catch (Exception exception) { Logger.LogNetError(Configer.iCodeCSException, exception.Message + exception.StackTrace); return(null); } }
private string GetLuaName(string strSourceName) { try { char[] separator = new char[] { '.' }; strSourceName = strSourceName.Split(separator)[0]; char[] chArray2 = new char[] { '_' }; string[] strArray2 = strSourceName.Split(chArray2); strSourceName = strSourceName.Replace(strArray2[0] + "_", string.Empty); return(strSourceName); } catch (Exception exception) { Logger.LogNetError(Configer.iCodeCSException, exception.Message + exception.StackTrace.ToString()); return(string.Empty); } }
private void InitResouceData(string strConfigInfo) { try { char[] separator = new char[] { '|' }; string[] strArray = strConfigInfo.Split(separator); for (int i = 0; i < strArray.Length; i++) { char[] chArray2 = new char[] { ':' }; string[] strArray2 = strArray[i].Split(chArray2); if (strArray2.Length >= 2) { string str = strArray2[0]; string str2 = strArray2[1]; CRes res = new CRes { strResName = str }; char[] chArray3 = new char[] { ',' }; string[] strArray3 = str2.Split(chArray3); for (int j = 0; j < strArray3.Length; j++) { string key = strArray3[j].ToString(); if (!this.dicFileState.ContainsKey(key)) { this.dicFileState[key] = this.iSTATE_LOCAL; Logger.d("AddToDic:" + key + ",State:" + this.iSTATE_LOCAL.ToString()); } int istate = -1; if (this.dicFileState.ContainsKey(key)) { istate = this.dicFileState[key]; } bool flag = this.isLuaFile(strArray3[j]); res.aryFileState.Add(new CFileState(strArray3[j], istate, flag)); } this.aryRes.Add(res); } } } catch (Exception exception) { Logger.LogNetError(Configer.iCodeCSException, exception.Message + exception.StackTrace.ToString()); } }
public void RefreshDownStatus(string strSuccFile) { try { Logger.d("刷新下载状态:" + strSuccFile); for (int i = 0; i < this.aryRes.Count; i++) { CRes res = this.aryRes[i] as CRes; bool flag = true; for (int j = 0; j < res.aryFileState.Count; j++) { CFileState state = res.aryFileState[j] as CFileState; if (state.strFileName.Equals(strSuccFile)) { state.iDownState = this.iSTATE_LOCAL; } else if (!this.CheckIsDown(state.iDownState)) { flag = false; } if ((this.CheckIsDown(state.iDownState) && this.isLuaFile(state.strFileName)) && !this.dicLoaded.ContainsKey(state.strFileName)) { this.dicLoaded.Add(state.strFileName, true); NotificationCenter.DefaultCenter().PostNotification(null, "OnUILuaLoaded", this.GetLuaName(state.strFileName)); } } if (flag) { res.iLoadState = this.iSTATE_LOCAL; } Logger.d("--Res:" + res.strResName + ",status:" + res.iLoadState.ToString()); } this.Dump(); this.SetLuaLoadSucc(string.Empty); } catch (Exception exception) { Logger.LogNetError(Configer.iCodeCSException, exception.Message + exception.StackTrace.ToString()); } }
public void RefreshLuaLoadStatus() { try { if (this.isNeedLoadLua && this.blIsInitFinish) { for (int i = 0; i < this.aryRes.Count; i++) { CRes res = this.aryRes[i] as CRes; if (((res.iLuaState != this.iLuaInited) && this.CheckIsDown(res.iLoadState)) && ((res.iLuaState != this.iLuaIniting) && this.CheckIsDown(res.iLoadState))) { bool flag = false; bool flag2 = true; for (int k = 0; k < res.aryFileState.Count; k++) { CFileState state = res.aryFileState[k] as CFileState; string strFileName = state.strFileName; if (state.isLua) { flag = true; if (this.isLuaFile(strFileName) && (!this.CheckIsDown(state.iDownState) || (state.iLuaState == -1))) { flag2 = false; } } } if (!flag) { Logger.d("res:" + res.strResName + " no lua"); res.iLuaState = this.iLuaInited; } if (flag2) { res.iLuaState = this.iLuaWaitInit; } if (res.iLuaState == this.iLuaWaitInit) { res.iLuaState = this.iLuaIniting; for (int m = 0; m < res.aryFileState.Count; m++) { CFileState state2 = res.aryFileState[m] as CFileState; string key = state2.strFileName; if (state2.isLua && !this.dicInitLua.ContainsKey(key)) { this.dicInitLua.Add(key, true); Logger.d("开始加载-》" + key); string luaName = this.GetLuaName(key); LuaHelper.GetResManager().LuaInitToVm(luaName); } } res.iLuaState = this.iLuaInited; } } } bool flag3 = true; for (int j = 0; j < this.aryRes.Count; j++) { CRes res2 = this.aryRes[j] as CRes; if (res2.iLuaState != this.iLuaInited) { flag3 = false; break; } } if (flag3) { Logger.d("init lua finish"); this.isNeedLoadLua = false; } } } catch (Exception exception) { Logger.LogNetError(Configer.iCodeCSException, exception.Message + exception.StackTrace.ToString()); } }
public static int PraseConnect(string strContent, int iLen, int iFlag) { try { Dictionary <string, object> dictionary = Json.Deserialize(strContent) as Dictionary <string, object>; if (dictionary.ContainsKey("iPdrLibRet")) { int num = Convert.ToInt32(dictionary["iPdrLibRet"] as string); int num2 = -1; if (dictionary.ContainsKey("ret")) { num2 = Convert.ToInt32(dictionary["ret"] as string); } if (num == 0) { strCloudConfigInfo = strContent; if (dictionary.ContainsKey("isDebug")) { string str = dictionary["isDebug"] as string; if (str.Equals("1")) { Logger.INEED_LOG_TEXT = 1; } else { Logger.INEED_LOG_TEXT = 0; } } if (dictionary.ContainsKey("log_level")) { string s = dictionary["log_level"] as string; int result = 0; int.TryParse(s, out result); Logger.LOG_LEVEL = result; } if (dictionary.ContainsKey("isNetLog")) { string str3 = dictionary["isNetLog"] as string; if (str3 == "1") { Configer.strSendLogFlag = "1"; } else { Configer.strSendLogFlag = "0"; } } if (dictionary.ContainsKey("totalSwitch")) { Logger.d("ret:" + num2.ToString()); if (((num2 != 0) && (num2 != 1)) && (num2 != 2)) { Logger.LogNetError(0x3f1, "cgi return exception:" + dictionary["ret"].ToString()); } else { Logger.d("cgi return: " + num2.ToString()); } if (dictionary.ContainsKey("curr_lua_dir") && (dictionary["curr_lua_dir"].ToString() != string.Empty)) { Configer.m_CurHotUpdatePath = dictionary["curr_lua_dir"].ToString(); if (Configer.m_CurHotUpdatePath != string.Empty) { Configer.m_CurHotUpdatePath = Configer.m_CurHotUpdatePath + "/res/"; } Logger.d("m_CurHotUpdatePath:" + Configer.m_CurHotUpdatePath); } string strCurState = string.Empty; string strFile = string.Empty; if (dictionary.ContainsKey("filelist")) { strCurState = dictionary["filelist"].ToString(); } if (dictionary.ContainsKey("filename")) { strFile = dictionary["filename"].ToString(); } if (dictionary.ContainsKey("lua_newversion")) { int curTimestamp; if (!int.TryParse(dictionary["lua_newversion"].ToString(), out curTimestamp)) { Logger.d("云端lua_newversion获取不成功,使用时间戳为版本号:" + dictionary["lua_newversion"].ToString()); curTimestamp = DateUtils.GetCurTimestamp(); } ResourceManager.iLuaVer = curTimestamp; } else if (ResourceManager.iLuaVer == 1) { Logger.d("use time ver"); ResourceManager.iLuaVer = DateUtils.GetCurTimestamp(); } string strConfigInfo = string.Empty; if (dictionary.ContainsKey("dependency")) { strConfigInfo = dictionary["dependency"].ToString(); } Configer.strCtrFlagTotalSwitch = dictionary["totalSwitch"] as string; if (Configer.strCtrFlagTotalSwitch.Equals("1")) { if ((dictionary["ret"].ToString() == "1") || (dictionary["ret"].ToString() == "2")) { Logger.d("初始化下载列表"); GetInstance().increaceUpdate.SetUpdateInfo(strConfigInfo, strCurState); } if (dictionary["ret"].ToString() == "0") { Logger.d("下载成功回调:" + strFile); GetInstance().increaceUpdate.AddDownSuccFile(strFile); } } } else { Logger.d("totalSwitch no data"); } } else { Logger.d("connect iRet:" + num.ToString()); } } else { Logger.d("no para iPdrLibRet"); } } catch (Exception exception) { Logger.e("connect fail,retry:" + exception.ToString()); } return(0); }