DotNetZip - 此流不支持查找操作
DotNetZip - This stream does not support seek operations
当我尝试提取 "test.png" 时,我收到以下错误:此流不支持查找操作。
也可以使用通配符吗? var entry = zipout["*.png"];流媒体时我不会知道同样的事情。
var request = (HttpWebRequest)WebRequest.Create("http://www.xxx.xxxx.com/xxx/xxxx?key=ndXqH2fXzePomlVoX39trxUf%2FV1bfN0rZsHsTyEvI%2F0%3D&labelFormat=png");
using (var ms = new MemoryStream())
{
using (var response = (HttpWebResponse)request.GetResponse())
{
using (var stream =response.GetResponseStream())
{
using (var zipout = ZipFile.Read(stream))
{
var entry = zipout["test.png"];
entry.Extract(ms);
}
}
}
}
已更新
using (var response = request.GetResponse())
{
using (var responseStream = response.GetResponseStream())
{
using (var stream = new MemoryStream())
{
if (responseStream != null)
{
responseStream.CopyTo(stream);
}
using (var zipout = ZipFile.Read(stream))
{
using (var ms = new MemoryStream())
{
var entry = zipout["test.png"];
entry.Extract(ms);
}
}
}
}
}
新错误:消息 = "Cannot read that as a ZipFile"
var request = (HttpWebRequest)WebRequest.Create("var request = (HttpWebRequest)WebRequest.Create("http://www.xxx.xxxx.com/xxx/xxxx?key=ndXqH2fXzePomlVoX39trxUf%2FV1bfN0rZsHsTyEvI%2F0%3D&labelFormat=png");
using (var response = request.GetResponse())
{
using (var responseStream = response.GetResponseStream())
{
using (var stream = new MemoryStream())
{
if (responseStream == null)
{
return;
}
responseStream.CopyTo(stream);
stream.Position = 0;
using (var zipout = ZipFile.Read(stream))
{
using (var ms = new MemoryStream())
{
var entry = zipout["test.png"];
if (entry != null)
{
entry.Extract(ms);
}
else
{
return;
}
}
}
}
}
}
当我尝试提取 "test.png" 时,我收到以下错误:此流不支持查找操作。
也可以使用通配符吗? var entry = zipout["*.png"];流媒体时我不会知道同样的事情。
var request = (HttpWebRequest)WebRequest.Create("http://www.xxx.xxxx.com/xxx/xxxx?key=ndXqH2fXzePomlVoX39trxUf%2FV1bfN0rZsHsTyEvI%2F0%3D&labelFormat=png");
using (var ms = new MemoryStream())
{
using (var response = (HttpWebResponse)request.GetResponse())
{
using (var stream =response.GetResponseStream())
{
using (var zipout = ZipFile.Read(stream))
{
var entry = zipout["test.png"];
entry.Extract(ms);
}
}
}
}
已更新
using (var response = request.GetResponse())
{
using (var responseStream = response.GetResponseStream())
{
using (var stream = new MemoryStream())
{
if (responseStream != null)
{
responseStream.CopyTo(stream);
}
using (var zipout = ZipFile.Read(stream))
{
using (var ms = new MemoryStream())
{
var entry = zipout["test.png"];
entry.Extract(ms);
}
}
}
}
}
新错误:消息 = "Cannot read that as a ZipFile"
var request = (HttpWebRequest)WebRequest.Create("var request = (HttpWebRequest)WebRequest.Create("http://www.xxx.xxxx.com/xxx/xxxx?key=ndXqH2fXzePomlVoX39trxUf%2FV1bfN0rZsHsTyEvI%2F0%3D&labelFormat=png");
using (var response = request.GetResponse())
{
using (var responseStream = response.GetResponseStream())
{
using (var stream = new MemoryStream())
{
if (responseStream == null)
{
return;
}
responseStream.CopyTo(stream);
stream.Position = 0;
using (var zipout = ZipFile.Read(stream))
{
using (var ms = new MemoryStream())
{
var entry = zipout["test.png"];
if (entry != null)
{
entry.Extract(ms);
}
else
{
return;
}
}
}
}
}
}