位于IsolatedStorage 中的Zip 文件
我的应用程序需要在Silverlight中下载多个文件,并且因为我不想多次询问用户保存文件的权限,所以我首先将文件保存在IsolatedStorage中,然后我想将它们全部压缩到一个文件并询问一次用于保存权限。
因此我使用 SharpZipLib 来压缩位于isolatedStorage中的多个文件,问题是SharpZipLib只接受文件地址作为ZipEntery:
ZipEntry z= new ZipEntry(name);
正如你所知,因为文件位于IsolatedStorage中,我没有它们的地址。
我在 从/到内存流或字节数组创建 Zip 上看到了示例,但是我无法将它用于多个文件。
请帮助我找到一种使用 SharpZipLib 的方法,或者向我介绍另一种下载多个文件的方法,而无需多次请求许可。
My application need to download multiple files in Silverlight, and because I don't want to ask user multiple times for permission to save the files, I save the files in IsolatedStorage first and then I want to zip them all to a file and ask once for saving permission.
therefore I used SharpZipLib to zip multiple files which are located in IsolatedStorage, the problem is that SharpZipLib just accept file address as ZipEntery:
ZipEntry z= new ZipEntry(name);
and as you know cause the files are located in IsolatedStorage I don't have the address of them.
I saw sample on Create a Zip from/to a memory stream or byte array but I cant use it for multiple files.
Please help me to find a way to use SharpZipLib or introduce me another way to downloading multiple files without asking multiple times for permission.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ZipEntry z= new ZipEntry(name);
中的name
是 zip 中的逻辑/相对名称,您可以以任何您想要的方式建立它。因此,只要您可以将 IsoStorage 文件作为流重新打开,您就应该能够使用 SharpZip。
The
name
inZipEntry z= new ZipEntry(name);
is a logical/relative name inside your zip, you can establish it any way you want.So as long as you can re-open you IsoStorage files as a Stream, you should be able to use SharpZip.