use of net.technicpack.launchercore.install.verifiers.ValidJsonFileVerifier in project LauncherV3 by TechnicPack.
the class EnsureAssetsIndexTask method runTask.
@Override
public void runTask(InstallTasksQueue queue) throws IOException {
MojangVersion version = ((InstallTasksQueue<MojangVersion>) queue).getMetadata();
String assetKey = version.getAssetsKey();
if (assetKey == null || assetKey.isEmpty()) {
assetKey = "legacy";
}
String assetsUrl;
AssetIndex assetIndex = version.getAssetIndex();
if (assetIndex != null) {
assetsUrl = assetIndex.getUrl();
} else {
assetsUrl = MojangUtils.getAssetsIndex(assetKey);
}
File output = new File(assetsDirectory + File.separator + "indexes", assetKey + ".json");
(new File(output.getParent())).mkdirs();
IFileVerifier fileVerifier;
if (assetIndex != null && assetIndex.getSha1() != null)
fileVerifier = new SHA1FileVerifier(assetIndex.getSha1());
else
fileVerifier = new ValidJsonFileVerifier(MojangUtils.getGson());
if (!output.exists() || !fileVerifier.isFileValid(output)) {
downloadIndexQueue.addTask(new DownloadFileTask(assetsUrl, output, fileVerifier));
}
examineIndexQueue.addTask(new InstallMinecraftAssetsTask(modpack, assetsDirectory.getAbsolutePath(), output, checkAssetsQueue, downloadAssetsQueue, installAssetsQueue));
}
use of net.technicpack.launchercore.install.verifiers.ValidJsonFileVerifier in project LauncherV3 by TechnicPack.
the class HttpFileRetriever method retrieveVersion.
@Override
public void retrieveVersion(File target, String key) throws InterruptedException, IOException {
String url = baseUrl + key + "/" + key + ".json";
Utils.downloadFile(url, target.getName(), target.getAbsolutePath(), null, new ValidJsonFileVerifier(MojangUtils.getGson()), listener);
}
Aggregations