当前位置: 首页>>代码示例>>C#>>正文


C# Packet.ToString方法代码示例

本文整理汇总了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;
        }
开发者ID:ratdart,项目名称:Procon-1,代码行数:26,代码来源:ConnectionConsole.cs

示例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;
        }
开发者ID:ratdart,项目名称:Procon-1,代码行数:51,代码来源:ConnectionConsole.cs


注:本文中的Core.Packet.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。