COnvert to new prefix system

pull/73/head
MillenniumEarl 2021-02-16 16:09:32 +01:00
parent 2f43996b68
commit f483f9ce8f
1 changed files with 14 additions and 12 deletions

View File

@ -76,10 +76,12 @@ function readCache(path: string) {
if (existsSync(path)) { if (existsSync(path)) {
const data = readFileSync(path, {encoding: "utf-8", flag: "r"}); const data = readFileSync(path, {encoding: "utf-8", flag: "r"});
const json: { [s: string]: DictType } = JSON.parse(data); const json: { [s: string]: DictType } = JSON.parse(data);
shared.setEngines(json.engines);
shared.setStatuses(json.statuses); shared.setPrefixPair("engines", json.engines);
shared.setTags(json.tags); shared.setPrefixPair("statuses", json.statuses);
shared.setOthers(json.others); shared.setPrefixPair("tags", json.tags);
shared.setPrefixPair("others", json.others);
returnValue = true; returnValue = true;
} }
return returnValue; return returnValue;
@ -91,10 +93,10 @@ function readCache(path: string) {
*/ */
function saveCache(path: string): void { function saveCache(path: string): void {
const saveDict = { const saveDict = {
engines: shared.engines, engines: shared.prefixes["engines"],
statuses: shared.statuses, statuses: shared.prefixes["statuses"],
tags: shared.tags, tags: shared.prefixes["tags"],
others: shared.others, others: shared.prefixes["others"],
}; };
const json = JSON.stringify(saveDict); const json = JSON.stringify(saveDict);
writeFileSync(path, json); writeFileSync(path, json);
@ -135,9 +137,9 @@ function assignLatestPlatformData(data: LatestResObj): void {
} }
// Save the values // Save the values
shared.setEngines(Object.assign({}, scrapedData["Engine"])); shared.setPrefixPair("engines", Object.assign({}, scrapedData["Engine"]));
shared.setStatuses(Object.assign({}, scrapedData["Status"])); shared.setPrefixPair("statuses", Object.assign({}, scrapedData["Status"]));
shared.setOthers(Object.assign({}, scrapedData["Other"])); shared.setPrefixPair("others", Object.assign({}, scrapedData["Other"]));
shared.setTags(data.Tags); shared.setPrefixPair("tags", data.Tags);
} }
//#endregion //#endregion