|
@@ -4,7 +4,8 @@ interface
|
|
|
|
|
|
uses
|
|
|
Controls, ZhAPI, ActnList, ZjIDTree, DB, ZjGridDBA, ZjGrid, Windows, Messages,
|
|
|
- sdDB, VCLZip, VCLUnZip, Dialogs, Forms, ShlObj, Classes, StrUtils, Math, ADODB;
|
|
|
+ sdDB, VCLZip, VCLUnZip, Dialogs, Forms, ShlObj, Classes, StrUtils, Math, ADODB,
|
|
|
+ IdGlobal;
|
|
|
|
|
|
type
|
|
|
TBookmarkRefreshEvent = procedure (AExpandFrame: Boolean) of object;
|
|
@@ -870,13 +871,25 @@ begin
|
|
|
end;
|
|
|
|
|
|
{Zip}
|
|
|
+function ZipComplete(const AFileName: string): Boolean;
|
|
|
+var
|
|
|
+ iSize1, iSize2: Integer;
|
|
|
+begin
|
|
|
+ iSize1 := FileSizeByName(AFileName);
|
|
|
+ Sleep(200);
|
|
|
+ iSize2 := FileSizeByName(AFileName);
|
|
|
+ Result := iSize1 = iSize2;
|
|
|
+end;
|
|
|
+
|
|
|
procedure ZipFolder(AFileFolder, AFileName: string);
|
|
|
var
|
|
|
sTempFile: string;
|
|
|
vZip: TVCLZip;
|
|
|
+ iCount: Integer;
|
|
|
begin
|
|
|
sTempFile := GetTempFileName;
|
|
|
vZip := TVCLZip.Create(nil);
|
|
|
+ iCount := 0;
|
|
|
try
|
|
|
vZip.FilesList.Clear;
|
|
|
vZip.ZipName := sTempFile;
|
|
@@ -887,6 +900,11 @@ begin
|
|
|
//vZip.RecreateDirs := True;
|
|
|
vZip.FilesList.Add(AFileFolder + '\*.*');
|
|
|
vZip.Zip;
|
|
|
+ while not ZipComplete(sTempFile) and (iCount < 10) do
|
|
|
+ begin
|
|
|
+ Sleep(200);
|
|
|
+ Inc(iCount);
|
|
|
+ end;
|
|
|
CopyFileOrFolder(sTempFile, AFileName);
|
|
|
finally
|
|
|
vZip.Free;
|