Changeset 631 for AE/installer2/src/net/oni2/aeinstaller/backend
- Timestamp:
- Jan 18, 2013, 4:45:11 PM (12 years ago)
- Location:
- AE/installer2/src/net/oni2/aeinstaller/backend
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/installer2/src/net/oni2/aeinstaller/backend/mods/Mod.java
r623 r631 216 216 } 217 217 218 private String getSanitizedPathName() { 219 return name.replaceAll("[^a-zA-Z0-9_.-]", "_"); 220 } 221 218 222 /** 219 223 * @return Path to local mod folder … … 233 237 } 234 238 235 return new File(Paths.getModsPath(), folderStart); 239 return new File(Paths.getModsPath(), folderStart 240 + getSanitizedPathName()); 236 241 } 237 242 … … 254 259 255 260 /** 261 * @return Is mod installed? 262 */ 263 public boolean isInstalled() { 264 return ModManager.getInstance().isModInstalled(this); 265 } 266 267 /** 256 268 * @return Name of mod 257 269 */ … … 376 388 return exeFile; 377 389 } 390 378 391 /** 379 392 * @return Icon file of this tool -
AE/installer2/src/net/oni2/aeinstaller/backend/mods/ModManager.java
r626 r631 334 334 * @return Is mod installed? 335 335 */ 336 publicboolean isModInstalled(Mod m) {336 boolean isModInstalled(Mod m) { 337 337 return currentlyInstalled.contains(m.getPackageNumber()); 338 338 } -
AE/installer2/src/net/oni2/aeinstaller/backend/oni/Installer.java
r625 r631 8 8 import java.io.FilenameFilter; 9 9 import java.io.IOException; 10 import java.io.InputStream; 10 11 import java.io.PrintWriter; 11 12 import java.text.SimpleDateFormat; … … 19 20 import java.util.Vector; 20 21 22 import net.oni2.aeinstaller.AEInstaller2; 21 23 import net.oni2.aeinstaller.backend.Paths; 22 24 import net.oni2.aeinstaller.backend.Settings; … … 244 246 combineBSLFolders(mods, listener); 245 247 246 if (Settings.getInstance().get("copyintro", false)) { 247 File src = new File(Paths.getVanillaGDF(), "intro.bik"); 248 if (src.exists()) { 249 try { 250 FileUtils.copyFileToDirectory(src, Paths.getEditionGDF()); 251 } catch (IOException e) { 252 e.printStackTrace(); 253 } 254 } 255 } 256 if (Settings.getInstance().get("copyoutro", true)) { 257 File src = new File(Paths.getVanillaGDF(), "outro.bik"); 258 if (src.exists()) { 259 try { 260 FileUtils.copyFileToDirectory(src, Paths.getEditionGDF()); 261 } catch (IOException e) { 262 e.printStackTrace(); 263 } 264 } 265 } 248 copyVideos(); 266 249 267 250 if (unlockLevels.size() > 0) { 268 File dat = new File(Paths.getEditionBasePath(), "persist.dat"); 269 if (dat.exists()) { 270 PersistDat save = new PersistDat(dat); 271 HashSet<Integer> currentlyUnlocked = save.getUnlockedLevels(); 272 currentlyUnlocked.addAll(unlockLevels); 273 save.setUnlockedLevels(currentlyUnlocked); 274 save.close(); 275 } else { 276 // TODO: what if persist.dat does not exist? 277 } 251 unlockLevels(unlockLevels); 278 252 } 279 253 } … … 445 419 } 446 420 421 private static void copyVideos() { 422 if (Settings.getInstance().get("copyintro", false)) { 423 File src = new File(Paths.getVanillaGDF(), "intro.bik"); 424 if (src.exists()) { 425 try { 426 FileUtils.copyFileToDirectory(src, Paths.getEditionGDF()); 427 } catch (IOException e) { 428 e.printStackTrace(); 429 } 430 } 431 } 432 if (Settings.getInstance().get("copyoutro", true)) { 433 File src = new File(Paths.getVanillaGDF(), "outro.bik"); 434 if (src.exists()) { 435 try { 436 FileUtils.copyFileToDirectory(src, Paths.getEditionGDF()); 437 } catch (IOException e) { 438 e.printStackTrace(); 439 } 440 } 441 } 442 } 443 444 private static void unlockLevels(HashSet<Integer> unlockLevels) { 445 File dat = new File(Paths.getEditionBasePath(), "persist.dat"); 446 if (!dat.exists()) { 447 InputStream is = AEInstaller2.class.getResourceAsStream("/net/oni2/aeinstaller/resources/persist.dat"); 448 try { 449 FileUtils.copyInputStreamToFile(is, dat); 450 } catch (IOException e) { 451 // TODO Auto-generated catch block 452 e.printStackTrace(); 453 } 454 } 455 PersistDat save = new PersistDat(dat); 456 HashSet<Integer> currentlyUnlocked = save.getUnlockedLevels(); 457 currentlyUnlocked.addAll(unlockLevels); 458 save.setUnlockedLevels(currentlyUnlocked); 459 save.close(); 460 } 461 447 462 /** 448 463 * Initializes the Edition core
Note:
See TracChangeset
for help on using the changeset viewer.