我使用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()))
给我这个错误:
可以打开我的拉链......任何想法?提前谢谢!