/* */ package NET.worlds.scape; /* */ /* */ import NET.worlds.core.Archive; /* */ import NET.worlds.core.IniFile; /* */ import NET.worlds.network.Cache; /* */ import NET.worlds.network.CacheFile; /* */ import NET.worlds.network.NetUpdate; /* */ import NET.worlds.network.URL; /* */ import java.io.File; /* */ import java.io.FileInputStream; /* */ import java.io.FileNotFoundException; /* */ import java.io.FileOutputStream; /* */ import java.io.IOException; /* */ import java.io.InputStream; /* */ import java.io.PrintStream; /* */ import java.net.MalformedURLException; /* */ import java.util.Enumeration; /* */ import java.util.zip.ZipEntry; /* */ import java.util.zip.ZipFile; /* */ /* */ /* */ /* */ /* */ /* */ public class PendingDrone /* */ { /* */ static /* */ { /* 29 */ doAvatarUpdates = true; /* */ } /* */ /* */ /* 33 */ static boolean doAvatarUpdates = IniFile.gamma().getIniInt("noAvUpdates", 0) == 0; /* */ protected PosableDrone drone; /* */ protected URL url; /* */ /* */ PendingDrone(PosableDrone _drone, URL _url) { /* 38 */ this.drone = _drone; /* 39 */ this.url = _url; /* 40 */ this.loaded = false; /* */ } /* */ /* 43 */ public PosableDrone getDrone() { return this.drone; } /* 44 */ public URL getUrl() { return this.url; } /* 45 */ public boolean getLoaded() { return this.loaded; } /* 46 */ public void setLoaded() { this.loaded = true; } /* */ /* */ /* */ /* */ /* */ /* */ protected boolean loaded; /* */ /* */ /* */ /* */ static final boolean debug = false; /* */ /* */ /* */ /* */ public synchronized void download(URL avURL) /* */ { /* 62 */ if (!doAvatarUpdates) { return; /* */ } /* */ /* 65 */ if (avURL == null) { return; /* */ } /* */ /* */ /* */ try /* */ { /* 71 */ if (PosableDroneLoader.avatarExistsLocally(avURL)) { /* 72 */ return; /* */ } /* */ /* */ /* */ } /* */ catch (MalformedURLException e) /* */ { /* 79 */ return; /* */ } /* */ /* 82 */ String s = PosableDroneLoader.getAvatarBaseName(avURL); /* 83 */ assert (s != null); /* 84 */ s = s.toLowerCase(); /* */ /* 86 */ URL realFile = URL.make(NetUpdate.getUpgradeServerURL() + /* 87 */ "AvatarUpgrades/" + s + ".zip"); /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 95 */ CacheFile cf = Cache.getFile(realFile); /* 96 */ cf.waitUntilLoaded(); /* 97 */ if (cf.error()) /* */ { /* */ /* */ /* */ /* 102 */ return; /* */ } /* */ /* 105 */ finishDownload(cf.getLocalName()); /* */ /* 107 */ cf.close(); /* */ } /* */ /* */ /* */ /* */ public synchronized boolean finishDownload(String localName) /* */ { /* */ try /* */ { /* 116 */ patchArchive = new ZipFile(localName); /* */ } /* */ catch (IOException e) /* */ { /* */ ZipFile patchArchive; /* */ /* 122 */ notify(); /* 123 */ return false; /* */ } /* */ /* */ /* */ /* */ ZipFile patchArchive; /* */ /* */ /* 131 */ Enumeration enums = patchArchive.entries(); /* 132 */ while (enums.hasMoreElements()) /* */ { /* 134 */ ZipEntry ze = (ZipEntry)enums.nextElement(); /* 135 */ String filename = ze.getName(); /* 136 */ String avatarFile = URL.homeUnalias("avatars/" + /* 137 */ filename); /* */ /* 139 */ String[] validExtensions = /* 140 */ { /* 141 */ ".bod", ".seq", ".dat", ".cmp", ".mov" }; /* */ /* */ /* 144 */ boolean validFile = false; /* 145 */ for (int idx = 0; idx < validExtensions.length; /* 146 */ idx++) /* */ { /* */ /* 149 */ if (avatarFile.toString().endsWith(validExtensions[idx])) /* */ { /* 151 */ validFile = true; /* 152 */ break; /* */ } /* */ } /* */ /* 156 */ if (validFile) /* */ { /* 158 */ if (avatarFile.toString().endsWith("avatars.dat")) /* */ { /* */ /* */ /* */ /* 163 */ avatarFile = URL.homeUnalias("avatars/avatars.tmp"); /* */ /* 165 */ CopyAvatarFile(patchArchive, ze, avatarFile); /* 166 */ AppendAvatarsDat(); /* */ } /* */ else /* */ { /* 170 */ CopyAvatarFile(patchArchive, ze, avatarFile); /* */ } /* */ } /* */ } /* */ try /* */ { /* 176 */ patchArchive.close(); /* */ } /* */ catch (IOException localIOException1) {} /* */ /* 180 */ notify(); /* */ /* 182 */ return false; /* */ } /* */ /* */ public Room getBackgroundLoadRoom() /* */ { /* 187 */ if ((this.drone == null) || (this.drone.getOwner() == null)) /* 188 */ return null; /* 189 */ return this.drone.getOwner().getRoom(); /* */ } /* */ /* */ /* */ private void AppendAvatarsDat() /* */ { /* 195 */ String contentZip = URL.homeUnalias("avatars/content.zip"); /* */ /* */ /* */ /* */ /* 200 */ Archive.flushAll(); /* */ ZipFile contentZipArchive; /* */ try /* */ { /* 204 */ contentZipArchive = new ZipFile(contentZip); /* */ } /* */ catch (IOException e) { /* */ ZipFile contentZipArchive; /* 208 */ contentZipArchive = null; /* */ } /* */ /* 211 */ if (contentZipArchive != null) /* */ { /* 213 */ ZipEntry origAvatarDat = contentZipArchive.getEntry( /* 214 */ "avatars.dat"); /* 215 */ if (origAvatarDat != null) /* */ { /* */ /* */ /* */ /* */ /* 221 */ CopyAvatarFile(contentZipArchive, origAvatarDat, /* 222 */ URL.homeUnalias("avatars/avatars.dat")); /* 223 */ StripAvatarDat(contentZipArchive); /* */ } /* */ else /* */ { /* */ try { /* 228 */ contentZipArchive.close(); /* */ } /* */ catch (IOException localIOException1) {} /* */ } /* */ } /* */ /* */ /* */ try /* */ { /* 237 */ avDat = new FileOutputStream(URL.homeUnalias( /* 238 */ "avatars/avatars.dat"), true); /* */ } catch (IOException e) { /* */ FileOutputStream avDat; /* 241 */ System.out.println(e); return; /* */ } /* */ /* */ FileOutputStream avDat; /* */ try /* */ { /* 247 */ avTmp = new FileInputStream(URL.homeUnalias( /* 248 */ "avatars/avatars.tmp")); /* */ } /* */ catch (FileNotFoundException e) { /* */ try { /* */ FileInputStream avTmp; /* 253 */ avDat.close(); /* */ } /* */ catch (IOException localIOException2) {} /* */ return; /* */ } /* */ FileInputStream avTmp; /* 259 */ byte[] buf = new byte['Ѐ']; /* */ try /* */ { /* */ for (;;) { /* 263 */ int bytesRead = avTmp.read(buf); /* 264 */ if (bytesRead == -1) break; /* 265 */ avDat.write(buf, 0, bytesRead); /* */ } /* */ File avTmpFile; /* */ return; /* */ } /* */ catch (IOException localIOException3) /* */ { /* */ try { /* 273 */ avDat.close(); /* 274 */ avTmp.close(); /* */ } /* */ catch (IOException localIOException4) {} /* */ /* */ /* 279 */ avTmpFile = new File(URL.homeUnalias("avatars/avatars.tmp")); /* */ /* 281 */ avTmpFile.delete(); /* */ /* */ /* 284 */ DroneAnimator.loadconfig( /* 285 */ URL.make("home:avatars/avatars.dat").unalias()); /* */ } /* */ } /* */ /* */ /* Error */ /* */ private void StripAvatarDat(ZipFile contentZipArchive) /* */ { /* */ // Byte code: /* */ // 0: new 256 java/io/FileOutputStream /* */ // 3: dup /* */ // 4: ldc_w 318 /* */ // 7: invokestatic 173 NET/worlds/network/URL:homeUnalias (Ljava/lang/String;)Ljava/lang/String; /* */ // 10: invokespecial 320 java/io/FileOutputStream: (Ljava/lang/String;)V /* */ // 13: astore_2 /* */ // 14: goto +5 -> 19 /* */ // 17: astore_3 /* */ // 18: return /* */ // 19: new 321 java/util/zip/ZipOutputStream /* */ // 22: dup /* */ // 23: aload_2 /* */ // 24: invokespecial 323 java/util/zip/ZipOutputStream: (Ljava/io/OutputStream;)V /* */ // 27: astore_3 /* */ // 28: aload_1 /* */ // 29: invokevirtual 156 java/util/zip/ZipFile:entries ()Ljava/util/Enumeration; /* */ // 32: astore 4 /* */ // 34: goto +181 -> 215 /* */ // 37: aload 4 /* */ // 39: invokeinterface 160 1 0 /* */ // 44: checkcast 166 java/util/zip/ZipEntry /* */ // 47: astore 5 /* */ // 49: aload 5 /* */ // 51: invokevirtual 168 java/util/zip/ZipEntry:getName ()Ljava/lang/String; /* */ // 54: astore 6 /* */ // 56: aload 6 /* */ // 58: ldc -65 /* */ // 60: invokevirtual 326 java/lang/String:equals (Ljava/lang/Object;)Z /* */ // 63: ifne +152 -> 215 /* */ // 66: aload_1 /* */ // 67: aload 5 /* */ // 69: invokevirtual 330 java/util/zip/ZipFile:getInputStream (Ljava/util/zip/ZipEntry;)Ljava/io/InputStream; /* */ // 72: astore 7 /* */ // 74: new 166 java/util/zip/ZipEntry /* */ // 77: dup /* */ // 78: aload 5 /* */ // 80: invokevirtual 168 java/util/zip/ZipEntry:getName ()Ljava/lang/String; /* */ // 83: invokespecial 334 java/util/zip/ZipEntry: (Ljava/lang/String;)V /* */ // 86: astore 8 /* */ // 88: aload_3 /* */ // 89: aload 8 /* */ // 91: invokevirtual 335 java/util/zip/ZipOutputStream:putNextEntry (Ljava/util/zip/ZipEntry;)V /* */ // 94: sipush 1024 /* */ // 97: newarray /* */ // 99: astore 9 /* */ // 101: aload 7 /* */ // 103: aload 9 /* */ // 105: invokevirtual 339 java/io/InputStream:read ([B)I /* */ // 108: istore 10 /* */ // 110: iload 10 /* */ // 112: iconst_m1 /* */ // 113: if_icmpne +6 -> 119 /* */ // 116: goto +58 -> 174 /* */ // 119: aload_3 /* */ // 120: aload 9 /* */ // 122: iconst_0 /* */ // 123: iload 10 /* */ // 125: invokevirtual 342 java/util/zip/ZipOutputStream:write ([BII)V /* */ // 128: goto -27 -> 101 /* */ // 131: astore 10 /* */ // 133: getstatic 261 java/lang/System:out Ljava/io/PrintStream; /* */ // 136: new 85 java/lang/StringBuilder /* */ // 139: dup /* */ // 140: ldc_w 343 /* */ // 143: invokespecial 96 java/lang/StringBuilder: (Ljava/lang/String;)V /* */ // 146: aload 5 /* */ // 148: invokevirtual 168 java/util/zip/ZipEntry:getName ()Ljava/lang/String; /* */ // 151: invokevirtual 101 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder; /* */ // 154: ldc_w 345 /* */ // 157: invokevirtual 101 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder; /* */ // 160: aload 10 /* */ // 162: invokevirtual 347 java/io/IOException:getMessage ()Ljava/lang/String; /* */ // 165: invokevirtual 101 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder; /* */ // 168: invokevirtual 107 java/lang/StringBuilder:toString ()Ljava/lang/String; /* */ // 171: invokevirtual 350 java/io/PrintStream:println (Ljava/lang/String;)V /* */ // 174: aload_3 /* */ // 175: invokevirtual 352 java/util/zip/ZipOutputStream:closeEntry ()V /* */ // 178: aload 7 /* */ // 180: invokevirtual 355 java/io/InputStream:close ()V /* */ // 183: goto +32 -> 215 /* */ // 186: astore 8 /* */ // 188: getstatic 261 java/lang/System:out Ljava/io/PrintStream; /* */ // 191: new 85 java/lang/StringBuilder /* */ // 194: dup /* */ // 195: ldc_w 356 /* */ // 198: invokespecial 96 java/lang/StringBuilder: (Ljava/lang/String;)V /* */ // 201: aload 8 /* */ // 203: invokevirtual 347 java/io/IOException:getMessage ()Ljava/lang/String; /* */ // 206: invokevirtual 101 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder; /* */ // 209: invokevirtual 107 java/lang/StringBuilder:toString ()Ljava/lang/String; /* */ // 212: invokevirtual 350 java/io/PrintStream:println (Ljava/lang/String;)V /* */ // 215: aload 4 /* */ // 217: invokeinterface 202 1 0 /* */ // 222: ifne -185 -> 37 /* */ // 225: aload_1 /* */ // 226: invokevirtual 205 java/util/zip/ZipFile:close ()V /* */ // 229: aload_3 /* */ // 230: invokevirtual 358 java/util/zip/ZipOutputStream:close ()V /* */ // 233: goto +29 -> 262 /* */ // 236: astore 5 /* */ // 238: getstatic 261 java/lang/System:out Ljava/io/PrintStream; /* */ // 241: new 85 java/lang/StringBuilder /* */ // 244: dup /* */ // 245: ldc_w 359 /* */ // 248: invokespecial 96 java/lang/StringBuilder: (Ljava/lang/String;)V /* */ // 251: aload 5 /* */ // 253: invokevirtual 361 java/lang/StringBuilder:append (Ljava/lang/Object;)Ljava/lang/StringBuilder; /* */ // 256: invokevirtual 107 java/lang/StringBuilder:toString ()Ljava/lang/String; /* */ // 259: invokevirtual 350 java/io/PrintStream:println (Ljava/lang/String;)V /* */ // 262: new 286 java/io/File /* */ // 265: dup /* */ // 266: ldc -17 /* */ // 268: invokestatic 173 NET/worlds/network/URL:homeUnalias (Ljava/lang/String;)Ljava/lang/String; /* */ // 271: invokespecial 288 java/io/File: (Ljava/lang/String;)V /* */ // 274: astore 5 /* */ // 276: new 286 java/io/File /* */ // 279: dup /* */ // 280: ldc_w 318 /* */ // 283: invokestatic 173 NET/worlds/network/URL:homeUnalias (Ljava/lang/String;)Ljava/lang/String; /* */ // 286: invokespecial 288 java/io/File: (Ljava/lang/String;)V /* */ // 289: astore 6 /* */ // 291: new 286 java/io/File /* */ // 294: dup /* */ // 295: ldc_w 364 /* */ // 298: invokestatic 173 NET/worlds/network/URL:homeUnalias (Ljava/lang/String;)Ljava/lang/String; /* */ // 301: invokespecial 288 java/io/File: (Ljava/lang/String;)V /* */ // 304: astore 7 /* */ // 306: invokestatic 241 NET/worlds/core/Archive:flushAll ()V /* */ // 309: aload 5 /* */ // 311: aload 7 /* */ // 313: invokevirtual 366 java/io/File:renameTo (Ljava/io/File;)Z /* */ // 316: istore 8 /* */ // 318: aload 6 /* */ // 320: aload 5 /* */ // 322: invokevirtual 366 java/io/File:renameTo (Ljava/io/File;)Z /* */ // 325: istore 8 /* */ // 327: goto +13 -> 340 /* */ // 330: astore 8 /* */ // 332: getstatic 261 java/lang/System:out Ljava/io/PrintStream; /* */ // 335: aload 8 /* */ // 337: invokevirtual 267 java/io/PrintStream:println (Ljava/lang/Object;)V /* */ // 340: return /* */ // Line number table: /* */ // Java source line #293 -> byte code offset #0 /* */ // Java source line #295 -> byte code offset #14 /* */ // Java source line #296 -> byte code offset #17 /* */ // Java source line #297 -> byte code offset #19 /* */ // Java source line #299 -> byte code offset #28 /* */ // Java source line #300 -> byte code offset #34 /* */ // Java source line #302 -> byte code offset #37 /* */ // Java source line #303 -> byte code offset #49 /* */ // Java source line #304 -> byte code offset #56 /* */ // Java source line #309 -> byte code offset #66 /* */ // Java source line #310 -> byte code offset #74 /* */ // Java source line #311 -> byte code offset #88 /* */ // Java source line #313 -> byte code offset #94 /* */ // Java source line #318 -> byte code offset #101 /* */ // Java source line #319 -> byte code offset #110 /* */ // Java source line #320 -> byte code offset #119 /* */ // Java source line #321 -> byte code offset #128 /* */ // Java source line #322 -> byte code offset #131 /* */ // Java source line #324 -> byte code offset #133 /* */ // Java source line #325 -> byte code offset #146 /* */ // Java source line #324 -> byte code offset #171 /* */ // Java source line #330 -> byte code offset #174 /* */ // Java source line #331 -> byte code offset #178 /* */ // Java source line #332 -> byte code offset #183 /* */ // Java source line #333 -> byte code offset #186 /* */ // Java source line #334 -> byte code offset #188 /* */ // Java source line #300 -> byte code offset #215 /* */ // Java source line #341 -> byte code offset #225 /* */ // Java source line #342 -> byte code offset #229 /* */ // Java source line #343 -> byte code offset #233 /* */ // Java source line #344 -> byte code offset #236 /* */ // Java source line #345 -> byte code offset #238 /* */ // Java source line #349 -> byte code offset #262 /* */ // Java source line #350 -> byte code offset #276 /* */ // Java source line #351 -> byte code offset #291 /* */ // Java source line #353 -> byte code offset #306 /* */ // Java source line #356 -> byte code offset #309 /* */ // Java source line #358 -> byte code offset #318 /* */ // Java source line #360 -> byte code offset #327 /* */ // Java source line #361 -> byte code offset #330 /* */ // Java source line #362 -> byte code offset #332 /* */ // Java source line #364 -> byte code offset #340 /* */ // Local variable table: /* */ // start length slot name signature /* */ // 0 341 0 this PendingDrone /* */ // 0 341 1 contentZipArchive ZipFile /* */ // 13 2 2 os FileOutputStream /* */ // 19 5 2 os FileOutputStream /* */ // 17 2 3 e IOException /* */ // 27 203 3 zs java.util.zip.ZipOutputStream /* */ // 32 184 4 enums Enumeration /* */ // 47 100 5 ze ZipEntry /* */ // 236 16 5 e IOException /* */ // 274 47 5 origFile File /* */ // 54 3 6 filename String /* */ // 289 30 6 newFile File /* */ // 72 107 7 is InputStream /* */ // 304 8 7 oldFile File /* */ // 86 4 8 ze2 ZipEntry /* */ // 186 16 8 e IOException /* */ // 316 10 8 b boolean /* */ // 330 6 8 e Exception /* */ // 99 22 9 buffer byte[] /* */ // 108 16 10 bytesRead int /* */ // 131 30 10 e IOException /* */ // Exception table: /* */ // from to target type /* */ // 0 14 17 java/io/IOException /* */ // 101 116 131 java/io/IOException /* */ // 119 128 131 java/io/IOException /* */ // 66 183 186 java/io/IOException /* */ // 225 233 236 java/io/IOException /* */ // 309 327 330 java/lang/Exception /* */ } /* */ /* */ private void CopyAvatarFile(ZipFile patchArchive, ZipEntry ze, String avatarFile) /* */ { /* */ try /* */ { /* 372 */ is = patchArchive.getInputStream(ze); /* */ } catch (IOException e) { /* */ InputStream is; /* */ return; /* */ } /* */ InputStream is; /* 378 */ try { os = new FileOutputStream(avatarFile); /* */ } catch (IOException e) { /* */ try { /* */ FileOutputStream os; /* 382 */ is.close(); /* */ } /* */ catch (IOException localIOException1) {} /* */ /* */ return; /* */ } /* */ FileOutputStream os; /* 389 */ byte[] buffer = new byte['Ѐ']; /* */ try /* */ { /* */ for (;;) /* */ { /* 394 */ int bytesRead = is.read(buffer); /* 395 */ if (bytesRead == -1) /* */ break; /* 397 */ os.write(buffer, 0, bytesRead); /* */ } /* */ /* */ /* */ return; /* */ } /* */ catch (IOException localIOException2) /* */ { /* */ try /* */ { /* 407 */ is.close(); /* 408 */ os.close(); /* */ } /* */ catch (IOException localIOException3) {} /* */ } /* */ } /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\PendingDrone.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */