当前路径:Functions/File_Opreations.cs using ICSharpCode.SharpZipLib.Zip; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; namespace Function { public class File_Opreations { #region /// <summary> /// 压缩文件 /// </summary> /// <param name="FileToZip">要进行压缩的文件名</param> /// <param name="ZipedFile">压缩后生成的压缩文件名</param> public static bool Download_Logfile(List<string> Filelist, string ZipedFile, string filepath) { bool res = true; FileStream ZipFile = null; ZipOutputStream ZipStream = null; ZipEntry ZipEntry = null; //string filepath = @"..\..\log\"; string suffix = ".txt"; string filepatch = ""; ZipFile = File.Create(filepath + ZipedFile); try { foreach (string FileToZip in Filelist) { filepatch = filepath + FileToZip + suffix; ZipFile = File.OpenRead(filepatch); byte[] buffer = new byte[ZipFile.Length]; ZipFile.Read(buffer, 0, buffer.Length); // ZipFile.Close(); ZipStream = new ZipOutputStream(ZipFile); // ZipEntry = new ZipEntry(FileToZip); ZipEntry = new ZipEntry(FileToZip + suffix); ZipStream.PutNextEntry(ZipEntry); //ZipStream.SetLevel(level); ZipStream.Write(buffer, 0, buffer.Length); } if (ZipEntry != null) { ZipEntry = null; } if (ZipStream != null) { ZipStream.Finish(); ZipStream.Close(); } if (ZipFile != null) { ZipFile.Close(); ...
完整源码文件,请先购买后再查看
相关源码
- GONESERP电子商务管理系统软件2022-07-02
- 支付宝订单监控2022(旗舰版).NET源码2022-06-30
- 健身房会籍管理2022-06-28
- 排课管理系统源码2022-06-28
- 学校家教服务管理系统2022-06-28
- 超市管理系统2022-06-27
关于我们 | 顾问团队 | 发展历程 | 联系我们 | 源码上传
联系电话(Tel):4008-010-151(免长途)
地址:北京市海淀区大恒科技大厦五层 邮编:100080
Floor 5th,Daheng Building,Zhongguancun,Beijing,China,100080
51Aspx.com 版权所有 CopyRight © 2006-2022. 京ICP备09089570号 | 京公网安备11010702000869号
联系电话(Tel):4008-010-151(免长途)
地址:北京市海淀区大恒科技大厦五层 邮编:100080
Floor 5th,Daheng Building,Zhongguancun,Beijing,China,100080
51Aspx.com 版权所有 CopyRight © 2006-2022. 京ICP备09089570号 | 京公网安备11010702000869号