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

📄 unit1.pas

📁 著名的SecureBlackBox控件完整源码
💻 PAS
字号:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  kbmMWServer, StdCtrls, kbmMWCustomTransport,
  kbmMWInventoryService, kbmMWTCPIPIndyTransport,
  kbmMWGlobal, kbmMWSecurity, kbmMWZipStdTransStream, IdBaseComponent,
  IdComponent,
  SBUtils, SBkbmMWIndy8Plugin,
  IdIntercept, IdSSLIntercept, SBServerIndyIntercept;

type
  TForm1 = class(TForm)
    kbmMWServer1: TkbmMWServer;
    kbmMWTCPIPIndyServerTransport1: TkbmMWTCPIPIndyServerTransport;
    Label1: TLabel;
    Label2: TLabel;
    GroupBox1: TGroupBox;
    Button3: TButton;
    Button4: TButton;
    GroupBox2: TGroupBox;
    Button1: TButton;
    Button2: TButton;
    GroupBox3: TGroupBox;
    lCounter: TLabel;
    ElkbmMWIndy8Plugin1: TElkbmMWIndy8Plugin;
    ElIndyServerSSLIntercept1: TElIndyServerSSLIntercept;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure kbmMWServer1ServeRequest(Sender: TObject;
      InStream: TkbmMWCustomRequestTransportStream;
      Service: TkbmMWCustomService; ClientIdent: TkbmMWClientIdentity;
      const Args: array of Variant);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

// This is a sample customizable server.
// New services can be created by creating a new kbmMWQueryService or
// kbmMWCustomService file via File->New->kbmMW Service objects
// and add the needed code/components.
//

procedure TForm1.Button1Click(Sender: TObject);
begin
     kbmMWServer1.Active:=true;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
     kbmMWServer1.Active:=false;
end;

procedure TForm1.FormCreate(Sender: TObject);
var
   sd:TkbmMWCustomServiceDefinition;
begin
     // Register services here which this server application should provide.
     // RegisterService registers the service with the name the service prefers to be known as.
     // Using RegisterServiceByName you can register services under other custom names.
     // This can be of interest if you want to provide a standard service under a custom name.
     //
     // By setting the Enabled parameter to true, the service will be enabled.
     //
     // The MaxCount is used to define how many concurrent instances of the service is allowed.
     // If MaxCount<0 there is no limit, and new service instances are started when needed.
     // If MaxCount>=0 then a max of MaxCount services can be running at the same time.
     // If f.ex. MaxCount=10 and 10 instances are allready in the process of serving requests, an 11 request
     // will be put into a queue waiting for a vacant service from the service pool.
     //
     // The timeout parameter controls how long time a service can stay idle (not being used)
     // before its garbage collected or in other words before that specific service instance is
     // destroyed and removed from the pool of available service instances. Set to 0 to not garbage
     // collect instances of that specific service.
     //
     // RegisterService(AServiceClass:TkbmMWCustomServiceClass; Default:boolean);
     // RegisterServiceByName(AServiceName:string; AServiceClass:TkbmMWCustomServiceClass; Default:boolean);

     // Set properties on sd to control additional servicedefinition settings.
     sd:=kbmMWServer1.RegisterService(TkbmMWInventoryService,false);
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
     kbmMWServer1.Statistics.Save('Stats.txt');
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
     kbmMWServer1.Statistics.Load('Stats.txt');
end;

procedure TForm1.kbmMWServer1ServeRequest(Sender: TObject;
  InStream: TkbmMWCustomRequestTransportStream;
  Service: TkbmMWCustomService; ClientIdent: TkbmMWClientIdentity;
  const Args: array of Variant);
begin
     // Here you can catch requests before they are actually served.
     // It can f.ex. be usefull for logging, stats or other things.
     lCounter.Caption:=inttostr(kbmMWServer1.AccRequestCount+1);
end;
    
initialization
SetLicenseKey('ADDCD14AD06709806817E0B3D7BFD0A2222D536FE156466C5D5FE65DB5DEAE76' + 
  'FFDEBC07E915A5751C12C01C783958872A38E4A5EDA140E7247E0F2E56442A3C' + 
  'F3E9347AD8FDE52083A0DFC86BC00ECB0FD0CF1B51159A2BCB84F6EA6349EF47' + 
  '5C15A59AFCC55F7C3AAD26C279628B5D91B1DC94BD2385354A70CCA3B76101D9' + 
  'F41C84A639FC3CCE4BA8F0CC4A66DCD150114A3F58C1AD46B7B94643741BC20A' + 
  '8DCA83AB921480951B423CAA19EF1863A47CA2C3422E7E5634BED98939A5AE43' + 
  'DE1E4BAD79E66D8A5C973B3455656C8C9B6FF024FADD6CDA02D0F506D98493C8' + 
  'BD1ED7B237DB75FA31F2C82654490CDDDEE24E19939137B9E1DB05508733B22F');

end.

⌨️ 快捷键说明

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