在Windows手机中使用SharpCompress库提取.7zip文件但是异常

时间:2013-12-09 11:56:52

标签: windows-phone-7 windows-phone-8

                        IArchive archive = null;
                        IReader reader = null;
                        archive = SevenZipArchive.Open(fileStream, Options.LookForHeader);

                        reader = archive.ExtractAllEntries();            
                        while (reader.MoveToNextEntry())
                        {
                            if (!reader.Entry.IsDirectory)
                            {
                                Stream _redaer = new MemoryStream();
                                reader.WriteEntryTo(_redaer);
                                fileName = reader.Entry.FilePath;
                                int index = fileName.LastIndexOf("/");
                                string file = fileName.Substring(index + 1, (fileName.Length - (index + 1)));
                                using (binaryReader = new BinaryReader(_redaer, encoding))
                                {
                                    long fileLength = _redaer.Length;
                                    MemoryStream ms = new MemoryStream();
                                    _redaer.Position = 0;
                                    _redaer.CopyTo(ms);
                                    byte[] buteArray = ms.ToArray();
                                    SaveToIsoStore(fileName, buteArray);
                                }
                            }
                        }

此代码提供SharpCompress.Common.InvalidFormatException类型的异常,请在wp7中提供解决方案。

0 个答案:

没有答案