コード例 #1
0
bool ContentManager::DownloadContent(const ContentDownloadRequest& request) {
	if (request.NothingIsRequired()) {
		return false;
	}

	//TODO: check if content already exists on HDD or was just downloaded!

	if (request.IsEngineRequested()) {
		if (IsContentAlreadyBeingDownloaded(request.GetEngineVersion())) {
			throw Exception(_("Engine being downloaded already! Please wait!"));
		}
		prDownloader().Download(DownloadEnum::CAT_ENGINE, request.GetEngineVersion(), "");
	}

	if (request.IsMapRequested()) {
		if (IsContentAlreadyBeingDownloaded(request.GetMapName())) {
			throw Exception(_("Map being downloaded already! Please wait!"));
		}
		prDownloader().Download(DownloadEnum::CAT_MAP, request.GetMapName(), request.GetMapHash());
	}

	if (request.IsGameRequested()) {
		if (IsContentAlreadyBeingDownloaded(request.GetGameName())) {
			throw Exception(_("Game being downloaded already! Please wait!"));
		}
		prDownloader().Download(DownloadEnum::CAT_GAME, request.GetGameName(), request.GetGameHash());
	}

	return true;
}
コード例 #2
0
bool ContentManager::DownloadContent(const ContentDownloadRequest& request) {
	if (request.NothingIsRequired()) {
		return false;
	}

	//TODO: check if content already exists on HDD or was just downloaded!

	if (request.IsEngineRequested()) {
		if (IsContentAlreadyBeingDownloaded(request.GetEngineVersion())) {
			throw Exception(_("Engine being downloaded already! Please wait!"));
		}
		ServerManager::Instance()->DownloadContent(PrDownloader::GetEngineCat(), request.GetEngineVersion(), "");
	}

	if (request.IsMapRequested()) {
		if (IsContentAlreadyBeingDownloaded(request.GetMapName())) {
			throw Exception(_("Map being downloaded already! Please wait!"));
		}
		ServerManager::Instance()->DownloadContent("map", request.GetMapName(), request.GetMapHash());
	}

	if (request.IsGameRequested()) {
		if (IsContentAlreadyBeingDownloaded(request.GetGameName())) {
			throw Exception(_("Game being downloaded already! Please wait!"));
		}
		ServerManager::Instance()->DownloadContent("game", request.GetGameName(), request.GetGameHash());
	}

	return true;
}