Jon*_*alk 3 zip mobile-phones unzip windows-mobile
我需要programaticaly解压缩zip存档到Windows Mobile上的文件夹.是否有一个易于使用的API,我可以直接使用,或者我应该使用一些外部库?
你需要一个外部库.有一个zlibce.dll,一个本机DLL,如果你是C++,你可以使用它.
如果.NET是你的事,然后我可以推荐DotNetZip,运行于.NETCF 2.0,是免费的,开源的,并具有良好的文档,性能好.在DotNetZip源代码发布中,有一个可以查看和编译的CF-Unzipper项目; 它演示了如何解压缩设备上的文件.这是一个链接,您可以在其中查看设备应用程序的代码.
这是代码的zip相关部分的片段.它解压缩到一个名称来自zip文件的目录(没有.zip扩展名).
private void UnzipSelectedFile()
{
string parent = System.IO.Path.GetDirectoryName(_selectedpath);
string dir = System.IO.Path.Combine(parent,
System.IO.Path.GetFileNameWithoutExtension(_selectedpath));
try
{
using (var zip1 = new Ionic.Zip.ZipFile(_selectedpath))
{
foreach (var entry in zip1)
{
entry.Extract(dir, true);
}
}
// re-populate the treeview with the extracted files:
AddChildren(tvFolders.SelectedNode.Parent);
}
catch (Exception ex)
{
MessageBox.Show("Exception! " + ex);
}
}
Run Code Online (Sandbox Code Playgroud)
这是指向该库文档的在线版本的链接.