Zip And Unzip files and folders

2019-06-26 11:26发布

问题:

I need to zip and unzip the directory hirarchy in Windows Mobile using C++/C#. What is the simplest library available for it?

I have googled many times. I found some stuff, but I am not able to go ahead with it.

If you have implemented or if you know some stuff about it please let me know.

回答1:

For .NET, SharpZipLib.

See also: Zip library options for the Compact Framework?



回答2:

DotNetZip is a .NET library, has a build for .NET CF.

There's a .NET CF sample application delivered with the devkit. It is a CF app that unzips files on the device.

The code that does the unzipping looks like this:

using (var zip1 = Ionic.Zip.ZipFile.Read(_selectedpath))
{
    foreach (var entry in zip1)
    {
        entry.Extract(dir, ExtractExistingFileAction.OverwriteSilently);
    }
}

// now, re-populate the treeview with the extracted files:
AddChildren(tvFolders.SelectedNode.Parent);