Exemplo n.º 1
0
void listFiles(Aurora::ERFFile &erf, Aurora::GameID game) {
    const Aurora::Archive::ResourceList &resources = erf.getResources();
    const size_t fileCount = resources.size();

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

    std::printf("              Filename               |    Size\n");
    std::printf("=====================================|===========\n");

    for (Aurora::Archive::ResourceList::const_iterator r = resources.begin(); r != resources.end(); ++r) {
        const Aurora::FileType type = TypeMan.aliasFileType(r->type, game);

        Common::UString name = r->name;
        if (name.empty())
            findHashedName(r->hash, name);

        name = Common::FilePath::getFile(name);

        std::printf("%32s%-4s | %10d\n", name.c_str(), TypeMan.setFileType("", type).c_str(),
                    erf.getResourceSize(r->index));
    }
}
Exemplo n.º 2
0
void listVerboseFiles(Aurora::ERFFile &erf, Aurora::GameID game) {
    const Aurora::Archive::ResourceList &resources = erf.getResources();
    const size_t fileCount = resources.size();

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

    std::vector<FileEntry> fileEntries;
    fileEntries.reserve(fileCount);

    size_t nameLength = 10;
    for (Aurora::Archive::ResourceList::const_iterator r = resources.begin(); r != resources.end(); ++r) {
        const Aurora::FileType type = TypeMan.aliasFileType(r->type, game);

        Common::UString name = r->name;
        if (name.empty())
            findHashedName(r->hash, name);

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

        name = TypeMan.addFileType(name, type);

        nameLength = MAX<size_t>(nameLength, name.size() + 1);

        fileEntries.push_back(FileEntry(name, erf.getResourceSize(r->index)));
    }

    if ((nameLength % 2) == 1)
        nameLength++;

    std::printf("%sFileName%s|    Size\n", Common::UString(' ', (nameLength - 8) / 2).c_str(),
                Common::UString(' ', (nameLength - 8) / 2).c_str());
    std::printf("%s|===========\n", Common::UString('=', nameLength).c_str());

    for (std::vector<FileEntry>::const_iterator f = fileEntries.begin(); f != fileEntries.end(); ++f)
        std::printf("%-*s| %10d\n", (int)nameLength, f->file.c_str(), f->size);
}