如何制作7-Zip文件使用.NET? [英] How do I create 7-Zip archives with .NET?

查看:176
本文介绍了如何制作7-Zip文件使用.NET?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何创建7-Zip文件从我的C#控制台应用程序?我需要能够使用常规,广泛使用的7-Zip 程序提取档案。

How can I create 7-Zip archives from my C# console application? I need to be able to extract the archives using the regular, widely available 7-Zip program.


  • 在脱壳而出,以7z.exe - 这是最简单,最有效的方法,我可以证实,它工作得很好。作为<一个href="http://stackoverflow.com/questions/222030/how-do-i-create-7-zip-archives-with-net#222047">workmad3提到,我只需要保证7z.exe安装在所有目标计算机,这是一件好事,我可以保证。
  • <一个href="http://www.eggheadcafe.com/tutorials/aspnet/064b41e4-60bc-4d35-9136-368603bcc27a/7zip-lzma-inmemory-com.aspx">7Zip在内存COM pression - 这是指COM pressing内存的cookie发送到客户端之前;这种方法似乎有点乐观。该包装方法(包裹 LZMA SDK )返回类型字节[] 。当我写了字节[] 数组到一个文件中,我可以使用7-Zip的(不提取它File.7z不支持的存档)。
  • 7zSharp 包装(发现codePLEX) - 这包装的7z格式exe文件/的LZMA SDK 。我引用的项目,从我的应用程序,并成功创造了一些档案文件,但我无法使用常规的7-Zip程序解压文件(不支持File.7z存档)。
  • 7Zip的SDK又名LZMA SDK - 我想我不是足够聪明,知道如何使用这个(这就是为什么我张贴在这里)...演示创造一个7zip压缩包,能够通过正规7zip的程序中提取任何工作code的例子吗?
  • $ C $的CProject C#(.NET)接口,用于7-Zip文件的DLL - 只支持从7zip的档案提取...我需要创建它们
  • SharpZipLib - 根据他们的常见问题解答,SharpZipLib不支持7zip的。
  • "Shelling out" to 7z.exe - this is the simplest and most effective approach, and I can confirm that it works nicely. As workmad3 mentions, I just need to guarantee that 7z.exe is installed on all target machines, which is something I can guarantee.
  • 7Zip in memory compression - this refers to compressing cookies "in-memory" before sending to the client; this method seems somewhat promising. The wrapper methods (wrapping the LZMA SDK) return type byte[]. When I write the byte[] array to a file, I can't extract it using 7-Zip (File.7z is not supported archive).
  • 7zSharp Wrapper (found on CodePlex) - this wraps the 7z exe/LZMA SDK. I referenced the project from my app, and it successfully created some archive files, but I was unable to extract the files using the regular 7-Zip program (File.7z is not supported archive).
  • 7Zip SDK aka LZMA SDK - I guess I'm not smart enough to figure out how to use this (which is why I posted here)... Any working code examples that demonstrate creating a 7zip archive that is able to be extracted by the regular 7zip program?
  • CodeProject C# (.NET) Interface for 7-Zip Archive DLLs - only supports extracting from 7zip archives... I need to create them!
  • SharpZipLib - According to their FAQ, SharpZipLib doesn't support 7zip.

推荐答案

如果你能保证在7-ZIP的应用程序将被安装(和路径),在所有目标机器上,你可以通过调用命令行程序7z格式卸载。没有最完美的解决方案,但它是最工作。

If you can guarantee the 7-zip app will be installed (and in the path) on all target machines, you can offload by calling the command line app 7z. Not the most elegant solution but it is the least work.

这篇关于如何制作7-Zip文件使用.NET?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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