本文整理匯總了C#中PRoCon.Core.Remote.Packet.ToString方法的典型用法代碼示例。如果您正苦於以下問題:C# Packet.ToString方法的具體用法?C# Packet.ToString怎麽用?C# Packet.ToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PRoCon.Core.Remote.Packet
的用法示例。
在下文中一共展示了Packet.ToString方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: m_prcClient_PacketSent
protected void m_prcClient_PacketSent(FrostbiteConnection sender, bool isHandled, Packet packetBeforeDispatch) {
if (LogDebugDetails == true) {
if (packetBeforeDispatch.OriginatedFromServer == false) {
Write(GetDebugPacket("^6Client", "^2", packetBeforeDispatch, null));
}
else {
if (LogEventsConnection == true) {
Write(GetDebugPacket("^8Server", "^2", packetBeforeDispatch, null));
}
}
}
else {
if (packetBeforeDispatch.OriginatedFromServer == false || LogEventsConnection == true) {
Write("^b^2{0}", packetBeforeDispatch.ToString().TrimEnd('\r', '\n'));
}
}
BytesSent += packetBeforeDispatch.PacketSize;
}
示例2: GetDebugPacket
protected static string GetDebugPacket(string connectionPrefix, string packetColour, Packet packet, Packet requestPacket) {
string debugString = String.Empty;
try {
debugString = string.Format("{0,10}: {1,-12} S: {2,-6} {3}{4}", connectionPrefix, GetRequestResponseColour(packet), packet.SequenceNumber, packetColour, packet.ToDebugString().Replace("\r", "").Replace("\n", ""));
if (requestPacket != null) {
debugString = String.Format("{0} ^0(RE: ^2{1}^0)", debugString, requestPacket.ToDebugString().TrimEnd('\r', '\n'));
}
debugString = debugString.Replace("{", "{{").Replace("}", "}}");
}
catch (Exception e) {
FrostbiteConnection.LogError(String.Join(", ", new[] { connectionPrefix, packetColour, packet.ToString(), requestPacket != null ? requestPacket.ToString() : "" }), "", e);
debugString = "";
}
return debugString;
}
示例3: m_prcClient_PacketRecieved
private void m_prcClient_PacketRecieved(FrostbiteConnection sender, bool isHandled, Packet packetBeforeDispatch) {
Packet cpRequestPacket = Client.Game.Connection.GetRequestPacket(packetBeforeDispatch);
if (packetBeforeDispatch.OriginatedFromServer == false && packetBeforeDispatch.IsResponse == true) {
if (LogDebugDetails == true && cpRequestPacket != null) {
if (cpRequestPacket.OriginatedFromServer == false) {
Write(GetDebugPacket("^6Client", "^4", packetBeforeDispatch, cpRequestPacket));
}
else {
if (LogEventsConnection == true) {
Write(GetDebugPacket("^8Server", "^4", packetBeforeDispatch, cpRequestPacket));
}
}
}
else {
if ((cpRequestPacket != null && cpRequestPacket.OriginatedFromServer == false) || LogEventsConnection == true) {
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 (LogDebugDetails == true) {
if (cpRequestPacket != null && cpRequestPacket.OriginatedFromServer == false) {
Write(GetDebugPacket("^6Client", "^4", packetBeforeDispatch, null));
}
else {
if (LogEventsConnection == true) {
Write(GetDebugPacket("^8Server", "^4", packetBeforeDispatch, null));
}
}
}
else {
if ((cpRequestPacket != null && cpRequestPacket.OriginatedFromServer == false) || LogEventsConnection == true) {
Write("^b^4{0}", packetBeforeDispatch.ToString().TrimEnd('\r', '\n').Replace("{", "{{").Replace("}", "}}"));
}
}
}
BytesRecieved += packetBeforeDispatch.PacketSize;
}