// WTF: this does not update packs!! // only updating info for selected pack. pulldown menus and info area! void updatePacks() { for (int i = 0; i < packPanels.size(); i++) { if (selectedPack == i && getIndex() >= 0) { ModPack pack = ModPack.getPackArray().get(getIndex()); if (pack != null) { String mods = ""; if (pack.getMods() != null) { mods += "<p>This pack contains the following mods by default:</p><ul>"; for (String name : pack.getMods()) { mods += "<li>" + name + "</li>"; } mods += "</ul>"; } packPanels.get(i).setBackground(UIManager.getColor("control").darker().darker()); packPanels.get(i).setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); File tempDir = new File( OSUtils.getCacheStorageLocation(), "ModPacks" + File.separator + pack.getDir()); packInfo.setText( "<html><img src='file:///" + tempDir.getPath() + File.separator + pack.getImageName() + "' width=400 height=200></img> <br>" + pack.getInfo() + mods); packInfo.setCaretPosition(0); if (ModPack.getSelectedPack(isFTB()).getServerUrl().equals("") || ModPack.getSelectedPack(isFTB()).getServerUrl() == null) { server.setEnabled(false); } else { server.setEnabled(true); } String tempVer = Settings.getSettings().getPackVer(pack.getDir()); version.removeActionListener(al); version.removeAllItems(); version.addItem("Recommended"); if (pack.getOldVersions() != null) { for (String s : pack.getOldVersions()) { version.addItem(s); } version.setSelectedItem(tempVer); } version.addActionListener(al); } } else { packPanels.get(i).setBackground(UIManager.getColor("control")); packPanels.get(i).setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } } }
public static void cleanUp() { ModPack pack = ModPack.getSelectedPack(); File tempFolder = new File(OSUtils.getDynamicStorageLocation(), "ModPacks" + sep + pack.getDir() + sep); for (String file : tempFolder.list()) { if (!file.equals(pack.getLogoName()) && !file.equals(pack.getImageName()) && !file.equals("version") && !file.equals(pack.getAnimation())) { try { if (Settings.getSettings().getDebugLauncher() && file.endsWith(".zip")) { Logger.logInfo("debug: retaining modpack file: " + tempFolder + File.separator + file); } else { FileUtils.delete(new File(tempFolder, file)); } } catch (IOException e) { Logger.logError(e.getMessage(), e); } } } }