Created
January 15, 2024 22:31
-
-
Save womblee/11b38c9c349407cb04eaa9cf9ce6990b to your computer and use it in GitHub Desktop.
Prototype of disabling everything that was installed ACTUALLY BY MY DL MOD DOWNLOADER
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (auto const& it : ini) | |
{ | |
// mINI has everything in lowercase, first tried CustomPak, wasted my time... | |
if (it.first == "custompak") | |
{ | |
//;[DONT_EDIT_THIS_LINE]satan_reborn.pak=1,colorful_night_stars.pak=1 | |
// Prime example of what we will try to parse | |
// Create a file dummy | |
std::ifstream file(dide_direct); | |
// To indicate a success of finding what we need | |
bool success = false; | |
// Open | |
if (file.is_open()) | |
{ | |
std::string line; | |
// Find the start position of the relevant part | |
bool found = false; | |
while (std::getline(file, line)) | |
{ | |
size_t start_pos = line.find(";[DONT_TOUCH_THIS_LINE]"); | |
if (start_pos != std::string::npos) | |
{ | |
// Erase the prefix | |
line.erase(0, start_pos + strlen(";[DONT_TOUCH_THIS_LINE]")); | |
found = true; | |
break; // Stop reading after finding the section indicator | |
} | |
} | |
if (found) | |
{ | |
std::vector<std::string> keys; | |
// Tokenize the remaining string using commas | |
std::istringstream token_s(line); | |
std::string token; | |
while (std::getline(token_s, token, ',')) | |
{ | |
// Extract the key (before the equals sign) | |
size_t equals = token.find('='); | |
if (equals != std::string::npos) | |
keys.push_back(token.substr(0, equals)); | |
} | |
// Add the extracted keys | |
for (const auto& key : keys) | |
{ | |
for (auto const& it2 : it.second) | |
{ | |
if (it2.first.find(key) != std::string::npos) | |
ini[it.first][it2.first] = "0"; | |
} | |
} | |
// Congrats | |
success = true; | |
} | |
} | |
// Close the file | |
file.close(); | |
if (!success) | |
{ | |
for (auto const& it2 : it.second) | |
ini[it.first][it2.first] = "0"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment