/* */ package NET.worlds.scape; /* */ /* */ import NET.worlds.core.Archive; /* */ import NET.worlds.network.URL; /* */ import java.net.MalformedURLException; /* */ import java.util.Enumeration; /* */ import java.util.Vector; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class PosableDroneLoader /* */ implements Runnable /* */ { /* */ static final boolean debug = false; /* */ DroneLoader loader; /* 156 */ private static boolean useCachedFiles = ; /* */ private Vector droneList; /* */ /* */ PosableDroneLoader() { /* 160 */ this.droneList = new Vector(); /* */ } /* */ /* 163 */ public static boolean usingCache() { return useCachedFiles; } /* */ /* */ public static PendingDrone makePendingDrone(PosableDrone _drone, URL _url) /* */ { /* 167 */ if (useCachedFiles) { /* 168 */ return new PendingCacheDrone(_drone, _url); /* */ } /* 170 */ return new PendingDrone(_drone, _url); /* */ } /* */ /* */ public void load(PosableDrone _drone, URL _url) /* */ { /* 175 */ PendingDrone pd = makePendingDrone(_drone, _url); /* */ /* 177 */ this.droneList.addElement(pd); /* */ /* */ /* 180 */ if (this.loader != null) { this.loader.wakeUp(); /* */ } /* */ } /* */ /* */ public boolean isPending(PosableDrone _drone, URL _url) /* */ { /* 186 */ Vector listCopy = (Vector)this.droneList.clone(); /* 187 */ Enumeration enums = listCopy.elements(); /* 188 */ while (enums.hasMoreElements()) /* */ { /* 190 */ PendingDrone pd = (PendingDrone)enums.nextElement(); /* 191 */ if (pd.getUrl().toString().equals(_url.toString())) /* */ { /* 193 */ if (pd.getDrone().toString().equals(_drone.toString())) /* 194 */ return true; /* */ } /* */ } /* 197 */ return false; /* */ } /* */ /* */ public void run() /* */ { /* 202 */ this.loader = new DroneLoader(); /* */ /* */ for (;;) /* */ { /* 206 */ this.loader.load(this.droneList); /* */ } /* */ } /* */ /* */ public static String getAvatarBaseName(URL pUrl) /* */ { /* 212 */ String s = null; /* */ /* */ /* 215 */ int dot = pUrl.getAbsolute().indexOf('.'); /* 216 */ if (dot != -1) /* */ { /* 218 */ s = pUrl.getAbsolute().substring(7, dot); /* */ } /* */ /* 221 */ return s; /* */ } /* */ /* */ /* */ public static boolean avatarExistsLocally(URL pUrl) /* */ throws MalformedURLException /* */ { /* 228 */ if (useCachedFiles) { /* 229 */ return false; /* */ } /* */ /* 232 */ if (pUrl.toString().equals(PosableShape.getDefaultURL().toString())) /* */ { /* 234 */ return true; /* */ } /* */ /* 237 */ if (!pUrl.getAbsolute().substring(0, 7).equals("avatar:")) { /* 238 */ throw new MalformedURLException("Not an avatar URL"); /* */ } /* 240 */ String s = getAvatarBaseName(pUrl); /* */ /* 242 */ if (s == null) { /* 243 */ throw new MalformedURLException("No file extension"); /* */ } /* 245 */ URL realFile = URL.make(pUrl, s + ".bod"); /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 253 */ return Archive.exists(realFile.unalias()); /* */ } /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\PosableDroneLoader.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */