A
airlenllq
Unregistered / Unconfirmed
GUEST, unregistred user!
FIdFtp : TIDFTP;
FFileSize : LongWord; //size of file
FBytesTransfer : LongWord; //size of file that has transfered
FSuccess : Boolean; //flag is or not Download successed
procedure DownLoad;
begin
...
FFileSize : FIDFtp.Size(f);//f : the file that will download
...
end;
procedure THisDataTransfer.ftpWorkBegin(Sender: TObject; AWorkMode: TWorkMode;
const AWorkCountMax: Integer);
begin
if AWorkCountMax > 0 then
FProgressBar.Max := AWorkCountMax
else
FProgressBar.Max := FFileSize;
end;
procedure THisDataTransfer.ftpWork(Sender: TObject; AWorkMode: TWorkMode;
const AWorkCount: Integer);
begin
FBytesTransfer := AWorkCount;
FProgressBar.Position := FBytesTransfer;
end;
procedure THisDataTransfer.ftpWorkEnd(Sender: TObject; AWorkMode: TWorkMode);
begin
if FBytesTransfer = FFileSize then
FSuccess := True;
FFileSize := 0;
FBytesTransfer := 0;
FProgressBar.Position := 0;
FProgressBar.Visible := False;
end;
请问:为什么下载完了之后,FBytesTransfer的值与 FFileSize 的值相差很多
但已经下载成功了;
标识文件大小的还有已传输的是字节还是位?
这段代码是否有问题?
怎样来判断文件已经完整下载?
FFileSize : LongWord; //size of file
FBytesTransfer : LongWord; //size of file that has transfered
FSuccess : Boolean; //flag is or not Download successed
procedure DownLoad;
begin
...
FFileSize : FIDFtp.Size(f);//f : the file that will download
...
end;
procedure THisDataTransfer.ftpWorkBegin(Sender: TObject; AWorkMode: TWorkMode;
const AWorkCountMax: Integer);
begin
if AWorkCountMax > 0 then
FProgressBar.Max := AWorkCountMax
else
FProgressBar.Max := FFileSize;
end;
procedure THisDataTransfer.ftpWork(Sender: TObject; AWorkMode: TWorkMode;
const AWorkCount: Integer);
begin
FBytesTransfer := AWorkCount;
FProgressBar.Position := FBytesTransfer;
end;
procedure THisDataTransfer.ftpWorkEnd(Sender: TObject; AWorkMode: TWorkMode);
begin
if FBytesTransfer = FFileSize then
FSuccess := True;
FFileSize := 0;
FBytesTransfer := 0;
FProgressBar.Position := 0;
FProgressBar.Visible := False;
end;
请问:为什么下载完了之后,FBytesTransfer的值与 FFileSize 的值相差很多
但已经下载成功了;
标识文件大小的还有已传输的是字节还是位?
这段代码是否有问题?
怎样来判断文件已经完整下载?