Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Repository files navigation

Introduction

UnRAR is the official library from RARLabs for extracting WinRAR archives. This project implements UnRAR bindings for RealStudio and Xojo Win32 applications. Creating archives is not supported by the library.

Synopsis

The project consists of a module containing three classes: Iterator, IteratorEx, and ArchiveEntry.

The Iterator class implements the basic, older UnRAR interface. It does not support Unicode filenames, archives with encrypted headers, or extracting into memory. For almost all archives you should prefer the IteratorEx class.

Example

This example extracts an entire RAR archive into a directory

DimarchiveAsFolderItem' assume a valid RAR archiveDimoutputdirAsFolderItem' assume a valid directoryDimrarAsNewUnRAR.IteratorEx(archive)DoIfNotrar.MoveNext(UnRAR.RAR_EXTRACT,outputdir)ThenExitDoLooprar.Close

How to incorporate RB-RAR into your Realbasic/Xojo project

Import the UnRAR module

  1. Download the RB-RAR project either in ZIP archive format or by cloning the repository with your Git client.
  2. Open the RB-RAR project in REALstudio or Xojo. Open your project in a separate window.
  3. Copy the UnRAR module into your project and save.

Ensure the UnRAR.dll shared library is installed

You will need to ship the UnRAR.dll file with your application and install it into the same directory as your app. A pre-built Win32 DLL is available here, or you can build it yourself from source.

More examples

Extract a single file

DimindexAsInteger=2' the third file in the archiveDimarchiveAsFolderItem' assume a valid RAR archiveDimoutputfileAsFolderItem' assume a valid, non-existing fileDimrarAsNewUnRAR.IteratorEx(archive)rar.Reset(index)' move to the indexCallrar.MoveNext(UnRAR.RAR_EXTRACT,outputfile)rar.Close

Test an entire archive

DimarchiveAsFolderItem' assume a valid RAR archiveDimrarAsNewUnRAR.IteratorEx(archive)DoIfNotrar.MoveNext(UnRAR.RAR_TEST)ThenExitDoLoopIfrar.LastError<>UnRAR.ErrorEndArchiveThenMsgBox("Test failed!")EndIfrar.Close

Test a single file

DimindexAsInteger=2' the third file in the archiveDimarchiveAsFolderItem' assume a valid RAR archiveDimrarAsNewUnRAR.IteratorEx(archive)rar.Reset(index)' move to the index IfNotrar.MoveNext(UnRAR.RAR_TEST)Andrar.LastError<>UnRAR.ErrorEndArchiveThenMsgBox("Test failed!")EndIfrar.Close

About

A Realbasic and Xojo binding to the UnRAR library

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Contributors

Languages