本文整理汇总了C#中Core.Packet.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.ToString方法的具体用法?C# Packet.ToString怎么用?C# Packet.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core.Packet
的用法示例。
在下文中一共展示了Packet.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: m_prcClient_PacketSent
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;
}
示例2: m_prcClient_PacketRecieved
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;
}