protected PacketMessage ParsePacketMessage(string clientAddress, string paramString, ConnectType connectType) { ParamGeter paramGeter = new ParamGeter(paramString); PacketHead head = new PacketHead(connectType, PacketMsgType.Request); head.Address = clientAddress; head.MsgId = paramGeter.GetInt("msgid"); head.Uid = paramGeter.GetInt("uid"); head.ActionId = paramGeter.GetInt("actionId"); string[] sidArray = paramGeter.GetString("sid").Split('|'); if (sidArray.Length > 2) { head.GameId = sidArray[1].ToInt(); head.ServerId = sidArray[2].ToInt(); } else { head.GameId = paramGeter.GetInt("gametype"); head.ServerId = paramGeter.GetInt("serverid"); } head.EnableGzip = false; PacketMessage packet = new PacketMessage(); packet.Head = head; packet.Content = BufferUtils.GetBytes(paramString); return(packet); }
private MessageHead ParseMessageHead(ParamGeter paramGeter) { int msgId = paramGeter.GetInt("msgid"); int actionId = paramGeter.GetInt("actionId"); string St = "st"; string st = paramGeter.GetString("st"); if (!string.IsNullOrEmpty(st)) { St = st; } return(new MessageHead(msgId, actionId, St, 0)); }
private RequestSettings ParseRequestSettings(ParamGeter paramGeter, string remoteAddress) { int gameId = 0; int serverId = 0; if (paramGeter.Contains("sid")) { string[] array = paramGeter.GetString("sid").Split('|'); if (array.Length > 2) { string sid = array[0]; gameId = array[1].ToInt(); serverId = array[2].ToInt(); } else { gameId = paramGeter.GetInt("gametype"); serverId = paramGeter.GetInt("serverid"); } } return(new RequestSettings(gameId, serverId, remoteAddress)); }