UTPackMangler.java 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. package QuickVerifyCrap;
  2. import java.io.*;
  3. import java.util.HashSet;
  4. import java.util.LinkedList;
  5. import java.util.List;
  6. import java.util.Set;
  7. public class UTPackMangler {
  8. public static void main(String[] args) throws Exception{
  9. try{
  10. BufferedReader r = new BufferedReader(new FileReader("C:\\LMAA\\packs.dedup.txt.UE"));
  11. String line = r.readLine();
  12. long totalBytes = 0;
  13. long totalCompressedbytes = 0;
  14. long linesMangled = 0;
  15. Set<String> remotepaths = new HashSet<>();
  16. System.out.println("Mangling File...");
  17. List<PackData> packs = new LinkedList<>();
  18. while(line !=null)
  19. {
  20. String[] splitted = line.split("\"");
  21. if(splitted.length<2)
  22. {
  23. System.out.println(line);
  24. }
  25. else
  26. {
  27. PackData p = new PackData();
  28. p.hash = splitted[1];
  29. p.remotepath = splitted[7];
  30. int size = Integer.valueOf(splitted[3]);
  31. int comppressedSize = Integer.valueOf(splitted[5]);
  32. totalBytes += size;
  33. totalCompressedbytes += comppressedSize;
  34. p.size = size;
  35. p.compressedSize= comppressedSize;
  36. remotepaths.add(p.remotepath);
  37. linesMangled++;
  38. if(linesMangled%1000==0)
  39. {
  40. System.out.println("Mangled:"+linesMangled);
  41. }
  42. packs.add(p);
  43. }
  44. line = r.readLine();
  45. }
  46. PrintStream w = new PrintStream(new FileOutputStream("C:\\LMAA\\downloader.sh"));
  47. w.println("#!/bin/bash");
  48. w.println("echo Generating directories");
  49. remotepaths.forEach((s)->
  50. {
  51. w.println("mkdir -p "+s);
  52. });
  53. w.println("echo Downloading....");
  54. long totalMb = totalBytes/1024/1024;
  55. long totalMbComp = totalCompressedbytes/1024/1024;
  56. w.println("echo Total Size: "+ totalMb+ "Total Compressed Size" +totalMbComp);
  57. System.out.println("echo Total Size: "+ totalMb+ "Total Compressed Size" +totalMbComp);
  58. long progress = 0;
  59. for(PackData p:packs)
  60. {
  61. String serverPath = "http://cdn.unrealengine.com/dependencies/"+p.remotepath+"/"+p.hash;
  62. String downloadcmd = "wget -nc -qO ./"+p.remotepath+"/"+p.hash+" "+serverPath;
  63. w.println(downloadcmd);
  64. progress += p.compressedSize;
  65. w.println("echo -ne \"Downloaded "+(progress/1024/1024)+" of" +totalMbComp+" MB\\r\"");
  66. }
  67. }
  68. catch (Exception e)
  69. {
  70. e.printStackTrace();
  71. }
  72. }
  73. }
  74. class PackData
  75. {
  76. int size;
  77. int compressedSize;
  78. String hash;
  79. String remotepath;
  80. }