ZipFile.OpenRead()的问题

时间:2014-09-18 10:09:13

标签: c# .net windows-phone-8.1 zipfile ziparchive

我使用Microsoft Compression库,我需要解压缩文件的方法,这是我的代码:

    public async void unZipFiles()
    {
        //Declaration of variables
        var classSync = new Sync();
        StorageFile ZipArchive = await        ApplicationData.Current.LocalFolder.GetFileAsync("ZipFile.zip");
        var pathToExtract = ApplicationData.Current.LocalFolder.ToString();

        using (ZipArchive archive = ZipFile.OpenRead(ZipArchive.Path.ToString()))  //ERROR HERE!!
        {
            foreach (ZipArchiveEntry entry in archive.Entries)
            {
                if (entry.FullName.EndsWith(".txt", StringComparison.OrdinalIgnoreCase))
                {
                    entry.ExtractToFile(Path.Combine(pathToExtract, entry.FullName));
                }
            }
        } 
    }

当我的编译器到达此代码行时:      使用(ZipArchive archive = ZipFile.OpenRead(ZipArchive.Path.ToString()))

给我这个错误:

enter image description here

可以打开我的拉链......任何想法?提前谢谢!

0 个答案:

没有答案