Universal-Updater -> DarkStore Part 2

Renamed Strings For DarkStore
Made .store Files Useable
This commit is contained in:
dark98
2021-09-09 16:23:22 +01:00
parent 76b41884c5
commit c894ff9924
61 changed files with 650 additions and 648 deletions
+17 -17
View File
@@ -24,8 +24,8 @@
* reasonable ways as different from the original version.
*/
#ifndef _UNIVERSAL_UPDATER_META_HPP
#define _UNIVERSAL_UPDATER_META_HPP
#ifndef _DARKSTORE_META_HPP
#define _DARKSTORE_META_HPP
#include "json.hpp"
#include <string>
@@ -44,22 +44,22 @@ public:
Meta();
~Meta() { this->SaveCall(); };
std::string GetUpdated(const std::string &unistoreName, const std::string &entry) const;
int GetMarks(const std::string &unistoreName, const std::string &entry) const;
bool UpdateAvailable(const std::string &unistoreName, const std::string &entry, const std::string &updated) const;
std::vector<std::string> GetInstalled(const std::string &unistoreName, const std::string &entry) const;
std::string GetUpdated(const std::string &storeName, const std::string &entry) const;
int GetMarks(const std::string &storeName, const std::string &entry) const;
bool UpdateAvailable(const std::string &storeName, const std::string &entry, const std::string &updated) const;
std::vector<std::string> GetInstalled(const std::string &storeName, const std::string &entry) const;
void SetUpdated(const std::string &unistoreName, const std::string &entry, const std::string &updated) {
this->metadataJson[unistoreName][entry]["updated"] = updated;
void SetUpdated(const std::string &storeName, const std::string &entry, const std::string &updated) {
this->metadataJson[storeName][entry]["updated"] = updated;
};
void SetMarks(const std::string &unistoreName, const std::string &entry, int marks) {
this->metadataJson[unistoreName][entry]["marks"] = marks;
void SetMarks(const std::string &storeName, const std::string &entry, int marks) {
this->metadataJson[storeName][entry]["marks"] = marks;
};
/* TODO: Handle this better. */
void SetInstalled(const std::string &unistoreName, const std::string &entry, const std::string &name) {
const std::vector<std::string> installs = this->GetInstalled(unistoreName, entry);
void SetInstalled(const std::string &storeName, const std::string &entry, const std::string &name) {
const std::vector<std::string> installs = this->GetInstalled(storeName, entry);
bool write = true;
if (!installs.empty()) {
@@ -73,22 +73,22 @@ public:
}
}
if (write) this->metadataJson[unistoreName][entry]["installed"] += name;
if (write) this->metadataJson[storeName][entry]["installed"] += name;
}
/* Remove installed state from a download list entry. */
void RemoveInstalled(const std::string &unistoreName, const std::string &entry, const std::string &name) {
const std::vector<std::string> installs = this->GetInstalled(unistoreName, entry);
void RemoveInstalled(const std::string &storeName, const std::string &entry, const std::string &name) {
const std::vector<std::string> installs = this->GetInstalled(storeName, entry);
if (installs.empty()) return;
for (int i = 0; i < (int)installs.size(); i++) {
if (installs[i] == name) {
this->metadataJson[unistoreName][entry]["installed"].erase(i);
this->metadataJson[storeName][entry]["installed"].erase(i);
break;
}
}
if (this->metadataJson[unistoreName][entry]["installed"].empty() && this->metadataJson[unistoreName][entry].contains("updated")) this->metadataJson[unistoreName][entry].erase("updated");
if (this->metadataJson[storeName][entry]["installed"].empty() && this->metadataJson[storeName][entry].contains("updated")) this->metadataJson[storeName][entry].erase("updated");
}
void ImportMetadata();