From f1809fed68a81a87f01d3a4c35e1364ee75b3dc1 Mon Sep 17 00:00:00 2001 From: Mag-nus Date: Thu, 23 Feb 2017 21:49:12 -0600 Subject: [PATCH 1/2] Added special output (dev feature) for FindOpcodeInFilesForm. Added turbine chat decoders. --- aclogview/CM_Admin.cs | 153 ++++++++++++++++- aclogview/CM_Communication.cs | 55 ++++++- aclogview/FindOpcodeInFilesForm.Designer.cs | 73 +++++++- aclogview/FindOpcodeInFilesForm.cs | 112 ++++++++++++- aclogview/Form1.Designer.cs | 32 ++-- aclogview/Form1.cs | 174 ++++++++++++-------- 6 files changed, 503 insertions(+), 96 deletions(-) diff --git a/aclogview/CM_Admin.cs b/aclogview/CM_Admin.cs index 0d65eda..f68eae0 100644 --- a/aclogview/CM_Admin.cs +++ b/aclogview/CM_Admin.cs @@ -12,8 +12,13 @@ public override bool acceptMessageData(BinaryReader messageDataReader, TreeView bool handled = true; PacketOpcode opcode = Util.readOpcode(messageDataReader); - switch (opcode) { - + switch (opcode) { + case PacketOpcode.Evt_Admin__ChatServerData_ID: // 0xF7DE + { + var message = ChatServerData.read(messageDataReader); + message.contributeToTreeView(outputTreeView); + break; + } default: { handled = false; break; @@ -21,7 +26,149 @@ public override bool acceptMessageData(BinaryReader messageDataReader, TreeView } return handled; - } + } + + public class ChatServerData : Message + { + public uint Size; + public uint TurbineChatType; + public uint Unknown_1; + public uint Unknown_2; + public uint Unknown_3; + public uint Unknown_4; + public uint Unknown_5; + public uint Unknown_6; + public uint PayloadSize; + + // 0x01 + public uint Channel; + public string SenderName; + public string Message; + public uint Unknown01_1; + public uint Sender; + public uint Unknown01_2; + public uint Unknown01_3; + + // 0x03 + public uint Unknown03_1; + public uint Unknown03_2; + public uint Unknown03_3; + public uint OutChannel; + public string OutText; + public uint Unknown03_4; + public uint OutSender; + public uint Unknown03_5; + public uint Unknown03_6; + + // 0x05 + public uint Unknown05_1; + public uint Unknown05_2; + public uint Unknown05_3; + public uint Unknown05_4; + + public static ChatServerData read(BinaryReader binaryReader) + { + var newObj = new ChatServerData(); + newObj.Size = binaryReader.ReadUInt32(); + newObj.TurbineChatType = binaryReader.ReadUInt32(); + newObj.Unknown_1 = binaryReader.ReadUInt32(); + newObj.Unknown_2 = binaryReader.ReadUInt32(); + newObj.Unknown_3 = binaryReader.ReadUInt32(); + newObj.Unknown_4 = binaryReader.ReadUInt32(); + newObj.Unknown_5 = binaryReader.ReadUInt32(); + newObj.Unknown_6 = binaryReader.ReadUInt32(); + newObj.PayloadSize = binaryReader.ReadUInt32(); + if (newObj.TurbineChatType == 0x01) + { + newObj.Channel = binaryReader.ReadUInt32(); + + var messageLen = binaryReader.ReadByte(); + var messageBytes = binaryReader.ReadBytes(messageLen * 2); + newObj.SenderName = Encoding.Unicode.GetString(messageBytes); + messageLen = binaryReader.ReadByte(); + messageBytes = binaryReader.ReadBytes(messageLen * 2); + newObj.Message = Encoding.Unicode.GetString(messageBytes); + + newObj.Unknown01_1 = binaryReader.ReadUInt32(); + newObj.Sender = binaryReader.ReadUInt32(); + newObj.Unknown01_2 = binaryReader.ReadUInt32(); + newObj.Unknown01_3 = binaryReader.ReadUInt32(); + } + else if (newObj.TurbineChatType == 0x03) + { + newObj.Unknown03_1 = binaryReader.ReadUInt32(); + newObj.Unknown03_2 = binaryReader.ReadUInt32(); + newObj.Unknown03_3 = binaryReader.ReadUInt32(); + newObj.OutChannel = binaryReader.ReadUInt32(); + + var messageLen = binaryReader.ReadByte(); + var messageBytes = binaryReader.ReadBytes(messageLen * 2); + newObj.OutText = Encoding.Unicode.GetString(messageBytes); + + newObj.Unknown03_4 = binaryReader.ReadUInt32(); + newObj.OutSender = binaryReader.ReadUInt32(); + newObj.Unknown03_5 = binaryReader.ReadUInt32(); + newObj.Unknown03_6 = binaryReader.ReadUInt32(); + + } + else if (newObj.TurbineChatType == 0x05) + { + newObj.Unknown05_1 = binaryReader.ReadUInt32(); + newObj.Unknown05_2 = binaryReader.ReadUInt32(); + newObj.Unknown05_3 = binaryReader.ReadUInt32(); + newObj.Unknown05_4 = binaryReader.ReadUInt32(); + } + + return newObj; + } + + public override void contributeToTreeView(TreeView treeView) + { + TreeNode rootNode = new TreeNode(this.GetType().Name); + rootNode.Expand(); + rootNode.Nodes.Add("Size = " + Size); + rootNode.Nodes.Add("TurbineChatType = " + TurbineChatType); + rootNode.Nodes.Add("Unknown_1 = " + Unknown_1); + rootNode.Nodes.Add("Unknown_2 = " + Unknown_2); + rootNode.Nodes.Add("Unknown_3 = " + Unknown_3); + rootNode.Nodes.Add("Unknown_4 = " + Unknown_4); + rootNode.Nodes.Add("Unknown_5 = " + Unknown_5); + rootNode.Nodes.Add("Unknown_6 = " + Unknown_6); + rootNode.Nodes.Add("PayloadSize = " + PayloadSize); + + if (TurbineChatType == 0x01) + { + rootNode.Nodes.Add("Channel = " + Channel); + rootNode.Nodes.Add("SenderName = " + SenderName); + rootNode.Nodes.Add("Message = " + Message); + rootNode.Nodes.Add("Unknown01_1 = " + Unknown01_1); + rootNode.Nodes.Add("Sender = " + Sender); + rootNode.Nodes.Add("Unknown01_2 = " + Unknown01_2); + rootNode.Nodes.Add("Unknown01_3 = " + Unknown01_3); + } + else if (TurbineChatType == 0x03) + { + rootNode.Nodes.Add("Unknown03_1 = " + Unknown03_1); + rootNode.Nodes.Add("Unknown03_2 = " + Unknown03_2); + rootNode.Nodes.Add("Unknown03_3 = " + Unknown03_3); + rootNode.Nodes.Add("OutChannel = " + OutChannel); + rootNode.Nodes.Add("OutText = " + OutText); + rootNode.Nodes.Add("Unknown03_4 = " + Unknown03_4); + rootNode.Nodes.Add("OutSender = " + OutSender); + rootNode.Nodes.Add("Unknown03_5 = " + Unknown03_5); + rootNode.Nodes.Add("Unknown03_6 = " + Unknown03_6); + } + else if (TurbineChatType == 0x05) + { + rootNode.Nodes.Add("Unknown05_1 = " + Unknown05_1); + rootNode.Nodes.Add("Unknown05_2 = " + Unknown05_2); + rootNode.Nodes.Add("Unknown05_3 = " + Unknown05_3); + rootNode.Nodes.Add("Unknown05_4 = " + Unknown05_4); + } + + treeView.Nodes.Add(rootNode); + } + } } diff --git a/aclogview/CM_Communication.cs b/aclogview/CM_Communication.cs index f8d9a03..8af8ecd 100644 --- a/aclogview/CM_Communication.cs +++ b/aclogview/CM_Communication.cs @@ -31,6 +31,12 @@ public override bool acceptMessageData(BinaryReader messageDataReader, TreeView message.contributeToTreeView(outputTreeView); break; }*/ + case PacketOpcode.Evt_Communication__Recv_ChatRoomTracker_ID: // 0x0295 + { + var message = Recv_ChatRoomTracker.read(messageDataReader); + message.contributeToTreeView(outputTreeView); + break; + } case PacketOpcode.Evt_Communication__WeenieError_ID: // 0x028A { WeenieError message = WeenieError.read(messageDataReader); @@ -66,7 +72,7 @@ public override bool acceptMessageData(BinaryReader messageDataReader, TreeView var message = TextBoxString.read(messageDataReader); message.contributeToTreeView(outputTreeView); break; - } + } default: { handled = false; break; @@ -140,6 +146,53 @@ public override void contributeToTreeView(TreeView treeView) } }*/ + public class Recv_ChatRoomTracker : Message + { + public uint AllegianceChannel; + public uint GeneralChannel; + public uint TradeChannel; + public uint LFGChannel; + public uint RoleplayChannel; + public uint Olthoi; + public uint Society; + public uint Unknown_3; + public uint Unknown_4; + public uint Unknown_5; + + public static Recv_ChatRoomTracker read(BinaryReader binaryReader) + { + var newObj = new Recv_ChatRoomTracker(); + newObj.AllegianceChannel = binaryReader.ReadUInt32(); + newObj.GeneralChannel = binaryReader.ReadUInt32(); + newObj.TradeChannel = binaryReader.ReadUInt32(); + newObj.LFGChannel = binaryReader.ReadUInt32(); + newObj.RoleplayChannel = binaryReader.ReadUInt32(); + newObj.Olthoi = binaryReader.ReadUInt32(); + newObj.Society = binaryReader.ReadUInt32(); + newObj.Unknown_3 = binaryReader.ReadUInt32(); + newObj.Unknown_4 = binaryReader.ReadUInt32(); + newObj.Unknown_5 = binaryReader.ReadUInt32(); + return newObj; + } + + public override void contributeToTreeView(TreeView treeView) + { + TreeNode rootNode = new TreeNode(this.GetType().Name); + rootNode.Expand(); + rootNode.Nodes.Add("AllegianceChannel = " + AllegianceChannel); + rootNode.Nodes.Add("GeneralChannel = " + GeneralChannel); + rootNode.Nodes.Add("TradeChannel = " + TradeChannel); + rootNode.Nodes.Add("LFGChannel = " + LFGChannel); + rootNode.Nodes.Add("RoleplayChannel = " + RoleplayChannel); + rootNode.Nodes.Add("Olthoi = " + Olthoi); + rootNode.Nodes.Add("Society = " + Society); + rootNode.Nodes.Add("Unknown_3 = " + Unknown_3); + rootNode.Nodes.Add("Unknown_4 = " + Unknown_4); + rootNode.Nodes.Add("Unknown_5 = " + Unknown_5); + treeView.Nodes.Add(rootNode); + } + } + public class WeenieError : Message { public WERROR etype; diff --git a/aclogview/FindOpcodeInFilesForm.Designer.cs b/aclogview/FindOpcodeInFilesForm.Designer.cs index 1a189c9..3a55efb 100644 --- a/aclogview/FindOpcodeInFilesForm.Designer.cs +++ b/aclogview/FindOpcodeInFilesForm.Designer.cs @@ -45,17 +45,24 @@ private void InitializeComponent() this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.timer1 = new System.Windows.Forms.Timer(this.components); + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.tabPage2 = new System.Windows.Forms.TabPage(); + this.richTextBox1 = new System.Windows.Forms.RichTextBox(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); this.statusStrip1.SuspendLayout(); + this.tabControl1.SuspendLayout(); + this.tabPage1.SuspendLayout(); + this.tabPage2.SuspendLayout(); this.SuspendLayout(); // // txtSearchPathRoot // this.txtSearchPathRoot.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.txtSearchPathRoot.Location = new System.Drawing.Point(15, 25); + this.txtSearchPathRoot.Location = new System.Drawing.Point(12, 25); this.txtSearchPathRoot.Name = "txtSearchPathRoot"; - this.txtSearchPathRoot.Size = new System.Drawing.Size(723, 20); + this.txtSearchPathRoot.Size = new System.Drawing.Size(726, 20); this.txtSearchPathRoot.TabIndex = 0; // // label1 @@ -107,18 +114,16 @@ private void InitializeComponent() this.dataGridView1.AllowUserToDeleteRows = false; this.dataGridView1.AllowUserToResizeColumns = false; this.dataGridView1.AllowUserToResizeRows = false; - this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.columnHits, this.columnFileSize, this.columnFilePath}); - this.dataGridView1.Location = new System.Drawing.Point(15, 80); + this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; + this.dataGridView1.Location = new System.Drawing.Point(3, 3); this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.ReadOnly = true; - this.dataGridView1.Size = new System.Drawing.Size(757, 456); + this.dataGridView1.Size = new System.Drawing.Size(764, 425); this.dataGridView1.TabIndex = 5; this.dataGridView1.CellContentDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentDoubleClick); // @@ -187,15 +192,60 @@ private void InitializeComponent() this.timer1.Interval = 200; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // + // tabControl1 + // + this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tabControl1.Controls.Add(this.tabPage1); + this.tabControl1.Controls.Add(this.tabPage2); + this.tabControl1.Location = new System.Drawing.Point(3, 79); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(778, 457); + this.tabControl1.TabIndex = 9; + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.dataGridView1); + this.tabPage1.Location = new System.Drawing.Point(4, 22); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(3); + this.tabPage1.Size = new System.Drawing.Size(770, 431); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "File Results"; + this.tabPage1.UseVisualStyleBackColor = true; + // + // tabPage2 + // + this.tabPage2.Controls.Add(this.richTextBox1); + this.tabPage2.Location = new System.Drawing.Point(4, 22); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new System.Windows.Forms.Padding(3); + this.tabPage2.Size = new System.Drawing.Size(770, 431); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "Special Output"; + this.tabPage2.UseVisualStyleBackColor = true; + // + // richTextBox1 + // + this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill; + this.richTextBox1.Font = new System.Drawing.Font("Lucida Console", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.richTextBox1.Location = new System.Drawing.Point(3, 3); + this.richTextBox1.Name = "richTextBox1"; + this.richTextBox1.Size = new System.Drawing.Size(764, 425); + this.richTextBox1.TabIndex = 0; + this.richTextBox1.Text = ""; + // // FindOpcodeInFilesForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(784, 561); + this.Controls.Add(this.tabControl1); this.Controls.Add(this.statusStrip1); this.Controls.Add(this.txtOpcode); this.Controls.Add(this.label2); - this.Controls.Add(this.dataGridView1); this.Controls.Add(this.btnChangeSearchPathRoot); this.Controls.Add(this.btnStopSearch); this.Controls.Add(this.btnStartSearch); @@ -206,6 +256,9 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); this.statusStrip1.ResumeLayout(false); this.statusStrip1.PerformLayout(); + this.tabControl1.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + this.tabPage2.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -227,5 +280,9 @@ private void InitializeComponent() private System.Windows.Forms.DataGridViewTextBoxColumn columnHits; private System.Windows.Forms.DataGridViewTextBoxColumn columnFileSize; private System.Windows.Forms.DataGridViewTextBoxColumn columnFilePath; + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.TabPage tabPage2; + private System.Windows.Forms.RichTextBox richTextBox1; } } \ No newline at end of file diff --git a/aclogview/FindOpcodeInFilesForm.cs b/aclogview/FindOpcodeInFilesForm.cs index f8e1aa5..fcf2421 100644 --- a/aclogview/FindOpcodeInFilesForm.cs +++ b/aclogview/FindOpcodeInFilesForm.cs @@ -84,6 +84,9 @@ private class ProcessFileResut } private readonly ConcurrentBag processFileResuts = new ConcurrentBag(); + + private readonly ConcurrentDictionary specialOutputHits = new ConcurrentDictionary(); + private readonly ConcurrentQueue specialOutputHitsQueue = new ConcurrentQueue(); private void btnStartSearch_Click(object sender, EventArgs e) { @@ -102,6 +105,14 @@ private void btnStartSearch_Click(object sender, EventArgs e) while (!processFileResuts.IsEmpty) processFileResuts.TryTake(out result); + + specialOutputHits.Clear(); + string specialOutputHitsResult; + while (!specialOutputHitsQueue.IsEmpty) + specialOutputHitsQueue.TryDequeue(out specialOutputHitsResult); + richTextBox1.Clear(); + + filesToProcess.AddRange(Directory.GetFiles(txtSearchPathRoot.Text, "*.pcap", SearchOption.AllDirectories)); filesToProcess.AddRange(Directory.GetFiles(txtSearchPathRoot.Text, "*.pcapng", SearchOption.AllDirectories)); @@ -168,6 +179,8 @@ private void ProcessFile(string fileName) var records = PCapReader.LoadPcap(fileName, ref searchAborted); + // We could put the abort check in the foreach, but the only downside to having it here is if you abort/close during a huge log parse, you have to wait a few seconds for the log to finish + // before the app actually terminates. if (searchAborted || Disposing || IsDisposed) return; @@ -176,15 +189,95 @@ private void ProcessFile(string fileName) if (record.opcodes.Contains((PacketOpcode)opCodeToSearchFor)) hits++; - /*foreach (BlobFrag frag in record.netPacket.fragList_) + // Custom search code that can output information to Special Output + foreach (BlobFrag frag in record.netPacket.fragList_) { - if (frag.dat_.Length > 20) + if (frag.dat_.Length <= 20) // ITS IMPORTANT THAT YOU MAKE SURE YOU HAVE THE CORRECT LENGTH HERE. If your target is shorter than this, it will be skipped + continue; + + BinaryReader fragDataReader = new BinaryReader(new MemoryStream(frag.dat_)); + + var messageCode = fragDataReader.ReadUInt32(); + + /*if (messageCode == 0x02BB) // Creature Message + { + var parsed = CM_Communication.HearSpeech.read(fragDataReader); + + //if (parsed.ChatMessageType != 0x0C) + // continue; + + var output = parsed.ChatMessageType.ToString("X4") + " " + parsed.MessageText; + + if (!specialOutputHits.ContainsKey(output)) + { + if (specialOutputHits.TryAdd(output, 0)) + specialOutputHitsQueue.Enqueue(output); + } + }*/ + + /*if (messageCode == 0xF7B0) // Game Event + { + var character = fragDataReader.ReadUInt32(); // Character + var sequence = fragDataReader.ReadUInt32(); // Sequence + var _event = fragDataReader.ReadUInt32(); // Event + + if (_event == 0x0147) // Group Chat + { + var parsed = CM_Communication.ChannelBroadcast.read(fragDataReader); + + var output = parsed.GroupChatType.ToString("X4"); + if (!specialOutputHits.ContainsKey(output)) + { + if (specialOutputHits.TryAdd(output, 0)) + specialOutputHitsQueue.Enqueue(output); + } + } + + if (_event == 0x02BD) // Tell + { + var parsed = CM_Communication.HearDirectSpeech.read(fragDataReader); + + var output = parsed.ChatMessageType.ToString("X4"); + + if (!specialOutputHits.ContainsKey(output)) + { + if (specialOutputHits.TryAdd(output, 0)) + specialOutputHitsQueue.Enqueue(output); + } + } + }*/ + + /*if (messageCode == 0xF7B1) // Game Action { - BinaryReader fragDataReader = new BinaryReader(new MemoryStream(frag.dat_)); + }*/ - // Custom search can go here - } - }*/ + /*if (messageCode == 0xF7DE) // TurbineChat + { + var parsed = CM_Admin.ChatServerData.read(fragDataReader); + + string output = parsed.TurbineChatType.ToString("X2"); + + if (!specialOutputHits.ContainsKey(output)) + { + if (specialOutputHits.TryAdd(output, 0)) + specialOutputHitsQueue.Enqueue(output); + } + }*/ + + /*if (messageCode == 0xF7E0) // Server Message + { + var parsed = CM_Communication.TextBoxString.read(fragDataReader); + + //var output = parsed.ChatMessageType.ToString("X4") + " " + parsed.MessageText + ","; + var output = parsed.ChatMessageType.ToString("X4"); + + if (!specialOutputHits.ContainsKey(output)) + { + if (specialOutputHits.TryAdd(output, 0)) + specialOutputHitsQueue.Enqueue(output); + } + }*/ + } } Interlocked.Increment(ref filesProcessed); @@ -206,6 +299,13 @@ private void timer1_Tick(object sender, EventArgs e) } } + string specialOutputHitsQueueResult; + while (!specialOutputHitsQueue.IsEmpty) + { + if (specialOutputHitsQueue.TryDequeue(out specialOutputHitsQueueResult)) + richTextBox1.Text += specialOutputHitsQueueResult + Environment.NewLine; + } + toolStripStatusLabel1.Text = "Files Processed: " + filesProcessed + " of " + filesToProcess.Count; } diff --git a/aclogview/Form1.Designer.cs b/aclogview/Form1.Designer.cs index 229f2e1..fc81679 100644 --- a/aclogview/Form1.Designer.cs +++ b/aclogview/Form1.Designer.cs @@ -40,6 +40,7 @@ private void InitializeComponent() { this.menuItem_File = new System.Windows.Forms.MenuItem(); this.menuItem_Open = new System.Windows.Forms.MenuItem(); this.menuItem_Edit = new System.Windows.Forms.MenuItem(); + this.mnuItem_EditNextHighlightedRow = new System.Windows.Forms.MenuItem(); this.menuItem1 = new System.Windows.Forms.MenuItem(); this.menuItem_ToolCount = new System.Windows.Forms.MenuItem(); this.menuItem_ToolBad = new System.Windows.Forms.MenuItem(); @@ -68,6 +69,7 @@ private void InitializeComponent() { // this.splitContainer_Main.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.splitContainer_Main.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer_Main.FixedPanel = System.Windows.Forms.FixedPanel.Panel2; this.splitContainer_Main.Location = new System.Drawing.Point(0, 24); this.splitContainer_Main.Name = "splitContainer_Main"; this.splitContainer_Main.Orientation = System.Windows.Forms.Orientation.Horizontal; @@ -82,7 +84,7 @@ private void InitializeComponent() { this.splitContainer_Main.Panel2.Controls.Add(this.splitContainer_Bottom); this.splitContainer_Main.Panel2.RightToLeft = System.Windows.Forms.RightToLeft.No; this.splitContainer_Main.Size = new System.Drawing.Size(1520, 918); - this.splitContainer_Main.SplitterDistance = 423; + this.splitContainer_Main.SplitterDistance = 500; this.splitContainer_Main.TabIndex = 0; // // listView_Packets @@ -100,7 +102,7 @@ private void InitializeComponent() { this.listView_Packets.Location = new System.Drawing.Point(0, 0); this.listView_Packets.MultiSelect = false; this.listView_Packets.Name = "listView_Packets"; - this.listView_Packets.Size = new System.Drawing.Size(1516, 419); + this.listView_Packets.Size = new System.Drawing.Size(1516, 496); this.listView_Packets.TabIndex = 0; this.listView_Packets.UseCompatibleStateImageBehavior = false; this.listView_Packets.View = System.Windows.Forms.View.Details; @@ -117,26 +119,26 @@ private void InitializeComponent() { // columnHeader5 // this.columnHeader5.Text = "S/R"; + this.columnHeader5.Width = 50; // // columnHeader2 // this.columnHeader2.Text = "Time"; - this.columnHeader2.Width = 100; + this.columnHeader2.Width = 80; // // columnHeader7 // this.columnHeader7.Text = "Headers"; - this.columnHeader7.Width = 150; + this.columnHeader7.Width = 220; // // columnHeader3 // this.columnHeader3.Text = "Type"; - this.columnHeader3.Width = 200; + this.columnHeader3.Width = 500; // // columnHeader4 // this.columnHeader4.Text = "Size"; - this.columnHeader4.Width = 100; // // columnHeader6 // @@ -157,7 +159,7 @@ private void InitializeComponent() { // splitContainer_Bottom.Panel2 // this.splitContainer_Bottom.Panel2.Controls.Add(this.treeView_ParsedData); - this.splitContainer_Bottom.Size = new System.Drawing.Size(1520, 491); + this.splitContainer_Bottom.Size = new System.Drawing.Size(1520, 414); this.splitContainer_Bottom.SplitterDistance = 1130; this.splitContainer_Bottom.TabIndex = 0; // @@ -167,7 +169,7 @@ private void InitializeComponent() { this.textBox_PacketData.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.textBox_PacketData.Location = new System.Drawing.Point(0, 0); this.textBox_PacketData.Name = "textBox_PacketData"; - this.textBox_PacketData.Size = new System.Drawing.Size(1126, 487); + this.textBox_PacketData.Size = new System.Drawing.Size(1126, 410); this.textBox_PacketData.TabIndex = 0; this.textBox_PacketData.Text = ""; // @@ -176,7 +178,7 @@ private void InitializeComponent() { this.treeView_ParsedData.Dock = System.Windows.Forms.DockStyle.Fill; this.treeView_ParsedData.Location = new System.Drawing.Point(0, 0); this.treeView_ParsedData.Name = "treeView_ParsedData"; - this.treeView_ParsedData.Size = new System.Drawing.Size(382, 487); + this.treeView_ParsedData.Size = new System.Drawing.Size(382, 410); this.treeView_ParsedData.TabIndex = 0; this.treeView_ParsedData.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView_ParsedData_AfterSelect); // @@ -199,13 +201,22 @@ private void InitializeComponent() { // this.menuItem_Open.Index = 0; this.menuItem_Open.Text = "Open"; - this.menuItem_Open.Click += new System.EventHandler(this.menuItem5_Click); + this.menuItem_Open.Click += new System.EventHandler(this.menuItem_Open_Click); // // menuItem_Edit // this.menuItem_Edit.Index = 1; + this.menuItem_Edit.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + this.mnuItem_EditNextHighlightedRow}); this.menuItem_Edit.Text = "Edit"; // + // mnuItem_EditNextHighlightedRow + // + this.mnuItem_EditNextHighlightedRow.Index = 0; + this.mnuItem_EditNextHighlightedRow.Shortcut = System.Windows.Forms.Shortcut.F3; + this.mnuItem_EditNextHighlightedRow.Text = "Next Highlighted Row"; + this.mnuItem_EditNextHighlightedRow.Click += new System.EventHandler(this.mnuItem_EditNextHighlightedRow_Click); + // // menuItem1 // this.menuItem1.Index = 2; @@ -371,6 +382,7 @@ private void InitializeComponent() { private System.Windows.Forms.MenuItem menuItem_ToolBad; private System.Windows.Forms.MenuItem menuItem_ToolHeatmap; private System.Windows.Forms.MenuItem mnuItem_ToolFindOpcodeInFiles; + private System.Windows.Forms.MenuItem mnuItem_EditNextHighlightedRow; } } diff --git a/aclogview/Form1.cs b/aclogview/Form1.cs index 9152884..74400cf 100644 --- a/aclogview/Form1.cs +++ b/aclogview/Form1.cs @@ -77,17 +77,6 @@ protected override void OnClosing(CancelEventArgs e) Settings.Default.Save(); } - private void menuItem5_Click(object sender, EventArgs e) { - OpenFileDialog openFile = new OpenFileDialog(); - openFile.AddExtension = true; - openFile.Filter = "Packet Captures (*.pcap;*.pcapng)|*.pcap;*.pcapng|All Files (*.*)|*.*"; - - if (openFile.ShowDialog() != DialogResult.OK) { - return; - } - - loadPcap(openFile.FileName); - } private void readPacket(PacketRecord packet, StringBuilder packetTypeStr, BinaryReader packetReader) { BlobFrag newFrag = new BlobFrag(); @@ -748,16 +737,13 @@ private void updateTree() { } } - private void listView_Packets_SelectedIndexChanged(object sender, EventArgs e) { - updateData(); - } - - private void checkBox_HideHeaderOnly_CheckedChanged(object sender, EventArgs e) { - listView_Packets.RedrawItems(0, records.Count - 1, false); + private void listView_Packets_SelectedIndexChanged(object sender, EventArgs e) + { updateData(); } - private void listView_Packets_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e) { + private void listView_Packets_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e) + { if (e.ItemIndex < listItems.Count) { e.Item = listItems[e.ItemIndex]; @@ -780,26 +766,48 @@ private void listView_Packets_RetrieveVirtualItem(object sender, RetrieveVirtual } } } - } + } + + + private void treeView_ParsedData_AfterSelect(object sender, TreeViewEventArgs e) + { + updateText(); + } + + + private void menuItem_Open_Click(object sender, EventArgs e) + { + OpenFileDialog openFile = new OpenFileDialog(); + openFile.AddExtension = true; + openFile.Filter = "Packet Captures (*.pcap;*.pcapng)|*.pcap;*.pcapng|All Files (*.*)|*.*"; - private void menuItem_About_Click(object sender, EventArgs e) { - MessageBox.Show("aclogview\n\nA program to view and parse Asheron's Call 1 packet capture files (.pcap) generated by aclog.\n\nFor more info and source code, see https://github.com/tfarley/aclogview", "About"); - } + if (openFile.ShowDialog() != DialogResult.OK) + return; - private void treeView_ParsedData_AfterSelect(object sender, TreeViewEventArgs e) { - updateText(); + loadPcap(openFile.FileName); + } + + + private void mnuItem_EditNextHighlightedRow_Click(object sender, EventArgs e) + { + for (int i = listView_Packets.TopItem.Index + 1; i < listView_Packets.Items.Count; i++) + { + if (listView_Packets.Items[i].BackColor != SystemColors.Window) + { + listView_Packets.TopItem = listView_Packets.Items[i]; + listView_Packets.TopItem.Selected = true; + listView_Packets.TopItem.Focused = true; + break; + } + } } - private void checkBox_useHighlighting_CheckedChanged(object sender, EventArgs e) { - updateText(); - } private void menuItem_ToolCount_Click(object sender, EventArgs e) { FolderBrowserDialog openFolder = new FolderBrowserDialog(); - if (openFolder.ShowDialog() != DialogResult.OK) { + if (openFolder.ShowDialog() != DialogResult.OK) return; - } List files = new List(); files.AddRange(Directory.GetFiles(openFolder.SelectedPath, "*.pcap", SearchOption.AllDirectories)); @@ -807,27 +815,29 @@ private void menuItem_ToolCount_Click(object sender, EventArgs e) { OrderedDictionary opcodeOccurrences = new OrderedDictionary(); - foreach (PacketOpcode opcode in Enum.GetValues(typeof(PacketOpcode))) { + foreach (PacketOpcode opcode in Enum.GetValues(typeof(PacketOpcode))) opcodeOccurrences[opcode] = 0; - } - foreach (string file in files) { + foreach (string file in files) + { loadPcap(file, true); - foreach (PacketRecord record in records) { - foreach (PacketOpcode opcode in record.opcodes) { - if (opcodeOccurrences.Contains(opcode)) { + foreach (PacketRecord record in records) + { + foreach (PacketOpcode opcode in record.opcodes) + { + if (opcodeOccurrences.Contains(opcode)) opcodeOccurrences[opcode] = (Int32)opcodeOccurrences[opcode] + 1; - } else { + else opcodeOccurrences[opcode] = 1; - } } } } long totalCount = 0; StringBuilder occurencesString = new StringBuilder(); - foreach (DictionaryEntry entry in opcodeOccurrences) { + foreach (DictionaryEntry entry in opcodeOccurrences) + { occurencesString.Append(entry.Key); occurencesString.Append(" = "); occurencesString.Append(entry.Value); @@ -846,12 +856,12 @@ private void menuItem_ToolCount_Click(object sender, EventArgs e) { popup.ShowDialog(); } - private void menuItem_ToolBad_Click(object sender, EventArgs e) { + private void menuItem_ToolBad_Click(object sender, EventArgs e) + { FolderBrowserDialog openFolder = new FolderBrowserDialog(); - if (openFolder.ShowDialog() != DialogResult.OK) { + if (openFolder.ShowDialog() != DialogResult.OK) return; - } List files = new List(); files.AddRange(Directory.GetFiles(openFolder.SelectedPath, "*.pcap", SearchOption.AllDirectories)); @@ -859,39 +869,40 @@ private void menuItem_ToolBad_Click(object sender, EventArgs e) { OrderedDictionary opcodeOccurrences = new OrderedDictionary(); - foreach (PacketOpcode opcode in Enum.GetValues(typeof(PacketOpcode))) { + foreach (PacketOpcode opcode in Enum.GetValues(typeof(PacketOpcode))) opcodeOccurrences[opcode] = 0; - } - foreach (string file in files) { + foreach (string file in files) + { loadPcap(file); int curPacket = 0; int curFragment = 0; - try { - for (curPacket = 0; curPacket < records.Count; ++curPacket) { + try + { + for (curPacket = 0; curPacket < records.Count; ++curPacket) + { PacketRecord record = records[curPacket]; - for (curFragment = 0; curFragment < record.netPacket.fragList_.Count; ++curFragment) { + for (curFragment = 0; curFragment < record.netPacket.fragList_.Count; ++curFragment) + { BlobFrag frag = record.netPacket.fragList_[curFragment]; - if (frag.memberHeader_.numFrags > 0) { + if (frag.memberHeader_.numFrags > 0) continue; - } BinaryReader fragDataReader = new BinaryReader(new MemoryStream(frag.dat_)); bool handled = false; - foreach (MessageProcessor messageProcessor in messageProcessors) { + foreach (MessageProcessor messageProcessor in messageProcessors) + { long readerStartPos = fragDataReader.BaseStream.Position; bool accepted = messageProcessor.acceptMessageData(fragDataReader, treeView_ParsedData); - if (accepted && handled) { + if (accepted && handled) throw new Exception("Multiple message processors are handling the same data!"); - } - if (accepted) { + if (accepted) handled = true; - } fragDataReader.BaseStream.Position = readerStartPos; } @@ -903,19 +914,21 @@ private void menuItem_ToolBad_Click(object sender, EventArgs e) { } } - } catch (Exception ex) { + } + catch (Exception ex) + { MessageBox.Show("Packet " + curPacket + " Fragment " + curFragment + " EXCEPTION: " + ex.Message); break; } } } - private void menuItem_ToolHeatmap_Click(object sender, EventArgs e) { + private void menuItem_ToolHeatmap_Click(object sender, EventArgs e) + { FolderBrowserDialog openFolder = new FolderBrowserDialog(); - if (openFolder.ShowDialog() != DialogResult.OK) { + if (openFolder.ShowDialog() != DialogResult.OK) return; - } List files = new List(); files.AddRange(Directory.GetFiles(openFolder.SelectedPath, "*.pcap", SearchOption.AllDirectories)); @@ -924,20 +937,25 @@ private void menuItem_ToolHeatmap_Click(object sender, EventArgs e) { uint packetCount = 0; uint messageCount = 0; uint[,] heatmap = new uint[256, 256]; - foreach (string file in files) { + foreach (string file in files) + { loadPcap(file, true); - foreach (PacketRecord record in records) { + foreach (PacketRecord record in records) + { packetCount++; - foreach (BlobFrag frag in record.netPacket.fragList_) { - if (frag.memberHeader_.blobNum == 0) { + foreach (BlobFrag frag in record.netPacket.fragList_) + { + if (frag.memberHeader_.blobNum == 0) messageCount++; - } - if (frag.dat_.Length > 20) { + + if (frag.dat_.Length > 20) + { BinaryReader fragDataReader = new BinaryReader(new MemoryStream(frag.dat_)); fragDataReader.ReadUInt32(); fragDataReader.ReadUInt32(); - if ((PacketOpcode)fragDataReader.ReadUInt32() == PacketOpcode.Evt_Movement__AutonomousPosition_ID) { + if ((PacketOpcode)fragDataReader.ReadUInt32() == PacketOpcode.Evt_Movement__AutonomousPosition_ID) + { uint objcell_id = fragDataReader.ReadUInt32(); uint x = (objcell_id >> 24) & 0xFF; uint y = 255 - ((objcell_id >> 16) & 0xFF); @@ -951,9 +969,12 @@ private void menuItem_ToolHeatmap_Click(object sender, EventArgs e) { System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); Stream imageStream = assembly.GetManifestResourceStream("aclogview.map.png"); Bitmap heatmapImg = new Bitmap(imageStream); - for (int y = 0; y < 256; ++y) { - for (int x = 0; x < 256; ++x) { - if (heatmap[x, y] > 0) { + for (int y = 0; y < 256; ++y) + { + for (int x = 0; x < 256; ++x) + { + if (heatmap[x, y] > 0) + { Color curColor = heatmapImg.GetPixel(x, y); heatmapImg.SetPixel(x, y, Color.FromArgb(255, Math.Min(255, 200 + curColor.R), curColor.G, curColor.B)); } @@ -972,5 +993,22 @@ private void mnuItem_ToolFindOpcodeInFiles_Click(object sender, EventArgs e) var form = new FindOpcodeInFilesForm(); form.Show(this); } + + private void menuItem_About_Click(object sender, EventArgs e) + { + MessageBox.Show("aclogview\n\nA program to view and parse Asheron's Call 1 packet capture files (.pcap) generated by aclog.\n\nFor more info and source code, see https://github.com/tfarley/aclogview", "About"); + } + + + private void checkBox_HideHeaderOnly_CheckedChanged(object sender, EventArgs e) + { + listView_Packets.RedrawItems(0, records.Count - 1, false); + updateData(); + } + + private void checkBox_useHighlighting_CheckedChanged(object sender, EventArgs e) + { + updateText(); + } } } From d07737db9058575ec528a72f53672e074746c4d2 Mon Sep 17 00:00:00 2001 From: Mag-nus Date: Mon, 6 Mar 2017 19:49:52 -0600 Subject: [PATCH 2/2] Added Shift+F3 - Find Previous, fixed a possible crash when using F3 when no pcap is loaded. Misc CM_ stuff --- aclogview/CM_Allegiance.cs | 40 +++++++++++++++++++++++++++-------- aclogview/CM_Communication.cs | 22 +++++++++---------- aclogview/Form1.Designer.cs | 13 +++++++++++- aclogview/Form1.cs | 19 +++++++++++++++++ 4 files changed, 73 insertions(+), 21 deletions(-) diff --git a/aclogview/CM_Allegiance.cs b/aclogview/CM_Allegiance.cs index 61ada20..c89c771 100644 --- a/aclogview/CM_Allegiance.cs +++ b/aclogview/CM_Allegiance.cs @@ -272,7 +272,8 @@ public void contributeToTreeNode(TreeNode node) { } } - public class AllegianceNode { + public class AllegianceNode + { public AllegianceNode _patron; public AllegianceNode _peer; public AllegianceNode _vassal; @@ -281,7 +282,8 @@ public class AllegianceNode { // TODO: Read in all the stuff } - public class AllegianceHierarchy { + public class AllegianceHierarchy + { public AllegianceVersion m_oldVersion; public uint m_total; public PackableHashTable m_AllegianceOfficers; @@ -298,28 +300,48 @@ public class AllegianceHierarchy { public int m_NameLastSetTime; public uint m_isLocked; public uint m_ApprovedVassal; - public AllegianceNode m_pMonarch; + public AllegianceNode m_pMonarch; + + // TODO: Read in all the stuff + + public static AllegianceHierarchy read(BinaryReader binaryReader) + { + AllegianceHierarchy newObj = new AllegianceHierarchy(); + newObj.m_oldVersion = (AllegianceVersion)binaryReader.ReadByte(); + newObj.m_total = binaryReader.ReadUInt32(); + // TODO: Read in profile + return newObj; + } - // TODO: Read in all the stuff + public void contributeToTreeNode(TreeNode node) + { + node.Nodes.Add("m_oldVersion = " + m_oldVersion); + node.Nodes.Add("m_total = " + m_total); + // TODO: Read in profile + } } - public class AllegianceProfile { + public class AllegianceProfile + { public uint _total_members; public uint _total_vassals; public AllegianceHierarchy _allegiance; - public static AllegianceProfile read(BinaryReader binaryReader) { + public static AllegianceProfile read(BinaryReader binaryReader) + { AllegianceProfile newObj = new AllegianceProfile(); newObj._total_members = binaryReader.ReadUInt32(); newObj._total_vassals = binaryReader.ReadUInt32(); - // TODO: Read in profile + newObj._allegiance = AllegianceHierarchy.read(binaryReader); return newObj; } - public void contributeToTreeNode(TreeNode node) { + public void contributeToTreeNode(TreeNode node) + { node.Nodes.Add("_total_members = " + _total_members); node.Nodes.Add("_total_vassals = " + _total_vassals); - // TODO: Read in profile + TreeNode profileNode = node.Nodes.Add("allegianceProfile = "); + _allegiance.contributeToTreeNode(profileNode); } } diff --git a/aclogview/CM_Communication.cs b/aclogview/CM_Communication.cs index 8af8ecd..ac50586 100644 --- a/aclogview/CM_Communication.cs +++ b/aclogview/CM_Communication.cs @@ -155,11 +155,11 @@ public class Recv_ChatRoomTracker : Message public uint RoleplayChannel; public uint Olthoi; public uint Society; - public uint Unknown_3; - public uint Unknown_4; - public uint Unknown_5; - - public static Recv_ChatRoomTracker read(BinaryReader binaryReader) + public uint SocietyCelHan; + public uint SocietyEldWeb; + public uint SocietyRadBlo; + + public static Recv_ChatRoomTracker read(BinaryReader binaryReader) { var newObj = new Recv_ChatRoomTracker(); newObj.AllegianceChannel = binaryReader.ReadUInt32(); @@ -169,9 +169,9 @@ public static Recv_ChatRoomTracker read(BinaryReader binaryReader) newObj.RoleplayChannel = binaryReader.ReadUInt32(); newObj.Olthoi = binaryReader.ReadUInt32(); newObj.Society = binaryReader.ReadUInt32(); - newObj.Unknown_3 = binaryReader.ReadUInt32(); - newObj.Unknown_4 = binaryReader.ReadUInt32(); - newObj.Unknown_5 = binaryReader.ReadUInt32(); + newObj.SocietyCelHan = binaryReader.ReadUInt32(); + newObj.SocietyEldWeb = binaryReader.ReadUInt32(); + newObj.SocietyRadBlo = binaryReader.ReadUInt32(); return newObj; } @@ -186,9 +186,9 @@ public override void contributeToTreeView(TreeView treeView) rootNode.Nodes.Add("RoleplayChannel = " + RoleplayChannel); rootNode.Nodes.Add("Olthoi = " + Olthoi); rootNode.Nodes.Add("Society = " + Society); - rootNode.Nodes.Add("Unknown_3 = " + Unknown_3); - rootNode.Nodes.Add("Unknown_4 = " + Unknown_4); - rootNode.Nodes.Add("Unknown_5 = " + Unknown_5); + rootNode.Nodes.Add("SocietyCelHan = " + SocietyCelHan); + rootNode.Nodes.Add("SocietyEldWeb = " + SocietyEldWeb); + rootNode.Nodes.Add("SocietyRadBlo = " + SocietyRadBlo); treeView.Nodes.Add(rootNode); } } diff --git a/aclogview/Form1.Designer.cs b/aclogview/Form1.Designer.cs index fc81679..69e5388 100644 --- a/aclogview/Form1.Designer.cs +++ b/aclogview/Form1.Designer.cs @@ -54,6 +54,7 @@ private void InitializeComponent() { this.statusStrip = new System.Windows.Forms.StatusStrip(); this.checkBox_HideHeaderOnly = new System.Windows.Forms.CheckBox(); this.checkBox_useHighlighting = new System.Windows.Forms.CheckBox(); + this.mnuItem_EditPreviousHighlightedRow = new System.Windows.Forms.MenuItem(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer_Main)).BeginInit(); this.splitContainer_Main.Panel1.SuspendLayout(); this.splitContainer_Main.Panel2.SuspendLayout(); @@ -99,6 +100,7 @@ private void InitializeComponent() { this.columnHeader6}); this.listView_Packets.Dock = System.Windows.Forms.DockStyle.Fill; this.listView_Packets.FullRowSelect = true; + this.listView_Packets.HideSelection = false; this.listView_Packets.Location = new System.Drawing.Point(0, 0); this.listView_Packets.MultiSelect = false; this.listView_Packets.Name = "listView_Packets"; @@ -207,12 +209,13 @@ private void InitializeComponent() { // this.menuItem_Edit.Index = 1; this.menuItem_Edit.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + this.mnuItem_EditPreviousHighlightedRow, this.mnuItem_EditNextHighlightedRow}); this.menuItem_Edit.Text = "Edit"; // // mnuItem_EditNextHighlightedRow // - this.mnuItem_EditNextHighlightedRow.Index = 0; + this.mnuItem_EditNextHighlightedRow.Index = 1; this.mnuItem_EditNextHighlightedRow.Shortcut = System.Windows.Forms.Shortcut.F3; this.mnuItem_EditNextHighlightedRow.Text = "Next Highlighted Row"; this.mnuItem_EditNextHighlightedRow.Click += new System.EventHandler(this.mnuItem_EditNextHighlightedRow_Click); @@ -320,6 +323,13 @@ private void InitializeComponent() { this.checkBox_useHighlighting.UseVisualStyleBackColor = true; this.checkBox_useHighlighting.CheckedChanged += new System.EventHandler(this.checkBox_useHighlighting_CheckedChanged); // + // mnuItem_EditPreviousHighlightedRow + // + this.mnuItem_EditPreviousHighlightedRow.Index = 0; + this.mnuItem_EditPreviousHighlightedRow.Shortcut = System.Windows.Forms.Shortcut.ShiftF3; + this.mnuItem_EditPreviousHighlightedRow.Text = "Previous Highlighted Row"; + this.mnuItem_EditPreviousHighlightedRow.Click += new System.EventHandler(this.mnuItem_EditPreviousHighlightedRow_Click); + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -383,6 +393,7 @@ private void InitializeComponent() { private System.Windows.Forms.MenuItem menuItem_ToolHeatmap; private System.Windows.Forms.MenuItem mnuItem_ToolFindOpcodeInFiles; private System.Windows.Forms.MenuItem mnuItem_EditNextHighlightedRow; + private System.Windows.Forms.MenuItem mnuItem_EditPreviousHighlightedRow; } } diff --git a/aclogview/Form1.cs b/aclogview/Form1.cs index 74400cf..027ad16 100644 --- a/aclogview/Form1.cs +++ b/aclogview/Form1.cs @@ -787,9 +787,28 @@ private void menuItem_Open_Click(object sender, EventArgs e) loadPcap(openFile.FileName); } + private void mnuItem_EditPreviousHighlightedRow_Click(object sender, EventArgs e) + { + if (listView_Packets.TopItem == null) + return; + + for (int i = listView_Packets.TopItem.Index - 1; i >= 0; i--) + { + if (listView_Packets.Items[i].BackColor != SystemColors.Window) + { + listView_Packets.TopItem = listView_Packets.Items[i]; + listView_Packets.TopItem.Selected = true; + listView_Packets.TopItem.Focused = true; + break; + } + } + } private void mnuItem_EditNextHighlightedRow_Click(object sender, EventArgs e) { + if (listView_Packets.TopItem == null) + return; + for (int i = listView_Packets.TopItem.Index + 1; i < listView_Packets.Items.Count; i++) { if (listView_Packets.Items[i].BackColor != SystemColors.Window)