问候,
我在WinRT C#工作。我有一个类下载10个7-Zip文件,解压缩然后尝试删除不再需要的原始文件。它删除较小的文件,但不删除较大的文件(只有一个兆左右),我甚至无法删除最后一个使用资源管理器尝试手动删除它,因为它说它仍在使用中。删除最后一个的唯一方法是关闭应用程序。代码很简单:
I am working in WinRT C#. I have a class that downloads 10 7-Zip files, decompresses them then tries to delete the original files that are no longer needed. It deletes the smaller files but does not delete the larger ones (only a meg or so) and I can't even delete the last one using Explorer trying to manually delete it because it says it's still in use. The only way to delete that last one is to close the app. The code is simple:
StorageFile file = await CreateOutputFile(fileName, path); MemoryStream theMemStream = new MemoryStream(); theMemStream.Write(bytes, 0, bytes.Length); await FileIO.WriteBytesAsync(file, bytes); var result = await unZipFile(file, path); try { if (file != null) { await file.DeleteAsync(); file = null; } } catch (Exception ex) { return ex.Message; }
推荐答案
我猜unZipFile中的某些运算符未完成导致此问题。
I guess some operator in unZipFile not are not finished caused this issue.
请检查unZipFile代码,在文件中存储或保存流。
Please check the unZipFile codes, to store or save stream in files.
最好的问候, Jesse
Best regards, Jesse
更多推荐
DeleteAsync错误:访问被拒绝。 (HRESULT异常:0x80070005(E
发布评论