public override string ToString() { if (type == null || attr == null) { return("(any packet)"); } string dir = (attr.Direction == ePacketDirection.ServerToClient ? "S=>C" : "S<=C"); string desc = (attr.Description != null ? attr.Description : DefaultPacketDescriptions.GetDescription(attr.Code, attr.Direction)); return(string.Format("{0} 0x{1:X2}: \"{2}\"", dir, attr.Code, desc)); }
private void listSelectedButton_Click(object sender, EventArgs e) { InfoWindowForm info = new InfoWindowForm(); StringBuilder str = new StringBuilder(1024); bool found = false; for (int i = 0; i < Packet.MAX_CODE; i++) { if (stocCheckedListBox.GetItemChecked(i)) { if (!found) { found = true; str.Append("server to client packets:\n"); } str.AppendFormat("0x{0:X2} - ", i); string scDesc = DefaultPacketDescriptions.GetDescription(i, ePacketDirection.ClientToServer); str.Append(scDesc == null ? "unknown" : scDesc); str.Append("\n"); } } if (found) { str.Append("\n\n"); } found = false; for (int i = 0; i < Packet.MAX_CODE; i++) { if (ctosCheckedListBox.GetItemChecked(i)) { if (!found) { found = true; str.Append("client to server packets:\n"); } str.AppendFormat("0x{0:X2} - ", i); string csDesc = DefaultPacketDescriptions.GetDescription(i, ePacketDirection.ClientToServer); str.Append(csDesc == null ? "unknown" : csDesc); str.Append("\n"); } } if (found) { str.Append("\n\n"); } info.InfoRichTextBox.Text = str.ToString(); info.StartWindowThread(); }
public PacketCodeFilterForm(IExecutionContext context) { m_context = context; InitializeComponent(); stocCheckedListBox.Items.Clear(); ctosCheckedListBox.Items.Clear(); for (int i = 0; i < Packet.MAX_CODE; i++) { string description; string delim = " - "; if (PacketManager.GetPacketTypesCount(i, ePacketDirection.ServerToClient) > 0) { delim = ">>>"; } description = DefaultPacketDescriptions.GetDescription(i, ePacketDirection.ServerToClient); stocCheckedListBox.Items.Add("0x" + i.ToString("X2") + delim + description, false); delim = " - "; if (PacketManager.GetPacketTypesCount(i, ePacketDirection.ClientToServer) > 0) { delim = ">>>"; } description = DefaultPacketDescriptions.GetDescription(i, ePacketDirection.ClientToServer); ctosCheckedListBox.Items.Add("0x" + i.ToString("X2") + delim + description, false); } templateComboBox.Items.Clear(); templateComboBox.Items.Add("(select template)"); templateComboBox.Items.Add(new KeepPacketsTemplate()); templateComboBox.Items.Add(new SiegePacketsTemplate()); templateComboBox.Items.Add(new HousePacketsTemplate()); templateComboBox.Items.Add(new TextMessagePacketsTemplate()); templateComboBox.Items.Add(new RegionChangePacketsTemplate()); templateComboBox.Items.Add(new PetPacketsTemplate()); templateComboBox.Items.Add(new BoatsPacketsTemplate()); templateComboBox.Items.Add(new UnknownPacketsTemplate()); templateComboBox.SelectedIndex = 0; this.stocCheckedListBox.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.resetTemplate_Event); this.ctosCheckedListBox.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.resetTemplate_Event); }