mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-03 00:39:02 +00:00
Add Description to UniStorev2 List.
This commit is contained in:
+14
-16
@@ -106,7 +106,7 @@ void Store::writeToFile(int index) {
|
||||
|
||||
// Here we get the data of the UniStore!
|
||||
UniStoreV2Struct Store::getData(const int index) {
|
||||
UniStoreV2Struct temp = {"", "", "", "", "" ,"", -1, 0, false};
|
||||
UniStoreV2Struct temp = {"", "", "", "", "", "" ,"", -1, 0, false};
|
||||
|
||||
if (index > (int)this->storeJson["storeContent"].size()) return temp; // Empty.
|
||||
|
||||
@@ -121,6 +121,11 @@ UniStoreV2Struct Store::getData(const int index) {
|
||||
temp.author = this->storeJson["storeContent"][index]["info"]["author"];
|
||||
}
|
||||
|
||||
// Description.
|
||||
if (this->storeJson["storeContent"][index]["info"].contains("description")) {
|
||||
temp.description = this->storeJson["storeContent"][index]["info"]["description"];
|
||||
}
|
||||
|
||||
// Version.
|
||||
if (this->storeJson["storeContent"][index]["info"].contains("version")) {
|
||||
temp.version = this->storeJson["storeContent"][index]["info"]["version"];
|
||||
@@ -247,25 +252,13 @@ void Store::sorting(bool Ascending, SortType sorttype) {
|
||||
this->sorttype = sorttype;
|
||||
switch(this->sorttype) {
|
||||
case SortType::TITLE:
|
||||
if (Ascending) {
|
||||
std::sort(this->sortedStore.begin(), this->sortedStore.end(), compareTitleAscending);
|
||||
} else {
|
||||
std::sort(this->sortedStore.begin(), this->sortedStore.end(), compareTitleDescending);
|
||||
}
|
||||
Ascending ? std::sort(this->sortedStore.begin(), this->sortedStore.end(), compareTitleAscending) : std::sort(this->sortedStore.begin(), this->sortedStore.end(), compareAuthorAscending);
|
||||
break;
|
||||
case SortType::AUTHOR:
|
||||
if (Ascending) {
|
||||
std::sort(this->sortedStore.begin(), this->sortedStore.end(), compareAuthorAscending);
|
||||
} else {
|
||||
std::sort(this->sortedStore.begin(), this->sortedStore.end(), compareAuthorDescending);
|
||||
}
|
||||
Ascending ? std::sort(this->sortedStore.begin(), this->sortedStore.end(), compareTitleAscending) : std::sort(this->sortedStore.begin(), this->sortedStore.end(), compareAuthorDescending);
|
||||
break;
|
||||
case SortType::LAST_UPDATED:
|
||||
if (Ascending) {
|
||||
std::sort(this->sortedStore.begin(), sortedStore.end(), compareUpdateAscending);
|
||||
} else {
|
||||
std::sort(this->sortedStore.begin(), sortedStore.end(), compareUpdateDescending);
|
||||
}
|
||||
Ascending ? std::sort(this->sortedStore.begin(), this->sortedStore.end(), compareUpdateAscending) : std::sort(this->sortedStore.begin(), this->sortedStore.end(), compareUpdateDescending);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -281,6 +274,11 @@ std::string Store::returnAuthor(const int index) {
|
||||
return this->sortedStore[index].author;
|
||||
}
|
||||
|
||||
std::string Store::returnDescription(const int index) {
|
||||
if (index > (int)this->sortedStore.size()) return "?"; // Out of scope.
|
||||
return this->sortedStore[index].description;
|
||||
}
|
||||
|
||||
int Store::returnIconIndex(const int index) {
|
||||
if (index > (int)this->sortedStore.size()) return -1; // Out of scope.
|
||||
return this->sortedStore[index].icon_index;
|
||||
|
||||
Reference in New Issue
Block a user