/* */ package NET.worlds.scape; /* */ /* */ import NET.worlds.console.Console; /* */ import NET.worlds.network.URL; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class WobLoader /* */ implements BGLoaded /* */ { /* */ private WobLoaded loaded; /* */ private URL origURL; /* */ SuperRoot value; /* */ /* */ public WobLoader(URL url, WobLoaded loaded) /* */ { /* 31 */ this(url, loaded, false); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ public WobLoader(URL url, WobLoaded loaded, boolean immediate) /* */ { /* 41 */ this.origURL = url; /* 42 */ this.loaded = loaded; /* */ /* 44 */ if (url.endsWith(".class")) { /* 45 */ String s = url.getAbsolute(); /* 46 */ if (s.startsWith("system:")) { /* 47 */ int len = s.length(); /* */ try { /* 49 */ Class c = Class.forName(s.substring(7, len - 6)); /* 50 */ SuperRoot sr = (SuperRoot)c.newInstance(); /* 51 */ sr.loadInit(); /* 52 */ gotIt(sr); /* */ } catch (Exception e) { /* 54 */ e.printStackTrace(System.out); /* 55 */ Console.println("Can't make instance of class " + url); /* 56 */ gotIt(null); /* */ } /* 58 */ return; /* */ } /* */ } /* */ /* 62 */ if (immediate) { /* 63 */ String s = url.unalias(); /* 64 */ if (s.indexOf(':') > 1) { /* 65 */ gotIt(null); /* */ } else /* 67 */ syncBackgroundLoad(asyncBackgroundLoad(s, url), url); /* */ } else { /* 69 */ BackgroundLoader.get(this, url); /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static SuperRoot immediateLoad(URL url) /* */ { /* 80 */ WobLoader w = new WobLoader(url, null, true); /* 81 */ return w.value; /* */ } /* */ /* */ public Object asyncBackgroundLoad(String localName, URL remoteURL) { /* 85 */ if (remoteURL.endsWith(".class")) { /* 86 */ return WobClassLoader.get(localName, remoteURL.getClassName()); /* */ } /* 88 */ return localName; /* */ } /* */ /* */ public boolean syncBackgroundLoad(Object obj, URL remoteURL) /* */ { /* 93 */ SuperRoot sr = null; /* */ /* 95 */ if (obj != null) { /* 96 */ if ((obj instanceof String)) { /* 97 */ sr = SuperRoot.readFile((String)obj, remoteURL); /* */ } else { /* */ try { /* 100 */ sr = (SuperRoot)((Class)obj).newInstance(); /* 101 */ sr.loadInit(); /* */ } catch (Exception e) { /* 103 */ e.printStackTrace(System.out); /* */ } /* */ } /* */ } /* 107 */ gotIt(sr); /* 108 */ return false; /* */ } /* */ /* */ /* */ /* */ private void gotIt(SuperRoot s) /* */ { /* 115 */ if (s != null) { /* 116 */ s.setSourceURL(this.origURL); /* */ } /* 118 */ this.value = s; /* 119 */ if (this.loaded != null) { /* 120 */ this.loaded.wobLoaded(this, s); /* */ } /* */ } /* */ /* */ public Room getBackgroundLoadRoom() { /* 125 */ if ((this.loaded instanceof SuperRoot)) { /* 126 */ SuperRoot o = (SuperRoot)this.loaded; /* */ /* 128 */ while (o != null) { /* 129 */ if ((o instanceof WObject)) /* 130 */ return ((WObject)o).getRoom(); /* 131 */ o = o.getOwner(); /* */ } /* */ } /* */ /* 135 */ return null; /* */ } /* */ /* 138 */ public URL getWobName() { return this.origURL; } /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\WobLoader.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */