jhuix / librarres

The librarres project is a library that reads RAR compressed files as resource packages.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Librarres

librarres 工程是一读取由RAR压缩文件做为资源包的库。

UnRAR

RAR文件分析和解压缩采用 www.rarlab.com 的解压缩UnRAR 5.6.8开源版本源码, 该部分源码请遵守它相关的开源许可。

Example

1. 获取一个test.rar资源包里的名为"skin\ui\index.html"的内容至缓存中:

JRES::IRes* rarres = JRES::CreateRarRes(true);
if (rarres) {
    if (rarres->Open("test.rar", 0)) {
        char* buf = nullptr;
        size_t bufsize = 0;
        void* res = rarres->LoadResource("skin\\ui\\index.html", &buf, bufsize);
        if (res) {
            //TO DO USE data of "buf"
            rarres->FreeResource(res);
        }
    }
    rarres->Release();
}

2. 在windows平台下,获取一个test.rar资源包里的名为"skin/img/caotion.png"的内容至IStream中:

JRES::IRes* rarres = JRES::CreateRarRes(false);
if (rarres) {
    if (rarres->Open("test.rar", '/')) {
        IStream* res = rarres->LoadResource("skin/img/caotion.png");
        if (res) {
            //TO DO USE IStream interface methods of "res";
            //For examples: <Seek>|<Read>|<Write> methods etc.
            res->Release();
        }
    }
    rarres->Release();
}

License

MIT

Copyright (c) 2018-present, Jhuix (Hui Jin)

About

The librarres project is a library that reads RAR compressed files as resource packages.

License:MIT License


Languages

Language:C++ 99.5%Language:Makefile 0.5%