|
|
@@ -5,7 +5,7 @@ interface
|
|
|
uses
|
|
|
Classes, SysUtils, Variants, Forms, StdCtrls, Types, Dialogs, Graphics,
|
|
|
Windows, Controls, Messages, StrUtils, Math, ScMessage, ScConsts, DBClient,
|
|
|
- Registry, ShlObj, ShellAPI, IniFiles, DB, TLHelp32, ADODB, WinSock, sdDB;
|
|
|
+ Registry, ShlObj, ShellAPI, IniFiles, DB, TLHelp32, ADODB, WinSock, sdDB, VCLUnZip;
|
|
|
|
|
|
type
|
|
|
TUniqueIdGenerator = class(TObject)
|
|
|
@@ -583,6 +583,7 @@ var
|
|
|
|
|
|
function DeleteFolder(const AFolder: string; AToRecycleBin: Boolean = False): Boolean;
|
|
|
function CopyFolder(const ASourceFolder, ATargetFolder: string): Boolean;
|
|
|
+function UnZip(const zipFile: string): string; // 返回解压后的文件(只返回一个解压文件。如果有多个,则指定一个返回)
|
|
|
|
|
|
implementation
|
|
|
|
|
|
@@ -6630,4 +6631,30 @@ begin
|
|
|
Result := iAllLength;
|
|
|
end;
|
|
|
|
|
|
+
|
|
|
+function UnZip(const zipFile: string): string;
|
|
|
+var
|
|
|
+ vUnZip: TVCLUnZip;
|
|
|
+ sPath: string;
|
|
|
+ i: Integer;
|
|
|
+begin
|
|
|
+ Result := '';
|
|
|
+ sPath := ExtractFilePath(zipFile);
|
|
|
+ vUnZip := TVCLUnZip.Create(nil);
|
|
|
+ try
|
|
|
+ vUnZip.ZipName := zipFile;
|
|
|
+// vUnZip.Password := '1234578';
|
|
|
+ vUnZip.DestDir := sPath;
|
|
|
+ vUnZip.DoAll := True;
|
|
|
+ vUnZip.RecreateDirs := True;
|
|
|
+ vUnZip.RetainAttributes := True;
|
|
|
+ vUnZip.OverwriteMode := Always;
|
|
|
+ i := vUnZip.UnZip;
|
|
|
+ if i > 0 then
|
|
|
+ Result := sPath + 'main.xml';
|
|
|
+ finally
|
|
|
+ vUnZip.Free;
|
|
|
+ end;
|
|
|
+end;
|
|
|
+
|
|
|
end.
|