本文整理汇总了C#中WowPacketParser.Misc.Packet.SetPosition方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.SetPosition方法的具体用法?C# Packet.SetPosition怎么用?C# Packet.SetPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WowPacketParser.Misc.Packet
的用法示例。
在下文中一共展示了Packet.SetPosition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleServerWardenData
public static void HandleServerWardenData(Packet packet)
{
var opcode = packet.ReadEnum<WardenServerOpcode>("Warden Server Opcode", TypeCode.Byte);
packet.SetPosition(0);
switch (opcode)
{
case WardenServerOpcode.ModuleInfo:
{
packet.ReadByte();
packet.ReadBytes("Module MD5", 16);
packet.ReadBytes("Module RC4", 16);
packet.ReadUInt32("Module Length");
break;
}
case WardenServerOpcode.ModuleChunk:
{
packet.ReadByte();
var length = packet.ReadUInt16("Chunk Length");
packet.ReadBytes("Module Chunk", length);
break;
}
case WardenServerOpcode.CheatChecks:
{
packet.ReadByte();
byte length;
while ((length = packet.ReadByte()) != 0)
{
packet.ReadBytes("String", length);
}
// var rest = (int)(packet.GetLength() - packet.GetPosition());
break;
}
case WardenServerOpcode.Data:
{
while (packet.CanRead())
{
packet.ReadByte();
var length = packet.ReadUInt16("Data Length");
packet.ReadInt32("Data Checksum");
packet.ReadBytes("Data", length);
}
break;
}
case WardenServerOpcode.Seed:
{
packet.ReadByte();
packet.ReadBytes("Seed", 16);
break;
}
}
}
示例2: HandleServerWardenData
public static void HandleServerWardenData(Packet packet)
{
var opcode = packet.ReadEnum<WardenServerOpcode>("Warden Server Opcode", TypeCode.Byte);
packet.SetPosition(0);
switch (opcode)
{
case WardenServerOpcode.ModuleInfo:
{
packet.ReadByte();
var md5 = packet.ReadBytes(16);
packet.WriteLine("Module MD5: " + Utilities.ByteArrayToHexString(md5));
var rc4 = packet.ReadBytes(16);
packet.WriteLine("Module RC4: " + Utilities.ByteArrayToHexString(rc4));
packet.ReadUInt32("Module Length");
break;
}
case WardenServerOpcode.ModuleChunk:
{
packet.ReadByte();
var length = packet.ReadUInt16("Chunk Length");
var chunk = packet.ReadBytes(length);
packet.WriteLine("Module Chunk: " + Utilities.ByteArrayToHexString(chunk));
break;
}
case WardenServerOpcode.CheatChecks:
{
packet.ReadByte();
byte length;
while ((length = packet.ReadByte()) != 0)
{
var strBytes = packet.ReadBytes(length);
var str = Encoding.ASCII.GetString(strBytes);
packet.WriteLine("String: " + str);
}
// var rest = (int)(packet.GetLength() - packet.GetPosition());
break;
}
case WardenServerOpcode.Data:
{
while (packet.CanRead())
{
packet.ReadByte();
var length = packet.ReadUInt16("Data Length");
packet.ReadInt32("Data Checksum");
var data = packet.ReadBytes(length);
packet.WriteLine("Data: " + Utilities.ByteArrayToHexString(data));
}
break;
}
case WardenServerOpcode.Seed:
{
packet.ReadByte();
var seed = packet.ReadBytes(16);
packet.WriteLine("Seed: " + Utilities.ByteArrayToHexString(seed));
break;
}
}
}