mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2025-02-02 05:52:31 +01:00
Move game filtering from Downloader::getGameList to Downloader::getGames
This commit is contained in:
parent
9c80ed1d39
commit
c722283022
@ -175,31 +175,13 @@ void Downloader::updateCheck()
|
||||
|
||||
void Downloader::getGameList()
|
||||
{
|
||||
gameItems = this->getGames();
|
||||
|
||||
// Filter the game list
|
||||
if (!config.sGameRegex.empty())
|
||||
{
|
||||
// GameRegex filter aliases
|
||||
if (config.sGameRegex == "all")
|
||||
config.sGameRegex = ".*";
|
||||
|
||||
if (config.sGameRegex == "free")
|
||||
{
|
||||
gameItems = this->getFreeGames();
|
||||
}
|
||||
else
|
||||
{ // Filter the names
|
||||
std::vector<gameItem> gameItemsFiltered;
|
||||
boost::regex expression(config.sGameRegex);
|
||||
boost::match_results<std::string::const_iterator> what;
|
||||
for (unsigned int i = 0; i < gameItems.size(); ++i)
|
||||
{
|
||||
if (boost::regex_search(gameItems[i].name, what, expression)) // Check if name matches the specified regex
|
||||
gameItemsFiltered.push_back(gameItems[i]);
|
||||
}
|
||||
gameItems = gameItemsFiltered;
|
||||
}
|
||||
gameItems = this->getGames();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2138,6 +2120,19 @@ std::vector<gameItem> Downloader::getGames()
|
||||
if (config.bPlatformDetection && !(platform & config.iInstallerType))
|
||||
continue;
|
||||
|
||||
// Filter the game list
|
||||
if (!config.sGameRegex.empty())
|
||||
{
|
||||
// GameRegex filter aliases
|
||||
if (config.sGameRegex == "all")
|
||||
config.sGameRegex = ".*";
|
||||
|
||||
boost::regex expression(config.sGameRegex);
|
||||
boost::match_results<std::string::const_iterator> what;
|
||||
if (!boost::regex_search(game.name, what, expression)) // Check if name matches the specified regex
|
||||
continue;
|
||||
}
|
||||
|
||||
if (config.bDLC)
|
||||
{
|
||||
int dlcCount = product["dlcCount"].asInt();
|
||||
|
Loading…
x
Reference in New Issue
Block a user