⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 global.pas

📁 一个SNOOP控件,各位看看可以对网络包进行分析.
💻 PAS
字号:
unit Global;

interface

uses
  SysUtils, Forms, IniFiles;

type
  TGlobal = class
  public
	// Coordination
	Left: Integer;
	Top: Integer;
	Width: Integer;
	Height: Integer;
	// WinPcap
	AdapterIndex: Integer;
	Filter: String;
	ReadTimeOut: Integer;
	SnapLen: Integer;
	ThreadSafe: Boolean;
	// Statistics
	MaxBytes: Integer;

	constructor Create;
	destructor Destroy; override;
	procedure Load;
	procedure Save;
  end;

var
  _Global: TGlobal;
  
implementation

constructor TGlobal.Create;
begin
	Load;
end;

destructor TGlobal.Destroy;
begin
	Save;
end;

procedure TGlobal.Load;
var
	IniFile: TIniFile;
begin
	IniFile := TIniFile.Create(ExtractFilePath(Application.ExeName) + 'Statistics.ini');
	// Coordination
	Left := IniFile.ReadInteger('Coordination', 'Left', 0);
	Top := IniFile.ReadInteger('Coordination', 'Top', 0);
	Width := IniFile.ReadInteger('Coordination', 'Width', 320);
	Height := IniFile.ReadInteger('Coordination', 'Height', 160);
	// WinPcap
	AdapterIndex := IniFile.ReadInteger('WinPcap', 'AdapterIndex', -1);
	Filter := IniFile.ReadString('WinPcap', 'Filter', ''); // gilgil temp 2003.08.19
	ReadTimeOut := IniFile.ReadInteger('WinPcap', 'ReadTimeOut', 1000);
	SnapLen := IniFile.ReadInteger('WinPcap', 'SnapLen', 1600); // gilgil temp 2003.08.19
	ThreadSafe := IniFile.ReadBool('WinPcap', 'ThreadSafe', true);
	// Statistics
	MaxBytes := IniFile.ReadInteger('Statistics', 'MaxBytes', 1000000);

	IniFile.Free;
end;

procedure TGlobal.Save;
var
	IniFile: TIniFile;
begin
	IniFile := TIniFile.Create(ExtractFilePath(Application.ExeName) + 'Statistics.ini');
	try
		// Coordination
		IniFile.WriteInteger('Coordination', 'Left', Left);
		IniFile.WriteInteger('Coordination', 'Top', Top);
		IniFile.WriteInteger('Coordination', 'Width', Width);
		IniFile.WriteInteger('Coordination', 'Height', Height);
		// WinPcap
		IniFile.WriteInteger('WinPcap', 'AdapterIndex', AdapterIndex);
		IniFile.WriteString('WinPcap', 'Filter', Filter); // gilgil temp 2003.08.19
		IniFile.WriteInteger('WinPcap', 'ReadTimeOut', ReadTimeOut);
		IniFile.WriteInteger('WinPcap', 'SnapLen', SnapLen); // gilgil temp 2003.08.19
		IniFile.WriteBool('WinPcap', 'ThreadSafe', ThreadSafe);
		// Statistics
		IniFile.WriteInteger('Statistics', 'MaxBytes', MaxBytes);
	finally
		IniFile.Free;
	end;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -