RAR extraktor pre .NET

Úvod do RAR Extractor pre .NET

RAR Extractor je knižnica .NET, ktorá umožňuje vývojárom vytiahnuť súbory z archívov RR. Tento sprievodca poskytuje prehľad o funkciách a funkčnostiach extraktora RER, spolu s príkladmi kódu, aby ste mohli začať.

Odstrániť RAR archívy

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");
}

Odstrániť špecifické súbory z RAR archív

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);
        }                    
    }
}
 Slovenčina
OSZAR »