public static void ProcessPackets(byte[] data, PlayerInfo pi, NetworkStream ns) { List <Blaze.Packet> packets = Blaze.FetchAllBlazePackets(new MemoryStream(data)); foreach (Blaze.Packet p in packets) { Log("[CLNT] #" + pi.userId + " " + Blaze.PacketToDescriber(p)); switch (p.Component) { case 0x1: AuthenticationComponent.HandlePacket(p, pi, ns); break; case 0x4: GameManagerComponent.HandlePacket(p, pi, ns); break; case 0x7: StatsComponent.HandlePacket(p, pi, ns); break; case 0x9: UtilComponent.HandlePacket(p, pi, ns); break; case 0x7802: UserSessionComponent.HandlePacket(p, pi, ns); break; } } }
public void AddPacket(byte[] data) { MemoryStream m = new MemoryStream(data); m.Seek(0, 0); List <Blaze.Packet> result = Blaze.FetchAllBlazePackets(m); lock (_sync) { packets.AddRange(result); } }
private void loadPacketsToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog d = new OpenFileDialog(); d.Filter = "*.bin|*.bin"; if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK) { byte[] data = File.ReadAllBytes(d.FileName); lock (_sync) { packets.Clear(); packets.AddRange(Blaze.FetchAllBlazePackets(new MemoryStream(data))); packetCount = -1; } } }
private void openBINToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog d = new OpenFileDialog(); d.Filter = "*.bin|*.bin"; if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK) { try { MemoryStream m = new MemoryStream(File.ReadAllBytes(d.FileName)); Packets = Blaze.FetchAllBlazePackets(m); RefreshStuff(); this.Text = "Packet Viewer - " + Path.GetFileName(d.FileName); } catch (Exception ex) { MessageBox.Show("Error:\n" + ex.Message); Packets = null; } } }