Read content of RAR files using C#

亡梦爱人 提交于 2019-11-27 19:11:00

Low level lib to work with 7z.dll (supports rar archives, incliding multi-part, works with .net streams):

C# (.net) interface for 7-Zip archive dlls

And more high-level lib based on the first one:

SevenZipSharp

Install NUnrar from nuget

RarArchive file = RarArchive.Open("rar file path");//@"C:\test.rar"
                    foreach (RarArchiveEntry rarFile in file.Entries)
                    {
                        string path = "extracted file path";//@"C:\"
                        rarFile.WriteToDirectory(path);

                    }

Chilkat Rar library

More specific: link

My unrar project, http://nunrar.codeplex.com/ aims to be very .NETty and has streaming support. If you need something else, please suggest or give me a patch.

Another possibility is using including the rar command-line executable as application ressource and call it via System.Diagnostics.Process.

You may want to redirect the input/output stream.

Gfy

If you want to directly access files stored in uncompressed rar files, then this answer might be of use.

ReScene is a project for recreating rar archives from the extracted files. You need a .srr file for this. The source code is available. You may want to take a look at RarStream.cs.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!