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


C# IPacketMsg.GetData方法代码示例

本文整理汇总了C#中IPacketMsg.GetData方法的典型用法代码示例。如果您正苦于以下问题:C# IPacketMsg.GetData方法的具体用法?C# IPacketMsg.GetData怎么用?C# IPacketMsg.GetData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPacketMsg的用法示例。


在下文中一共展示了IPacketMsg.GetData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandleMsg

        public override void HandleMsg(IPacketMsg packetMsg)
        {
            if (packetMsg.MsgType == EMsg.ClientServiceCall ||
                packetMsg.MsgType == EMsg.ClientServiceModule ||
                packetMsg.MsgType == EMsg.ClientReadMachineAuth ||
                packetMsg.MsgType == EMsg.ClientRequestMachineAuth)
            {
                IRC.Instance.SendOps("Yo xPaw and Netshroud, got {0}", packetMsg.MsgType);

                ErrorReporter.Notify(new NotImplementedException(string.Format("Got {0}", packetMsg.MsgType)));

                string file = Path.Combine(Application.Path, "files", ".support", string.Format("dump_{0}_{1}.bin", packetMsg.MsgType, DateTime.UtcNow.ToString("yyyyMMddHHmmssfff")));
                Console.WriteLine(file);
                File.WriteAllBytes(file, packetMsg.GetData());
            }
        }
开发者ID:qyh214,项目名称:SteamDatabaseBackend,代码行数:16,代码来源:ReadMachineAuth.cs

示例2: OnClientMsgReceived

        /// <summary>
        /// Called when a client message is received from the network.
        /// </summary>
        /// <param name="packetMsg">The packet message.</param>
        protected virtual bool OnClientMsgReceived( IPacketMsg packetMsg )
        {
            if ( packetMsg == null )
            {
                DebugLog.WriteLine( "CMClient", "Packet message failed to parse, shutting down connection" );
                Disconnect();
                return false;
            }

            DebugLog.WriteLine( "CMClient", "<- Recv'd EMsg: {0} ({1}) (Proto: {2})", packetMsg.MsgType, ( int )packetMsg.MsgType, packetMsg.IsProto );

            // Multi message gets logged down the line after it's decompressed
            if ( packetMsg.MsgType != EMsg.Multi )
            {
                try
                {
                    DebugNetworkListener?.OnIncomingNetworkMessage( packetMsg.MsgType, packetMsg.GetData() );
                }
                catch ( Exception e )
                {
                    DebugLog.WriteLine( "CMClient", "DebugNetworkListener threw an exception: {0}", e );
                }
            }

            // ensure that during channel setup, no other messages are processed
            if ( ( !encryptionSetup && pendingNetFilterEncryption == null && packetMsg.MsgType != EMsg.ChannelEncryptRequest ) ||
                 ( !encryptionSetup && pendingNetFilterEncryption != null && packetMsg.MsgType != EMsg.ChannelEncryptRequest && packetMsg.MsgType != EMsg.ChannelEncryptResult ) )
            {
                DebugLog.WriteLine( "CMClient", "Rejected EMsg: {0} during channel setup" );
                return false;
            }

            switch ( packetMsg.MsgType )
            {
                case EMsg.ChannelEncryptRequest:
                    return HandleEncryptRequest( packetMsg );

                case EMsg.ChannelEncryptResult:
                    return HandleEncryptResult( packetMsg );

                case EMsg.Multi:
                    HandleMulti( packetMsg );
                    break;

                case EMsg.ClientLogOnResponse: // we handle this to get the SteamID/SessionID and to setup heartbeating
                    HandleLogOnResponse( packetMsg );
                    break;

                case EMsg.ClientLoggedOff: // to stop heartbeating when we get logged off
                    HandleLoggedOff( packetMsg );
                    break;

                case EMsg.ClientServerList: // Steam server list
                    HandleServerList( packetMsg );
                    break;

                case EMsg.ClientCMList:
                    HandleCMList( packetMsg );
                    break;

                case EMsg.ClientSessionToken: // am session token
                    HandleSessionToken( packetMsg );
                    break;
            }

            return true;
        }
开发者ID:DoctorMcKay,项目名称:SteamKit,代码行数:71,代码来源:CMClient.cs


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