public static Chat_Model_Base Parse(string str) { string uuid = str.Substring(40, 36); string id = str.Substring(76, 32); string roomId = str.Substring(108, 32); string text = str.Substring(140, 8); string timeStampClient = str.Substring(148, 16); string timeStampServer = str.Substring(164, 16); string senderId = str.Substring(180, 32); string[] array = str.Substring(212).Split(':'); string text2 = (array.Length != 2) ? string.Empty : array[0]; string message = (array.Length != 2) ? string.Empty : array[1]; if (int.Parse(text) == 0) { Chat_Model_BroadcastClanMessage_Response chat_Model_BroadcastClanMessage_Response = new Chat_Model_BroadcastClanMessage_Response(); chat_Model_BroadcastClanMessage_Response.Uuid = uuid; chat_Model_BroadcastClanMessage_Response.Id = id; chat_Model_BroadcastClanMessage_Response.NickName = text2; chat_Model_BroadcastClanMessage_Response.RoomId = roomId; chat_Model_BroadcastClanMessage_Response.TimeStampClient = timeStampClient; chat_Model_BroadcastClanMessage_Response.TimeStampServer = timeStampServer; chat_Model_BroadcastClanMessage_Response.SenderId = senderId; chat_Model_BroadcastClanMessage_Response.SenderName = text2; chat_Model_BroadcastClanMessage_Response.Message = message; Chat_Model_BroadcastClanMessage_Response chat_Model_BroadcastClanMessage_Response2 = chat_Model_BroadcastClanMessage_Response; chat_Model_BroadcastClanMessage_Response2.SetErrorType(text); return(chat_Model_BroadcastClanMessage_Response2); } return(null); }
private void OnReceiveMessage(ChatPacket packet) { Chat_Model_BroadcastClanMessage_Response chat_Model_BroadcastClanMessage_Response = packet.model as Chat_Model_BroadcastClanMessage_Response; int result = 0; int result2 = 0; int.TryParse(chat_Model_BroadcastClanMessage_Response.SenderId, out result); int.TryParse(chat_Model_BroadcastClanMessage_Response.Id, out result2); if (result == 0) { if (this.onReceiveNotification != null) { this.onReceiveNotification(chat_Model_BroadcastClanMessage_Response.Message); } } else if (chat_Model_BroadcastClanMessage_Response.Message.Contains(STAMP_SYMBOL_BEGIN)) { string s = chat_Model_BroadcastClanMessage_Response.Message.Substring(STAMP_SYMBOL_BEGIN.Length, 8); int result3 = -1; int.TryParse(s, out result3); if (this.onReceiveStamp != null) { ClanChatLogMessageData clanChatLogMessageData = new ClanChatLogMessageData(); clanChatLogMessageData.uuid = chat_Model_BroadcastClanMessage_Response.Uuid; clanChatLogMessageData.id = result2; clanChatLogMessageData.fromUserId = result; clanChatLogMessageData.senderName = chat_Model_BroadcastClanMessage_Response.SenderName; clanChatLogMessageData.stampId = result3; this.onReceiveStamp(clanChatLogMessageData); } } else if (this.onReceiveText != null) { ClanChatLogMessageData clanChatLogMessageData2 = new ClanChatLogMessageData(); clanChatLogMessageData2.uuid = chat_Model_BroadcastClanMessage_Response.Uuid; clanChatLogMessageData2.id = result2; clanChatLogMessageData2.fromUserId = result; clanChatLogMessageData2.senderName = chat_Model_BroadcastClanMessage_Response.SenderName; clanChatLogMessageData2.message = chat_Model_BroadcastClanMessage_Response.Message; this.onReceiveText(clanChatLogMessageData2); } }
public static Chat_Model_Base ParseModel(string str, CHAT_PACKET_TYPE type) { switch (type) { case CHAT_PACKET_TYPE.JOIN_ROOM: return(Chat_Model_JoinRoom.Parse(str)); case CHAT_PACKET_TYPE.BROADCAST_ROOM: return(Chat_Model_BroadcastMessage_Response.Parse(str)); case CHAT_PACKET_TYPE.PARTY_INVITE: return(Chat_Model_PartyInvite.Parse(str)); case CHAT_PACKET_TYPE.CLAN_JOIN_ROOM: return(Chat_Model_JoinClanRoom.Parse(str)); case CHAT_PACKET_TYPE.CLAN_LEAVE_ROOM: return(Chat_Model_LeaveClanRoom.Parse(str)); case CHAT_PACKET_TYPE.CLAN_SENDTO: return(Chat_Model_SendToClanMessage_Response.Parse(str)); case CHAT_PACKET_TYPE.CLAN_BROADCAST_ROOM: return(Chat_Model_BroadcastClanMessage_Response.Parse(str)); case CHAT_PACKET_TYPE.CLAN_BROADCAST_STATUS: return(Chat_Model_BroadcastClanStatus_Response.Parse(str)); case CHAT_PACKET_TYPE.RALLY_INVITE: return(Chat_Model_RallyInvite.Parse(str)); case CHAT_PACKET_TYPE.DARK_MARKET_RESET: return(Chat_Model_ResetDarkMarket.Parse(str)); case CHAT_PACKET_TYPE.DARK_MARKET_UPDATE: return(Chat_Model_UpdateDarkMarket.Parse(str)); default: return(new Chat_Model_Base()); } }