惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

A
About on SuperTechFans
博客园 - 聂微东
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 司徒正美
宝玉的分享
宝玉的分享
美团技术团队
量子位
The Cloudflare Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
IT之家
IT之家
爱范儿
爱范儿
J
Java Code Geeks
博客园 - Franky
Last Week in AI
Last Week in AI
B
Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
I
InfoQ
GbyAI
GbyAI
Recent Announcements
Recent Announcements
小众软件
小众软件
H
Help Net Security
Microsoft Azure Blog
Microsoft Azure Blog
MyScale Blog
MyScale Blog

博客园 - 吴勇

windbg入门 wpf数据显示控件 - 吴勇 - 博客园 Enterprise Library 快速入门3(Exception Handling Application Block) 操作系统方法 复合宾语和双宾语 句子 操作流 序列化 高级sql查询 反射技术 使用游标 基于.net开发平台项目案例集锦 设计原则 常用工具下载地址 反射 简单代码 微软正式推出.NET Framework 3.0 Redistributable Package 核心用户控件 Visual C# 3.0 新特性概览
文件夹压缩代码
吴勇 · 2006-11-07 · via 博客园 - 吴勇

        private void dlZipDir()//string strPath, string strFileName)
        {
            
string strPath = @"C:\Documents and Settings\wuy\桌面";

            String strBaseDir 
= "";
            
//MemoryStream ms = null;
            
//ms = new MemoryStream();
            
//zos = new ZipOutputStream(ms);
            zos = new ZipOutputStream(File.Create(outname));
            strBaseDir 
= strPath + "\\";
            addZipEntry(strBaseDir);
            zos.Finish();
            zos.Close();
        }

        
private void addZipEntry(string PathStr)
        
{
            DirectoryInfo di 
= new DirectoryInfo(PathStr);
            
foreach (DirectoryInfo item in di.GetDirectories())
            
{
                addZipEntry(item.FullName);
            }

            
foreach (FileInfo item in di.GetFiles())
            
{
                FileStream fs 
= File.OpenRead(item.FullName);
                
byte[] buffer = new byte[fs.Length];
                fs.Read(buffer, 
0, buffer.Length);
                
string strEntryName = item.FullName.Replace("aa""");
                ZipEntry entry 
= new ZipEntry(strEntryName);
                zos.PutNextEntry(entry);
                zos.Write(buffer, 
0, buffer.Length);
                fs.Close();
            }

        }