MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / readVersionProperties

Method readVersionProperties

launcher/minecraft/MojangVersionFormat.cpp:155–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153}
154
155void MojangVersionFormat::readVersionProperties(const QJsonObject& in, VersionFile* out)
156{
157 Bits::readString(in, "id", out->minecraftVersion);
158 Bits::readString(in, "mainClass", out->mainClass);
159 Bits::readString(in, "minecraftArguments", out->minecraftArguments);
160 Bits::readString(in, "type", out->type);
161
162 Bits::readString(in, "assets", out->assets);
163 if (in.contains("assetIndex")) {
164 out->mojangAssetIndex = assetIndexFromJson(requireObject(in, "assetIndex"));
165 } else if (!out->assets.isNull()) {
166 out->mojangAssetIndex = std::make_shared<MojangAssetIndexInfo>(out->assets);
167 }
168
169 out->releaseTime = timeFromS3Time(in.value("releaseTime").toString(""));
170 out->updateTime = timeFromS3Time(in.value("time").toString(""));
171
172 if (in.contains("minimumLauncherVersion")) {
173 out->minimumLauncherVersion = requireInteger(in.value("minimumLauncherVersion"));
174 if (out->minimumLauncherVersion > CURRENT_MINIMUM_LAUNCHER_VERSION) {
175 out->addProblem(ProblemSeverity::Warning, QObject::tr("The 'minimumLauncherVersion' value of this version (%1) is higher than "
176 "supported by %3 (%2). It might not work properly!")
177 .arg(out->minimumLauncherVersion)
178 .arg(CURRENT_MINIMUM_LAUNCHER_VERSION)
179 .arg(BuildConfig.LAUNCHER_DISPLAYNAME));
180 }
181 }
182
183 if (in.contains("compatibleJavaMajors")) {
184 for (auto compatible : requireArray(in.value("compatibleJavaMajors"))) {
185 out->compatibleJavaMajors.append(requireInteger(compatible));
186 }
187 }
188 if (in.contains("compatibleJavaName")) {
189 out->compatibleJavaName = requireString(in.value("compatibleJavaName"));
190 }
191
192 if (in.contains("downloads")) {
193 auto downloadsObj = requireObject(in, "downloads");
194 for (auto iter = downloadsObj.begin(); iter != downloadsObj.end(); iter++) {
195 auto classifier = iter.key();
196 auto classifierObj = requireObject(iter.value());
197 out->mojangDownloads[classifier] = downloadInfoFromJson(classifierObj);
198 }
199 }
200}
201
202VersionFilePtr MojangVersionFormat::versionFileFromJson(const QJsonDocument& doc, const QString& filename)
203{

Callers

nothing calls this directly

Calls 11

assetIndexFromJsonFunction · 0.85
requireObjectFunction · 0.85
timeFromS3TimeFunction · 0.85
requireArrayFunction · 0.85
downloadInfoFromJsonFunction · 0.85
valueMethod · 0.80
addProblemMethod · 0.80
appendMethod · 0.80
readStringFunction · 0.70
containsMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected