mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2025-02-02 14:02:32 +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()
|
void Downloader::getGameList()
|
||||||
{
|
{
|
||||||
gameItems = this->getGames();
|
if (config.sGameRegex == "free")
|
||||||
|
|
||||||
// Filter the game list
|
|
||||||
if (!config.sGameRegex.empty())
|
|
||||||
{
|
{
|
||||||
// GameRegex filter aliases
|
gameItems = this->getFreeGames();
|
||||||
if (config.sGameRegex == "all")
|
}
|
||||||
config.sGameRegex = ".*";
|
else
|
||||||
|
{
|
||||||
if (config.sGameRegex == "free")
|
gameItems = this->getGames();
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2138,6 +2120,19 @@ std::vector<gameItem> Downloader::getGames()
|
|||||||
if (config.bPlatformDetection && !(platform & config.iInstallerType))
|
if (config.bPlatformDetection && !(platform & config.iInstallerType))
|
||||||
continue;
|
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)
|
if (config.bDLC)
|
||||||
{
|
{
|
||||||
int dlcCount = product["dlcCount"].asInt();
|
int dlcCount = product["dlcCount"].asInt();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user