delphi 谁帮我翻译下这段代码——高分

来源:百度知道 编辑:UC知道 时间:2024/06/30 17:33:33
unit web;

interface

uses
Classes,IdHTTP,SysUtils,IdCookieManager,IdMultipartFormData
,windows;

type
TWeb = class(TThread)
private
protected
procedure Execute; override;
public
mode: Integer;
url: string;
idhttp: TIDHttp;
sl: TStringList;
mpfDS: TIdMultiPartFormDataStream;
flag: Boolean;
err,html: string;
stm: TMemoryStream;
constructor create;
end;

implementation

constructor TWeb.create;
begin
idhttp := TIDHttp.Create(nil);
idhttp.CookieManager := TIDCookieManager.Create(idhttp);
sl := TStringList.Create();
mpfDS := TIdMultiPartFormDataStream.Create();
stm := TMemoryStream.Create();

FreeOnTerminate := True;
inherited Create(True);
end;

procedure TWeb.Execute;
begin
while not Terminated do

//是个基于多线程的模拟浏览器的 Get 和Post 方法的类,具体我也不大清楚,,
//也只能大概说说了.

unit web;

interface

uses
Classes,IdHTTP,SysUtils,IdCookieManager,IdMultipartFormData
,windows;

//类的声明
type
TWeb = class(TThread)
private
protected
procedure Execute; override; //重写父类TThread的Exeecute方法.
public
mode: Integer; //标志位:根据这个判断是Get还是Post
url: string; //Url地址
idhttp: TIDHttp; //Indy 的http组件
sl: TStringList;
mpfDS: TIdMultiPartFormDataStream; //用这个控件实现 Stream的提交方法的.
flag: Boolean; //标志位,代码没有读懂,不知道是控制什么状态的
err,html: string;
stm: TMemoryStream;
constructor create; //构建函数
end;

implementation

//构造函数 ,全是初始化声明的类,没啥好说的.
constructor TWeb.create;
begin
idhttp := TIDHttp.Create(nil);
idhttp.CookieManager := TIDCookieManager.Create(idhttp);
sl := TStringList.Create();
mpfDS := TIdMultiPartFormDataStream.Create();
stm := TM