package com.nowcomputing; import c.a.a.a.b; import c.a.a.a.c; import c.a.a.c; import java.io.File; import java.io.IOException; import java.net.URL; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; public class w { static final Logger a = Logger.getLogger(S.class.getName()); private static String c; private static String d; private static String e; private static String f; private static String g; private static String h; private static String i; private R j; private long k; private long l; private Thread m; private boolean n; private h o; protected Exception b; public w(e parame) { String str = D.c().getAbsolutePath(); str = e.a(str); c = str + File.separator + "launcher.jar"; d = c + ".lzma"; h = str + File.separator + ".mc.exe"; i = h + ".tmp"; f = str + File.separator + "runtime" + File.separator + "Minecraft.app"; e = f + File.separator + "Contents" + File.separator + "MacOS" + File.separator + "launcher"; g = f + ".zip"; } public void a(R paramR) { this.j = paramR; } public M a() { c c = b(); if (c != null) switch (A.a[S.b().ordinal()]) { case 1: return a(c) ? M.b : M.a; case 2: return c(c) ? M.b : M.a; case 3: case 4: return b(c) ? M.b : M.a; } return M.a; } public static c b() { c c = null; try { String str = S.a(S.b("https://launchermeta.mojang.com/mc/launcher.json")); b b = new b(); c = (c)b.a(str); } catch (IOException iOException) { a.log(Level.FINE, "Error Checking for new Minecraft launcher", iOException); } catch (c c1) { a.log(Level.FINE, "Error reading Minecraft launcher json", (Throwable)c1); } return c; } private boolean a(c paramc) { try { c c1 = (c)paramc.get("windows"); String str1 = (String)c1.get("apphash"); String str2 = S.d(h); return !str2.equals(str1); } catch (Exception exception) { return false; } } private boolean b(c paramc) { try { c c1 = (c)paramc.get("java"); String str1 = (String)c1.get("sha1"); String str2 = S.d(c); return !str2.equals(str1); } catch (Exception exception) { return false; } } private boolean c(c paramc) { try { c c1 = (c)paramc.get("osx"); String str1 = (String)c1.get("apphash"); String str2 = S.d(e); return !str2.equals(str1); } catch (Exception exception) { return false; } } public void c() { this.m = new x(this); this.m.start(); } public void d() { c c = b(); if (c == null) return; switch (A.a[S.b().ordinal()]) { case 1: e(c); return; case 2: d(c); return; case 3: case 4: f(c); return; } } private void d(c paramc) { c c1 = (c)paramc.get("osx"); a((String)c1.get("applink"), g, (String)c1.get("downloadhash")); File file = new File(g); S.a(file, new File(f), (List)null); file.delete(); if (this.j != null) this.j.a(); } private void e(c paramc) { c c1 = (c)paramc.get("windows"); a((String)c1.get("applink"), i, (String)c1.get("apphash")); S.b(new File(i), new File(h)); S.i(new File(h)); if (this.j != null) this.j.a(); } private void f(c paramc) { c c1 = (c)paramc.get("java"); c c2 = (c)c1.get("lzma"); a((String)c2.get("url"), d, (String)c2.get("sha1")); S.a(d, c); String str1 = (String)c1.get("sha1"); String str2 = S.d(c); if (!str2.equals(str1)) throw new IOException("Error uncompressing " + d); if (this.j != null) this.j.a(); } public void a(String paramString1, String paramString2, String paramString3) { a.log(Level.INFO, "Downloading " + paramString2); this.o = new h(new URL(paramString1), new File(paramString2), new z(this)); this.k = this.o.a(); this.o.run(); if (!this.o.b()) throw this.o.c(); String str = S.d(paramString2); if (!str.equals(paramString3)) throw new IOException("Error downloading " + paramString2); } public Exception e() { return this.b; } }