User (Old forums)MemberMarch 19, 2009 at 4:53 pmPost count: 23064
How can I implement the extract here option?
Imported from legacy forums. Posted by Juan (had 3610 views)User (Old forums)MemberMarch 23, 2009 at 3:14 pmPost count: 23064
You will have to implement your own button that will call your own “extract dialog box”, that will present all the options you want to offer (e.g. destination folder, overwriting existing files, password for encrypted files, …). Once the user clicks on the extract button on that form, you will need to parse all the options, and extract the files according to those options.
Imported from legacy forums. Posted by André (had 255 views)User (Old forums)MemberMarch 23, 2009 at 4:14 pmPost count: 23064
Thank you Andre but I dont have a UI, when I try to copy or move the files to an AbstractFolder your library creates a folder with the same name of the zip file. I just need to unzip the files under the same folder than the zip file exists.
I am using the following:
Imported from legacy forums. Posted by Juan (had 2640 views)User (Old forums)MemberMarch 24, 2009 at 1:50 pmPost count: 23064
Sorry, I misunderstood your request.
This depends on how the files are saved in the zip archive. If the files are saved with a path, and you simply unzip the files using ZipArchive.CopyFilesTo(), it will extract them with the same folder structure there is in the archive.
If you want to ignore the folder structure in the archive, you will need to get each file individually in the archive, and copy each one to the folder location into newly created DiskFile’s that will contain the extracted files.
AbstractFile zipFile = new DiskFile( @”D:\Temp\SomeArchive.zip” );
ZipArchive archive = new ZipArchive( zipFile );
AbstractFolder destFolder = new DiskFolder( @”D:\Temp\” );
foreach( ZippedFile sourceFile in archive.GetFiles( true ) )
AbstractFile destFile = new DiskFile( destFolder.FullName + sourceFile.Name );
sourceFile.CopyTo( destFile, true );
This will unzip all files in the archive to “D:\Temp”, which is where is located the zip archive itself.
Imported from legacy forums. Posted by André (had 237 views)
- You must be logged in to reply to this topic.