本文整理汇总了C++中common::FileList类的典型用法代码示例。如果您正苦于以下问题:C++ FileList类的具体用法?C++ FileList怎么用?C++ FileList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FileList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UNUSED
bool DragonAge2Engine::detectLanguages(Aurora::GameID UNUSED(game), const Common::UString &target,
Aurora::Platform UNUSED(platform),
std::vector<Aurora::Language> &languages) const {
try {
Common::UString tlkDir =
Common::FilePath::findSubDirectory(target, "packages/core/data/talktables", true);
if (tlkDir.empty())
return true;
Common::FileList tlks;
if (!tlks.addDirectory(tlkDir))
return true;
for (size_t i = 0; i < Aurora::kLanguageMAX; i++) {
Common::UString langStr = getLanguageString((Aurora::Language) i);
if (langStr.empty())
continue;
if (!tlks.contains("core_" + langStr + ".tlk", true))
continue;
languages.push_back((Aurora::Language) i);
}
} catch (...) {
}
return true;
}
示例2: getName
Common::UString Module::getName(const Common::UString &module) {
/* Return the localized name of the first (and only) area of the module,
* which is the closest thing to the name of the module.
*
* To do that, if looks through the module directory for a matching RIM file
* (case-insensitively) and opens it without indexing into the ResourceManager.
* It then opens the module.ifo, grabs the name of the area, opens its ARE file
* and returns the localized "Name" field.
*
* If there's any error while doing all this, an empty string is returned.
*/
try {
const Common::FileList modules(ConfigMan.getString("KOTOR_moduleDir"));
const Aurora::RIMFile rim(new Common::ReadFile(modules.findFirst(module + ".rim", true)));
const uint32 ifoIndex = rim.findResource("module", Aurora::kFileTypeIFO);
const Aurora::GFF3File ifo(rim.getResource(ifoIndex), MKTAG('I', 'F', 'O', ' '));
const Aurora::GFF3List &areas = ifo.getTopLevel().getList("Mod_Area_list");
if (areas.empty())
return "";
const uint32 areIndex = rim.findResource((*areas.begin())->getString("Area_Name"), Aurora::kFileTypeARE);
const Aurora::GFF3File are(rim.getResource(areIndex), MKTAG('A', 'R', 'E', ' '));
return are.getTopLevel().getString("Name");
} catch (...) {
}
return "";
}
示例3: detectLanguages
bool WitcherEngine::detectLanguages(Aurora::GameID UNUSED(game), const Common::UString &target,
Aurora::Platform UNUSED(platform),
std::vector<Aurora::Language> &languagesText,
std::vector<Aurora::Language> &languagesVoice) const {
try {
Common::UString dataDir = Common::FilePath::findSubDirectory(target, "data", true);
if (dataDir.empty())
return true;
Common::FileList files;
if (!files.addDirectory(dataDir))
return true;
for (size_t i = 0; i < Aurora::kLanguageMAX; i++) {
const uint32 langID = LangMan.getLanguageID((Aurora::Language) i);
const Common::UString voiceKey = Common::UString::format("lang_%d.key" , langID);
const Common::UString textKey = Common::UString::format("dialog_%d.tlk", langID);
if (files.contains(voiceKey, true))
languagesVoice.push_back((Aurora::Language) i);
if (files.contains(textKey, true))
languagesText.push_back((Aurora::Language) i);
}
} catch (...) {
}
return true;
}
示例4: probeGame
bool EngineManager::probeGame(GameInstance &game) const {
game._gameID = Aurora::kGameIDUnknown;
game._platform = Aurora::kPlatformUnknown;
if (Common::FilePath::isDirectory(game._target)) {
// Try to probe from that directory
Common::FileList rootFiles;
if (!rootFiles.addDirectory(game._target))
// Fatal: can't read the directory
return false;
return probeGame(game, rootFiles);
}
if (Common::FilePath::isRegularFile(game._target)) {
// Try to probe from that file
Common::File file;
if (file.open(game._target))
return probeGame(game, file);
}
return false;
}
示例5: addResourceDir
ResourceManager::ChangeID ResourceManager::addResourceDir(const Common::UString &dir,
const char *glob, int depth, uint32 priority) {
// Find the directory
Common::UString directory = Common::FilePath::findSubDirectory(_baseDir, dir, true);
if (directory.empty())
throw Common::Exception("No such directory \"%s\"", dir.c_str());
// Find files
Common::FileList files;
files.addDirectory(directory, depth);
ChangeID change = newChangeSet();
if (!glob) {
// Add the files
addResources(files, change, priority);
return change;
}
// Find files matching the glob pattern
Common::FileList globFiles;
files.getSubList(glob, globFiles, true);
// Add the files
addResources(globFiles, change, priority);
return change;
}
示例6: UNUSED
bool NWN2Engine::detectLanguages(Aurora::GameID UNUSED(game), const Common::UString &target,
Aurora::Platform UNUSED(platform),
std::vector<Aurora::Language> &languages) const {
try {
Common::FileList files;
if (!files.addDirectory(target))
return true;
Common::UString tlk = files.findFirst("dialog.tlk", true);
if (tlk.empty())
return true;
uint32 languageID = Aurora::TalkTable_TLK::getLanguageID(tlk);
if (languageID == Aurora::kLanguageInvalid)
return true;
Aurora::Language language = LangMan.getLanguage(languageID);
if (language == Aurora::kLanguageInvalid)
return true;
languages.push_back(language);
} catch (...) {
}
return true;
}
示例7:
bool NWN2EngineProbe::probe(const Common::UString &directory, const Common::FileList &rootFiles) const {
// If either the ini file or the binary is found, this should be a valid path
if (rootFiles.contains(".*/nwn2.ini", true))
return true;
if (rootFiles.contains(".*/nwn2main.exe", true))
return true;
return false;
}
示例8: addResources
void ResourceManager::addResources(const Common::FileList &files, ChangeID &change, uint32 priority) {
for (Common::FileList::const_iterator file = files.begin(); file != files.end(); ++file) {
Resource res;
res.priority = priority;
res.source = kSourceFile;
res.path = *file;
res.type = getFileType(*file);
addResource(res, Common::FilePath::getStem(*file), change);
}
}
示例9: probe
bool probe(const Common::UString &UNUSED(directory), const Common::FileList &rootFiles) const {
// Don't accidentally trigger on NWN2
if (rootFiles.contains("/nwn2.ini", true))
return false;
if (rootFiles.contains("/nwn2main.exe", true))
return false;
// As a fallback, look for the nwn.ini, nwnplayer.ini or nwncdkey.ini
return rootFiles.contains("/nwn.ini", true) ||
rootFiles.contains("/nwnplayer.ini", true) ||
rootFiles.contains("/nwncdkey.ini", true);
}
示例10: probe
bool TheWitcherEngineProbe::probe(const Common::UString &directory, const Common::FileList &rootFiles) const {
// There should be a system directory
Common::UString systemDir = Common::FilePath::findSubDirectory(directory, "system", true);
if (systemDir.empty())
return false;
// The system directory has to be readable
Common::FileList systemFiles;
if (!systemFiles.addDirectory(systemDir))
return false;
// If either witcher.ini or witcher.exe exists, this should be a valid path
return systemFiles.contains(".*/witcher.(exe|ini)", true);
}
示例11:
bool DragonAge2EngineProbe::probe(const Common::UString &directory, const Common::FileList &rootFiles) const {
// If the launcher binary is found, this should be a valid path
if (rootFiles.contains(".*/dragonage2launcher.exe", true))
return true;
return false;
}
示例12: getDescription
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 "";
}
示例13: getCharacters
void NWNEngine::getCharacters(std::vector<Common::UString> &characters, bool local) {
characters.clear();
Common::UString pcDir = ConfigMan.getString(local ? "NWN_localPCDir" : "NWN_serverPCDir");
if (pcDir.empty())
return;
Common::FileList chars;
chars.addDirectory(pcDir);
for (Common::FileList::const_iterator c = chars.begin(); c != chars.end(); ++c) {
if (!Common::FilePath::getExtension(*c).equalsIgnoreCase(".bic"))
continue;
characters.push_back(Common::FilePath::getStem(*c));
}
}
示例14: findArchive
Common::UString ResourceManager::findArchive(const Common::UString &file,
const DirectoryList &dirs, const Common::FileList &files) {
Common::UString escapedFile = Common::FilePath::escapeStringLiteral(file);
Common::FileList nameMatch;
if (!files.getSubList(".*/" + escapedFile, nameMatch, true))
return "";
Common::UString realName;
for (DirectoryList::const_iterator dir = dirs.begin(); dir != dirs.end(); ++dir) {
Common::UString escapedPath = Common::FilePath::escapeStringLiteral(Common::FilePath::normalize(*dir)) + "/" + escapedFile;
if (!(realName = nameMatch.findFirst(escapedPath, true)).empty())
return realName;
}
return "";
}
示例15: updateMusic
void Console::updateMusic() {
_music.clear();
_maxSizeMusic = 0;
const Common::FileList music(Common::FilePath::findSubDirectory(ResMan.getDataBase(), "streammusic", true));
for (Common::FileList::const_iterator m = music.begin(); m != music.end(); ++m) {
if (!Common::FilePath::getExtension(*m).equalsIgnoreCase(".wav"))
continue;
_music.push_back(Common::FilePath::getStem(*m));
_maxSizeMusic = MAX(_maxSizeMusic, _music.back().size());
}
std::sort(_music.begin(), _music.end(), Common::UString::iless());
setArguments("playmusic", _music);
}