我'm trying to build a wp7 application that must allow user to read ebooks in epub format. Since there isn' t任何可用的库来读取Windows手机上的epub文件,我正在尝试创建一个 . 所以我必须解压缩文件,然后解析它 .
问题是我可以't unzip the epub file. I'使用 SharpZipLib.WindowsPhone7.dll
但我得到一个例外:
尝试访问该方法失败:System.IO.File.OpenRead(System.String)
在这条线上:
ZipInputStream s = new ZipInputStream(File.OpenRead(path_epubfile));
可以帮到我吗?
1 回答
这将取决于如何获得内容 . 这里有三种可能的选择;
Option 1 :如果使用"Content"的Build Action将内容添加到项目中,则可以使用
StreamResourceInfo
类(在System.Windows.Resources
名称空间中)获取流Option 2 :如果你've added it to your project and set the Build Action to 1048284 then you' ll需要使用
GetManifestResourceStream()
注意:您需要将"EPubReader.Example.txt"传递给
GetManifestResourceStream()
. 您可以使用GetManifestResourceNames()
查看可用的资源 .Option 3 :如果您've obtained the content at run time, it'将存储在
IsolatedStorage
中 .