РАР Екстрактор за .NET

Увод у РАР Екстрактор за .NET

РАР Екстрактор је .НЕТ библиотека која омогућава програмерима да екстрактирају датотеке из ДАР архива. Овај водич пружа преглед карактеристика и функционалности ДРА ЕКстрактора, заједно са примерама кода да бисте започели.

Истраживање РАР Архиве

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

Извлачење специфичних датотека из РАР архива

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);
        }                    
    }
}
 Српски