ImageEn, unit imageenio

TImageEnIO.ExtractFromFileZIP

TImageEnIO.ExtractFromFileZIP


Declaration

function ExtractFromFileZIP(const FileName: string; FileIndex: Integer; const DestFolder: string; UseFullPath: Boolean = True; const Password: string = ''): Boolean; overload;
function ExtractFromFileZIP(const FileName: string; FileIndexes: TCardinalArray; Count: Integer; const DestFolder: string; UseFullPath: Boolean = True; const Password: string = ''): Boolean; overload;


Description

Extracts one or all files from ZIP archive to the specified folder.
Specify -1 to extract all files, or specify an index of a specific file. The file(s) will be output to the specified folder.
If UseFullPath = False, then all files will be output to the specified folder. If UseFullPath = true, then the folder structure of the zip will be created within the specified path.
If the file is encrypted you can specify the password (otherwise a password prompt will be displayed if AutoPromptForPassword is enabled).
Result will be false if the file is not ZIP format or no ZIP plug-in is available (Aborting will be true). Errors due to a file not being available will raise an exception.



Note:
ZIP extraction requires the 7z plug-in from: www.imageen.com/download/
To abort while extracting set Aborting to true
Read more about ImageEn ZIP Support


Examples

// Extract all files from a zip file to D:\Out\ (Recreating the internal zip folder structure)
ImageEnView1.IO.ExtractFromFileZIP( 'C:\test.zip', -1, 'D:\Out\', True );

// Extract the first file from a zip file to D:\Out\
ImageEnView1.IO.ExtractFromFileZIP( 'C:\test.zip', 0, 'D:\Out\', False );

// Extract three files from a zip
images[0] := 2;
images[1] := 4;
images[2] := 5;
ImageEnView1.IO.ExtractFromFileZIP( 'C:\test.zip', images, 3, 'D:\Out\', False );