Skip to content

Instantly share code, notes, and snippets.

@Konctantin
Created April 18, 2011 12:16
Show Gist options
  • Save Konctantin/925217 to your computer and use it in GitHub Desktop.
Save Konctantin/925217 to your computer and use it in GitHub Desktop.
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
m_parser = new UpdateParser();
var parsers = (e.Argument as List<PacketParser>);
for (int i = 0; i < parsers.Count; ++i)
{
var code = parsers[i].Packet.Opcode;
var Reader = new BinaryReader(new MemoryStream(parsers[i].Packet.Data));
if (code == WowOpcodes.SMSG_COMPRESSED_UPDATE_OBJECT)
{
Reader = Decompress(Reader);
code = WowOpcodes.SMSG_UPDATE_OBJECT;
}
if (code == WowOpcodes.SMSG_UPDATE_OBJECT)
{
m_parser.ParseRest(Reader);
}
if (code == WowOpcodes.SMSG_INIT_WORLD_STATES)
{
Reader.ReadUInt32();
m_parser.Area = Reader.ReadUInt32();
}
//if (code == WowOpcodes.SMSG_SET_PHASE_SHIFT)
//{
// m_parser.Phase = Reader.ReadUInt32();
//}
if (code == WowOpcodes.SMSG_AURA_UPDATE_ALL)
{
m_parser.ParseAurasAll(Reader);
}
(sender as MyBackgroundWorker).Progress(i, parsers.Count);
Reader.Close();
}
e.Result = m_parser.GetObjects.Count;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment