Add downloadToRAM as a param.

To-Do: Maybe cleanup or something?
This commit is contained in:
SuperSaiyajinStackZ
2019-12-22 16:14:55 +01:00
parent 9e87033aff
commit 11e7664706
7 changed files with 62 additions and 129 deletions
+2 -2
View File
@@ -100,7 +100,7 @@ ScriptBrowse::ScriptBrowse() {
DisplayMsg(Lang::get("GETTING_SCRIPT_LIST"));
// Get repo info
downloadToFile("https://github.com/Universal-Team/extras/raw/scripts/info/scriptInfo.json", metaFile);
downloadToFile("https://github.com/Universal-Team/extras/raw/scripts/info/scriptInfo.json", metaFile, true);
FILE* file = fopen(metaFile, "r");
if(file) infoJson = nlohmann::json::parse(file, nullptr, false);
fclose(file);
@@ -230,7 +230,7 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
}
DisplayMsg(fileName);
downloadToFile(infoJson[selection]["url"], Config::ScriptPath + titleFix + ".json");
downloadToFile(infoJson[selection]["url"], Config::ScriptPath + titleFix + ".json", true);
infoJson[selection]["curRevision"] = infoJson[selection]["revision"];
}
}
+8 -4
View File
@@ -130,17 +130,19 @@ void runFunctions(nlohmann::json &json) {
if(!missing) ScriptHelper::removeFile(file, message);
} else if(type == "downloadFile") {
bool missing = false;
bool missing = false, downloadToRAM = false;
std::string file, output, message;
if(json.at(choice).at(i).contains("file")) file = json.at(choice).at(i).at("file");
else missing = true;
if(json.at(choice).at(i).contains("output")) output = json.at(choice).at(i).at("output");
else missing = true;
if(json.at(choice).at(i).contains("downloadToRAM") && json.at(choice).at(i).at("downloadToRAM").is_boolean())
downloadToRAM = json.at(choice).at(i).at("downloadToRAM");
if(json.at(choice).at(i).contains("message")) message = json.at(choice).at(i).at("message");
if(!missing) ScriptHelper::downloadFile(file, output, message);
if(!missing) ScriptHelper::downloadFile(file, output, downloadToRAM, message);
} else if(type == "downloadRelease") {
bool missing = false, includePrereleases = false;
bool missing = false, includePrereleases = false, downloadToRAM = false;
std::string repo, file, output, message;
if(json.at(choice).at(i).contains("repo")) repo = json.at(choice).at(i).at("repo");
else missing = true;
@@ -150,8 +152,10 @@ void runFunctions(nlohmann::json &json) {
else missing = true;
if(json.at(choice).at(i).contains("includePrereleases") && json.at(choice).at(i).at("includePrereleases").is_boolean())
includePrereleases = json.at(choice).at(i).at("includePrereleases");
if(json.at(choice).at(i).contains("downloadToRAM") && json.at(choice).at(i).at("downloadToRAM").is_boolean())
downloadToRAM = json.at(choice).at(i).at("downloadToRAM");
if(json.at(choice).at(i).contains("message")) message = json.at(choice).at(i).at("message");
if(!missing) ScriptHelper::downloadRelease(repo, file, output, includePrereleases, message);
if(!missing) ScriptHelper::downloadRelease(repo, file, output, includePrereleases, downloadToRAM, message);
} else if(type == "extractFile") {
bool missing = false;
+2 -2
View File
@@ -73,7 +73,7 @@ std::vector<std::string> tinyDBList;
TinyDB::TinyDB() {
DisplayMsg(Lang::get("TINYDB_DOWNLOADING"));
downloadToFile("https://tinydb.eiphax.tech/api/universal-updater.json?raw=true", tinyDBFile);
downloadToFile("https://tinydb.eiphax.tech/api/universal-updater.json?raw=true", tinyDBFile, true);
tinyDBList = parseObjects();
selectedOption = tinyDBList[0];
}
@@ -244,7 +244,7 @@ void TinyDB::execute() {
if(tinyDBJson.at(selectedOption).at("script").at(i).contains("output")) output = tinyDBJson.at(selectedOption).at("script").at(i).at("output");
else missing = true;
if(tinyDBJson.at(selectedOption).at("script").at(i).contains("message")) message = tinyDBJson.at(selectedOption).at("script").at(i).at("message");
if(!missing) ScriptHelper::downloadFile(file, output, message);
if(!missing) ScriptHelper::downloadFile(file, output, false, message);
} else if(type == "installCia") {
bool missing = false;