Created
July 2, 2011 23:27
-
-
Save LordJZ/1061778 to your computer and use it in GitHub Desktop.
SMSG_COMPOUND_PACKET 4.2 reader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace Kamilla.WorldOfWarcraft.Latest.Parsers.Misc | |
{ | |
[WowPacketParser(WowOpcodes.SMSG_COMPRESSED_COMPOUND_PACKET)] | |
[WowPacketParser(WowOpcodes.SMSG_COMPOUND_PACKET)] | |
internal sealed class CompoundPacketParser : WowPacketParser | |
{ | |
protected override void Parse() | |
{ | |
if ((WowOpcodes)this.Packet.Opcode == WowOpcodes.SMSG_COMPRESSED_COMPOUND_PACKET) | |
{ | |
this.Decompress(); | |
Output.AppendLine(); | |
} | |
while (!Reader.IsRead) | |
{ | |
var size = Reader.ReadUInt16(); | |
var opcode = Reader.ReadUInt16(); | |
var data = Reader.ReadBytes(size - 2); | |
var pkt = new WowPacket( | |
data, Packet.TransferDirection, Packet.Flags, opcode, Packet.ArrivalTime, | |
Packet.ArrivalTickCount, data.Length, ((WowPacket)Packet).ConnectionId | |
); | |
var item = new PacketViewerItem(pkt, this.Descriptor, PacketDump, this.Item.FullIndex); | |
this.Descriptor.CreateParser(item); | |
var parser = item.Parser; | |
Output.AppendFormatLine("Opcode: {0} (0x{1:X4}), {2} ({3}+2 bytes)", | |
(WowOpcodes)opcode, opcode, parser.GetType().Name, size - 2); | |
if (parser is UndefinedPacketParser) | |
{ | |
this.ParsingError = true; | |
return; | |
} | |
parser.NoSignature = true; | |
parser.ParseContents(); | |
this.ParsingError |= parser.ParsingError; | |
Output.AppendLine(" " + parser.GetTextOutput().PadMultiline(2)); | |
Output.AppendLine(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment