- function Zip(ZipMode,PackSize:Integer;ZipFile,UnzipDir:String):Boolean;
-
var ziper:TVCLZip;
-
begin
-
-
-
try
-
if copy(UnzipDir, length(UnzipDir), 1) = '\' then
-
UnzipDir := copy(UnzipDir, 1, length(UnzipDir) - 1);
-
ziper:=TVCLZip.Create(application);
-
ziper.DoAll:=true;
-
ziper.OverwriteMode:=Always;
-
if PackSize<>0 then begin
-
ziper.MultiZipInfo.MultiMode:=mmBlocks;
-
ziper.MultiZipInfo.SaveZipInfoOnFirstDisk:=True;
-
ziper.MultiZipInfo.FirstBlockSize:=PackSize;
-
ziper.MultiZipInfo.BlockSize:=PackSize;
-
end;
-
ziper.FilesList.Clear;
-
ziper.ZipName := ZipFile;
-
if ZipMode=0 then begin
-
ziper.FilesList.Add(UnzipDir+'\*.*');
-
Application.ProcessMessages;
-
ziper.Zip;
-
end else begin
-
ziper.DestDir:= UnzipDir;
-
ziper.UnZip;
-
end;
-
ziper.Free;
-
Result:=True;
-
except
-
Result:=False;
-
end;
-
end;
|
请发表评论