本文整理汇总了C#中GSPacketIn.Read方法的典型用法代码示例。如果您正苦于以下问题:C# GSPacketIn.Read方法的具体用法?C# GSPacketIn.Read怎么用?C# GSPacketIn.Read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GSPacketIn
的用法示例。
在下文中一共展示了GSPacketIn.Read方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandlePacket
public void HandlePacket(GameClient client, GSPacketIn packet)
{
// for 1.115c+ The First client packet Changes.
if (client.Version < GameClient.eClientVersion.Version1115)
{
int rc4 = packet.ReadByte();
byte clientType = (byte)packet.ReadByte();
client.ClientType = (GameClient.eClientType)(clientType & 0x0F);
client.ClientAddons = (GameClient.eClientAddons)(clientType & 0xF0);
byte major = (byte)packet.ReadByte();
byte minor = (byte)packet.ReadByte();
byte build = (byte)packet.ReadByte();
if(rc4==1)
{
//DOLConsole.Log("SBox=\n");
//DOLConsole.LogDump(client.PacketProcessor.Encoding.SBox);
packet.Read(((PacketEncoding168)client.PacketProcessor.Encoding).SBox,0,256);
((PacketEncoding168)client.PacketProcessor.Encoding).EncryptionState=PacketEncoding168.eEncryptionState.PseudoRC4Encrypted;
//DOLConsole.WriteLine(client.Socket.RemoteEndPoint.ToString()+": SBox set!");
//DOLConsole.Log("SBox=\n");
//DOLConsole.LogDump(((PacketEncoding168)client.PacketProcessor.Encoding).SBox);
}
else
{
//Send the crypt key to the client
client.Out.SendVersionAndCryptKey();
}
}
else
{
// we don't handle Encryption for 1.115c
// the rc4 secret can't be unencrypted from RSA.
// register client type
byte clientType = (byte)packet.ReadByte();
client.ClientType = (GameClient.eClientType)(clientType & 0x0F);
client.ClientAddons = (GameClient.eClientAddons)(clientType & 0xF0);
// if the DataSize is above 7 then the RC4 key is bundled
// this is stored in case we find a way to handle encryption someday !
if (packet.DataSize > 7)
{
packet.Skip(6);
ushort length = packet.ReadShortLowEndian();
packet.Read(client.PacketProcessor.Encoding.SBox, 0, length);
// ((PacketEncoding168)client.PacketProcessor.Encoding).EncryptionState=PacketEncoding168.eEncryptionState.PseudoRC4Encrypted;
}
//Send the crypt key to the client
client.Out.SendVersionAndCryptKey();
}
}
示例2: HandlePacket
public void HandlePacket(GameClient client, GSPacketIn packet)
{
int rc4 = packet.ReadByte();
byte clientType = (byte)packet.ReadByte();
client.ClientType = (GameClient.eClientType)(clientType & 0x0F);
client.ClientAddons = (GameClient.eClientAddons)(clientType & 0xF0);
byte major = (byte)packet.ReadByte();
byte minor = (byte)packet.ReadByte();
byte build = (byte)packet.ReadByte();
if(rc4==1)
{
//DOLConsole.Log("SBox=\n");
//DOLConsole.LogDump(client.PacketProcessor.Encoding.SBox);
packet.Read(((PacketEncoding168)client.PacketProcessor.Encoding).SBox,0,256);
((PacketEncoding168)client.PacketProcessor.Encoding).EncryptionState=PacketEncoding168.eEncryptionState.PseudoRC4Encrypted;
//DOLConsole.WriteLine(client.Socket.RemoteEndPoint.ToString()+": SBox set!");
//DOLConsole.Log("SBox=\n");
//DOLConsole.LogDump(((PacketEncoding168)client.PacketProcessor.Encoding).SBox);
}
else
{
//Send the crypt key to the client
client.Out.SendVersionAndCryptKey();
}
}