private void m_prcClient_PacketSent(FrostbiteConnection sender, bool isHandled, Packet packetBeforeDispatch) { if (this.LogDebugDetails == true) { if (packetBeforeDispatch.OriginatedFromServer == false) { this.Write(this.GetDebugPacket("^6Client", "^2", packetBeforeDispatch, null)); //this.Write("^b^6{0,18}^0 {1}\tS:{2}\t^2{3}", "Command:", this.GetRequestResponseColour(packetBeforeDispatch), packetBeforeDispatch.SequenceNumber, packetBeforeDispatch.ToDebugString().TrimEnd('\r', '\n')); } else { if (this.LogEventsConnection == true) { this.Write(this.GetDebugPacket("^8Server", "^2", packetBeforeDispatch, null)); //this.Write("^b^8{0,18}^0 {1}\tS:{2}\t^2{3}", "Event:", this.GetRequestResponseColour(packetBeforeDispatch), packetBeforeDispatch.SequenceNumber, packetBeforeDispatch.ToDebugString().TrimEnd('\r', '\n')); } } } else { if (packetBeforeDispatch.OriginatedFromServer == false || this.LogEventsConnection == true) { this.Write("^b^2{0}", packetBeforeDispatch.ToString().TrimEnd('\r', '\n')); } } this.BytesSent += packetBeforeDispatch.PacketSize; }
void m_prcClient_PacketRecieved(FrostbiteConnection sender, bool isHandled, Packet packetBeforeDispatch) { Packet cpRequestPacket = this.m_prcClient.Game.Connection.GetRequestPacket(packetBeforeDispatch); if (packetBeforeDispatch.OriginatedFromServer == false && packetBeforeDispatch.IsResponse == true) { if (this.LogDebugDetails == true && cpRequestPacket != null) { if (cpRequestPacket.OriginatedFromServer == false) { this.Write(this.GetDebugPacket("^6Client", "^4", packetBeforeDispatch, cpRequestPacket)); //this.Write("^b^6{0,18}^0 {1}\tS:{2}\t^4{3}\t^0(RE: ^2{4}^0)", "Command:", this.GetRequestResponseColour(packetBeforeDispatch), packetBeforeDispatch.SequenceNumber, packetBeforeDispatch.ToDebugString().TrimEnd('\r', '\n').Replace("{", "{{").Replace("}", "}}"), cpRequestPacket.ToString().Replace("{", "{{").Replace("}", "}}")); } else { if (this.LogEventsConnection == true) { this.Write(this.GetDebugPacket("^8Server", "^4", packetBeforeDispatch, cpRequestPacket)); //this.Write("^b^8{0,18}^0 {1}\tS:{2}\t^4{3}\t^0(RE: ^2{4}^0)", "Event:", this.GetRequestResponseColour(packetBeforeDispatch), packetBeforeDispatch.SequenceNumber, packetBeforeDispatch.ToDebugString().TrimEnd('\r', '\n').Replace("{", "{{").Replace("}", "}}"), cpRequestPacket.ToString().Replace("{", "{{").Replace("}", "}}")); } } } else { if ((cpRequestPacket != null && cpRequestPacket.OriginatedFromServer == false) || this.LogEventsConnection == true) { this.Write("^b^4{0}", packetBeforeDispatch.ToString().TrimEnd('\r', '\n').Replace("{", "{{").Replace("}", "}}")); } } } // ELSE IF it's an event initiated by the server (OnJoin, OnLeave, OnChat etc) else if (packetBeforeDispatch.OriginatedFromServer == true && packetBeforeDispatch.IsResponse == false) { if (this.LogDebugDetails == true) { if (cpRequestPacket != null && cpRequestPacket.OriginatedFromServer == false) { this.Write(this.GetDebugPacket("^6Client", "^4", packetBeforeDispatch, null)); //this.Write("^b^6{0,18}^0 {1}\tS:{2}\t^4{3}", "Command:", this.GetRequestResponseColour(packetBeforeDispatch), packetBeforeDispatch.SequenceNumber, packetBeforeDispatch.ToDebugString().Replace("{", "{{").Replace("}", "}}")); } else { if (this.LogEventsConnection == true) { this.Write(this.GetDebugPacket("^8Server", "^4", packetBeforeDispatch, null)); //this.Write("^b^8{0,18}^0 {1}\tS:{2}\t^4{3}", "Event:", this.GetRequestResponseColour(packetBeforeDispatch), packetBeforeDispatch.SequenceNumber, packetBeforeDispatch.ToDebugString().Replace("{", "{{").Replace("}", "}}")); } } } else { if ((cpRequestPacket != null && cpRequestPacket.OriginatedFromServer == false) || this.LogEventsConnection == true) { this.Write("^b^4{0}", packetBeforeDispatch.ToString().TrimEnd('\r', '\n').Replace("{", "{{").Replace("}", "}}")); } } } this.BytesRecieved += packetBeforeDispatch.PacketSize; }