本文整理汇总了C#中Framework.Network.Packets.PacketReader.ReadBytes方法的典型用法代码示例。如果您正苦于以下问题:C# PacketReader.ReadBytes方法的具体用法?C# PacketReader.ReadBytes怎么用?C# PacketReader.ReadBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Framework.Network.Packets.PacketReader
的用法示例。
在下文中一共展示了PacketReader.ReadBytes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleAuthLogonProof
public void HandleAuthLogonProof(PacketReader data)
{
Log.Message(LogType.NORMAL, "AuthLogonProof");
using (var logonProof = new PacketWriter())
{
var a = data.ReadBytes(32);
var m1 = data.ReadBytes(20);
SecureRemotePassword.CalculateU(a);
SecureRemotePassword.CalculateM2(m1);
SecureRemotePassword.CalculateK();
foreach (var b in SecureRemotePassword.K)
if (b < 0x10)
account.SessionKey += "0" + String.Format(CultureInfo.InvariantCulture, "{0:X}", b);
else
account.SessionKey += String.Format(CultureInfo.InvariantCulture, "{0:X}", b);
logonProof.WriteUInt8((byte)ClientLink.CMD_AUTH_LOGON_PROOF);
logonProof.WriteUInt8(0);
logonProof.WriteBytes(SecureRemotePassword.M2);
logonProof.WriteUInt32(0x800000);
logonProof.WriteUInt32(0);
logonProof.WriteUInt16(0);
SecureRemotePassword.Dispose();
DB.Realms.Execute("UPDATE accounts SET sessionkey = ? WHERE id = ?", account.SessionKey, account.Id);
Send(logonProof);
}
}
示例2: HandleAuthResponse
public static void HandleAuthResponse(ref PacketReader packet, WorldClass session)
{
BitUnpack BitUnpack = new BitUnpack(packet);
ushort skipBytes;
uint[] UnknownInt = new uint[5];
ushort clientBuild;
byte[] authChallenge = new byte[20];
byte[] UnknownByte = new byte[2];
ulong unknownLong;
int addonPackedSize;
int addonUnpackedSize;
skipBytes = packet.Read<ushort>();
UnknownInt[4] = packet.Read<uint>();
authChallenge[14] = packet.Read<byte>();
authChallenge[8] = packet.Read<byte>();
UnknownInt[0] = packet.Read<uint>();
authChallenge[10] = packet.Read<byte>();
authChallenge[19] = packet.Read<byte>();
authChallenge[16] = packet.Read<byte>();
authChallenge[13] = packet.Read<byte>();
authChallenge[4] = packet.Read<byte>();
UnknownByte[1] = packet.Read<byte>();
authChallenge[9] = packet.Read<byte>();
authChallenge[0] = packet.Read<byte>();
UnknownInt[2] = packet.Read<uint>();
authChallenge[5] = packet.Read<byte>();
authChallenge[2] = packet.Read<byte>();
clientBuild = packet.Read<ushort>();
authChallenge[12] = packet.Read<byte>();
UnknownInt[3] = packet.Read<uint>();
authChallenge[18] = packet.Read<byte>();
authChallenge[17] = packet.Read<byte>();
authChallenge[11] = packet.Read<byte>();
unknownLong = packet.Read<ulong>();
authChallenge[7] = packet.Read<byte>();
authChallenge[1] = packet.Read<byte>();
authChallenge[3] = packet.Read<byte>();
UnknownByte[0] = packet.Read<byte>();
authChallenge[6] = packet.Read<byte>();
UnknownInt[1] = packet.Read<uint>();
authChallenge[15] = packet.Read<byte>();
addonPackedSize = packet.Read<int>();
addonUnpackedSize = packet.Read<int>();
byte[] packedAddon = packet.ReadBytes(addonPackedSize - 4);
AddonHandler.ReadAddonData(packedAddon, addonUnpackedSize, session);
uint nameLength = BitUnpack.GetBits<uint>(11);
bool aBit = BitUnpack.GetBit();
// BitUnpack.Flush();
string accountName = packet.ReadString(nameLength);
SQLResult result = DB.Realms.Select("SELECT * FROM accounts WHERE name = ?", accountName);
if (result.Count == 0)
session.clientSocket.Close();
else
session.Account = new Account()
{
Id = result.Read<int>(0, "id"),
Name = result.Read<string>(0, "name"),
Password = result.Read<string>(0, "password"),
SessionKey = result.Read<string>(0, "sessionkey"),
Expansion = result.Read<byte>(0, "expansion"),
GMLevel = result.Read<byte>(0, "gmlevel"),
IP = result.Read<string>(0, "ip"),
Language = result.Read<string>(0, "language")
};
string K = session.Account.SessionKey;
byte[] kBytes = new byte[K.Length / 2];
for (int i = 0; i < K.Length; i += 2)
kBytes[i / 2] = Convert.ToByte(K.Substring(i, 2), 16);
session.Crypt.Initialize(kBytes);
uint realmId = WorldConfig.RealmId;
//.........这里部分代码省略.........