package QuickVerifyCrap; import java.io.*; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Set; public class UTPackMangler { public static void main(String[] args) throws Exception{ try{ BufferedReader r = new BufferedReader(new FileReader("C:\\LMAA\\packs.dedup.txt.UE")); String line = r.readLine(); long totalBytes = 0; long totalCompressedbytes = 0; long linesMangled = 0; Set remotepaths = new HashSet<>(); System.out.println("Mangling File..."); List packs = new LinkedList<>(); while(line !=null) { String[] splitted = line.split("\""); if(splitted.length<2) { System.out.println(line); } else { PackData p = new PackData(); p.hash = splitted[1]; p.remotepath = splitted[7]; int size = Integer.valueOf(splitted[3]); int comppressedSize = Integer.valueOf(splitted[5]); totalBytes += size; totalCompressedbytes += comppressedSize; p.size = size; p.compressedSize= comppressedSize; remotepaths.add(p.remotepath); linesMangled++; if(linesMangled%1000==0) { System.out.println("Mangled:"+linesMangled); } packs.add(p); } line = r.readLine(); } PrintStream w = new PrintStream(new FileOutputStream("C:\\LMAA\\downloader.sh")); w.println("#!/bin/bash"); w.println("echo Generating directories"); remotepaths.forEach((s)-> { w.println("mkdir -p "+s); }); w.println("echo Downloading...."); long totalMb = totalBytes/1024/1024; long totalMbComp = totalCompressedbytes/1024/1024; w.println("echo Total Size: "+ totalMb+ "Total Compressed Size" +totalMbComp); System.out.println("echo Total Size: "+ totalMb+ "Total Compressed Size" +totalMbComp); long progress = 0; for(PackData p:packs) { String serverPath = "http://cdn.unrealengine.com/dependencies/"+p.remotepath+"/"+p.hash; String downloadcmd = "wget -nc -qO ./"+p.remotepath+"/"+p.hash+" "+serverPath; w.println(downloadcmd); progress += p.compressedSize; w.println("echo -ne \"Downloaded "+(progress/1024/1024)+" of" +totalMbComp+" MB\\r\""); } } catch (Exception e) { e.printStackTrace(); } } } class PackData { int size; int compressedSize; String hash; String remotepath; }