本文整理汇总了C#中WowPacketParser.Misc.Packet.Write方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.Write方法的具体用法?C# Packet.Write怎么用?C# Packet.Write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WowPacketParser.Misc.Packet
的用法示例。
在下文中一共展示了Packet.Write方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleServerAddonsList
public static void HandleServerAddonsList(Packet packet)
{
// This packet requires _addonCount from CMSG_AUTH_SESSION to be parsed.
if (_addonCount == -1)
{
packet.WriteLine("CMSG_AUTH_SESSION was not received - cannot successfully parse this packet.");
packet.ReadToEnd();
return;
}
for (var i = 0; i < _addonCount; i++)
{
packet.ReadByte("Addon State", i);
var sendCrc = packet.ReadBoolean("Use CRC", i);
if (sendCrc)
{
var usePublicKey = packet.ReadBoolean("Use Public Key", i);
if (usePublicKey)
{
var pubKey = packet.ReadChars(256);
packet.Write("[{0}] Public Key: ", i);
foreach (var t in pubKey)
packet.Write(t.ToString(CultureInfo.InvariantCulture));
}
packet.ReadInt32("Unk Int32", i);
}
if (packet.ReadBoolean("Use URL File", i))
packet.ReadCString("Addon URL File", i);
}
if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_0_8_9464))
{
var bannedCount = packet.ReadInt32("Banned Addons Count");
for (var i = 0; i < bannedCount; i++)
{
packet.ReadInt32("ID", i);
var unkStr2 = packet.ReadBytes(16);
packet.WriteLine("[{0}] Unk Hash 1: {1}", i, Utilities.ByteArrayToHexString(unkStr2));
var unkStr3 = packet.ReadBytes(16);
packet.WriteLine("[{0}] Unk Hash 2: {1}", i, Utilities.ByteArrayToHexString(unkStr3));
packet.ReadInt32("Unk Int32 3", i);
if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_3a_11723))
packet.ReadInt32("Unk Int32 4", i);
}
}
}
示例2: HandleServerAddonsList
public static void HandleServerAddonsList(Packet packet)
{
for (var i = 0; i < _addonCount; i++)
{
packet.ReadByte("Addon State", i);
var sendCrc = packet.ReadBoolean("Use CRC", i);
if (sendCrc)
{
var usePublicKey = packet.ReadBoolean("Use Public Key", i);
if (usePublicKey)
{
var pubKey = packet.ReadChars(256);
packet.Write("[{0}] Public Key: ", i);
foreach (var t in pubKey)
packet.Write(t);
}
packet.ReadInt32("Unk Int32", i);
}
if (packet.ReadBoolean("Use URL File", i))
packet.ReadCString("Addon URL File", i);
}
if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_0_8_9464))
{
var bannedCount = packet.ReadInt32("Banned Addons Count");
for (var i = 0; i < bannedCount; i++)
{
packet.ReadInt32("ID", i);
var unkStr2 = packet.ReadBytes(16);
packet.WriteLine("[{0}] Unk Hash 1: {1}", i, Utilities.ByteArrayToHexString(unkStr2));
var unkStr3 = packet.ReadBytes(16);
packet.WriteLine("[{0}] Unk Hash 2: {1}", i, Utilities.ByteArrayToHexString(unkStr3));
packet.ReadInt32("Unk Int32 3", i);
if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_3a_11723))
packet.ReadInt32("Unk Int32 4", i);
}
}
}
示例3: ReadUpdateAccountDataBlock
public static void ReadUpdateAccountDataBlock(ref Packet packet)
{
packet.ReadEnum<AccountDataType>("Data Type", TypeCode.Int32);
packet.ReadTime("Login Time");
var decompCount = packet.ReadInt32();
packet = packet.Inflate(decompCount);
var data = packet.ReadBytes(decompCount);
packet.WriteLine("Account Data: ");
foreach (var b in data)
packet.Write((char)b);
packet.WriteLine();
}
示例4: HandleMultiplePackets2
public static void HandleMultiplePackets2(Packet packet)
{
if (ClientVersion.AddedInVersion(ClientType.Cataclysm))
{
packet.ReadToEnd();
throw new NotImplementedException("This opcode heavily relies on ALL" +
"of its contained packets to be parsed successfully");
// Some sort of infinite loop happens here...
}
packet.WriteLine("{");
var i = 0;
while (packet.CanRead())
{
packet.Opcode = packet.ReadUInt16();
if (i > 0)
packet.WriteLine();
packet.Write("[{0}] ", i++);
Handler.Parse(packet, isMultiple: true);
}
packet.WriteLine("}");
}
示例5: HandleMultiplePackets
public static void HandleMultiplePackets(Packet packet)
{
//packet.WriteLine("Starting Multiple_packets handler");
//packet.AsHex();
// Testing: packet.WriteLine(packet.AsHex());
packet.WriteLine("{");
var i = 0;
while (packet.CanRead())
{
var opcode = 0;
var len = 0;
byte[] bytes = null;
if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_3_0_15005))
{
opcode = packet.ReadUInt16();
// Why are there so many 0s in some packets? Should we have some check if opcode == 0 here?
len = packet.ReadUInt16();
bytes = packet.ReadBytes(len);
}
else if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_2_2_14545))
{
len = packet.ReadUInt16();
opcode = packet.ReadUInt16();
bytes = packet.ReadBytes(len - 2);
}
else
{
packet.ReadToEnd();
}
if (bytes == null || len == 0)
continue;
if (i > 0)
packet.WriteLine();
packet.Write("[{0}] ", i++);
using (var newpacket = new Packet(bytes, opcode, packet.Time, packet.Direction, packet.Number, packet.Writer, packet.FileName))
Handler.Parse(newpacket, true);
}
packet.WriteLine("}");
}
示例6: HandleMultiplePackets2
public static void HandleMultiplePackets2(Packet packet)
{
// Testing: packet.WriteLine(packet.AsHex());
packet.WriteLine("{");
var i = 0;
while (packet.CanRead())
{
packet.Opcode = packet.ReadUInt16();
if (i > 0)
packet.WriteLine();
packet.Write("[{0}] ", i++);
Handler.Parse(packet, isMultiple: true);
}
packet.WriteLine("}");
}