Changeset 653
- Timestamp:
- Jan 25, 2013, 3:57:36 PM (12 years ago)
- Location:
- AE/installer2/src/net/oni2/aeinstaller
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/installer2/src/net/oni2/aeinstaller/AEInstaller.properties
r651 r653 1 1 appname=AE Installer 2 2 appversion=0.99 f2 appversion=0.99g -
AE/installer2/src/net/oni2/aeinstaller/AEInstaller2.java
r651 r653 60 60 e.printStackTrace(); 61 61 } 62 } 63 64 private static void initBundles() { 65 File localesDir = new File(Paths.getInstallerPath(), "locales"); 66 if (localesDir.isDirectory()) 67 addClassPath(localesDir); 68 imagesBundle = ResourceBundle.getBundle("net.oni2.aeinstaller.Images"); 69 basicBundle = ResourceBundle 70 .getBundle("net.oni2.aeinstaller.AEInstaller"); 71 globalBundle = ResourceBundle 72 .getBundle("net.oni2.aeinstaller.localization.Global"); 62 73 } 63 74 … … 107 118 } 108 119 } 120 121 initBundles(); 109 122 110 123 if (Settings.getPlatform() == Platform.MACOS) … … 115 128 Settings.setDebug(debug); 116 129 Settings.getInstance().setNoCacheUpdateMode(noCacheUpdate); 117 118 File localesDir = new File(Paths.getInstallerPath(), "locales");119 if (localesDir.isDirectory())120 addClassPath(localesDir);121 imagesBundle = ResourceBundle.getBundle("net.oni2.aeinstaller.Images");122 basicBundle = ResourceBundle123 .getBundle("net.oni2.aeinstaller.AEInstaller");124 globalBundle = ResourceBundle125 .getBundle("net.oni2.aeinstaller.localization.Global");126 130 127 131 SwingJavaBuilder.getConfig().addResourceBundle(imagesBundle); -
AE/installer2/src/net/oni2/aeinstaller/backend/oni/Installer.java
r648 r653 213 213 } 214 214 215 File logFile = new File(Paths.getInstallerPath(), "Installation.log"); 216 PrintWriter log = null; 217 try { 218 log = new PrintWriter(logFile); 219 } catch (FileNotFoundException e) { 220 e.printStackTrace(); 221 } 222 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 223 Date start = new Date(); 224 log.println("Installation of mods started at " + sdf.format(start)); 225 226 log.println(); 227 log.println("Installed tools:"); 228 for (Package t : PackageManager.getInstance().getInstalledTools()) { 229 log.println(String.format(" - %s (%s)", t.getName(), t.getVersion())); 230 } 231 log.println("Installing mods:"); 232 for (Package m : mods) { 233 log.println(String.format(" - %s (%s)", m.getName(), m.getVersion())); 234 } 235 log.println(); 236 215 237 File installCfg = new File(Paths.getEditionGDF(), "installed_mods.xml"); 216 238 PackageManager.getInstance().saveModSelection(installCfg, mods); 217 239 218 HashSet<Integer> unlockLevels = new HashSet<Integer>();240 TreeSet<Integer> unlockLevels = new TreeSet<Integer>(); 219 241 220 242 Vector<File> foldersOni = new Vector<File>(); … … 243 265 } 244 266 } 245 combineBinaryFiles(foldersOni, listener );246 combineBSLFolders(mods, listener );247 248 copyVideos( );267 combineBinaryFiles(foldersOni, listener, log); 268 combineBSLFolders(mods, listener, log); 269 270 copyVideos(log); 249 271 250 272 if (unlockLevels.size() > 0) { 251 unlockLevels(unlockLevels); 252 } 273 unlockLevels(unlockLevels, log); 274 } 275 276 Date end = new Date(); 277 log.println("Initialization ended at " + sdf.format(end)); 278 log.println("Process took " 279 + ((end.getTime() - start.getTime()) / 1000) + " seconds"); 280 log.close(); 253 281 } 254 282 255 283 private static void combineBSLFolders(TreeSet<Package> mods, 256 InstallProgressListener listener ) {284 InstallProgressListener listener, PrintWriter log) { 257 285 listener.installProgressUpdate(95, 100, "Installing BSL files"); 286 log.println("Installing BSL files"); 258 287 259 288 HashMap<EBSLInstallType, Vector<Package>> modsToInclude = new HashMap<EBSLInstallType, Vector<Package>>(); … … 351 380 352 381 private static void combineBinaryFiles(List<File> srcFoldersFiles, 353 InstallProgressListener listener ) {382 InstallProgressListener listener, PrintWriter log) { 354 383 TreeMap<String, Vector<File>> levels = new TreeMap<String, Vector<File>>(); 355 384 … … 379 408 totalSteps++; 380 409 381 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");382 383 File logFile = new File(Paths.getInstallerPath(), "Installation.log");384 PrintWriter log = null;385 try {386 log = new PrintWriter(logFile);387 } catch (FileNotFoundException e) {388 e.printStackTrace();389 }390 391 Date start = new Date();392 log.println("Installation of mods started at " + sdf.format(start));393 394 410 log.println("Importing levels"); 395 411 for (String l : levels.keySet()) { … … 411 427 stepsDone++; 412 428 } 413 414 Date end = new Date(); 415 log.println("Initialization ended at " + sdf.format(end)); 416 log.println("Process took " 417 + ((end.getTime() - start.getTime()) / 1000) + " seconds"); 418 log.close(); 419 } 420 421 private static void copyVideos() { 429 } 430 431 private static void copyVideos(PrintWriter log) { 422 432 if (Settings.getInstance().get("copyintro", false)) { 423 433 File src = new File(Paths.getVanillaGDF(), "intro.bik"); 434 log.println("Copying intro"); 424 435 if (src.exists()) { 425 436 try { … … 432 443 if (Settings.getInstance().get("copyoutro", true)) { 433 444 File src = new File(Paths.getVanillaGDF(), "outro.bik"); 445 log.println("Copying outro"); 434 446 if (src.exists()) { 435 447 try { … … 442 454 } 443 455 444 private static void unlockLevels(HashSet<Integer> unlockLevels) { 456 private static void unlockLevels(TreeSet<Integer> unlockLevels, 457 PrintWriter log) { 445 458 File dat = new File(Paths.getEditionBasePath(), "persist.dat"); 459 log.println("Unlocking levels: " + unlockLevels.toString()); 446 460 if (!dat.exists()) { 447 InputStream is = AEInstaller2.class.getResourceAsStream("/net/oni2/aeinstaller/resources/persist.dat"); 461 InputStream is = AEInstaller2.class 462 .getResourceAsStream("/net/oni2/aeinstaller/resources/persist.dat"); 448 463 try { 449 464 FileUtils.copyInputStreamToFile(is, dat);
Note:
See TracChangeset
for help on using the changeset viewer.