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


C# GSPacketIn.Read方法代码示例

本文整理汇总了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();
			}
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:52,代码来源:CryptKeyRequestHandler.cs

示例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();
			}
		}
开发者ID:boscorillium,项目名称:dol,代码行数:25,代码来源:CryptKeyRequestHandler.cs


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