MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / loadIndexedPackVersion

Method loadIndexedPackVersion

launcher/modplatform/flame/FlameModIndex.cpp:105–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103}
104
105auto FlameMod::loadIndexedPackVersion(QJsonObject& obj, bool load_changelog) -> ModPlatform::IndexedVersion
106{
107 auto versionArray = Json::requireArray(obj, "gameVersions");
108 if (versionArray.isEmpty()) {
109 return {};
110 }
111
112 ModPlatform::IndexedVersion file;
113 for (auto mcVer : versionArray) {
114 auto str = mcVer.toString();
115
116 if (str.contains('.'))
117 file.mcVersion.append(str);
118 }
119
120 file.addonId = Json::requireInteger(obj, "modId");
121 file.fileId = Json::requireInteger(obj, "id");
122 file.date = Json::requireString(obj, "fileDate");
123 file.version = Json::requireString(obj, "displayName");
124 file.downloadUrl = Json::ensureString(obj, "downloadUrl");
125 file.fileName = Json::requireString(obj, "fileName");
126
127 auto hash_list = Json::ensureArray(obj, "hashes");
128 for (auto h : hash_list) {
129 auto hash_entry = Json::ensureObject(h);
130 auto hash_types = ProviderCaps.hashType(ModPlatform::Provider::FLAME);
131 auto hash_algo = enumToString(Json::ensureInteger(hash_entry, "algo", 1, "algorithm"));
132 if (hash_types.contains(hash_algo)) {
133 file.hash = Json::requireString(hash_entry, "value");
134 file.hash_type = hash_algo;
135 break;
136 }
137 }
138
139 if(load_changelog)
140 file.changelog = api.getModFileChangelog(file.addonId.toInt(), file.fileId.toInt());
141
142 return file;
143}

Callers

nothing calls this directly

Calls 8

requireArrayFunction · 0.85
enumToStringFunction · 0.85
isEmptyMethod · 0.80
appendMethod · 0.80
hashTypeMethod · 0.80
getModFileChangelogMethod · 0.80
toStringMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected