TriLib SharpZipLib.Zip.ZipEntry-无法访问GetInputStream的关闭流

问题描述

(这是将Unity 2020.1.4f1与Trilib 2.0.9 Model Loader一起使用)

我正在尝试从zipStream中提取字节(以将bytes[]加载到Unity中的Texture2D.LoadImage()中)。你如何做到的?

这是我尝试过的和出现的错误:

我收到错误消息:“无法访问关闭的流”。对于Stream zipStream = zipFile.GetInputStream(e),其中e是来自{ ZipEntry(由封闭式SDK产生)

ZipFile

Stream zipStream = zipFile.GetInputStream(e); // error occurs here tex.LoadImage(ReadFully(zipStream)); tex.Apply(); public static byte[] ReadFully(Stream input) { byte[] buffer = new byte[16 * 1024]; using (MemoryStream ms = new MemoryStream()) { int read; while ((read = input.Read(buffer,buffer.Length)) > 0) { ms.Write(buffer,read); } return ms.ToArray(); } } 在循环中提取-如果重要的话

e
foreach (ZipEntry e in zipFile)
        {
            if (e.IsFile)
            { ... 

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)