.Net Framework 4.0下,如何在没有第三方库的情况下压缩文件 [英] .Net Framework under 4.0, how to zip files without 3rd party libraries

查看:92
本文介绍了.Net Framework 4.0下,如何在没有第三方库的情况下压缩文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好世界!



希望你能帮助我一些经验,我非常感激。



我遇到了问题......我需要在.Net Framework 3.5或更早版本中使用代码(没有第三方库)压缩文件(特别是zip格式)。无论是VB.Net还是C#都无关紧要。

我用Google搜索,除此之外的一切似乎都会导致第三方库和东西。



链接也欢迎作为解决方案。



非常感谢你!

解决方案

< blockquote>值得一试 - 在C#中压缩/解压缩没有第三方库的Zip文件 [ ^ ] 。


您可以使用第三方开源库。请查看我过去的答案:

使用vb.net提取文件rar [ ^ ],

比较两个文件夹 [ ^ ]。



(对不起,我没有注意到你的没有第三方图书馆部分你的问题标题;然后我会问:为什么不使用它们。:-))



-SA


因为你不想使用第三方库而且没有.NET超过3.5你会遇到一些问题。 ..

系统。 IO.Compression [ ^ ]命名空间有一个DeflateStream和GZipStream类 - 从.NET 2.0开始 - 压缩文件。 deflate [ ^ ]是PKZIP(现代拉链的祖父)的原始算法,所以任何能够读取zip的工具都会很愉快地阅读...它不是一个现代的拉链格式能力的意义,但它是兼容的,所以你可以随它...


Hello world!

Hope you can help me with some experience, I'd appreciate this very much.

I've been stuck in a problem... I need to zip files (specifically zip format) in .Net Framework 3.5 or earlier with just code (no 3rd party libraries). Whether it's VB.Net or C# it doesn't matter.
I googled and everything but it all seems to lead to 3rd party libraries and stuff.

Links are welcome as solution as well.

Thank you so much for this!

解决方案

Worth a try - Compress/Decompress Zip Files without Third-party Libraries in C#[^].


You can use 3rd-party open-source libraries. Please see my past answers:
Extract file rar with vb.net[^],
Compare between two folders[^].

(Sorry I did not notice your "without 3rd-party libraries" part of your question title; then I would ask: why not using them. :-))

—SA


As you do not wan't to use 3rd party libraries and no .NET over 3.5 you have some problems...
System.IO.Compression[^] namespace have a DeflateStream and GZipStream class - since .NET 2.0 - to compressing files. As deflate[^] is the original algorithm for PKZIP (the grandfather of modern zip) so any tool capable to read zip will read it happily...It's not exactly a modern zip format in the meaning of ability, but it is compatible with, so you may go with it...


这篇关于.Net Framework 4.0下,如何在没有第三方库的情况下压缩文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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