Exemple #1
0
Common::UString Module::getDescription(const Common::UString &module) {
	try {
		const Common::FileList modules(ConfigMan.getString("NWN2_moduleDir"));

		const Aurora::ERFFile mod(new Common::ReadFile(modules.findFirst(module + ".mod", true)));
		const uint32 ifoIndex = mod.findResource("module", Aurora::kFileTypeIFO);

		const Aurora::GFF3File ifo(mod.getResource(ifoIndex), MKTAG('I', 'F', 'O', ' '));

		return ifo.getTopLevel().getString("Mod_Description");

	} catch (...) {
	}

	return "";
}
Exemple #2
0
void extractFiles(Aurora::ERFFile &erf, Aurora::GameID game,
                  std::set<Common::UString> &files, ExtractMode mode) {

    const Aurora::Archive::ResourceList &resources = erf.getResources();
    const size_t fileCount = resources.size();

    std::printf("Number of files: %u\n\n", (uint)fileCount);

    size_t i = 1;
    for (Aurora::Archive::ResourceList::const_iterator r = resources.begin(); r != resources.end(); ++r, ++i) {
        Common::UString name = r->name;
        if (name.empty())
            findHashedName(r->hash, name);

        name.replaceAll('\\', '/');

        if (mode == kExtractModeStrip)
            name = Common::FilePath::getFile(name);

        const Aurora::FileType type = TypeMan.aliasFileType(r->type, game);
        Common::UString fileName = TypeMan.addFileType(name, type);

        if (!files.empty() && (files.find(fileName) == files.end()))
            continue;

        if (mode == kExtractModeSubstitute)
            fileName.replaceAll('/', '=');

        std::printf("Extracting %u/%u: %s ... ", (uint)i, (uint)fileCount, fileName.c_str());

        Common::SeekableReadStream *stream = 0;
        try {
            stream = erf.getResource(r->index);

            dumpStream(*stream, fileName);

            std::printf("Done\n");
        } catch (Common::Exception &e) {
            Common::printException(e, "");
        }

        delete stream;
    }

}