Ejemplo n.º 1
0
bool download_engine(std::list<IDownload*>& dllist)
{
	httpDownload->download(dllist);
	bool res = true;
	for (const IDownload* dl: dllist) {
		if (isEngineDownload(dl->cat) && !fileSystem->extractEngine(dl->name, dl->version)) {
			LOG_ERROR("Failed to extract engine %s", dl->version.c_str());
			res = false;
		}
	}
	return res;
}
Ejemplo n.º 2
0
bool download_engine(std::list<IDownload*>& dllist)
{
	bool res = true;
	std::list<IDownload*> enginedls;


	for (IDownload* dl: dllist) {
		if (isEngineDownload(dl->cat)) {
			enginedls.push_back(dl);
		}
	}
	if (enginedls.empty())
		return res;

	httpDownload->download(enginedls);
	for (const IDownload* dl: enginedls) {
		if (!fileSystem->extractEngine(dl->name, dl->version)) {
			LOG_ERROR("Failed to extract engine %s", dl->version.c_str());
			res = false;
		}
	}
	return res;
}
Ejemplo n.º 3
0
bool search(downloadtype type, category cat, const char* name, std::list<IDownload*>& searchres)
{
	IDownload::category icat = getCat(cat);
	if (isEngineDownload(icat)) { //engine downloads only work with http
		type = DL_ENGINE;
		LOG_ERROR("engine dl");
	}
	typ = type;
	std::string searchname = name;

	switch(type) {
	case DL_RAPID:
		return rapidDownload->search(searchres, searchname.c_str(), icat);
	case DL_HTTP:
	case DL_ENGINE:
		return httpDownload->search(searchres, searchname.c_str(), icat);
	case DL_PLASMA:
		return plasmaDownload->search(searchres, searchname.c_str(), icat);
	case DL_ANY:
		rapidDownload->search(searchres, searchname.c_str(), icat);
		if (!searchres.empty()) {
			typ = DL_RAPID;
			break;
		}
		typ = DL_HTTP;
		httpDownload->search(searchres, searchname.c_str(), icat);
		if (!searchres.empty()) {
			break;
		}
		//last try, use plasma
		return plasmaDownload->search(searchres, searchname.c_str(), icat);
	default:
		LOG_ERROR("%s: type invalid", __FUNCTION__);
		return false;
	}
	return true;
}