📄 captureoptions.cs
字号:
using System;
using System.Drawing;
using System.ComponentModel;
using System.Windows.Forms;
using MyClasses;
namespace Pacanal
{
public class CaptureOptions : System.Windows.Forms.Form
{
private System.Windows.Forms.Label LblInterface;
private System.Windows.Forms.ComboBox CmbAdapter;
private System.Windows.Forms.CheckBox ChkCaptureLimit;
private System.Windows.Forms.Label LblBytes;
private System.Windows.Forms.Label LblFilter;
private System.Windows.Forms.TextBox TxtEachPacketSize;
private System.Windows.Forms.CheckBox ChkCaptureMode;
private System.Windows.Forms.TextBox TxtFilter;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.CheckBox ChkDisplayOptionsAutomaticScroll;
private System.Windows.Forms.CheckBox ChkDisplayOptionsRealTime;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Label LblPackets;
private System.Windows.Forms.Label LblSeconds;
private System.Windows.Forms.Label LblKilobytes;
private System.Windows.Forms.TextBox TxtCaptureLimitsSeconds;
private System.Windows.Forms.TextBox TxtCaptureLimitsKiloBytes;
private System.Windows.Forms.TextBox TxtCaptureLimitsPackets;
private System.Windows.Forms.CheckBox ChkCaptureLimitsSeconds;
private System.Windows.Forms.CheckBox ChkCaptureLimitsKiloBytes;
private System.Windows.Forms.CheckBox ChkCaptureLimitsPackets;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.CheckBox ChkNameResolutionTransport;
private System.Windows.Forms.CheckBox ChkNameResolutionNetwork;
private System.Windows.Forms.CheckBox ChkNameResolutionMAC;
private System.Windows.Forms.Panel panel4;
private System.Windows.Forms.Panel panel5;
private System.Windows.Forms.Label LblAdapterBufferSize;
private System.Windows.Forms.Label LblBufferSize;
private System.Windows.Forms.Label LblMinBytesToCopy;
private System.Windows.Forms.Label LblNumWrites;
private System.Windows.Forms.Label LblReadTimeOut;
private System.Windows.Forms.Label LblCaptureMode;
private System.Windows.Forms.Label LblHardwareFilter;
private System.Windows.Forms.Button BtnOk;
private System.Windows.Forms.Button BtnCancel;
private System.Windows.Forms.TextBox TxtAdapterBufferSize;
private System.Windows.Forms.TextBox TxtBufferSize;
private System.Windows.Forms.TextBox TxtMinBytesToCopy;
private System.Windows.Forms.TextBox TxtNumWrites;
private System.Windows.Forms.TextBox TxtReadTimeOut;
private System.Windows.Forms.ComboBox CmbCaptureMode;
private System.Windows.Forms.CheckedListBox ChkBoxHardwareFilter;
public Packet32 P32;
public string [] Adapters;
public Packet32.CAPTURE_LIMITS thisCaptureLimits;
public Packet32.CAPTURE_OPTIONS thisCaptureOptions;
public Packet32.DISPLAY_OPTIONS thisDisplayOptions;
public Packet32.NAME_RESOLUTION thisNameResolution;
private bool ParamsLoaded = false;
private System.Windows.Forms.CheckBox ChkManufacturerNameResolution;
private System.ComponentModel.Container components = null;
public CaptureOptions()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.LblInterface = new System.Windows.Forms.Label();
this.CmbAdapter = new System.Windows.Forms.ComboBox();
this.ChkCaptureLimit = new System.Windows.Forms.CheckBox();
this.TxtEachPacketSize = new System.Windows.Forms.TextBox();
this.LblBytes = new System.Windows.Forms.Label();
this.ChkCaptureMode = new System.Windows.Forms.CheckBox();
this.LblFilter = new System.Windows.Forms.Label();
this.TxtFilter = new System.Windows.Forms.TextBox();
this.panel1 = new System.Windows.Forms.Panel();
this.ChkDisplayOptionsRealTime = new System.Windows.Forms.CheckBox();
this.ChkDisplayOptionsAutomaticScroll = new System.Windows.Forms.CheckBox();
this.panel2 = new System.Windows.Forms.Panel();
this.ChkCaptureLimitsPackets = new System.Windows.Forms.CheckBox();
this.ChkCaptureLimitsKiloBytes = new System.Windows.Forms.CheckBox();
this.ChkCaptureLimitsSeconds = new System.Windows.Forms.CheckBox();
this.TxtCaptureLimitsPackets = new System.Windows.Forms.TextBox();
this.TxtCaptureLimitsKiloBytes = new System.Windows.Forms.TextBox();
this.TxtCaptureLimitsSeconds = new System.Windows.Forms.TextBox();
this.LblPackets = new System.Windows.Forms.Label();
this.LblSeconds = new System.Windows.Forms.Label();
this.LblKilobytes = new System.Windows.Forms.Label();
this.panel3 = new System.Windows.Forms.Panel();
this.ChkNameResolutionMAC = new System.Windows.Forms.CheckBox();
this.ChkNameResolutionNetwork = new System.Windows.Forms.CheckBox();
this.ChkNameResolutionTransport = new System.Windows.Forms.CheckBox();
this.panel4 = new System.Windows.Forms.Panel();
this.panel5 = new System.Windows.Forms.Panel();
this.LblAdapterBufferSize = new System.Windows.Forms.Label();
this.LblBufferSize = new System.Windows.Forms.Label();
this.LblMinBytesToCopy = new System.Windows.Forms.Label();
this.LblNumWrites = new System.Windows.Forms.Label();
this.LblReadTimeOut = new System.Windows.Forms.Label();
this.LblCaptureMode = new System.Windows.Forms.Label();
this.LblHardwareFilter = new System.Windows.Forms.Label();
this.TxtAdapterBufferSize = new System.Windows.Forms.TextBox();
this.TxtBufferSize = new System.Windows.Forms.TextBox();
this.TxtMinBytesToCopy = new System.Windows.Forms.TextBox();
this.TxtNumWrites = new System.Windows.Forms.TextBox();
this.TxtReadTimeOut = new System.Windows.Forms.TextBox();
this.CmbCaptureMode = new System.Windows.Forms.ComboBox();
this.BtnOk = new System.Windows.Forms.Button();
this.BtnCancel = new System.Windows.Forms.Button();
this.ChkBoxHardwareFilter = new System.Windows.Forms.CheckedListBox();
this.ChkManufacturerNameResolution = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// LblInterface
//
this.LblInterface.AutoSize = true;
this.LblInterface.Location = new System.Drawing.Point(8, 16);
this.LblInterface.Name = "LblInterface";
this.LblInterface.Size = new System.Drawing.Size(48, 13);
this.LblInterface.TabIndex = 0;
this.LblInterface.Text = "Interface";
//
// CmbAdapter
//
this.CmbAdapter.Location = new System.Drawing.Point(64, 8);
this.CmbAdapter.MaxDropDownItems = 4;
this.CmbAdapter.Name = "CmbAdapter";
this.CmbAdapter.Size = new System.Drawing.Size(656, 21);
this.CmbAdapter.TabIndex = 1;
//
// ChkCaptureLimit
//
this.ChkCaptureLimit.Location = new System.Drawing.Point(8, 40);
this.ChkCaptureLimit.Name = "ChkCaptureLimit";
this.ChkCaptureLimit.Size = new System.Drawing.Size(128, 24);
this.ChkCaptureLimit.TabIndex = 2;
this.ChkCaptureLimit.Text = "Limit each packet to ";
this.ChkCaptureLimit.CheckStateChanged += new System.EventHandler(this.ChkCaptureLimit_CheckStateChanged);
//
// TxtEachPacketSize
//
this.TxtEachPacketSize.Location = new System.Drawing.Point(136, 40);
this.TxtEachPacketSize.Name = "TxtEachPacketSize";
this.TxtEachPacketSize.Size = new System.Drawing.Size(48, 20);
this.TxtEachPacketSize.TabIndex = 3;
this.TxtEachPacketSize.Text = "68";
//
// LblBytes
//
this.LblBytes.AutoSize = true;
this.LblBytes.Location = new System.Drawing.Point(200, 48);
this.LblBytes.Name = "LblBytes";
this.LblBytes.Size = new System.Drawing.Size(31, 13);
this.LblBytes.TabIndex = 4;
this.LblBytes.Text = "bytes";
//
// ChkCaptureMode
//
this.ChkCaptureMode.Location = new System.Drawing.Point(248, 40);
this.ChkCaptureMode.Name = "ChkCaptureMode";
this.ChkCaptureMode.Size = new System.Drawing.Size(232, 24);
this.ChkCaptureMode.TabIndex = 5;
this.ChkCaptureMode.Text = "Capture packets in promiscuous mode";
this.ChkCaptureMode.CheckStateChanged += new System.EventHandler(this.ChkCaptureMode_CheckStateChanged);
//
// LblFilter
//
this.LblFilter.AutoSize = true;
this.LblFilter.Location = new System.Drawing.Point(8, 80);
this.LblFilter.Name = "LblFilter";
this.LblFilter.Size = new System.Drawing.Size(29, 13);
this.LblFilter.TabIndex = 6;
this.LblFilter.Text = "Filter";
//
// TxtFilter
//
this.TxtFilter.Location = new System.Drawing.Point(40, 72);
this.TxtFilter.Name = "TxtFilter";
this.TxtFilter.Size = new System.Drawing.Size(680, 20);
this.TxtFilter.TabIndex = 7;
this.TxtFilter.Text = "";
//
// panel1
//
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panel1.Location = new System.Drawing.Point(8, 104);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(712, 4);
this.panel1.TabIndex = 8;
//
// ChkDisplayOptionsRealTime
//
this.ChkDisplayOptionsRealTime.Location = new System.Drawing.Point(8, 120);
this.ChkDisplayOptionsRealTime.Name = "ChkDisplayOptionsRealTime";
this.ChkDisplayOptionsRealTime.Size = new System.Drawing.Size(216, 16);
this.ChkDisplayOptionsRealTime.TabIndex = 11;
this.ChkDisplayOptionsRealTime.Text = "Update the list of packets in real time";
//
// ChkDisplayOptionsAutomaticScroll
//
this.ChkDisplayOptionsAutomaticScroll.Location = new System.Drawing.Point(8, 144);
this.ChkDisplayOptionsAutomaticScroll.Name = "ChkDisplayOptionsAutomaticScroll";
this.ChkDisplayOptionsAutomaticScroll.Size = new System.Drawing.Size(192, 16);
this.ChkDisplayOptionsAutomaticScroll.TabIndex = 12;
this.ChkDisplayOptionsAutomaticScroll.Text = "Automatic scrolling in live capture";
//
// panel2
//
this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panel2.Location = new System.Drawing.Point(8, 168);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(360, 4);
this.panel2.TabIndex = 13;
//
// ChkCaptureLimitsPackets
//
this.ChkCaptureLimitsPackets.Location = new System.Drawing.Point(8, 192);
this.ChkCaptureLimitsPackets.Name = "ChkCaptureLimitsPackets";
this.ChkCaptureLimitsPackets.Size = new System.Drawing.Size(120, 16);
this.ChkCaptureLimitsPackets.TabIndex = 14;
this.ChkCaptureLimitsPackets.Text = "Stop capture after ";
this.ChkCaptureLimitsPackets.CheckStateChanged += new System.EventHandler(this.ChkCaptureLimitsPackets_CheckStateChanged);
//
// ChkCaptureLimitsKiloBytes
//
this.ChkCaptureLimitsKiloBytes.Location = new System.Drawing.Point(8, 216);
this.ChkCaptureLimitsKiloBytes.Name = "ChkCaptureLimitsKiloBytes";
this.ChkCaptureLimitsKiloBytes.Size = new System.Drawing.Size(120, 16);
this.ChkCaptureLimitsKiloBytes.TabIndex = 15;
this.ChkCaptureLimitsKiloBytes.Text = "Stop capture after ";
this.ChkCaptureLimitsKiloBytes.CheckStateChanged += new System.EventHandler(this.ChkCaptureLimitsKiloBytes_CheckStateChanged);
//
// ChkCaptureLimitsSeconds
//
this.ChkCaptureLimitsSeconds.Location = new System.Drawing.Point(8, 240);
this.ChkCaptureLimitsSeconds.Name = "ChkCaptureLimitsSeconds";
this.ChkCaptureLimitsSeconds.Size = new System.Drawing.Size(120, 16);
this.ChkCaptureLimitsSeconds.TabIndex = 16;
this.ChkCaptureLimitsSeconds.Text = "Stop capture after ";
this.ChkCaptureLimitsSeconds.CheckStateChanged += new System.EventHandler(this.ChkCaptureLimitsSeconds_CheckStateChanged);
//
// TxtCaptureLimitsPackets
//
this.TxtCaptureLimitsPackets.Location = new System.Drawing.Point(128, 184);
this.TxtCaptureLimitsPackets.Name = "TxtCaptureLimitsPackets";
this.TxtCaptureLimitsPackets.Size = new System.Drawing.Size(64, 20);
this.TxtCaptureLimitsPackets.TabIndex = 17;
this.TxtCaptureLimitsPackets.Text = "100";
//
// TxtCaptureLimitsKiloBytes
//
this.TxtCaptureLimitsKiloBytes.Location = new System.Drawing.Point(128, 208);
this.TxtCaptureLimitsKiloBytes.Name = "TxtCaptureLimitsKiloBytes";
this.TxtCaptureLimitsKiloBytes.Size = new System.Drawing.Size(64, 20);
this.TxtCaptureLimitsKiloBytes.TabIndex = 18;
this.TxtCaptureLimitsKiloBytes.Text = "10000";
//
// TxtCaptureLimitsSeconds
//
this.TxtCaptureLimitsSeconds.Location = new System.Drawing.Point(128, 232);
this.TxtCaptureLimitsSeconds.Name = "TxtCaptureLimitsSeconds";
this.TxtCaptureLimitsSeconds.Size = new System.Drawing.Size(64, 20);
this.TxtCaptureLimitsSeconds.TabIndex = 19;
this.TxtCaptureLimitsSeconds.Text = "20";
//
// LblPackets
//
this.LblPackets.AutoSize = true;
this.LblPackets.Location = new System.Drawing.Point(200, 192);
this.LblPackets.Name = "LblPackets";
this.LblPackets.Size = new System.Drawing.Size(98, 13);
this.LblPackets.TabIndex = 20;
this.LblPackets.Text = "packet(s) captured";
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -