Esempio n. 1
0
int Blorb::listMembers(Common::ArchiveMemberList &list) const {
	for (uint idx = 0; idx < _chunks.size(); ++idx) {
		list.push_back(Common::ArchiveMemberList::value_type(new Common::GenericArchiveMember(_chunks[idx]._filename, this)));
	}

	return (int)_chunks.size();
}
Esempio n. 2
0
int LangFilter::listMembers(Common::ArchiveMemberList &list) const {
	if (!_arc)
		return false;

	Common::ArchiveMemberList orgList;
	Common::String orgName, name;

	_arc->listMembers(orgList);

	int num = 0;
	//Search only files with the right language and create a list with their basenames
	for (Common::ArchiveMemberList::const_iterator it = orgList.begin(); it != orgList.end(); it++) {
		orgName = (*it)->getName();
		if (orgName.hasPrefix(kLanguages1[_lang]) ||orgName.hasPrefix(kLanguages1[kCommon]))
			name = Common::String(orgName.c_str() + 3);
		else if (orgName.hasPrefix(kLanguages2[_lang]) || orgName.hasPrefix(kLanguages2[kCommon])) {
			int i = 0;
			while (orgName[i++] != '/') {;}
			name = Common::String(orgName.c_str() + i);

			//If the file is a subfolder, reject it
			if (name.contains('/'))
				continue;
		} else
			continue;
		name.toLowercase();
		list.push_back(getMember(name));
		++num;
	}

	return num;
}
Esempio n. 3
0
int Lab::listMembers(Common::ArchiveMemberList &list) const {
	int count = 0;

	for (LabMap::const_iterator i = _entries.begin(); i != _entries.end(); ++i) {
		list.push_back(Common::ArchiveMemberList::value_type(i->_value));
		++count;
	}

	return count;
}
Esempio n. 4
0
int XARCArchive::listMembers(Common::ArchiveMemberList &list) const {
	int files = 0;
	for (Common::ArchiveMemberList::const_iterator it = _members.begin(); it != _members.end(); ++it) {
		// Add all the members to the list
		list.push_back(*it);
		files++;
	}

	return files;
}
Esempio n. 5
0
int HPFArchive::listMembers(Common::ArchiveMemberList &list) {
	int numMembers = 0;

	for (FileMap::const_iterator i = _files.begin(); i != _files.end(); ++i) {
		list.push_back(Common::ArchiveMemberList::value_type(new Common::GenericArchiveMember(i->_key, this)));
		numMembers++;
	}

	return numMembers;
}
Esempio n. 6
0
int TlkArchive::listMembers(Common::ArchiveMemberList &list) const {
	uint count = 0;

	for (; count < _entryCount; ++count) {
		const Common::String name = Common::String::format("%08u.AUD", _fileEntries[count * 2 + 0]);
		list.push_back(Common::ArchiveMemberList::value_type(new Common::GenericArchiveMember(name, this)));
	}

	return count;
}
Esempio n. 7
0
int PlainArchive::listMembers(Common::ArchiveMemberList &list) const {
	int count = 0;

	for (FileMap::const_iterator i = _files.begin(); i != _files.end(); ++i) {
		list.push_back(Common::ArchiveMemberList::value_type(new Common::GenericArchiveMember(i->_key, this)));
		++count;
	}

	return count;
}
Esempio n. 8
0
int PackageSet::listMembers(Common::ArchiveMemberList &list) const {
	Common::HashMap<Common::String, Common::ArchiveMemberPtr>::const_iterator it = _files.begin();
	Common::HashMap<Common::String, Common::ArchiveMemberPtr>::const_iterator end = _files.end();
	int count = 0;
	for (; it != end; ++it) {
		const Common::ArchiveMemberPtr ptr(it->_value);
		list.push_back(ptr);
		count++;
	}
	return count;
}
Esempio n. 9
0
int XARCArchive::listMatchingMembers(Common::ArchiveMemberList &list, const Common::String &pattern) {
	int matches = 0;
	for (Common::ArchiveMemberList::iterator it = _members.begin(); it != _members.end(); ++it) {
		if ((*it)->getName().matchString(pattern)) {
			// This file matches, add it
			list.push_back(*it);
			matches++;
		}
	}

	return matches;
}
Esempio n. 10
0
int AndroidAssetArchive::listMembers(Common::ArchiveMemberList &member_list) {
	JNIEnv *env = JNI::getEnv();
	Common::List<Common::String> dirlist;
	dirlist.push_back("");

	int count = 0;
	while (!dirlist.empty()) {
		const Common::String dir = dirlist.back();
		dirlist.pop_back();

		jstring jpath = env->NewStringUTF(dir.c_str());
		jobjectArray jpathlist =
			(jobjectArray)env->CallObjectMethod(_am, MID_list, jpath);

		if (env->ExceptionCheck()) {
			warning("Error while calling AssetManager->list(%s). Ignoring.",
					dir.c_str());
			env->ExceptionDescribe();
			env->ExceptionClear();

			// May as well keep going ...
			continue;
		}

		env->DeleteLocalRef(jpath);

		for (jsize i = 0; i < env->GetArrayLength(jpathlist); ++i) {
			jstring elem = (jstring)env->GetObjectArrayElement(jpathlist, i);
			const char *p = env->GetStringUTFChars(elem, 0);
			Common::String thispath = dir;

			if (!thispath.empty())
				thispath += "/";

			thispath += p;

			// Assume files have a . in them, and directories don't
			if (strchr(p, '.')) {
				member_list.push_back(getMember(thispath));
				++count;
			} else {
				dirlist.push_back(thispath);
			}

			env->ReleaseStringUTFChars(elem, p);
			env->DeleteLocalRef(elem);
		}

		env->DeleteLocalRef(jpathlist);
	}

	return count;
}
Esempio n. 11
0
int PackageManager::doSearch(Common::ArchiveMemberList &list, const Common::String &filter, const Common::String &path, uint typeFilter) {
	Common::String normalizedFilter = normalizePath(filter, _currentDirectory);
	int num = 0;

	if (path.size() > 0)
		warning("STUB: PackageManager::doSearch(<%s>, <%s>, %d)", filter.c_str(), path.c_str(), typeFilter);

	// Loop through checking each archive
	Common::List<ArchiveEntry *>::iterator i;
	for (i = _archiveList.begin(); i != _archiveList.end(); ++i) {
		Common::ArchiveMemberList memberList;

		if (!normalizedFilter.hasPrefix((*i)->_mountPath)) {
			// The mount path is in different subtree. Skipping
			continue;
		}

		// Construct relative path
		Common::String resFilter(&normalizedFilter.c_str()[(*i)->_mountPath.size()]);

		if ((*i)->archive->listMatchingMembers(memberList, resFilter) == 0)
			continue;

		// Create a list of the matching names
		for (Common::ArchiveMemberList::iterator it = memberList.begin(); it != memberList.end(); ++it) {
			if (((typeFilter & PackageManager::FT_DIRECTORY) && (*it)->getName().hasSuffix("/")) ||
				((typeFilter & PackageManager::FT_FILE) && !(*it)->getName().hasSuffix("/"))) {

				// Do not add duplicate files
				bool found = false;
				for (Common::ArchiveMemberList::iterator it1 = list.begin(); it1 != list.end(); ++it1) {
					if ((*it1)->getName() == (*it)->getName()) {
						found = true;
						break;
					}
				}

				if (!found)
					list.push_back(*it);
				num++;
			}
		}
	}

	return num;
}
Esempio n. 12
0
int ZipArchive::listMembers(Common::ArchiveMemberList &list) {
	int matches = 0;
	int err = unzGoToFirstFile(_zipFile);

	while (err == UNZ_OK) {
		char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1];
		if (unzGetCurrentFileInfo(_zipFile, NULL,
		                          szCurrentFileName, sizeof(szCurrentFileName)-1,
		                          NULL, 0, NULL, 0) == UNZ_OK) {
			list.push_back(ArchiveMemberList::value_type(new GenericArchiveMember(szCurrentFileName, this)));
			matches++;
		}

		err = unzGoToNextFile(_zipFile);
	}

	return matches;
}
Esempio n. 13
0
int AndroidAssetArchive::listMembers(Common::ArchiveMemberList &member_list) const {
	if (_hasCached) {
		member_list.insert(member_list.end(), _cachedMembers.begin(), _cachedMembers.end());
		return _cachedMembers.size();
	}

	int count = 0;
	AAssetDir *dir = AAssetManager_openDir(_am, "");
	const char *file = AAssetDir_getNextFileName(dir);

	while (file) {
		member_list.push_back(getMember(file));
		++count;
		file = AAssetDir_getNextFileName(dir);
	}
	AAssetDir_close(dir);

	_cachedMembers = Common::ArchiveMemberList(member_list);
	_hasCached = true;

	return count;
}
Esempio n. 14
0
int NSArchive::listMembers(Common::ArchiveMemberList &list) const {
	for (uint32 i = 0; i < _numFiles; i++) {
		list.push_back(Common::SharedPtr<Common::GenericArchiveMember>(new Common::GenericArchiveMember(_archiveDir[i], this)));
	}
	return _numFiles;
}
Esempio n. 15
0
int MsCabinet::listMembers(Common::ArchiveMemberList &list) const {
	for (FileMap::const_iterator it = _fileMap.begin(); it != _fileMap.end(); it++)
		list.push_back(getMember(it->_key));

	return _fileMap.size();
}
Esempio n. 16
0
int InstallerArchive::listMembers(Common::ArchiveMemberList &list) {
	for (FileMap::const_iterator it = _map.begin(); it != _map.end(); it++)
		list.push_back(getMember(it->_key));

	return _map.size();
}