private void Sniffer_PacketReceived(object sender, W2PacketEventArgs e) { if (toolsPauseLogging.Checked) { return; } if (m_ignoredPackets.ContainsOpCodeAndSize(e.PacketHeader.PacketId, e.PacketHeader.Size)) { return; } if (dgvPacketLog.RowCount > 1000) { dgvPacketLog.Rows.Clear(); } int currentRow = dgvPacketLog.Rows.Add( DateTime.Now, e.Direction.ToString(), e.IPHeader.SourceAddress, e.IPHeader.DestinationAddress, e.PacketHeader.Size, string.Format("0x{0:X2}", e.PacketHeader.PacketId), e.PacketHeader.ClientId); dgvPacketLog.Rows[currentRow].Tag = e; logPacket(e); }
private void btnAdd_Click(object sender, EventArgs e) { var opCode = (ushort)numOpCode.Value; var size = (ushort)numPacketSize.Value; if (m_ignoredPackets.ContainsOpCodeAndSize(opCode, size)) { return; } m_ignoredPackets.Add(opCode, size); string fmt = "OpCode {0:X2} Size {1}"; listIgnoredPackets.Items.Add(string.Format(fmt, opCode, size)); }