直接读取zip流并解压
MemoryStream ms = new MemoryStream();
Stream FileDataStream = m_Upfile.PostedFile.InputStream;
this.m_ZipInputStream = new ZipInputStream(FileDataStream);
ZipEntry entry;
while ((entry = this.m_ZipInputStream.GetNextEntry()) != null)
{
//FileStream fs = File.Create(this.m_ZIPToFolder + entry.Name);
int size = 2048;
byte[] data = new byte[2048];
while (true)
{
size = this.m_ZipInputStream.Read(data, 0, data.Length);
if (size > 0)
{
ms.Write(data, 0, size);
}
else
{
break;
}
}
}
DataSet ds = new DataSet();
try
{
ms.Position = 0;//位置重置到0
System.Xml.XmlReader reader = System.Xml.XmlReader.Create(ms);
ds.ReadXml(reader);
reader.Close();
}
catch
{
Common.MessageBox.PoP_Notice_Msg("", "压缩包转化为数据集失败!", 0);
return;
}