C# Zlib在winform应用程序中的使用
我正在寻找更改我的程序解压缩使用 zlib 的文件的方式。目前我正在使用 offzip & .bat(批处理程序)在单击事件时解压缩文件。
这是我在批处理程序中的内容(love command promt XD),
@ECHO Off
cd %0\..\
start %~dp0offzip.exe -a -1 *.bsg %~dp0 0
但这对我来说使用批处理文件看起来很俗气。
那么问题来了。我将如何进行以下操作。
- 打开一个文件,解压缩它
- 重新压缩它
不知道这是否有帮助,但这里是我目前使用 offzip 解压缩和重新压缩文件的选项。
Decompress: offzip.exe -a -1 <file> <path> 0
-a decompresses whole file
-1 keeps decompressed file in one piece
0 starts at the offset 0x0
Recompress: packzip.exe -w -15 <input file> <output>
-w winbits
-15 winbits equal -15
如果你能给我一个例子或者一些有帮助的东西。我也在寻找一个免费且易于使用的支持 zlib 的库。我已经看过 zlib.net,并且可能会接受它,但只是尝试做一些最好的事情。
预先感谢您对此事的任何帮助。
I'm looking to change how my program decompresses file that use zlib. At the moment I'm using offzip & .bat(batch program) to decompress the file upon click event.
Here's what I have in the batch program(love command promt XD)
@ECHO Off
cd %0\..\
start %~dp0offzip.exe -a -1 *.bsg %~dp0 0
But that just looks tacky to me using a batch file.
So here's the question. How would I go about the following.
- Open up a file, decompress it
- Recompress it
Don't know if this helps or not, but here are the option I currently use to decompress and recompress the file using offzip now.
Decompress: offzip.exe -a -1 <file> <path> 0
-a decompresses whole file
-1 keeps decompressed file in one piece
0 starts at the offset 0x0
Recompress: packzip.exe -w -15 <input file> <output>
-w winbits
-15 winbits equal -15
If you could give me an example or something that would help as well. I'm also looking for an free easy to use library that supports zlib. I've seen zlib.net, and will probably go with that, but just tring to do my homework on the best thing out there.
Thanks in advance for any help in the matter.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要 DotNetZip。价格合适(很难比免费的)。性能似乎不如 gzip/zip 及其兄弟。
使用方法很简单。以下是解压缩 zlib 压缩文件的方法:
压缩也同样简单:
或者,如果您已知数据量,则可以使用静态方法
构建 zip 文件也并不困难。它还支持 gzip 式压缩。
编辑注意: DotNetZip 曾经住在 Codeplex。 Codeplex 已关闭。旧存档仍然在 Codeplex 上提供。代码似乎已迁移到 Github:
You need DotNetZip. The price is right (hard to beat free). Performance seems to be least as good as gzip/zip and their brethren.
Usage is simple. Here's how to decompress a zlib-compressed file:
Compression is just as easy:
Or, if you've got a know quantity of data, you can use a static method
Building zip files isn't much more difficult, either. It also supports gzip-style compression.
Edited To Note: DotNetZip used to live at Codeplex. Codeplex has been shut down. The old archive is still available at Codeplex. It looks like the code has migrated to Github: