Changeset 720 for AE/installer2/src/net/oni2/aeinstaller/backend
- Timestamp:
- Mar 21, 2013, 12:33:53 PM (12 years ago)
- Location:
- AE/installer2/src/net/oni2/aeinstaller/backend
- Files:
-
- 1 added
- 3 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/installer2/src/net/oni2/aeinstaller/backend/Paths.java
r709 r720 5 5 import java.net.URLDecoder; 6 6 7 import net.oni2. settingsmanager.Settings;7 import net.oni2.SettingsManager; 8 8 9 9 /** … … 32 32 */ 33 33 public static File getInstallerPath() { 34 if (Settings .isDebug()) {34 if (SettingsManager.isDebug()) { 35 35 String wd = System.getProperty("user.dir"); 36 36 return new File(wd); 37 37 } else { 38 String jarPath = Settings .class.getProtectionDomain()38 String jarPath = SettingsManager.class.getProtectionDomain() 39 39 .getCodeSource().getLocation().getPath(); 40 40 String decodedPath = null; -
AE/installer2/src/net/oni2/aeinstaller/backend/depot/DepotConfig.java
r708 r720 3 3 import java.util.TreeSet; 4 4 5 import net.oni2. settingsmanager.Settings;5 import net.oni2.SettingsManager; 6 6 7 7 /** … … 88 88 */ 89 89 static String getDepotUrl() { 90 return Settings .getInstance().get("depot_url", "http://mods.oni2.net/");90 return SettingsManager.getInstance().get("depot_url", "http://mods.oni2.net/"); 91 91 } 92 92 … … 95 95 */ 96 96 static String getDepotApiUrl() { 97 return Settings .getInstance().get("depot_api_url",97 return SettingsManager.getInstance().get("depot_api_url", 98 98 "http://mods.oni2.net/?q=api/"); 99 99 } -
AE/installer2/src/net/oni2/aeinstaller/backend/oni/Installer.java
r708 r720 21 21 import java.util.regex.Pattern; 22 22 23 import net.oni2.SettingsManager; 23 24 import net.oni2.aeinstaller.AEInstaller2; 24 25 import net.oni2.aeinstaller.backend.CaseInsensitiveFile; … … 27 28 import net.oni2.aeinstaller.backend.packages.Package; 28 29 import net.oni2.aeinstaller.backend.packages.PackageManager; 29 import net.oni2. applicationinvoker.AppExecutionResult;30 import net.oni2. settingsmanager.Settings;31 import net.oni2. settingsmanager.Settings.Platform;30 import net.oni2.platformtools.PlatformInformation; 31 import net.oni2.platformtools.PlatformInformation.Platform; 32 import net.oni2.platformtools.applicationinvoker.ApplicationInvocationResult; 32 33 33 34 import org.apache.commons.io.FileUtils; … … 134 135 copyRemoveToolsFiles(plainCommon, 135 136 Paths.getEditionBasePath(), uninstall); 136 if ( Settings.getPlatform() == Platform.MACOS137 if (PlatformInformation.getPlatform() == Platform.MACOS 137 138 && plainMac.exists()) 138 139 copyRemoveToolsFiles(plainMac, … … 225 226 || s.endsWith(".raw") 226 227 || s.endsWith(".sep") 227 || (s.equals("intro.bik") && !Settings .getInstance()228 || (s.equals("intro.bik") && !SettingsManager.getInstance() 228 229 .get("copyintro", false)) 229 || (s.equals("outro.bik") && !Settings .getInstance()230 || (s.equals("outro.bik") && !SettingsManager.getInstance() 230 231 .get("copyoutro", false)); 231 232 } … … 279 280 if (oniCommon.exists()) 280 281 foldersOni.add(oniCommon); 281 if ( Settings.getPlatform() == Platform.MACOS282 if (PlatformInformation.getPlatform() == Platform.MACOS 282 283 && oniMac.exists()) 283 284 foldersOni.add(oniMac); … … 301 302 if (patchesCommon.exists()) 302 303 foldersPatches.add(patchesCommon); 303 if ( Settings.getPlatform() == Platform.MACOS304 if (PlatformInformation.getPlatform() == Platform.MACOS 304 305 && patchesMac.exists()) 305 306 foldersPatches.add(patchesMac); … … 369 370 File bslWin = CaseInsensitiveFile.getCaseInsensitiveFile( 370 371 bsl, "win_only"); 371 if (( Settings.getPlatform() == Platform.MACOS && bslMac372 if ((PlatformInformation.getPlatform() == Platform.MACOS && bslMac 372 373 .exists()) 373 || (( Settings.getPlatform() == Platform.WIN || Settings374 || ((PlatformInformation.getPlatform() == Platform.WIN || PlatformInformation 374 375 .getPlatform() == Platform.LINUX) && bslWin 375 376 .exists()) || bslCommon.exists()) { … … 406 407 File bslWin = CaseInsensitiveFile.getCaseInsensitiveFile(bsl, 407 408 "win_only"); 408 if ( Settings.getPlatform() == Platform.MACOS && bslMac.exists()) {409 if (PlatformInformation.getPlatform() == Platform.MACOS && bslMac.exists()) { 409 410 for (File f : bslMac.listFiles(dirFileFilter)) { 410 411 File targetBSL = new File(targetBaseFolder, f.getName()); … … 413 414 } 414 415 } 415 if (( Settings.getPlatform() == Platform.WIN || Settings416 if ((PlatformInformation.getPlatform() == Platform.WIN || PlatformInformation 416 417 .getPlatform() == Platform.LINUX) && bslWin.exists()) { 417 418 for (File f : bslWin.listFiles(dirFileFilter)) { … … 508 509 if (srcFolder.getPath().toLowerCase().contains("vanilla")) { 509 510 // Extract from .dat 510 App ExecutionResult res = OniSplit.export(levelFolder,511 ApplicationInvocationResult res = OniSplit.export(levelFolder, 511 512 srcFolder, exportPatterns); 512 513 logAppOutput(res, log); … … 533 534 .contains("vanilla")) { 534 535 // Extract from .dat 535 App ExecutionResult res = OniSplit.export(536 ApplicationInvocationResult res = OniSplit.export( 536 537 levelFolder, srcFolder, patterns); 537 538 logAppOutput(res, log); … … 556 557 Vector<File> files = new Vector<File>(); 557 558 files.add(new File(levelFolder, "*.oni")); 558 App ExecutionResult res = OniSplit.convertOniToXML(levelFolderXML,559 ApplicationInvocationResult res = OniSplit.convertOniToXML(levelFolderXML, 559 560 files); 560 561 logAppOutput(res, log); … … 613 614 "Installing level " + l); 614 615 615 App ExecutionResult res = OniSplit.packLevel(oniLevelFolders.get(l),616 ApplicationInvocationResult res = OniSplit.packLevel(oniLevelFolders.get(l), 616 617 new File(Paths.getEditionGDF(), sanitizeLevelName(l) 617 618 + ".dat")); … … 627 628 628 629 private static void copyVideos(PrintWriter log) { 629 if (Settings .getInstance().get("copyintro", false)) {630 if (SettingsManager.getInstance().get("copyintro", false)) { 630 631 File src = new File(Paths.getVanillaGDF(), "intro.bik"); 631 632 log.println("Copying intro"); … … 640 641 log.println("NOT copying intro"); 641 642 } 642 if (Settings .getInstance().get("copyoutro", true)) {643 if (SettingsManager.getInstance().get("copyoutro", true)) { 643 644 File src = new File(Paths.getVanillaGDF(), "outro.bik"); 644 645 log.println("Copying outro"); … … 741 742 742 743 // Export Vanilla-Level-Dat -> Temp/Level 743 App ExecutionResult res = OniSplit.export(tempLevelFolder, f);744 ApplicationInvocationResult res = OniSplit.export(tempLevelFolder, f); 744 745 logAppOutput(res, log); 745 746 … … 763 764 folders.add(f); 764 765 765 App ExecutionResult res = OniSplit766 ApplicationInvocationResult res = OniSplit 766 767 .importLevel(folders, 767 768 new File(Paths.getVanillaOnisPath(), levelName … … 922 923 } 923 924 924 private static void logAppOutput(App ExecutionResult result, PrintWriter log) {925 private static void logAppOutput(ApplicationInvocationResult result, PrintWriter log) { 925 926 if (result != null) { 926 927 log.println("\t\t\tCalled:"); -
AE/installer2/src/net/oni2/aeinstaller/backend/oni/OniSplit.java
r708 r720 6 6 7 7 import net.oni2.aeinstaller.backend.CaseInsensitiveFile; 8 import net.oni2.aeinstaller.backend.DotNet;9 8 import net.oni2.aeinstaller.backend.Paths; 10 import net.oni2.applicationinvoker.AppExecution; 11 import net.oni2.applicationinvoker.AppExecutionResult; 12 import net.oni2.settingsmanager.Settings; 13 import net.oni2.settingsmanager.Settings.Platform; 9 import net.oni2.platformtools.PlatformInformation; 10 import net.oni2.platformtools.PlatformInformation.Platform; 11 import net.oni2.platformtools.applicationinvoker.ApplicationInvoker; 12 import net.oni2.platformtools.applicationinvoker.ApplicationInvocationResult; 13 import net.oni2.platformtools.applicationinvoker.EExeType; 14 import net.oni2.platformtools.applicationinvoker.ERuntimeNotInstalledException; 14 15 15 16 /** … … 34 35 * @return OniSplit output 35 36 */ 36 public static App ExecutionResult export(File targetFolder, File input) {37 public static ApplicationInvocationResult export(File targetFolder, File input) { 37 38 return export(targetFolder, input, null); 38 39 } … … 49 50 * @return OniSplit output 50 51 */ 51 public static App ExecutionResult export(File targetFolder, File input,52 public static ApplicationInvocationResult export(File targetFolder, File input, 52 53 Vector<String> patterns) { 53 54 if (!targetFolder.exists()) 54 55 targetFolder.mkdir(); 55 56 56 Vector<String> cmdLine = getProgramInvocation();57 Vector<String> params = new Vector<String>(); 57 58 if (patterns == null) 58 cmdLine.add("-export");59 params.add("-export"); 59 60 else { 60 61 for (String p : patterns) 61 cmdLine.add("-export:" + p); 62 } 63 cmdLine.add(targetFolder.getPath()); 64 cmdLine.add(input.getPath()); 65 AppExecutionResult res = null; 66 try { 67 res = AppExecution.executeAndWait(cmdLine); 68 } catch (IOException e) { 62 params.add("-export:" + p); 63 } 64 params.add(targetFolder.getPath()); 65 params.add(input.getPath()); 66 ApplicationInvocationResult res = null; 67 try { 68 res = ApplicationInvoker.executeAndWait(EExeType.DOTNET, null, getProgramFile(), params); 69 } catch (IOException e) { 70 e.printStackTrace(); 71 } catch (ERuntimeNotInstalledException e) { 69 72 e.printStackTrace(); 70 73 } … … 81 84 * @return OniSplit output 82 85 */ 83 public static App ExecutionResult importLevel(Vector<File> sourceFolders,86 public static ApplicationInvocationResult importLevel(Vector<File> sourceFolders, 84 87 File targetFile) { 85 Vector<String> cmdLine = getProgramInvocation();86 cmdLine.add(getImportParam());88 Vector<String> params = new Vector<String>(); 89 params.add(getImportParam()); 87 90 for (File f : sourceFolders) 88 cmdLine.add(f.getPath()); 89 cmdLine.add(targetFile.getPath()); 90 AppExecutionResult res = null; 91 try { 92 res = AppExecution.executeAndWait(cmdLine); 93 } catch (IOException e) { 91 params.add(f.getPath()); 92 params.add(targetFile.getPath()); 93 ApplicationInvocationResult res = null; 94 try { 95 res = ApplicationInvoker.executeAndWait(EExeType.DOTNET, null, getProgramFile(), params); 96 } catch (IOException e) { 97 e.printStackTrace(); 98 } catch (ERuntimeNotInstalledException e) { 94 99 e.printStackTrace(); 95 100 } … … 108 113 * @return OniSplit output 109 114 */ 110 public static App ExecutionResult packLevel(Vector<File> sourceFoldersFiles,115 public static ApplicationInvocationResult packLevel(Vector<File> sourceFoldersFiles, 111 116 File targetFile) { 112 Vector<String> cmdLine = getProgramInvocation();113 cmdLine.add(getPackParam());114 cmdLine.add(getPackTypeParam());115 cmdLine.add("-out");116 cmdLine.add(targetFile.getPath());117 Vector<String> params = new Vector<String>(); 118 params.add(getPackParam()); 119 params.add(getPackTypeParam()); 120 params.add("-out"); 121 params.add(targetFile.getPath()); 117 122 for (File f : sourceFoldersFiles) 118 cmdLine.add(f.getPath()); 119 AppExecutionResult res = null; 120 try { 121 res = AppExecution.executeAndWait(cmdLine); 122 } catch (IOException e) { 123 params.add(f.getPath()); 124 ApplicationInvocationResult res = null; 125 try { 126 res = ApplicationInvoker.executeAndWait(EExeType.DOTNET, null, getProgramFile(), params); 127 } catch (IOException e) { 128 e.printStackTrace(); 129 } catch (ERuntimeNotInstalledException e) { 123 130 e.printStackTrace(); 124 131 } … … 138 145 * @return OniSplit output 139 146 */ 140 public static App ExecutionResult move(File targetFolder, String input,147 public static ApplicationInvocationResult move(File targetFolder, String input, 141 148 String moveParameter) { 142 149 if (!targetFolder.exists()) 143 150 targetFolder.mkdir(); 144 151 145 Vector<String> cmdLine = getProgramInvocation();146 cmdLine.add("-move"152 Vector<String> params = new Vector<String>(); 153 params.add("-move" 147 154 + (moveParameter != null ? ":" + moveParameter : "")); 148 cmdLine.add(targetFolder.getPath()); 149 cmdLine.add(input); 150 AppExecutionResult res = null; 151 try { 152 res = AppExecution.executeAndWait(cmdLine); 153 } catch (IOException e) { 155 params.add(targetFolder.getPath()); 156 params.add(input); 157 ApplicationInvocationResult res = null; 158 try { 159 res = ApplicationInvoker.executeAndWait(EExeType.DOTNET, null, getProgramFile(), params); 160 } catch (IOException e) { 161 e.printStackTrace(); 162 } catch (ERuntimeNotInstalledException e) { 154 163 e.printStackTrace(); 155 164 } … … 166 175 * @return OniSplit output 167 176 */ 168 public static App ExecutionResult convertOniToXML(File targetFolder,177 public static ApplicationInvocationResult convertOniToXML(File targetFolder, 169 178 Vector<File> inputFiles) { 170 179 if (!targetFolder.exists()) 171 180 targetFolder.mkdirs(); 172 181 173 Vector<String> cmdLine = getProgramInvocation();174 cmdLine.add("-extract:xml");175 cmdLine.add(targetFolder.getPath());182 Vector<String> params = new Vector<String>(); 183 params.add("-extract:xml"); 184 params.add(targetFolder.getPath()); 176 185 for (File f : inputFiles) { 177 cmdLine.add(f.getPath()); 178 } 179 AppExecutionResult res = null; 180 try { 181 res = AppExecution.executeAndWait(cmdLine); 182 } catch (IOException e) { 186 params.add(f.getPath()); 187 } 188 ApplicationInvocationResult res = null; 189 try { 190 res = ApplicationInvoker.executeAndWait(EExeType.DOTNET, null, getProgramFile(), params); 191 } catch (IOException e) { 192 e.printStackTrace(); 193 } catch (ERuntimeNotInstalledException e) { 183 194 e.printStackTrace(); 184 195 } … … 195 206 * @return OniSplit output 196 207 */ 197 public static App ExecutionResult convertXMLtoOni(File targetFolder,208 public static ApplicationInvocationResult convertXMLtoOni(File targetFolder, 198 209 Vector<File> inputFiles) { 199 210 if (!targetFolder.exists()) 200 211 targetFolder.mkdirs(); 201 212 202 Vector<String> cmdLine = getProgramInvocation();203 cmdLine.add("-create");204 cmdLine.add(targetFolder.getPath());213 Vector<String> params = new Vector<String>(); 214 params.add("-create"); 215 params.add(targetFolder.getPath()); 205 216 for (File f : inputFiles) { 206 cmdLine.add(f.getPath()); 207 } 208 AppExecutionResult res = null; 209 try { 210 res = AppExecution.executeAndWait(cmdLine); 211 } catch (IOException e) { 217 params.add(f.getPath()); 218 } 219 ApplicationInvocationResult res = null; 220 try { 221 res = ApplicationInvoker.executeAndWait(EExeType.DOTNET, null, getProgramFile(), params); 222 } catch (IOException e) { 223 e.printStackTrace(); 224 } catch (ERuntimeNotInstalledException e) { 212 225 e.printStackTrace(); 213 226 } … … 216 229 217 230 private static String getImportParam() { 218 if ( Settings.getPlatform() == Platform.MACOS)231 if (PlatformInformation.getPlatform() == Platform.MACOS) 219 232 return "-import:sep"; 220 233 else … … 227 240 228 241 private static String getPackTypeParam() { 229 if ( Settings.getPlatform() == Platform.MACOS)242 if (PlatformInformation.getPlatform() == Platform.MACOS) 230 243 return "-type:macintel"; 231 244 else 232 245 return "-type:pc"; 233 }234 235 private static Vector<String> getProgramInvocation() {236 Vector<String> res = new Vector<String>();237 if (DotNet.getRuntimeExe().length() > 0)238 res.add(DotNet.getRuntimeExe());239 res.add(getProgramFile().getPath());240 return res;241 246 } 242 247 -
AE/installer2/src/net/oni2/aeinstaller/backend/oni/XMLTools.java
r708 r720 6 6 7 7 import net.oni2.aeinstaller.backend.CaseInsensitiveFile; 8 import net.oni2.aeinstaller.backend.DotNet;9 8 import net.oni2.aeinstaller.backend.Paths; 10 import net.oni2.applicationinvoker.AppExecution; 11 import net.oni2.applicationinvoker.AppExecutionResult; 9 import net.oni2.platformtools.applicationinvoker.ApplicationInvoker; 10 import net.oni2.platformtools.applicationinvoker.ApplicationInvocationResult; 11 import net.oni2.platformtools.applicationinvoker.EExeType; 12 import net.oni2.platformtools.applicationinvoker.ERuntimeNotInstalledException; 12 13 13 14 /** … … 26 27 * @return XMLTools output 27 28 */ 28 public static App ExecutionResult patch(File patch, File source) {29 Vector<String> cmdLine = getProgramInvocation();29 public static ApplicationInvocationResult patch(File patch, File source) { 30 Vector<String> params = new Vector<String>(); 30 31 // xmlTools.exe patchfile -filename:PATCH -forceinfiles:TOPATCH 31 cmdLine.add("patchfile");32 cmdLine.add("-filename:" + patch.getPath());33 cmdLine.add("-forceinfiles:" + source.getPath());34 App ExecutionResult res = null;32 params.add("patchfile"); 33 params.add("-filename:" + patch.getPath()); 34 params.add("-forceinfiles:" + source.getPath()); 35 ApplicationInvocationResult res = null; 35 36 try { 36 res = AppExecution.executeAndWait(cmdLine); 37 res = ApplicationInvoker.executeAndWait(EExeType.DOTNET, null, 38 getProgramFile(), params); 37 39 } catch (IOException e) { 40 e.printStackTrace(); 41 } catch (ERuntimeNotInstalledException e) { 38 42 e.printStackTrace(); 39 43 } … … 41 45 } 42 46 43 private static Vector<String> getProgramInvocation() {44 Vector<String> res = new Vector<String>();45 if (DotNet.getRuntimeExe().length() > 0)46 res.add(DotNet.getRuntimeExe());47 res.add(getProgramFile().getPath());48 return res;49 }50 51 47 private static File getProgramFile() { 52 File toolsPath = CaseInsensitiveFile.getCaseInsensitiveFile(Paths.getEditionBasePath(), "Tools"); 53 return CaseInsensitiveFile.getCaseInsensitiveFile(toolsPath, "xmlTools.exe"); 48 File toolsPath = CaseInsensitiveFile.getCaseInsensitiveFile( 49 Paths.getEditionBasePath(), "Tools"); 50 return CaseInsensitiveFile.getCaseInsensitiveFile(toolsPath, 51 "xmlTools.exe"); 54 52 } 55 53 } -
AE/installer2/src/net/oni2/aeinstaller/backend/packages/Mod_Info.java
r699 r720 11 11 import net.oni2.aeinstaller.backend.CaseInsensitiveFile; 12 12 import net.oni2.aeinstaller.backend.Paths; 13 import net.oni2.platformtools.applicationinvoker.EExeType; 13 14 14 15 /** … … 112 113 } 113 114 } else if (sName.equalsIgnoreCase("ExeName")) { 114 exeFile = CaseInsensitiveFile.getCaseInsensitiveFile(Paths.getEditionBasePath(), sVal); 115 exeFile = CaseInsensitiveFile.getCaseInsensitiveFile( 116 Paths.getEditionBasePath(), sVal); 115 117 } else if (sName.equalsIgnoreCase("ExeType")) { 116 118 if (sVal.equalsIgnoreCase("OSBinary")) 117 119 exeType = EExeType.OSBINARY; 120 else if (sVal.equalsIgnoreCase("WinExe")) 121 exeType = EExeType.WINEXE; 118 122 else if (sVal.equalsIgnoreCase("DotNet")) 119 123 exeType = EExeType.DOTNET; … … 123 127 workingDir = sVal; 124 128 } else if (sName.equalsIgnoreCase("IconName")) { 125 iconFile = CaseInsensitiveFile.getCaseInsensitiveFile(Paths.getEditionBasePath(), sVal); 129 iconFile = CaseInsensitiveFile.getCaseInsensitiveFile( 130 Paths.getEditionBasePath(), sVal); 126 131 } 127 132 } … … 129 134 if (exeFile.getName().toLowerCase().endsWith(".jar")) 130 135 exeType = EExeType.JAR; 136 else if (exeType == EExeType.OSBINARY && exeFile.getName().toLowerCase().endsWith(".exe")) 137 exeType = EExeType.WINEXE; 131 138 } 132 139 } catch (FileNotFoundException e) { -
AE/installer2/src/net/oni2/aeinstaller/backend/packages/Package.java
r708 r720 12 12 import java.util.HashSet; 13 13 14 import org.apache.commons.io.FileUtils;15 16 14 import net.oni2.aeinstaller.backend.CaseInsensitiveFile; 17 15 import net.oni2.aeinstaller.backend.Paths; … … 21 19 import net.oni2.aeinstaller.backend.depot.model.TaxonomyTerm; 22 20 import net.oni2.aeinstaller.backend.oni.Installer; 23 import net.oni2.settingsmanager.Settings; 24 import net.oni2.settingsmanager.Settings.Platform; 21 import net.oni2.platformtools.PlatformInformation; 22 import net.oni2.platformtools.PlatformInformation.Platform; 23 import net.oni2.platformtools.applicationinvoker.EExeType; 24 25 import org.apache.commons.io.FileUtils; 25 26 26 27 /** … … 426 427 return true; 427 428 case MACOS: 428 return ( Settings.getPlatform() == Platform.MACOS);429 return (PlatformInformation.getPlatform() == Platform.MACOS); 429 430 case WIN: 430 return ( Settings.getPlatform() == Platform.WIN)431 || ( Settings.getPlatform() == Platform.LINUX);431 return (PlatformInformation.getPlatform() == Platform.WIN) 432 || (PlatformInformation.getPlatform() == Platform.LINUX); 432 433 } 433 434 return false;
Note:
See TracChangeset
for help on using the changeset viewer.