Home Forums .NET libraries Xceed Zip & Real-Time Zip for .NET Extract Here option

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #20141 |

    How can I implement the extract here option?

     Ty

    Imported from legacy forums. Posted by Juan (had 3610 views)

    User (Old forums)
    Member
    Post 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)
    Member
    Post 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:

    Xceed.Zip
    Xceed.FileSystem

    Imported from legacy forums. Posted by Juan (had 2640 views)

    User (Old forums)
    Member
    Post 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.

    e.g.:

          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)

    User (Old forums)
    Member
    Post count: 23064

    Ok ths

    Imported from legacy forums. Posted by Juan (had 3460 views)

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.