Changeset 720 for AE/installer2/src/net
- Timestamp:
- Mar 21, 2013, 12:33:53 PM (12 years ago)
- Location:
- AE/installer2/src/net/oni2/aeinstaller
- Files:
-
- 1 added
- 3 deleted
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/installer2/src/net/oni2/aeinstaller/AEInstaller.properties
r701 r720 1 1 appname=AE Installer 2 2 appversion=0.99 u2 appversion=0.99v -
AE/installer2/src/net/oni2/aeinstaller/AEInstaller2.java
r709 r720 21 21 import javax.swing.UIManager.LookAndFeelInfo; 22 22 23 import net.oni2.SettingsManager; 23 24 import net.oni2.aeinstaller.backend.CaseInsensitiveFile; 24 import net.oni2.aeinstaller.backend.DotNet;25 25 import net.oni2.aeinstaller.backend.Paths; 26 26 import net.oni2.aeinstaller.backend.SizeFormatter; … … 30 30 import net.oni2.aeinstaller.gui.HTMLLinkLabel; 31 31 import net.oni2.aeinstaller.gui.MainWin; 32 import net.oni2.settingsmanager.Settings; 33 import net.oni2.settingsmanager.Settings.Platform; 32 import net.oni2.platformtools.PlatformInformation; 33 import net.oni2.platformtools.PlatformInformation.Platform; 34 import net.oni2.platformtools.applicationinvoker.DotNet; 34 35 35 36 import org.javabuilders.swing.SwingJavaBuilder; … … 123 124 initBundles(); 124 125 125 if ( Settings.getPlatform() == Platform.MACOS)126 if (PlatformInformation.getPlatform() == Platform.MACOS) 126 127 initMacOS(); 127 128 128 Settings .setDebug(debug);129 Settings .deserializeFromFile(Paths.getSettingsFilename());130 Settings .setDebug(debug);131 Settings .getInstance().setNoCacheUpdateMode(noCacheUpdate);129 SettingsManager.setDebug(debug); 130 SettingsManager.deserializeFromFile(Paths.getSettingsFilename()); 131 SettingsManager.setDebug(debug); 132 SettingsManager.getInstance().setNoCacheUpdateMode(noCacheUpdate); 132 133 133 134 SwingJavaBuilder.getConfig().addResourceBundle(imagesBundle); … … 142 143 143 144 try { 144 String laf = Settings .getInstance().get("lookandfeel",145 String laf = SettingsManager.getInstance().get("lookandfeel", 145 146 (String) null); 146 147 if (laf == null) { 147 if ( Settings.getPlatform() != Platform.LINUX) {148 if (PlatformInformation.getPlatform() != Platform.LINUX) { 148 149 laf = UIManager.getSystemLookAndFeelClassName(); 149 150 } else { … … 171 172 System.out.println("TempPath: " + Paths.getTempPath()); 172 173 System.out.println("ValidPath: " + Installer.verifyRunningDirectory()); 173 System.out.println("Platform: " + Settings.getPlatform());174 System.out.println("Architect: " + Settings.getArchitecture());174 System.out.println("Platform: " + PlatformInformation.getPlatform()); 175 System.out.println("Architect: " + PlatformInformation.getArchitecture()); 175 176 System.out.println(".NET: " + DotNet.isInstalled()); 176 177 System.out.println("OniSplit: " + OniSplit.isOniSplitInstalled()); … … 190 191 HTMLLinkLabel hll = new HTMLLinkLabel(); 191 192 String dlUrl = ""; 192 switch ( Settings.getPlatform()) {193 switch (PlatformInformation.getPlatform()) { 193 194 case WIN: 194 switch ( Settings.getArchitecture()) {195 switch (PlatformInformation.getArchitecture()) { 195 196 case X86: 196 197 dlUrl = "http://download.microsoft.com/download/c/6/e/c6e88215-0178-4c6c-b5f3-158ff77b1f38/NetFx20SP2_x86.exe"; … … 220 221 globalBundle.getString("invalidPath.title"), 221 222 JOptionPane.ERROR_MESSAGE); 222 if (!Settings .isDebug()) {223 if (!SettingsManager.isDebug()) { 223 224 return; 224 225 } … … 238 239 JOptionPane.INFORMATION_MESSAGE); 239 240 } 240 Settings .getInstance().setOfflineMode(offline);241 SettingsManager.getInstance().setOfflineMode(offline); 241 242 242 243 SwingUtilities.invokeLater(new Runnable() { -
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; -
AE/installer2/src/net/oni2/aeinstaller/gui/MainWin.java
r708 r720 10 10 import java.awt.event.KeyEvent; 11 11 import java.io.File; 12 import java.io.FileNotFoundException; 12 13 import java.net.URL; 13 14 import java.util.Date; … … 39 40 import javax.swing.filechooser.FileFilter; 40 41 42 import net.oni2.SettingsManager; 41 43 import net.oni2.aeinstaller.AEInstaller2; 42 44 import net.oni2.aeinstaller.backend.ImageResizer; 43 45 import net.oni2.aeinstaller.backend.Paths; 44 import net.oni2.aeinstaller.backend.ToolLauncher;45 46 import net.oni2.aeinstaller.backend.SizeFormatter; 46 47 import net.oni2.aeinstaller.backend.depot.DepotManager; 47 48 import net.oni2.aeinstaller.backend.oni.InstallProgressListener; 48 49 import net.oni2.aeinstaller.backend.oni.Installer; 50 import net.oni2.aeinstaller.backend.oni.OniLauncher; 49 51 import net.oni2.aeinstaller.backend.oni.OniSplit; 50 52 import net.oni2.aeinstaller.backend.packages.Package; … … 57 59 import net.oni2.aeinstaller.gui.corepackages.CorePackagesDialog; 58 60 import net.oni2.aeinstaller.gui.downloadwindow.Downloader; 61 import net.oni2.aeinstaller.gui.modtable.EApplyFilterTo; 59 62 import net.oni2.aeinstaller.gui.modtable.ModInstallSelectionListener; 60 import net.oni2.aeinstaller.gui.modtable.EApplyFilterTo;61 63 import net.oni2.aeinstaller.gui.modtable.ModSelectionListener; 62 64 import net.oni2.aeinstaller.gui.modtable.ModTable; … … 65 67 import net.oni2.aeinstaller.gui.settings.SettingsDialog; 66 68 import net.oni2.aeinstaller.gui.toolmanager.ToolManager; 67 import net.oni2.applicationinvoker.AppExecution; 68 import net.oni2.settingsmanager.Settings; 69 import net.oni2.settingsmanager.Settings.Platform; 69 import net.oni2.platformtools.PlatformInformation; 70 import net.oni2.platformtools.PlatformInformation.Platform; 71 import net.oni2.platformtools.applicationinvoker.ApplicationInvoker; 72 import net.oni2.platformtools.applicationinvoker.ERuntimeNotInstalledException; 70 73 71 74 import org.javabuilders.BuildResult; … … 138 141 scrollMods.setViewportView(tblMods); 139 142 140 contents.setDividerLocation(Settings.getInstance().get("win_main_divloc", 550)); 143 contents.setDividerLocation(SettingsManager.getInstance().get( 144 "win_main_divloc", 550)); 141 145 contents.setResizeWeight(0.4); 142 146 143 if ( Settings.getPlatform() == Platform.MACOS) {147 if (PlatformInformation.getPlatform() == Platform.MACOS) { 144 148 mainMenu.setVisible(false); 145 149 } … … 165 169 tblMods.addModSelectionListener(this); 166 170 tblMods.addDownloadSizeListener(this); 167 168 setSize(Settings.getInstance().get("win_main_width", 950), Settings.getInstance().get("win_main_height", 600)); 171 172 setSize(SettingsManager.getInstance().get("win_main_width", 950), 173 SettingsManager.getInstance().get("win_main_height", 600)); 169 174 setLocationRelativeTo(null); 170 175 } … … 190 195 191 196 private void saveLocalData() { 192 Settings.getInstance().put("win_main_divloc", contents.getDividerLocation()); 193 Settings.getInstance().put("win_main_width", getWidth()); 194 Settings.getInstance().put("win_main_height", getHeight()); 195 Settings.getInstance().serializeToFile(Paths.getSettingsFilename()); 197 SettingsManager.getInstance().put("win_main_divloc", 198 contents.getDividerLocation()); 199 SettingsManager.getInstance().put("win_main_width", getWidth()); 200 SettingsManager.getInstance().put("win_main_height", getHeight()); 201 SettingsManager.getInstance().serializeToFile( 202 Paths.getSettingsFilename()); 196 203 } 197 204 198 205 @DoInBackground(progressMessage = "updateDepot.title", cancelable = false, indeterminateProgress = false) 199 206 private void execDepotUpdate(final BackgroundEvent evt) { 200 if (!Settings .getInstance().isOfflineMode()201 && !Settings .getInstance().isNoCacheUpdateMode()) {207 if (!SettingsManager.getInstance().isOfflineMode() 208 && !SettingsManager.getInstance().isNoCacheUpdateMode()) { 202 209 long start = new Date().getTime(); 203 210 … … 222 229 private void checkUpdates(Object evtSource) { 223 230 if ((evtSource != this) 224 || Settings .getInstance().get("notifyupdates", true)) {225 if (Settings .getInstance().isOfflineMode()) {231 || SettingsManager.getInstance().get("notifyupdates", true)) { 232 if (SettingsManager.getInstance().isOfflineMode()) { 226 233 if (evtSource != this) { 227 234 JOptionPane.showMessageDialog( … … 250 257 size += m.getZipSize(); 251 258 JCheckBox check = new JCheckBox("Mod: " + m.getName() 252 + " (" + SizeFormatter.format(m.getZipSize(), 1) + ")"); 259 + " (" + SizeFormatter.format(m.getZipSize(), 1) 260 + ")"); 253 261 check.setSelected(true); 254 262 check.addItemListener(new ItemListener() { … … 274 282 size += m.getZipSize(); 275 283 JCheckBox check = new JCheckBox("Tool: " + m.getName() 276 + " (" + SizeFormatter.format(m.getZipSize(), 1) + ")"); 284 + " (" + SizeFormatter.format(m.getZipSize(), 1) 285 + ")"); 277 286 check.setSelected(true); 278 287 check.addItemListener(new ItemListener() { … … 313 322 JCheckBox checkFutureUpdates = new JCheckBox( 314 323 bundle.getString("checkOnStartup.text")); 315 checkFutureUpdates.setSelected(Settings .getInstance().get(316 "notifyupdates", true));324 checkFutureUpdates.setSelected(SettingsManager 325 .getInstance().get("notifyupdates", true)); 317 326 checkFutureUpdates.addItemListener(new ItemListener() { 318 327 @Override 319 328 public void itemStateChanged(ItemEvent evt) { 320 Settings .getInstance().put("notifyupdates",329 SettingsManager.getInstance().put("notifyupdates", 321 330 evt.getStateChange() == ItemEvent.SELECTED); 322 331 } … … 492 501 public void actionPerformed(ActionEvent evt) { 493 502 try { 494 ToolLauncher.launch(m); 495 } catch (Exception ex) { 496 if (ex.getMessage().contains("JRE")) 503 ApplicationInvoker.execute(m.getExeType(), 504 m.getWorkingDir(), m.getExeFile(), null); 505 } catch (ERuntimeNotInstalledException e) { 506 JOptionPane.showMessageDialog(null, 507 bundle.getString("exeNotFound.text"), 508 bundle.getString("exeNotFound.title"), 509 JOptionPane.ERROR_MESSAGE); 510 e.printStackTrace(); 511 } catch (FileNotFoundException e) { 512 if (e.getMessage().contains("JRE")) 497 513 JOptionPane.showMessageDialog(null, 498 514 bundle.getString("jreNotFound.text"), 499 515 bundle.getString("jreNotFound.title"), 500 516 JOptionPane.ERROR_MESSAGE); 501 if (e x.getMessage().contains(".NET"))517 if (e.getMessage().contains(".NET")) 502 518 JOptionPane.showMessageDialog( 503 519 null, … … 505 521 bundle.getString("dotNetNotFound.title"), 506 522 JOptionPane.ERROR_MESSAGE); 523 if (e.getMessage().contains("Wine")) 524 JOptionPane.showMessageDialog(null, 525 bundle.getString("wineNotFound.text"), 526 bundle.getString("wineNotFound.title"), 527 JOptionPane.ERROR_MESSAGE); 528 e.printStackTrace(); 507 529 } 508 530 } … … 525 547 @DoInBackground(progressMessage = "checkCorePackages.title", cancelable = false, indeterminateProgress = false) 526 548 private void checkCorePackages(final BackgroundEvent evt) { 527 if (!Settings .getInstance().isOfflineMode()) {549 if (!SettingsManager.getInstance().isOfflineMode()) { 528 550 for (Package m : PackageManager.getInstance().getCoreTools()) { 529 551 if (m.isNewerAvailable()) { … … 558 580 } 559 581 evt.setProgressMessage(bundle.getString("coreToolsInstall.title")); 560 Installer.installTools(PackageManager.getInstance().getCoreTools(), false); 582 Installer.installTools(PackageManager.getInstance().getCoreTools(), 583 false); 561 584 } 562 585 } … … 594 617 } 595 618 596 if (toDownload.size() > 0 && Settings.getInstance().isOfflineMode()) { 619 if (toDownload.size() > 0 620 && SettingsManager.getInstance().isOfflineMode()) { 597 621 installState = EInstallState.OFFLINE; 598 622 break; … … 647 671 .getString("installDependencies.none"); 648 672 649 if (!Settings .getInstance()650 .get("notifyDepsAfterInstall", false)) {673 if (!SettingsManager.getInstance().get( 674 "notifyDepsAfterInstall", false)) { 651 675 int res = JOptionPane.showConfirmDialog(this, String 652 676 .format(bundle … … 736 760 revertSelection(); 737 761 if (installDeps.size() > 0 738 && Settings .getInstance().get("notifyDepsAfterInstall",739 false)) {762 && SettingsManager.getInstance().get( 763 "notifyDepsAfterInstall", false)) { 740 764 String installedDeps = ""; 741 765 for (Package m : installDeps) { … … 835 859 } 836 860 837 private Vector<String> getBasicOniLaunchParams() { 838 Vector<String> params = new Vector<String>(); 839 File exe = null; 840 switch (Settings.getPlatform()) { 841 case WIN: 842 exe = new File(Paths.getEditionBasePath(), "Oni.exe"); 843 if (exe.exists()) 844 params.add(exe.getPath()); 845 break; 846 case MACOS: 847 exe = new File(Paths.getEditionBasePath(), 848 "Oni.app/Contents/MacOS/Oni"); 849 if (exe.exists()) 850 params.add(exe.getPath()); 851 break; 852 case LINUX: 853 String wine = Settings.getWinePath(); 854 exe = new File(Paths.getEditionBasePath(), "Oni.exe"); 855 if (exe.exists()) { 856 if (wine != null) { 857 params.add(wine); 858 params.add(exe.getPath()); 859 } 860 } 861 break; 862 default: 863 } 864 if (params.size() > 0) { 865 params.add("-debugfiles"); 866 } 867 return params; 861 private void oni(boolean windowed) { 862 try { 863 OniLauncher.launch(windowed); 864 } catch (FileNotFoundException e) { 865 JOptionPane.showMessageDialog(this, 866 bundle.getString("oniExeNotFound.text"), 867 bundle.getString("oniExeNotFound.title"), 868 JOptionPane.ERROR_MESSAGE); 869 e.printStackTrace(); 870 } catch (ERuntimeNotInstalledException e) { 871 JOptionPane.showMessageDialog(this, 872 bundle.getString("wineNotFound.text"), 873 bundle.getString("wineNotFound.title"), 874 JOptionPane.ERROR_MESSAGE); 875 e.printStackTrace(); 876 } 868 877 } 869 878 870 879 @SuppressWarnings("unused") 871 880 private void oniFull() { 872 Vector<String> params = getBasicOniLaunchParams(); 873 if (params.size() > 0) { 874 AppExecution.execute(params, Paths.getEditionBasePath()); 875 } 881 oni(false); 876 882 } 877 883 878 884 @SuppressWarnings("unused") 879 885 private void oniWin() { 880 Vector<String> params = getBasicOniLaunchParams(); 881 if (params.size() > 0) { 882 params.add("-noswitch"); 883 AppExecution.execute(params, Paths.getEditionBasePath()); 884 } 886 oni(true); 885 887 } 886 888 -
AE/installer2/src/net/oni2/aeinstaller/gui/corepackages/CorePackagesDialog.java
r708 r720 12 12 import javax.swing.KeyStroke; 13 13 14 import net.oni2.SettingsManager; 14 15 import net.oni2.aeinstaller.backend.packages.Package; 15 16 import net.oni2.aeinstaller.gui.modtable.ModSelectionListener; … … 17 18 import net.oni2.aeinstaller.gui.modtable.ModTable.ETableContentType; 18 19 import net.oni2.aeinstaller.gui.packageinfobox.PackageInfoBox; 19 import net.oni2.settingsmanager.Settings;20 20 21 21 import org.javabuilders.BuildResult; … … 60 60 getRootPane().getActionMap().put("close", closeAction); 61 61 62 contents.setDividerLocation(Settings .getInstance().get("win_core_divloc", 550));62 contents.setDividerLocation(SettingsManager.getInstance().get("win_core_divloc", 550)); 63 63 contents.setResizeWeight(0.4); 64 64 … … 69 69 tblTools.addModSelectionListener(this); 70 70 71 setSize(Settings .getInstance().get("win_core_width", 950), Settings.getInstance().get("win_core_height", 600));71 setSize(SettingsManager.getInstance().get("win_core_width", 950), SettingsManager.getInstance().get("win_core_height", 600)); 72 72 setLocationRelativeTo(null); 73 73 } … … 80 80 @SuppressWarnings("unused") 81 81 private void closing() { 82 Settings .getInstance().put("win_core_divloc", contents.getDividerLocation());83 Settings .getInstance().put("win_core_width", getWidth());84 Settings .getInstance().put("win_core_height", getHeight());82 SettingsManager.getInstance().put("win_core_divloc", contents.getDividerLocation()); 83 SettingsManager.getInstance().put("win_core_width", getWidth()); 84 SettingsManager.getInstance().put("win_core_height", getHeight()); 85 85 } 86 86 } -
AE/installer2/src/net/oni2/aeinstaller/gui/modtable/ModTable.java
r708 r720 35 35 import javax.swing.table.TableRowSorter; 36 36 37 import net.oni2.SettingsManager; 37 38 import net.oni2.aeinstaller.backend.packages.Package; 38 39 import net.oni2.aeinstaller.backend.packages.Type; 39 40 import net.oni2.aeinstaller.gui.downloadwindow.Downloader; 40 import net.oni2.settingsmanager.Settings;41 41 42 42 /** … … 103 103 List<RowSorter.SortKey> sortKeys = new ArrayList<RowSorter.SortKey>(); 104 104 105 int sortCol = Settings .getInstance().get("modSortColumn", 1);106 SortOrder sortOrder = SortOrder.valueOf(Settings .getInstance().get(105 int sortCol = SettingsManager.getInstance().get("modSortColumn", 1); 106 SortOrder sortOrder = SortOrder.valueOf(SettingsManager.getInstance().get( 107 107 "modSortOrder", "ASCENDING")); 108 108 … … 244 244 int col = keys.get(0).getColumn(); 245 245 SortOrder so = keys.get(0).getSortOrder(); 246 Settings .getInstance().put("modSortColumn", col);247 Settings .getInstance().put("modSortOrder", so.toString());246 SettingsManager.getInstance().put("modSortColumn", col); 247 SettingsManager.getInstance().put("modSortOrder", so.toString()); 248 248 } 249 249 } … … 459 459 for (int i = 1; i < columns.size(); i++) { 460 460 TableColumn tc = columns.get(i); 461 if (!Settings .getInstance().get(461 if (!SettingsManager.getInstance().get( 462 462 String.format("modShowColumn%02d", tc.getModelIndex()), 463 463 true)) … … 506 506 tcm.removeColumn(col); 507 507 } 508 Settings .getInstance().put(508 SettingsManager.getInstance().put( 509 509 String.format("modShowColumn%02d", 510 510 col.getModelIndex()), itm.isSelected()); -
AE/installer2/src/net/oni2/aeinstaller/gui/settings/LaFComboModel.java
r708 r720 9 9 import javax.swing.event.ListDataListener; 10 10 11 import net.oni2. settingsmanager.Settings;11 import net.oni2.SettingsManager; 12 12 13 13 /** … … 32 32 33 33 34 String laf = Settings .getInstance().get("lookandfeel",34 String laf = SettingsManager.getInstance().get("lookandfeel", 35 35 UIManager.getLookAndFeel().getClass().getName()); 36 36 -
AE/installer2/src/net/oni2/aeinstaller/gui/settings/SettingsDialog.java
r708 r720 14 14 import javax.swing.UIManager; 15 15 16 import net.oni2. settingsmanager.Settings;16 import net.oni2.SettingsManager; 17 17 18 18 import org.javabuilders.BuildResult; … … 66 66 67 67 private void initValues() { 68 Settings set = Settings.getInstance();68 SettingsManager set = SettingsManager.getInstance(); 69 69 70 70 laFModel = new LaFComboModel(); … … 79 79 @SuppressWarnings("unused") 80 80 private boolean save() { 81 Settings set = Settings.getInstance();81 SettingsManager set = SettingsManager.getInstance(); 82 82 83 83 set.put("notifyupdates", chkNotifyOnStart.isSelected()); -
AE/installer2/src/net/oni2/aeinstaller/gui/toolmanager/ToolManager.java
r708 r720 17 17 import javax.swing.KeyStroke; 18 18 19 import net.oni2.SettingsManager; 19 20 import net.oni2.aeinstaller.backend.oni.Installer; 20 21 import net.oni2.aeinstaller.backend.packages.Package; … … 24 25 import net.oni2.aeinstaller.gui.modtable.ModTable.ETableContentType; 25 26 import net.oni2.aeinstaller.gui.packageinfobox.PackageInfoBox; 26 import net.oni2.settingsmanager.Settings;27 27 28 28 import org.javabuilders.BuildResult; … … 73 73 getRootPane().getActionMap().put("close", closeAction); 74 74 75 contents.setDividerLocation(Settings .getInstance().get("win_tools_divloc", 550));75 contents.setDividerLocation(SettingsManager.getInstance().get("win_tools_divloc", 550)); 76 76 contents.setResizeWeight(0.4); 77 77 … … 87 87 SwingJavaBuilder.getConfig().getResource("img.uninstall"))); 88 88 89 setSize(Settings .getInstance().get("win_tools_width", 950), Settings.getInstance().get("win_tools_height", 600));89 setSize(SettingsManager.getInstance().get("win_tools_width", 950), SettingsManager.getInstance().get("win_tools_height", 600)); 90 90 setLocationRelativeTo(null); 91 91 } … … 100 100 } else { 101 101 if (!selectedPackage.isLocalAvailable()) { 102 if (Settings .getInstance().isOfflineMode()) {102 if (SettingsManager.getInstance().isOfflineMode()) { 103 103 JOptionPane.showMessageDialog(this, 104 104 bundle.getString("offlineMode.text"), … … 152 152 @SuppressWarnings("unused") 153 153 private void closing() { 154 Settings .getInstance().put("win_tools_divloc", contents.getDividerLocation());155 Settings .getInstance().put("win_tools_width", getWidth());156 Settings .getInstance().put("win_tools_height", getHeight());154 SettingsManager.getInstance().put("win_tools_divloc", contents.getDividerLocation()); 155 SettingsManager.getInstance().put("win_tools_width", getWidth()); 156 SettingsManager.getInstance().put("win_tools_height", getHeight()); 157 157 } 158 158 } -
AE/installer2/src/net/oni2/aeinstaller/localization/MainWin.properties
r673 r720 89 89 dotNetNotFound.text=This tool requires a .NET runtime but it was not found. 90 90 dotNetNotFound.title=No .NET runtime found 91 92 wineNotFound.text=Wine is required to run a Windows executable on Linux but it was not found. 93 wineNotFound.title=Wine not found 94 95 oniExeNotFound.text=Oni's executable was not found. 96 oniExeNotFound.title=Oni not found 97 98 exeNotFound.text=Executable was not found. 99 exeNotFound.title=Exe not found
Note:
See TracChangeset
for help on using the changeset viewer.