using System;
using System.IO;
using Aspose.Zip;
using Aspose.Zip.Rar;

class Program
{
    static void Main(string[] args) // Extract RAR
    {
        // Set the license
        new License().SetLicense("Aspose.Total.Product.Family.lic");

        // LLoad the RAR file
        using (RarArchive rarArchive = new RarArchive("Sample.rar"))
        {
            // Parse all the entries in the archive
            foreach(var entry in rarArchive.Entries)
            {
                // Create a file
                var file = File.Create(entry.Name);

                // Open the archive and save data to the file
                using (var fileEntry = entry.Open())
                {
                    byte[] data = new byte[1024];
                    int bytesCount;
                    while ((bytesCount = fileEntry.Read(data, 0, data.Length)) > 0)
                        file.Write(data, 0, bytesCount);

                    // Close the file
                    file.Close();
                    file.Dispose();
                }
            }
        }
        Console.WriteLine("Done");
    }      
}