client.notifyStarted(zf.size());
while (list.hasMoreElements() && !canceled) {
ZipEntry ze = list.nextElement();
BufferedInputStream bis = new BufferedInputStream(zf.getInputStream(ze));
String name = ze.getName();
client.notifyMessage(DcResources.getText("msgProcessingFileX", name));
if (name.toLowerCase().endsWith(".xsl")) {
// directory name is contained in the name
writeToFile(bis, new File(DataCrow.reportDir, name));
} else if (name.toLowerCase().endsWith(".jpg")) {
String moduleName = name.substring(0, name.indexOf("_"));
Collection<DcImageIcon> c = icons.get(moduleName);
c = c == null ? new ArrayList<DcImageIcon>() : c;
int size = (int) ze.getSize();
byte[] bytes = new byte[size];
bis.read(bytes);
DcImageIcon icon = new DcImageIcon(bytes);
icon.setFilename(name.substring(name.indexOf("_") + 1));
c.add(icon);
icons.put(moduleName, c);
} else if (name.toLowerCase().endsWith(".properties")) {
writeToFile(bis, new File(DataCrow.moduleDir, name));
} else if (name.toLowerCase().endsWith(".xml")) {
File file = new File(System.getProperty("java.io.tmpdir"), name);
writeToFile(bis, file);
file.deleteOnExit();
data.put(name.substring(0, name.toLowerCase().indexOf(".xml")), file);
} else if (name.toLowerCase().endsWith(".jar")) {
// check if the custom module does not already exist
if (DcModules.get(name.substring(0, name.indexOf(".jar"))) == null) {
writeToFile(bis, new File(DataCrow.moduleDir, name));
ModuleJar moduleJar = new ModuleJar(name);
moduleJar.load();
modules.add(moduleJar);
}
}
client.notifyProcessed();
bis.close();
}
processData(icons, data);
reindexModules(modules);