- Timestamp:
- Apr 12, 2013, 7:37:24 PM (12 years ago)
- Location:
- java/installer2/src/net/oni2/aeinstaller/backend/oni/management
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
java/installer2/src/net/oni2/aeinstaller/backend/oni/management/Installer.java
r804 r809 70 70 71 71 /** 72 * @return list of currently installed mods73 */74 public static Vector<Integer> getInstalledMods() {75 File installCfg = new File(Paths.getEditionGDF(), "installed_mods.xml");76 return PackageManager.getInstance().loadModSelection(installCfg);77 }78 79 /**80 72 * Install the given set of mods 81 73 * … … 115 107 log.println(); 116 108 117 Paths.getEditionGDF().mkdirs(); 118 for (File f : Paths.getEditionGDF().listFiles(new FilenameFilter() { 119 public boolean accept(File arg0, String arg1) { 120 String s = arg1.toLowerCase(); 121 return s.endsWith(".dat") 122 || s.endsWith(".raw") 123 || s.endsWith(".sep") 124 || (s.equals("intro.bik") && !SettingsManager 125 .getInstance().get("copyintro", false)) 126 || (s.equals("outro.bik") && !SettingsManager 127 .getInstance().get("copyoutro", false)); 128 } 129 })) { 130 f.delete(); 131 } 109 HashSet<String> levelsAffectedBefore = null; 110 if (ModInstallationList.getInstance().isLoadedFromFile()) { 111 levelsAffectedBefore = ModInstallationList.getInstance() 112 .getAffectedLevels(); 113 } 114 HashSet<String> levelsAffectedNow = new HashSet<String>(); 115 // TODO: fill set 116 132 117 File IGMD = new File(Paths.getEditionGDF(), "IGMD"); 133 118 if (IGMD.exists()) { … … 149 134 } 150 135 } 151 152 File installCfg = new File(Paths.getEditionGDF(), "installed_mods.xml");153 PackageManager.getInstance().saveModSelection(installCfg, mods);154 136 155 137 TreeSet<Integer> unlockLevels = new TreeSet<Integer>(); … … 217 199 if (levelF.isDirectory()) { 218 200 levelN = fn; 201 levelsAffectedNow.add(fn.toLowerCase()); 219 202 } else if (fn.endsWith(".dat")) { 220 203 levelN = fn.substring(0, fn.lastIndexOf('.')).toLowerCase(); … … 228 211 } 229 212 213 Paths.getEditionGDF().mkdirs(); 214 for (File f : Paths.getEditionGDF().listFiles(new FilenameFilter() { 215 public boolean accept(File arg0, String arg1) { 216 String s = arg1.toLowerCase(); 217 return s.endsWith(".dat") 218 || s.endsWith(".raw") 219 || s.endsWith(".sep") 220 || (s.equals("intro.bik") && !SettingsManager 221 .getInstance().get("copyintro", false)) 222 || (s.equals("outro.bik") && !SettingsManager 223 .getInstance().get("copyoutro", false)); 224 } 225 })) { 226 String l = f.getName().toLowerCase(); 227 l = l.substring(0, l.length() - 4); 228 if ((levelsAffectedBefore == null) 229 || levelsAffectedBefore.contains(l) 230 || levelsAffectedNow.contains(l)) 231 f.delete(); 232 } 233 230 234 applyPatches(levels, foldersPatches, listener, log); 231 235 232 combineBinaryFiles(levels, listener, log); 236 TreeSet<String> levelsAffectedBoth = new TreeSet<String>(); 237 levelsAffectedBoth.addAll(levelsAffectedBefore); 238 levelsAffectedBoth.addAll(levelsAffectedNow); 239 combineBinaryFiles(levels, levelsAffectedBoth, listener, log); 233 240 combineBSLFolders(mods, listener, log); 234 241 … … 238 245 unlockLevels(unlockLevels, log); 239 246 } 247 248 ModInstallationList mil = ModInstallationList.getInstance(); 249 mil.setAffectedLevels(levelsAffectedNow); 250 TreeSet<Integer> modsInstalled = new TreeSet<Integer>(); 251 for (Package p : mods) { 252 modsInstalled.add(p.getPackageNumber()); 253 } 254 mil.setInstalledMods(modsInstalled); 255 mil.saveList(); 240 256 241 257 log.println(); … … 509 525 private static void combineBinaryFiles( 510 526 TreeMap<String, Vector<File>> oniLevelFolders, 511 InstallProgressListener listener, Logger log) { 527 TreeSet<String> levelsUpdated, InstallProgressListener listener, 528 Logger log) { 512 529 long startMS = new Date().getTime(); 513 530 … … 522 539 "Installing level " + l); 523 540 524 ApplicationInvocationResult res = OniSplit.packLevel( 525 oniLevelFolders.get(l), new File(Paths.getEditionGDF(), 526 sanitizeLevelName(l) + ".dat")); 527 log.logAppOutput(res, true); 541 if (levelsUpdated.contains(l.toLowerCase())) { 542 ApplicationInvocationResult res = OniSplit.packLevel( 543 oniLevelFolders.get(l), new File(Paths.getEditionGDF(), 544 sanitizeLevelName(l) + ".dat")); 545 log.logAppOutput(res, true); 546 } else { 547 log.println("\t\tLevel not affected by new mod selection"); 548 log.println(); 549 } 528 550 529 551 stepsDone++; … … 539 561 if (SettingsManager.getInstance().get("copyintro", false)) { 540 562 File src = new File(Paths.getVanillaGDF(), "intro.bik"); 563 File target = new File(Paths.getEditionGDF(), "intro.bik"); 541 564 log.println("Copying intro"); 542 if (src.exists() ) {565 if (src.exists() && !target.exists()) { 543 566 try { 544 567 FileUtils.copyFileToDirectory(src, Paths.getEditionGDF()); … … 552 575 if (SettingsManager.getInstance().get("copyoutro", true)) { 553 576 File src = new File(Paths.getVanillaGDF(), "outro.bik"); 577 File target = new File(Paths.getEditionGDF(), "outro.bik"); 554 578 log.println("Copying outro"); 555 if (src.exists() ) {579 if (src.exists() && !target.exists()) { 556 580 try { 557 581 FileUtils.copyFileToDirectory(src, Paths.getEditionGDF());
Note:
See TracChangeset
for help on using the changeset viewer.