use of net.technicpack.autoupdate.io.StreamVersion in project LauncherV3 by TechnicPack.
the class QueryUpdateStream method runTask.
@Override
public void runTask(InstallTasksQueue queue) throws IOException, InterruptedException {
try {
StreamVersion version = updateStream.getStreamVersion(relauncher.getStreamName());
if (version == null || version.getBuild() == 0)
return;
for (LauncherResource resource : version.getResources()) {
IFileVerifier verifier = new MD5FileVerifier(resource.getMd5());
File downloadFile = new File(new File(directories.getAssetsDirectory(), "launcher"), resource.getFilename());
if (!downloadFile.exists() || !verifier.isFileValid(downloadFile))
downloadTasks.addTask(new DownloadFileTask(resource.getUrl(), downloadFile, verifier, resource.getFilename()));
}
if (version.getBuild() == relauncher.getCurrentBuild() || (relauncher.getStreamName().startsWith("beta") && version.getBuild() <= relauncher.getCurrentBuild()))
return;
String updateUrl = null;
String runningPath = relauncher.getRunningPath();
if (runningPath == null) {
throw new DownloadException("Could not load a running path for currently-executing launcher.");
}
if (runningPath.endsWith(".exe"))
updateUrl = version.getExeUrl();
else
updateUrl = version.getJarUrl();
downloadTasks.addTask(new DownloadUpdate(updateUrl, relauncher, postDownloadTasks));
} catch (RestfulAPIException ex) {
return;
}
}
Aggregations