Changeset 749 for java/installer2/src/net/oni2/aeinstaller
- Timestamp:
- Mar 26, 2013, 6:26:41 PM (12 years ago)
- Location:
- java/installer2/src/net/oni2/aeinstaller
- Files:
-
- 4 added
- 2 deleted
- 8 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
java/installer2/src/net/oni2/aeinstaller/AEInstaller.properties
r730 r749 1 1 appname=AE Installer 2 2 appversion=0.99 w2 appversion=0.99x -
java/installer2/src/net/oni2/aeinstaller/AEInstaller2.java
r735 r749 25 25 import net.oni2.aeinstaller.backend.Paths; 26 26 import net.oni2.aeinstaller.backend.SizeFormatter; 27 import net.oni2.aeinstaller.backend.depot.DepotManager;28 import net.oni2.aeinstaller.backend.oni.Installer;29 27 import net.oni2.aeinstaller.backend.oni.OniSplit; 28 import net.oni2.aeinstaller.backend.oni.management.Installer; 30 29 import net.oni2.aeinstaller.gui.HTMLLinkLabel; 31 30 import net.oni2.aeinstaller.gui.MainWin; 31 import net.oni2.moddepot.DepotManager; 32 32 import net.oni2.platformtools.PlatformInformation; 33 33 import net.oni2.platformtools.PlatformInformation.Platform; … … 117 117 boolean debug = false; 118 118 boolean noCacheUpdate = false; 119 boolean offline = false; 119 120 for (String a : args) { 120 121 if (a.equalsIgnoreCase("-debug")) … … 122 123 if (a.equalsIgnoreCase("-nocacheupdate")) 123 124 noCacheUpdate = true; 125 if (a.equalsIgnoreCase("-offline")) 126 offline = true; 124 127 } 125 128 if (!debug) { … … 239 242 } 240 243 241 boolean offline = false;242 for (String a : args)243 if (a.equalsIgnoreCase("-offline"))244 offline = true;245 244 if (!offline) { 246 245 offline = !DepotManager.getInstance().checkConnection(); -
java/installer2/src/net/oni2/aeinstaller/DepotPackageCheck.java
r741 r749 4 4 import java.util.HashSet; 5 5 6 import net.oni2. aeinstaller.backend.depot.DepotConfig;7 import net.oni2. aeinstaller.backend.depot.DepotManager;8 import net.oni2. aeinstaller.backend.depot.model.Node;9 import net.oni2. aeinstaller.backend.depot.model.NodeMod;6 import net.oni2.moddepot.DepotConfig; 7 import net.oni2.moddepot.DepotManager; 8 import net.oni2.moddepot.model.Node; 9 import net.oni2.moddepot.model.NodeMod; 10 10 11 11 /** … … 34 34 HashMap<String, HashSet<NodeMod>> foundNodes = new HashMap<String, HashSet<NodeMod>>(); 35 35 for (Node n : DepotManager.getInstance().getNodesByType( 36 DepotConfig. getNodeType_Mod())) {36 DepotConfig.nodeType_Package)) { 37 37 NodeMod nm = (NodeMod) n; 38 38 if (nm.getUploads().size() != 1) { 39 if (!foundNodes.containsKey(nm.getInstallMethod() .getName()))40 foundNodes.put(nm.getInstallMethod() .getName(),39 if (!foundNodes.containsKey(nm.getInstallMethod())) 40 foundNodes.put(nm.getInstallMethod(), 41 41 new HashSet<NodeMod>()); 42 foundNodes.get(nm.getInstallMethod() .getName()).add(nm);42 foundNodes.get(nm.getInstallMethod()).add(nm); 43 43 } 44 44 } -
java/installer2/src/net/oni2/aeinstaller/backend/oni/management/InstallProgressListener.java
r722 r749 1 package net.oni2.aeinstaller.backend.oni ;1 package net.oni2.aeinstaller.backend.oni.management; 2 2 3 3 /** -
java/installer2/src/net/oni2/aeinstaller/backend/oni/management/Installer.java
r744 r749 1 package net.oni2.aeinstaller.backend.oni ;1 package net.oni2.aeinstaller.backend.oni.management; 2 2 3 3 import java.io.File; 4 4 import java.io.FileFilter; 5 import java.io.FileInputStream;6 5 import java.io.FileNotFoundException; 7 import java.io.FileOutputStream;8 6 import java.io.FilenameFilter; 9 7 import java.io.IOException; … … 15 13 import java.util.HashSet; 16 14 import java.util.List; 17 import java.util.Scanner;18 15 import java.util.TreeMap; 19 16 import java.util.TreeSet; … … 25 22 import net.oni2.aeinstaller.backend.CaseInsensitiveFile; 26 23 import net.oni2.aeinstaller.backend.Paths; 24 import net.oni2.aeinstaller.backend.oni.OniSplit; 25 import net.oni2.aeinstaller.backend.oni.PersistDat; 26 import net.oni2.aeinstaller.backend.oni.XMLTools; 27 27 import net.oni2.aeinstaller.backend.packages.EBSLInstallType; 28 28 import net.oni2.aeinstaller.backend.packages.Package; … … 38 38 39 39 import com.paour.NaturalOrderComparator; 40 import com.thoughtworks.xstream.XStream;41 import com.thoughtworks.xstream.io.xml.StaxDriver;42 40 43 41 /** … … 53 51 54 52 /** 53 * Verify that the Edition is within a subfolder to vanilla Oni 54 * (..../Oni/Edition/AEInstaller) 55 * 56 * @return true if GDF can be found in the parent's parent-path 57 */ 58 public static boolean verifyRunningDirectory() { 59 return Paths.getVanillaGDF().exists() 60 && Paths.getVanillaGDF().isDirectory(); 61 } 62 63 /** 55 64 * @return Is Edition Core initialized 56 65 */ 57 66 public static boolean isEditionInitialized() { 58 67 return Paths.getVanillaOnisPath().exists(); 59 }60 61 private static void createEmptyPath(File path) throws IOException {62 if (path.exists())63 FileUtils.deleteDirectory(path);64 path.mkdirs();65 68 } 66 69 … … 71 74 File installCfg = new File(Paths.getEditionGDF(), "installed_mods.xml"); 72 75 return PackageManager.getInstance().loadModSelection(installCfg); 73 }74 75 /**76 * @return Currently installed tools77 */78 @SuppressWarnings("unchecked")79 public static TreeSet<Integer> getInstalledTools() {80 File installCfg = new File(Paths.getInstallerPath(),81 "installed_tools.xml");82 TreeSet<Integer> res = new TreeSet<Integer>();83 try {84 if (installCfg.exists()) {85 FileInputStream fis = new FileInputStream(installCfg);86 XStream xs = new XStream(new StaxDriver());87 Object obj = xs.fromXML(fis);88 if (obj instanceof TreeSet<?>)89 res = (TreeSet<Integer>) obj;90 fis.close();91 }92 } catch (FileNotFoundException e) {93 e.printStackTrace();94 } catch (IOException e) {95 e.printStackTrace();96 }97 return res;98 }99 100 private static void writeInstalledTools(TreeSet<Integer> tools) {101 File installCfg = new File(Paths.getInstallerPath(),102 "installed_tools.xml");103 try {104 FileOutputStream fos = new FileOutputStream(installCfg);105 XStream xs = new XStream(new StaxDriver());106 xs.toXML(tools, fos);107 fos.close();108 } catch (FileNotFoundException e) {109 e.printStackTrace();110 } catch (IOException e) {111 e.printStackTrace();112 }113 }114 115 /**116 * @param tools117 * Tools to (un)install118 * @param uninstall119 * Uninstall tools or install?120 */121 public static void installTools(TreeSet<Package> tools, boolean uninstall) {122 TreeSet<Integer> installed = getInstalledTools();123 for (Package m : tools) {124 if (!uninstall || installed.contains(m.getPackageNumber())) {125 File plain = CaseInsensitiveFile.getCaseInsensitiveFile(126 m.getLocalPath(), "plain");127 if (plain.exists()) {128 if (m.hasSeparatePlatformDirs()) {129 File plainCommon = CaseInsensitiveFile130 .getCaseInsensitiveFile(plain, "common");131 File plainMac = CaseInsensitiveFile132 .getCaseInsensitiveFile(plain, "mac_only");133 File plainWin = CaseInsensitiveFile134 .getCaseInsensitiveFile(plain, "win_only");135 if (plainCommon.exists())136 copyRemoveToolsFiles(plainCommon,137 Paths.getEditionBasePath(), uninstall);138 if (PlatformInformation.getPlatform() == Platform.MACOS139 && plainMac.exists())140 copyRemoveToolsFiles(plainMac,141 Paths.getEditionBasePath(), uninstall);142 else if (plainWin.exists())143 copyRemoveToolsFiles(plainWin,144 Paths.getEditionBasePath(), uninstall);145 } else {146 copyRemoveToolsFiles(plain, Paths.getEditionBasePath(),147 uninstall);148 }149 }150 }151 if (uninstall)152 installed.remove(m.getPackageNumber());153 else154 installed.add(m.getPackageNumber());155 }156 writeInstalledTools(installed);157 }158 159 private static void copyRemoveToolsFiles(File srcFolder, File targetFolder,160 boolean remove) {161 for (File f : srcFolder.listFiles()) {162 try {163 if (f.isDirectory())164 copyRemoveToolsFiles(f,165 CaseInsensitiveFile.getCaseInsensitiveFile(166 targetFolder, f.getName()), remove);167 else {168 File targetFile = CaseInsensitiveFile169 .getCaseInsensitiveFile(targetFolder, f.getName());170 if (remove) {171 if (targetFile.exists())172 targetFile.delete();173 } else {174 if (!targetFile.getName().equals(f.getName()))175 targetFile.delete();176 FileUtils.copyFileToDirectory(f, targetFolder);177 }178 }179 } catch (IOException e) {180 e.printStackTrace();181 }182 }183 if (remove)184 if (targetFolder.list().length == 0)185 targetFolder.delete();186 76 } 187 77 … … 197 87 InstallProgressListener listener) { 198 88 File logFile = new File(Paths.getInstallerPath(), "Installation.log"); 199 PrintWriter log = null;89 Logger log = null; 200 90 try { 201 log = new PrintWriter(logFile);91 log = new Logger(logFile); 202 92 } catch (FileNotFoundException e) { 203 93 e.printStackTrace(); … … 353 243 354 244 private static void combineBSLFolders(TreeSet<Package> mods, 355 InstallProgressListener listener, PrintWriter log) {245 InstallProgressListener listener, Logger log) { 356 246 listener.installProgressUpdate(95, 100, "Installing BSL files"); 247 log.println(); 357 248 log.println("Installing BSL files"); 358 249 … … 386 277 387 278 for (Package m : modsToInclude.get(EBSLInstallType.NORMAL)) { 388 copyBSL(m, false );279 copyBSL(m, false, log); 389 280 } 390 281 Vector<Package> addons = modsToInclude.get(EBSLInstallType.ADDON); 391 282 for (int i = addons.size() - 1; i >= 0; i--) { 392 copyBSL(addons.get(i), true );393 } 394 } 395 396 private static void copyBSL(Package sourceMod, boolean addon ) {283 copyBSL(addons.get(i), true, log); 284 } 285 } 286 287 private static void copyBSL(Package sourceMod, boolean addon, Logger log) { 397 288 File targetBaseFolder = new File(Paths.getEditionGDF(), "IGMD"); 398 289 if (!targetBaseFolder.exists()) … … 440 331 } 441 332 442 System.out.println("For mod: " + sourceMod.getName() 443 + " install BSL folders: " + sources.toString()); 333 log.println("\tMod \"" + sourceMod.getName() + "\""); 444 334 for (File f : sources) { 335 log.println("\t\t" + f.getName()); 445 336 File targetPath = new File(targetBaseFolder, f.getName()); 446 337 if (!targetPath.exists()) … … 467 358 TreeMap<String, Vector<File>> oniLevelFolders, 468 359 List<File> patchFolders, InstallProgressListener listener, 469 PrintWriter log) {360 Logger log) { 470 361 log.println(); 471 362 log.println("Applying XML patches"); … … 515 406 ApplicationInvocationResult res = OniSplit.export( 516 407 levelFolder, srcFolder, exportPatterns); 517 log AppOutput(res, log);408 log.logAppOutput(res, true); 518 409 } 519 410 } … … 540 431 ApplicationInvocationResult res = OniSplit.export( 541 432 levelFolder, srcFolder, patterns); 542 log AppOutput(res, log);433 log.logAppOutput(res, true); 543 434 } 544 435 } else { … … 563 454 ApplicationInvocationResult res = OniSplit.convertOniToXML( 564 455 levelFolderXML, files); 565 log AppOutput(res, log);456 log.logAppOutput(res, true); 566 457 567 458 // Create masterpatch file (containing calls to all individual … … 581 472 patternWildcard = patternWildcard.replace('-', '*'); 582 473 File xmlFilePath = new File(levelFolderXML, patternWildcard); 583 masterpatchWriter.println(String.format("@COMMAND patchfile -filename:\"%s\" -forceinfiles:\"%s\"", patch.getPath(), xmlFilePath.getPath())); 474 masterpatchWriter 475 .println(String 476 .format("@COMMAND patchfile -filename:\"%s\" -forceinfiles:\"%s\"", 477 patch.getPath(), xmlFilePath.getPath())); 584 478 } 585 479 masterpatchWriter.close(); 586 480 // Apply patches through masterpatch in levelFolderXML 587 481 res = XMLTools.patch(masterpatch, null); 588 log AppOutput(res, log);482 log.logAppOutput(res, false); 589 483 590 484 // Create .oni files from XML … … 592 486 files.add(new File(levelFolderXML, "*.xml")); 593 487 res = OniSplit.convertXMLtoOni(levelFolder, files); 594 log AppOutput(res, log);488 log.logAppOutput(res, true); 595 489 596 490 // Remove XML folder as import will only require .oni's … … 610 504 private static void combineBinaryFiles( 611 505 TreeMap<String, Vector<File>> oniLevelFolders, 612 InstallProgressListener listener, PrintWriter log) {506 InstallProgressListener listener, Logger log) { 613 507 long startMS = new Date().getTime(); 614 508 … … 626 520 oniLevelFolders.get(l), new File(Paths.getEditionGDF(), 627 521 sanitizeLevelName(l) + ".dat")); 628 log AppOutput(res, log);522 log.logAppOutput(res, true); 629 523 630 524 stepsDone++; … … 636 530 } 637 531 638 private static void copyVideos(PrintWriter log) { 532 private static void copyVideos(Logger log) { 533 log.println(); 639 534 if (SettingsManager.getInstance().get("copyintro", false)) { 640 535 File src = new File(Paths.getVanillaGDF(), "intro.bik"); … … 665 560 } 666 561 667 private static void unlockLevels(TreeSet<Integer> unlockLevels, 668 PrintWriter log) { 562 private static void unlockLevels(TreeSet<Integer> unlockLevels, Logger log) { 669 563 File dat = new File(Paths.getEditionBasePath(), "persist.dat"); 564 log.println(); 670 565 log.println("Unlocking levels: " + unlockLevels.toString()); 671 566 if (!dat.exists()) { … … 685 580 } 686 581 687 /**688 * Initializes the Edition core689 *690 * @param listener691 * Listener for status updates692 */693 public static void initializeEdition(InstallProgressListener listener) {694 File init = new File(Paths.getTempPath(), "init");695 696 int totalSteps = 0;697 int stepsDone = 0;698 699 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");700 701 TreeSet<File> levelFiles = new TreeSet<File>(702 new NaturalOrderComparator());703 704 for (File f : Paths.getVanillaGDF().listFiles(new FilenameFilter() {705 @Override706 public boolean accept(File dir, String name) {707 return name.endsWith(".dat");708 }709 })) {710 totalSteps++;711 levelFiles.add(f);712 }713 totalSteps = totalSteps * 2 + 2;714 715 try {716 File logFile = new File(Paths.getInstallerPath(),717 "Initialization.log");718 PrintWriter log = new PrintWriter(logFile);719 720 Date start = new Date();721 log.println("Initialization of Edition core started at "722 + sdf.format(start));723 log.println("Cleaning directories");724 725 listener.installProgressUpdate(stepsDone, totalSteps,726 "Cleaning up directories");727 createEmptyPath(Paths.getVanillaOnisPath());728 createEmptyPath(init);729 File level0Folder = new File(init, "level0_Final");730 createEmptyPath(level0Folder);731 732 stepsDone++;733 734 log.println("Exporting levels and moving files to level0");735 736 for (File f : levelFiles) {737 String levelName = f.getName().substring(0,738 f.getName().indexOf('.'));739 Scanner fi = new Scanner(levelName);740 int levelNumber = Integer.parseInt(fi.findInLine("[0-9]+"));741 742 log.println("\t" + levelName + ":");743 log.println("\t\tExporting");744 listener.installProgressUpdate(stepsDone, totalSteps,745 "Exporting vanilla level " + levelNumber);746 747 // Edition/GameDataFolder/level*_Final/748 File tempLevelFolder = new File(init, levelName);749 750 // Export Vanilla-Level-Dat -> Temp/Level751 ApplicationInvocationResult res = OniSplit.export(752 tempLevelFolder, f);753 logAppOutput(res, log);754 755 log.println("\t\tMoving files");756 handleFileGlobalisation(tempLevelFolder, level0Folder,757 levelNumber);758 stepsDone++;759 log.println();760 }761 762 log.println("Reimporting levels");763 TreeSet<File> initFolders = new TreeSet<File>(764 new NaturalOrderComparator());765 for (File f : init.listFiles()) {766 initFolders.add(f);767 }768 769 for (File f : initFolders) {770 String levelName = f.getName();771 772 log.println("\t" + levelName);773 listener.installProgressUpdate(stepsDone, totalSteps,774 "Creating globalized " + levelName);775 776 Vector<File> folders = new Vector<File>();777 folders.add(f);778 779 ApplicationInvocationResult res = OniSplit780 .importLevel(folders,781 new File(Paths.getVanillaOnisPath(), levelName782 + ".dat"));783 logAppOutput(res, log);784 785 log.println();786 stepsDone++;787 }788 789 listener.installProgressUpdate(stepsDone, totalSteps,790 "Copying basic files");791 // Copy Oni-configs792 File persistVanilla = new File(Paths.getOniBasePath(),793 "persist.dat");794 File persistEdition = new File(Paths.getEditionBasePath(),795 "persist.dat");796 File keyConfVanilla = new File(Paths.getOniBasePath(),797 "key_config.txt");798 File keyConfEdition = new File(Paths.getEditionBasePath(),799 "key_config.txt");800 if (persistVanilla.exists() && !persistEdition.exists())801 FileUtils.copyFile(persistVanilla, persistEdition);802 if (keyConfVanilla.exists() && !keyConfEdition.exists())803 FileUtils.copyFile(keyConfVanilla, keyConfEdition);804 805 FileUtils.deleteDirectory(init);806 807 Date end = new Date();808 log.println("Initialization ended at " + sdf.format(end));809 log.println("Process took "810 + ((end.getTime() - start.getTime()) / 1000) + " seconds");811 log.close();812 } catch (IOException e) {813 e.printStackTrace();814 }815 }816 817 private static void moveFileToTargetOrDelete(File source, File target) {818 if (source.equals(target))819 return;820 if (!target.exists()) {821 if (!source.renameTo(target)) {822 System.err.println("File " + source.getPath() + " not moved!");823 }824 } else if (!source.delete()) {825 System.err.println("File " + source.getPath() + " not deleted!");826 }827 }828 829 private static void handleFileGlobalisation(File tempFolder,830 File level0Folder, int levelNumber) {831 // Move AKEV and related files to subfolder so they're not globalized:832 if (levelNumber != 0) {833 File akevFolder = new File(tempFolder, "AKEV");834 akevFolder.mkdir();835 OniSplit.move(akevFolder, tempFolder.getPath() + "/AKEV*.oni",836 "overwrite");837 }838 839 for (File f : tempFolder.listFiles(new FileFilter() {840 @Override841 public boolean accept(File pathname) {842 return pathname.isFile();843 }844 })) {845 // Move matching files to subfolder NoGlobal:846 if (f.getName().startsWith("TXMPfail")847 || f.getName().startsWith("TXMPlevel")848 || (f.getName().startsWith("TXMP") && f.getName().contains(849 "intro"))850 || f.getName().startsWith("TXMB")851 || f.getName().equals("M3GMpowerup_lsi.oni")852 || f.getName().equals("TXMPlsi_icon.oni")853 || (f.getName().startsWith("TXMB") && f.getName().contains(854 "splash_screen.oni"))) {855 File noGlobal = new File(tempFolder, "NoGlobal");856 noGlobal.mkdir();857 File noGlobalFile = new File(noGlobal, f.getName());858 moveFileToTargetOrDelete(f, noGlobalFile);859 }860 // Move matching files to level0_Animations/level0_TRAC861 else if (f.getName().startsWith("TRAC")) {862 File level0File = new File(level0Folder, f.getName());863 moveFileToTargetOrDelete(f, level0File);864 }865 // Move matching files to level0_Animations/level0_TRAM866 else if (f.getName().startsWith("TRAM")) {867 File level0File = new File(level0Folder, f.getName());868 moveFileToTargetOrDelete(f, level0File);869 }870 // Move matching files to level0_Textures871 else if (f.getName().startsWith("ONSK")872 || f.getName().startsWith("TXMP")) {873 File level0File = new File(level0Folder, f.getName());874 moveFileToTargetOrDelete(f, level0File);875 }876 // Move matching files to *VANILLA*/level0_Characters877 else if (f.getName().startsWith("ONCC")878 || f.getName().startsWith("TRBS")879 || f.getName().startsWith("ONCV")880 || f.getName().startsWith("ONVL")881 || f.getName().startsWith("TRMA")882 || f.getName().startsWith("TRSC")883 || f.getName().startsWith("TRAS")) {884 File level0File = new File(level0Folder, f.getName());885 moveFileToTargetOrDelete(f, level0File);886 }887 // Move matching files to level0_Sounds888 else if (f.getName().startsWith("OSBD")889 || f.getName().startsWith("SNDD")) {890 File level0File = new File(level0Folder, f.getName());891 moveFileToTargetOrDelete(f, level0File);892 }893 // Move matching files to level0_Particles894 else if (f.getName().startsWith("BINA3")895 || f.getName().startsWith("M3GMdebris")896 || f.getName().equals("M3GMtoxic_bubble.oni")897 || f.getName().startsWith("M3GMelec")898 || f.getName().startsWith("M3GMrat")899 || f.getName().startsWith("M3GMjet")900 || f.getName().startsWith("M3GMbomb_")901 || f.getName().equals("M3GMbarab_swave.oni")902 || f.getName().equals("M3GMbloodyfoot.oni")) {903 File level0File = new File(level0Folder, f.getName());904 moveFileToTargetOrDelete(f, level0File);905 }906 // Move matching files to Archive (aka delete them)907 else if (f.getName().startsWith("AGDB")908 || f.getName().startsWith("TRCM")) {909 f.delete();910 }911 // Move matching files to /level0_Final/912 else if (f.getName().startsWith("ONWC")) {913 File level0File = new File(level0Folder, f.getName());914 moveFileToTargetOrDelete(f, level0File);915 }916 }917 }918 919 582 private static String sanitizeLevelName(String ln) { 920 583 int ind = ln.indexOf("_"); … … 925 588 } 926 589 927 /**928 * Verify that the Edition is within a subfolder to vanilla Oni929 * (..../Oni/Edition/AEInstaller)930 *931 * @return true if GDF can be found in the parent's parent-path932 */933 public static boolean verifyRunningDirectory() {934 return Paths.getVanillaGDF().exists()935 && Paths.getVanillaGDF().isDirectory();936 }937 938 private static void logAppOutput(ApplicationInvocationResult result,939 PrintWriter log) {940 if (result != null) {941 log.println("\t\t\tCalled:");942 for (String s : result.cmdLine)943 log.println("\t\t\t\t" + s);944 log.println("\t\t\tReturned: " + result.errorCode);945 for (String s : result.output)946 log.println("\t\t\t\t" + s);947 log.println("\t\t\tDuration: " + result.time + " ms");948 log.println();949 }950 }951 590 } -
java/installer2/src/net/oni2/aeinstaller/backend/packages/Package.java
r720 r749 14 14 import net.oni2.aeinstaller.backend.CaseInsensitiveFile; 15 15 import net.oni2.aeinstaller.backend.Paths; 16 import net.oni2.aeinstaller.backend.depot.DepotConfig; 17 import net.oni2.aeinstaller.backend.depot.DepotManager; 18 import net.oni2.aeinstaller.backend.depot.model.NodeMod; 19 import net.oni2.aeinstaller.backend.depot.model.TaxonomyTerm; 20 import net.oni2.aeinstaller.backend.oni.Installer; 16 import net.oni2.aeinstaller.backend.oni.management.ToolsManager; 17 import net.oni2.moddepot.DepotConfig; 18 import net.oni2.moddepot.ECompatiblePlatform; 19 import net.oni2.moddepot.model.NodeMod; 21 20 import net.oni2.platformtools.PlatformInformation; 22 21 import net.oni2.platformtools.PlatformInformation.Platform; … … 43 42 private int zipSize = 0; 44 43 private NodeMod node = null; 45 private net.oni2. aeinstaller.backend.depot.model.File file = null;44 private net.oni2.moddepot.model.File file = null; 46 45 47 46 private File exeFile = null; … … 68 67 platform = nm.getPlatform(); 69 68 tool = nm.isTool(); 70 for ( TaxonomyTerm tt: nm.getTypes()) {71 Type t = PackageManager.getInstance().getTypeByName( tt.getName());69 for (String nType : nm.getTypes()) { 70 Type t = PackageManager.getInstance().getTypeByName(nType); 72 71 types.add(t); 73 72 if (!tool && !isCorePackage() && isValidOnPlatform()) … … 82 81 description = "<p>" + description + "</p>"; 83 82 } 84 file = DepotManager.getInstance().getFile( 85 nm.getUploads().firstElement().getFid()); 83 file = nm.getUploads().firstElement(); 86 84 zipSize = file.getFilesize(); 87 85 … … 107 105 */ 108 106 public void updateLocalData() { 109 File config = CaseInsensitiveFile.getCaseInsensitiveFile(getLocalPath(), "Mod_Info.cfg"); 107 File config = CaseInsensitiveFile.getCaseInsensitiveFile( 108 getLocalPath(), "Mod_Info.cfg"); 110 109 File aeicfg = new File(getLocalPath(), "aei.cfg"); 111 File plain = CaseInsensitiveFile.getCaseInsensitiveFile(getLocalPath(), "plain"); 110 File plain = CaseInsensitiveFile.getCaseInsensitiveFile(getLocalPath(), 111 "plain"); 112 112 if (config.exists()) { 113 113 Mod_Info mi = new Mod_Info(config, packageNumber); … … 230 230 public boolean isInstalled() { 231 231 if (tool) 232 return Installer.getInstalledTools().contains(packageNumber);232 return ToolsManager.getInstalledTools().contains(packageNumber); 233 233 else 234 234 return PackageManager.getInstance().isModInstalled(this); … … 323 323 */ 324 324 public boolean isCorePackage() { 325 return packageNumber < DepotConfig. getCoreNumberLimit();325 return packageNumber < DepotConfig.corePackageNumberLimit; 326 326 } 327 327 … … 329 329 * @return Get the depot file entry 330 330 */ 331 public net.oni2. aeinstaller.backend.depot.model.File getFile() {331 public net.oni2.moddepot.model.File getFile() { 332 332 return file; 333 333 } -
java/installer2/src/net/oni2/aeinstaller/backend/packages/PackageManager.java
r658 r749 14 14 15 15 import net.oni2.aeinstaller.backend.Paths; 16 import net.oni2.aeinstaller.backend.depot.DepotManager; 17 import net.oni2.aeinstaller.backend.depot.model.NodeMod; 18 import net.oni2.aeinstaller.backend.depot.model.TaxonomyTerm; 19 import net.oni2.aeinstaller.backend.oni.Installer; 16 import net.oni2.moddepot.DepotManager; 17 import net.oni2.moddepot.model.NodeMod; 18 import net.oni2.moddepot.model.TaxonomyTerm; 19 import net.oni2.aeinstaller.backend.oni.management.Installer; 20 import net.oni2.aeinstaller.backend.oni.management.ToolsManager; 20 21 21 22 import com.thoughtworks.xstream.XStream; … … 89 90 mods = new HashMap<Integer, Package>(); 90 91 91 Type localType = new Type("-Local-" , null);92 Type localType = new Type("-Local-"); 92 93 types.put("-Local-", localType); 93 94 94 95 for (TaxonomyTerm tt : DepotManager.getInstance().getTypes()) { 95 types.put(tt.getName(), new Type(tt.getName() , tt));96 types.put(tt.getName(), new Type(tt.getName())); 96 97 } 97 98 … … 110 111 111 112 for (NodeMod nm : DepotManager.getInstance().getModPackageNodes()) { 112 if (nm.getUploads().size() == 1 && nm.getStatus() == 1) {113 if (nm.getUploads().size() == 1) { 113 114 Package m = new Package(nm); 114 115 if (nm.isTool()) … … 265 266 public TreeSet<Package> getInstalledTools() { 266 267 TreeSet<Package> res = new TreeSet<Package>(); 267 for (int n : Installer.getInstalledTools()) {268 for (int n : ToolsManager.getInstalledTools()) { 268 269 res.add(getPackageByNumber(n)); 269 270 } … … 293 294 * @return Unmet dependencies 294 295 */ 295 public HashMap<Package, HashSet<Package>> checkDependencies(TreeSet<Package> mods) { 296 public HashMap<Package, HashSet<Package>> checkDependencies( 297 TreeSet<Package> mods) { 296 298 HashMap<Package, HashSet<Package>> res = new HashMap<Package, HashSet<Package>>(); 297 299 … … 317 319 * @return Incompatible mods 318 320 */ 319 public HashMap<Package, HashSet<Package>> checkIncompabitilites(TreeSet<Package> mods) { 321 public HashMap<Package, HashSet<Package>> checkIncompabitilites( 322 TreeSet<Package> mods) { 320 323 HashMap<Package, HashSet<Package>> res = new HashMap<Package, HashSet<Package>>(); 321 324 -
java/installer2/src/net/oni2/aeinstaller/backend/packages/Type.java
r648 r749 2 2 3 3 import java.util.HashSet; 4 5 import net.oni2.aeinstaller.backend.depot.model.TaxonomyTerm;6 4 7 5 /** … … 10 8 public class Type { 11 9 private String name; 12 @SuppressWarnings("unused")13 private TaxonomyTerm depotTerm;14 10 15 11 private HashSet<Package> entries = new HashSet<Package>(); … … 20 16 * @param name 21 17 * Name of type 22 * @param tt23 * Optional TaxTerm link24 18 */ 25 public Type(String name , TaxonomyTerm tt) {19 public Type(String name) { 26 20 this.name = name; 27 this.depotTerm = tt;28 21 } 29 22 -
java/installer2/src/net/oni2/aeinstaller/gui/MainWin.java
r720 r749 45 45 import net.oni2.aeinstaller.backend.Paths; 46 46 import net.oni2.aeinstaller.backend.SizeFormatter; 47 import net.oni2.aeinstaller.backend.depot.DepotManager;48 import net.oni2.aeinstaller.backend.oni.InstallProgressListener;49 import net.oni2.aeinstaller.backend.oni.Installer;50 47 import net.oni2.aeinstaller.backend.oni.OniLauncher; 51 48 import net.oni2.aeinstaller.backend.oni.OniSplit; 49 import net.oni2.aeinstaller.backend.oni.management.Initializer; 50 import net.oni2.aeinstaller.backend.oni.management.InstallProgressListener; 51 import net.oni2.aeinstaller.backend.oni.management.Installer; 52 import net.oni2.aeinstaller.backend.oni.management.ToolsManager; 52 53 import net.oni2.aeinstaller.backend.packages.Package; 53 54 import net.oni2.aeinstaller.backend.packages.PackageManager; … … 67 68 import net.oni2.aeinstaller.gui.settings.SettingsDialog; 68 69 import net.oni2.aeinstaller.gui.toolmanager.ToolManager; 70 import net.oni2.moddepot.DepotManager; 69 71 import net.oni2.platformtools.PlatformInformation; 70 72 import net.oni2.platformtools.PlatformInformation.Platform; … … 205 207 @DoInBackground(progressMessage = "updateDepot.title", cancelable = false, indeterminateProgress = false) 206 208 private void execDepotUpdate(final BackgroundEvent evt) { 209 DepotManager.loadFromCacheFile(Paths.getDepotCacheFilename()); 210 207 211 if (!SettingsManager.getInstance().isOfflineMode() 208 212 && !SettingsManager.getInstance().isNoCacheUpdateMode()) { 209 213 long start = new Date().getTime(); 210 214 211 try { 212 DepotManager.getInstance().updateInformation(); 213 } catch (Exception e) { 214 e.printStackTrace(); 215 } 215 if (DepotManager.getInstance().updateInformation()) 216 DepotManager.getInstance().saveToCacheFile( 217 Paths.getDepotCacheFilename()); 216 218 217 219 System.out.println("Took: " + (new Date().getTime() - start) … … 360 362 dl.setVisible(true); 361 363 if (dl.isFinished()) { 362 TreeSet<Integer> installed = Installer.getInstalledTools(); 364 TreeSet<Integer> installed = ToolsManager 365 .getInstalledTools(); 363 366 TreeSet<Package> tools = new TreeSet<Package>(); 364 367 for (Package m : execUpdates) … … 367 370 tools.add(m); 368 371 if (tools.size() > 0) { 369 Installer.installTools(tools, false);372 ToolsManager.installTools(tools, false); 370 373 } 371 374 } … … 461 464 @DoInBackground(progressMessage = "initializingEdition.title", cancelable = false, indeterminateProgress = false) 462 465 private void reglobalize(final BackgroundEvent evt) { 463 In staller.initializeEdition(new InstallProgressListener() {466 Initializer.initializeEdition(new InstallProgressListener() { 464 467 @Override 465 468 public void installProgressUpdate(int done, int total, String step) { … … 580 583 } 581 584 evt.setProgressMessage(bundle.getString("coreToolsInstall.title")); 582 Installer.installTools(PackageManager.getInstance().getCoreTools(),583 false);585 ToolsManager.installTools(PackageManager.getInstance() 586 .getCoreTools(), false); 584 587 } 585 588 } … … 731 734 732 735 if (actuallyTools.size() > 0) { 733 Installer.installTools(actuallyTools, false);736 ToolsManager.installTools(actuallyTools, false); 734 737 } 735 738 } … … 847 850 private void initialize(final BackgroundEvent evt) { 848 851 if (!Installer.isEditionInitialized()) { 849 In staller.initializeEdition(new InstallProgressListener() {852 Initializer.initializeEdition(new InstallProgressListener() { 850 853 @Override 851 854 public void installProgressUpdate(int done, int total, -
java/installer2/src/net/oni2/aeinstaller/gui/toolmanager/ToolManager.java
r720 r749 18 18 19 19 import net.oni2.SettingsManager; 20 import net.oni2.aeinstaller.backend.oni. Installer;20 import net.oni2.aeinstaller.backend.oni.management.ToolsManager; 21 21 import net.oni2.aeinstaller.backend.packages.Package; 22 22 import net.oni2.aeinstaller.gui.downloadwindow.Downloader; … … 97 97 TreeSet<Package> tools = new TreeSet<Package>(); 98 98 tools.add(selectedPackage); 99 Installer.installTools(tools, true);99 ToolsManager.installTools(tools, true); 100 100 } else { 101 101 if (!selectedPackage.isLocalAvailable()) { … … 123 123 TreeSet<Package> tools = new TreeSet<Package>(); 124 124 tools.add(selectedPackage); 125 Installer.installTools(tools, false);125 ToolsManager.installTools(tools, false); 126 126 } 127 127 }
Note:
See TracChangeset
for help on using the changeset viewer.