本文整理汇总了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());
}
}
示例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;
}