public DownloadHelper(Arguments arguments) { this.addObserver(downloadSummarizer); this.arguments = arguments; }
/** * Downloads a {@link DownloadableFile} moves it to the correct folder. Downloads to the local cache and then * copies to the download folder. * * @param downloadableFile a DownloadableFile with a download URL * @return status of the download, failed, skipped, or success */ public DownloadStatus downloadFile(final DownloadableFile downloadableFile) { return downloadFile(downloadableFile, true); }
private DownloadStatus notifyStatus(DownloadStatus status) { setChanged(); notifyObservers(status); return status; } }
@Override protected boolean postProcess(final Entry<File, Manifest> manifestEntry) { moveOverrides(manifestEntry.getValue()); downloadHelper.getDownloadSummarizer().summarize(); return true; }
/** * Starts processing the manifest files passed in. This includes downloading a modpack, updating the mods in a * manifest, downloading individual mods, and merging all manifests. * @throws InterruptedException exception is thrown if a processor is interrupted */ public void processManifests() throws InterruptedException { log.trace("Processing Manifests..."); downloadHelper = new DownloadHelper(arguments); downloadModpack(arguments); updateMods(arguments); downloadMods(arguments); mergeManifests(arguments); log.trace("Finished Processing Manifests."); }
if (BooleanUtils.isTrue(downloadableFile.getSkipDownload())) { log.debug("Skipped downloading {}", downloadableFile.getName()); return notifyStatus(DownloadStatus.SKIPPED); return notifyStatus(DownloadStatus.SKIPPED); return status; return notifyStatus(status); return notifyStatus(status);
@Override public void downloadMod(final Mod mod) { downloadHelper.downloadFile(mod); }
private void downloadCurseMod(CurseFile curseFile) { try { downloadHelper.downloadFile(getCurseForgeDownloadLocation(curseFile)); } catch (IOException e) { log.error(e); } }
modPack.setFileName(modPack.getName() + ".zip"); DownloadStatus downloadStatus = downloadHelper.downloadFile(modPack, false); modPack.setDownloadUrl(modPack.getCurseForgeDownloadUrl()); getDownloadUrl(modPack); downloadStatus = downloadHelper.downloadFile(modPack, false);
private void downloadForgeFile(String minecraftVersion, ModLoader modLoader, boolean downloadInstaller, boolean alternateDownloadUrl) { modLoader.setRename(modLoader.getRename(downloadInstaller)); String forgeFileName = "forge-" + minecraftVersion + "-" + modLoader.getForgeId(); String forgeURL = reference.getForgeUrl() + minecraftVersion + "-" + modLoader.getForgeId(); if (alternateDownloadUrl) { forgeFileName += "-" + minecraftVersion; forgeURL += "-" + minecraftVersion; } forgeFileName += downloadInstaller ? reference.getForgeInstaller() : reference.getForgeUniversal(); forgeURL += "/" + forgeFileName; modLoader.setDownloadUrl(forgeURL); modLoader.setFileName(forgeFileName); if (DownloadStatus.FAILURE.equals(downloadHelper.downloadFile(modLoader)) && alternateDownloadUrl) { log.warn("Attempting alternate Forge download URL"); downloadForgeFile(minecraftVersion, modLoader, downloadInstaller, false); } }