public void ParseServerData(COMDT_SELFDEFINE_CHATINFO chatInfo) { if (chatInfo == null) { return; } bool flag = false; this.totalCount = chatInfo.bMsgCnt; for (int i = 0; i < (int)chatInfo.bMsgCnt; i++) { COMDT_SELFDEFINE_DETAIL_CHATINFO cOMDT_SELFDEFINE_DETAIL_CHATINFO = chatInfo.astChatMsg[i]; if (cOMDT_SELFDEFINE_DETAIL_CHATINFO.bChatType == 4) { flag = true; break; } if (cOMDT_SELFDEFINE_DETAIL_CHATINFO.bChatType == 1 && cOMDT_SELFDEFINE_DETAIL_CHATINFO.stChatInfo.get_stSignalID().dwTextID > 0u) { flag = true; break; } } if (!flag) { this.UseDefaultShortcut(); return; } for (int j = 0; j < (int)chatInfo.bMsgCnt; j++) { COMDT_SELFDEFINE_DETAIL_CHATINFO cOMDT_SELFDEFINE_DETAIL_CHATINFO2 = chatInfo.astChatMsg[j]; if (cOMDT_SELFDEFINE_DETAIL_CHATINFO2.bChatType == 1) { uint dwTextID = cOMDT_SELFDEFINE_DETAIL_CHATINFO2.stChatInfo.get_stSignalID().dwTextID; TabElement tabElement = new TabElement(dwTextID, string.Empty); tabElement.cfgId = dwTextID; if (dwTextID > 0u) { ResInBatMsgCfg cfgData = this.GetCfgData(tabElement.cfgId); DebugHelper.Assert(cfgData != null, "custom shortcut ParseServerData cfgdata is null, cfgID:" + tabElement.cfgId); if (cfgData != null) { tabElement.configContent = cfgData.szContent; } } this.menuEntList.Add(tabElement); } else if (cOMDT_SELFDEFINE_DETAIL_CHATINFO2.bChatType == 1) { string text = StringHelper.BytesToString(cOMDT_SELFDEFINE_DETAIL_CHATINFO2.stChatInfo.get_stSelfDefineStr().szContent); if (!string.IsNullOrEmpty(text)) { TabElement tabElement2 = new TabElement(string.Empty); this.menuEntList.Add(tabElement2); } } } this.SyncData(this.menuEntList, this.lastMenuEntList); this.Print(this.menuEntList, "服务器解析出来的自定义数据"); }
public void ParseServerData(COMDT_SELFDEFINE_CHATINFO chatInfo) { if (chatInfo != null) { bool flag = false; this.totalCount = chatInfo.bMsgCnt; for (int i = 0; i < chatInfo.bMsgCnt; i++) { COMDT_SELFDEFINE_DETAIL_CHATINFO comdt_selfdefine_detail_chatinfo = chatInfo.astChatMsg[i]; if (comdt_selfdefine_detail_chatinfo.bChatType == 4) { flag = true; break; } if ((comdt_selfdefine_detail_chatinfo.bChatType == 1) && (comdt_selfdefine_detail_chatinfo.stChatInfo.stSignalID.dwTextID > 0)) { flag = true; break; } } if (!flag) { this.UseDefaultShortcut(); } else { for (int j = 0; j < chatInfo.bMsgCnt; j++) { COMDT_SELFDEFINE_DETAIL_CHATINFO comdt_selfdefine_detail_chatinfo2 = chatInfo.astChatMsg[j]; if (comdt_selfdefine_detail_chatinfo2.bChatType == 1) { uint dwTextID = comdt_selfdefine_detail_chatinfo2.stChatInfo.stSignalID.dwTextID; TabElement item = new TabElement(dwTextID, string.Empty) { cfgId = dwTextID }; if (dwTextID > 0) { ResInBatMsgCfg cfgData = this.GetCfgData(item.cfgId); DebugHelper.Assert(cfgData != null, "custom shortcut ParseServerData cfgdata is null, cfgID:" + item.cfgId); if (cfgData != null) { item.configContent = cfgData.szContent; } } this.menuEntList.Add(item); } else if ((comdt_selfdefine_detail_chatinfo2.bChatType == 1) && !string.IsNullOrEmpty(StringHelper.BytesToString(comdt_selfdefine_detail_chatinfo2.stChatInfo.stSelfDefineStr.szContent))) { TabElement element2 = new TabElement(string.Empty); this.menuEntList.Add(element2); } } this.SyncData(this.menuEntList, this.lastMenuEntList); this.Print(this.menuEntList, "服务器解析出来的自定义数据"); } } }