MonoDroid的:路径资产解压使用.NET框架文件 [英] MonoDroid: Path to Assets to unzip a file with .NET framework

查看:192
本文介绍了MonoDroid的:路径资产解压使用.NET框架文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 SharpZip .NET邮编图书馆来解压缩在资产/ MyZipFolder 文件夹中找到的文件。

I am using the SharpZip .NET Zip Library to unzip a file found in the Assets/MyZipFolder folder.

我需要的完整路径,这样我可以使用以下命令:

I need to get the full path so that I can use the following:

ZipInputStream s = new ZipInputStream(File.OpenRead(_zipFile))

我如何获取路径为资产/ MyZipFolder / MyZip.zip 来传递到.NET File.OpenRead命令?

How do I get the path to Assets/MyZipFolder/MyZip.zip to pass to a .NET File.OpenRead command?

推荐答案

从上下文可以使用只需打开一个读码流:

From your Context you can simply open a read stream using:

 using (var stream = Context.Assets.Open("MyZipFolder/MyZip.zip"))
 { 
      var s = new ZipInputStream(stream);
      // do read here ...
 }

请注意,该文件被标记为AndroidAsset用于生成操作,并记住在android系统是大小写敏感的文件名。

Be careful that the file is marked as an AndroidAsset for build action, and remember that file names in android are case sensitive.

这篇关于MonoDroid的:路径资产解压使用.NET框架文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆