如何压缩目录,在c#中创建RAR文件 [英] How to compress directory, Make RAR file in c#

查看:117
本文介绍了如何压缩目录,在c#中创建RAR文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在不使用第三方dll的情况下制作文件夹(目录)压缩(RAR)文件。

How to Make a folder(directory) compressed (RAR) file without using third party dlls.

推荐答案

Rar格式和算法是专有的。但您可以免费获得unrar代码( http://www.rarlab.com/rar_add.htm [ ^ ]),所以你可能会抓紧机会获得一个想法。



为什么你坚持使用rar,还有其他格式,你可以不受限制地自己实现。

但是毕竟,为什么还要烦恼实现你已经拥有的东西?



只需注意:压缩算法非常复杂。在这里你可以阅读关于RLE之后最简单的内容:霍夫曼代码 [ ^ ]
Rar format and algorithm is proprietary. But you can have unrar code for free (http://www.rarlab.com/rar_add.htm[^]), so you might take you chance to get an idea.

Why do you stick to rar, there are other other formats, where you can make your own implementation without restriction.
But after all, why bothering with implementing something that you already have?

Just a note: compression algorithms are really complicated. Here you can read about the probably simplest after RLE: the Huffman code[^]


显然你需要遍历你目录中的所有文件使用GZipStream压缩这些文件..
Well obviously you need to iterate through all files in your directory and copress those files with GZipStream..


我们如何在此

中添加密码保护

这篇关于如何压缩目录,在c#中创建RAR文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆