private void timer1_Tick(object sender, EventArgs e) { bool update = false; lock (_sync) { if (packets.Count != packetCount) { update = true; packetCount = packets.Count; } } if (update) { listBox1.Items.Clear(); lock (_sync) { foreach (Blaze.Packet p in packets) { listBox1.Items.Add(p.Length.ToString("X4") + " " + p.Component.ToString("X4") + " " + p.Command.ToString("X4") + " " + p.Error.ToString("X4") + " " + p.QType.ToString("X4") + " " + p.ID.ToString("X4") + " " + p.extLength.ToString("X4") + " " + Blaze.PacketToDescriber(p)); } } } }
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 static string PrintPacket(Blaze.Packet p) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("[{0}][{1}:{2}] {3}", Blaze.PacketToDescriber(p), p.Component.ToString("X4"), p.Command.ToString("X4"), p.QType == 0 ? "from client" : "from server"); sb.AppendLine(); sb.AppendLine("{"); List <Blaze.Tdf> content = Blaze.ReadPacketContent(p); foreach (Blaze.Tdf tdf in content) { sb.Append(PrintTdf(tdf, 1)); } sb.AppendLine("}"); return(sb.ToString()); }
public void RefreshStuff() { if (Packets == null) { return; } listBox1.Items.Clear(); int count = 0; foreach (Blaze.Packet p in Packets) { string s = (count++).ToString() + " : "; s += p.Length.ToString("X4") + " "; s += p.Component.ToString("X4") + " "; s += p.Command.ToString("X4") + " "; s += p.Error.ToString("X4") + " "; s += p.QType.ToString("X4") + " "; s += p.ID.ToString("X4") + " "; s += p.extLength.ToString("X4") + " "; byte qtype = (byte)(p.QType >> 8); switch (qtype) { case 0: s += "[Client]"; break; case 0x10: s += "[Server]"; break; case 0x20: s += "[Server][Async]"; break; case 0x30: s += "[Server][Error]"; break; } s += "[INFO] " + Blaze.PacketToDescriber(p); listBox1.Items.Add(s); } }