RAR extraktor a .NET-hez

Bevezetés a RAR Extractor .NET

A RAR Extractor egy .NET könyvtár, amely lehetővé teszi a fejlesztők számára, hogy kivonják a fájlokat a RR archívumokból.Ez az útmutató áttekintést nyújt a funkciók és a funkcionalitás a rAR extraktor, valamint a kód példák, amelyek megkezdődnek.

RAR archívumok

To extract a RAR archive, you can use the ExtractToDirectory method of the RarArchive class. This method takes the path to the destination directory where the extracted files will be saved.

using (var extractor = new RarArchive("example.rar"))
{
    extractor.ExtractToDirectory("extracted");
}

Speciális fájlok kivonása egy RAR archívumból

If you want to extract specific files from a RAR archive, you can use the Entries property.

using (RarArchive archive = new RarArchive("archive.rar"))
{
    using (var destination = File.Create(dataDir + "firstEntry.txt"))
    {
        using (var source = archive.Entries[0].Open())
        {
            byte[] buffer = new byte[1024];
            int bytesRead;
            while ((bytesRead = source.Read(buffer, 0, buffer.Length)) > 0)                       
                destination.Write(buffer, 0, bytesRead);
        }                    
    }
}
 Magyar
OSZAR »