|
@@ -16,7 +16,7 @@ namespace MBIRevitBase.Tools
|
|
/// <param name="data"></param>
|
|
/// <param name="data"></param>
|
|
/// <param name="fileName"></param>
|
|
/// <param name="fileName"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public static Stream ZipString(string data,string fileName)
|
|
|
|
|
|
+ public static Stream ZipString(string data, string fileName)
|
|
{
|
|
{
|
|
MemoryStream zipStream = new MemoryStream();
|
|
MemoryStream zipStream = new MemoryStream();
|
|
using (ZipArchive zipArchive = new ZipArchive(zipStream, ZipArchiveMode.Create, true))
|
|
using (ZipArchive zipArchive = new ZipArchive(zipStream, ZipArchiveMode.Create, true))
|
|
@@ -28,8 +28,21 @@ namespace MBIRevitBase.Tools
|
|
}
|
|
}
|
|
//zipArchive释放才会写入相关流
|
|
//zipArchive释放才会写入相关流
|
|
}
|
|
}
|
|
|
|
+ ;
|
|
zipStream.Seek(0, SeekOrigin.Begin);
|
|
zipStream.Seek(0, SeekOrigin.Begin);
|
|
|
|
+ //SaveStream(zipStream);
|
|
return zipStream;
|
|
return zipStream;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static void SaveStream(Stream stream)
|
|
|
|
+ {
|
|
|
|
+ string path = @"D:\319.zip";
|
|
|
|
+ using (var fileStream = File.Create(path))
|
|
|
|
+ {
|
|
|
|
+ stream.CopyTo(fileStream);
|
|
|
|
+ fileStream.Close();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|