ZipStorer没有创造Android的C#中的任何文件 [英] ZipStorer not creating any file in Android c#

查看:136
本文介绍了ZipStorer没有创造Android的C#中的任何文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好我使用Xamarin用C#,使一个应用程序,可以压缩和解压缩文件,所以试了几次后,我发现zipStorer。

Hi i am using Xamarin with c# to make an app that can zip and unzip files so after a few tries i found zipStorer.

HTTP://zipstorer.$c$cplex.com/

下面是我的code

 ZipStorer zip = ZipStorer.Open(Convert.ToString(Android.OS.Environment.GetExternalStoragePublicDirectory("BrSatisfacao/aaa.zip")), FileAccess.Read);

                List<ZipStorer.ZipFileEntry> dir = zip.ReadCentralDir();

                string path;

                foreach (ZipStorer.ZipFileEntry entry in dir)

                {

                    if (Path.GetFileName(entry.FilenameInZip) == "08.jpg")

                    {

                        path = Path.Combine(Convert.ToString(Android.OS.Environment.GetExternalStoragePublicDirectory("BrSatisfacao/")), Path.GetFileName(entry.FilenameInZip));

                        zip.ExtractFile(entry, Convert.ToString(Android.OS.Environment.GetExternalStoragePublicDirectory("BrSatisfacao/sample.jpg")));

                        break;

                    }   

                }

                zip.Close();

在几个小时code运行良好并打开拉链,并显示所有在控制台中,但正在创建无拉链...难道我做错了什么?

After a couple of hours the code is running fine and opening the zip and showing all in the console but no zip is being created... am i doing something wrong?

推荐答案

在内部ZipStorer使用的字符集437做(在ZipStorer.cs线85)的编码和编码取消:

Internally ZipStorer uses the character set 437 to do the encoding and un-encoding (line 85 in ZipStorer.cs):

    private static Encoding DefaultEncoding = Encoding.GetEncoding(437);

当你建立你的应用程序

Xamarin不包含该字符的默认设置。正如本地化明确和国际化文档:

Xamarin does not include this character set by default when you build your application. As stated in the Localisation And Internationalisation document:

为了减少应用程序的大小,Xamarin.iOS不包括任何特定的编码,你需要指导的mTouch包括包含您需要的编码支持的组件。

要包含的字符集,添加西字符,通过在应用程序中设置的国际化设置:

To include the character set, add the West character set through the internationalisation settings in your application:


确保你检查这两个调试发布

我不能得到这个工作对我来说,当我添加ZIP支持我的申请。最后,我通过使用Java IO库,但有可能是可添加的跨平台支持ZIP组件推出我自己的ZIP支持。

I could not get this to work for me when I was adding zip support to my application. In the end I rolled my own zip support by using the Java IO libraries but there may be a component available to add cross platform zip support.

这篇关于ZipStorer没有创造Android的C#中的任何文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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