📄 option.pas
字号:
unit Option;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Global;
type
TOptionForm = class(TForm)
cbxAdapter: TComboBox;
lblFilter: TLabel;
lblReadTimeOut: TLabel;
lblSnapLen: TLabel;
edReadTimeOut: TEdit;
edSnapLen: TEdit;
chkThreadSafe: TCheckBox;
lblAdapter: TLabel;
edFilter: TEdit;
btnOK: TButton;
btnCancel: TButton;
lblMaxBytes: TLabel;
edMaxBytes: TEdit;
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure btnOKClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
OptionForm: TOptionForm;
implementation
uses Main;
{$R *.DFM}
procedure TOptionForm.FormCreate(Sender: TObject);
begin
cbxAdapter.Items := MainForm.SnoopStatistics1.AdapterDescriptions;
end;
procedure TOptionForm.FormShow(Sender: TObject);
begin
_Global.Load;
// WinPcap
cbxAdapter.ItemIndex := _Global.AdapterIndex;
if cbxAdapter.ItemIndex = -1 then
cbxAdapter.ItemIndex := 0;
edFilter.Text := _Global.Filter;
edReadTimeOut.Text := IntToStr(_Global.ReadTimeOut);
edSnapLen.Text := IntToStr(_Global.SnapLen);
chkThreadSafe.Checked := _Global.ThreadSafe;
// Statistics
edMaxBytes.Text := IntToStr(_Global.MaxBytes);
end;
procedure TOptionForm.btnOKClick(Sender: TObject);
begin
// WinPcap
_Global.AdapterIndex := cbxAdapter.ItemIndex;
_Global.Filter := edFilter.Text;
_Global.ReadTimeOut := StrToInt(edReadTimeOut.Text);
_Global.SnapLen := StrToInt(edSnapLen.Text);
_Global.ThreadSafe := chkThreadSafe.Checked;
// Statistics
_Global.MaxBytes := StrToInt(edMaxBytes.Text);
_Global.Save;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -