Changeset 672 for AE/installer2/src/net
- Timestamp:
- Feb 23, 2013, 6:40:47 PM (12 years ago)
- Location:
- AE/installer2/src/net/oni2/aeinstaller
- Files:
-
- 3 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/installer2/src/net/oni2/aeinstaller/AEInstaller.properties
r671 r672 1 1 appname=AE Installer 2 2 appversion=0.99 p2 appversion=0.99q -
AE/installer2/src/net/oni2/aeinstaller/AEInstaller2.java
r653 r672 21 21 import javax.swing.UIManager.LookAndFeelInfo; 22 22 23 import net.oni2.aeinstaller.backend.DotNet; 23 24 import net.oni2.aeinstaller.backend.Paths; 24 25 import net.oni2.aeinstaller.backend.Settings; … … 171 172 System.out.println("Platform: " + Settings.getPlatform()); 172 173 System.out.println("Architect: " + Settings.getArchitecture()); 173 System.out.println(".NET: " + OniSplit.isDotNETInstalled());174 System.out.println(".NET: " + DotNet.isInstalled()); 174 175 System.out.println("OniSplit: " + OniSplit.isOniSplitInstalled()); 175 176 System.out.println("Globalized:" + Installer.isEditionInitialized()); … … 185 186 System.out.println(); 186 187 187 if (! OniSplit.isDotNETInstalled()) {188 if (!DotNet.isInstalled()) { 188 189 HTMLLinkLabel hll = new HTMLLinkLabel(); 189 190 String dlUrl = ""; -
AE/installer2/src/net/oni2/aeinstaller/backend/depot/DepotManager.java
r662 r672 275 275 NodeMod nm = (NodeMod) n; 276 276 if (nm.getInstallMethod().getName() 277 .equalsIgnoreCase(instMethName)) 278 result.add(nm); 277 .equalsIgnoreCase(instMethName)) { 278 try { 279 nm.getPackageNumber(); 280 result.add(nm); 281 } catch (NumberFormatException e) { 282 System.err.println("Node " + nm.getNid() + " does not have a package number!!!"); 283 } 284 } 279 285 } 280 286 } -
AE/installer2/src/net/oni2/aeinstaller/backend/oni/OniSplit.java
r624 r672 3 3 import java.io.File; 4 4 import java.io.IOException; 5 import java.lang.reflect.InvocationTargetException;6 import java.util.Map;7 5 import java.util.Vector; 8 6 7 import net.oni2.aeinstaller.backend.DotNet; 9 8 import net.oni2.aeinstaller.backend.Paths; 10 9 import net.oni2.aeinstaller.backend.AppExecution; 11 10 import net.oni2.aeinstaller.backend.Settings; 12 import net.oni2.aeinstaller.backend.Settings.Architecture;13 11 import net.oni2.aeinstaller.backend.Settings.Platform; 14 import net.oni2.aeinstaller.backend.WinRegistry;15 12 16 13 /** … … 18 15 */ 19 16 public class OniSplit { 20 21 /**22 * @return is a .NET implementation installed?23 */24 public static boolean isDotNETInstalled() {25 switch (Settings.getPlatform()) {26 case WIN:27 try {28 int view = WinRegistry.KEY_WOW64_32KEY;29 if (Settings.getArchitecture() == Architecture.AMD64)30 view = WinRegistry.KEY_WOW64_64KEY;31 32 Map<String, String> m = WinRegistry33 .readStringValues(34 WinRegistry.HKEY_LOCAL_MACHINE,35 "Software\\Microsoft\\NET Framework Setup\\NDP\\v2.0.50727",36 view);37 return m != null;38 } catch (IllegalArgumentException e) {39 e.printStackTrace();40 } catch (IllegalAccessException e) {41 e.printStackTrace();42 } catch (InvocationTargetException e) {43 e.printStackTrace();44 } catch (Exception e) {45 if (!e.getMessage()46 .equals("Registry access not supported (not a Windows OS?)."))47 e.printStackTrace();48 }49 return false;50 case MACOS:51 case LINUX:52 Vector<String> cmd = new Vector<String>();53 cmd.add("which");54 cmd.add("mono");55 Vector<String> res = null;56 try {57 res = AppExecution.executeAndWait(cmd);58 } catch (IOException e) {59 e.printStackTrace();60 }61 if (res != null) {62 if (res.get(0).startsWith("/")63 && res.get(0).endsWith("mono")) {64 return true;65 }66 }67 return false;68 default:69 return false;70 }71 }72 17 73 18 /** … … 209 154 private static Vector<String> getProgramInvocation() { 210 155 Vector<String> res = new Vector<String>(); 211 if ( Settings.getPlatform() != Platform.WIN)212 res.add( "mono");156 if (DotNet.getRuntimeExe().length() > 0) 157 res.add(DotNet.getRuntimeExe()); 213 158 res.add(getProgramFile().getPath()); 214 159 return res; -
AE/installer2/src/net/oni2/aeinstaller/backend/packages/Mod_Info.java
r671 r672 27 27 28 28 private File exeFile = null; 29 private EExeType exeType = EExeType.OSBINARY; 29 30 private File iconFile = null; 30 31 private String workingDir = "Base"; … … 111 112 } else if (sName.equalsIgnoreCase("ExeName")) { 112 113 exeFile = new File(Paths.getEditionBasePath(), sVal); 114 } else if (sName.equalsIgnoreCase("ExeType")) { 115 if (sVal.equalsIgnoreCase("OSBinary")) 116 exeType = EExeType.OSBINARY; 117 else if (sVal.equalsIgnoreCase("DotNet")) 118 exeType = EExeType.DOTNET; 119 else if (sVal.equalsIgnoreCase("Jar")) 120 exeType = EExeType.JAR; 113 121 } else if (sName.equalsIgnoreCase("WorkingDir")) { 114 122 workingDir = sVal; … … 116 124 iconFile = new File(Paths.getEditionBasePath(), sVal); 117 125 } 126 } 127 if (exeFile != null) { 128 if (exeFile.getName().toLowerCase().endsWith(".jar")) 129 exeType = EExeType.JAR; 118 130 } 119 131 } catch (FileNotFoundException e) { … … 203 215 204 216 /** 217 * @return the exeType 218 */ 219 public EExeType getExeType() { 220 return exeType; 221 } 222 223 /** 205 224 * @return the iconFile 206 225 */ -
AE/installer2/src/net/oni2/aeinstaller/backend/packages/Package.java
r670 r672 44 44 45 45 private File exeFile = null; 46 private EExeType exeType = EExeType.OSBINARY; 46 47 private File iconFile = null; 47 48 private String workingDir = "Base"; … … 124 125 125 126 exeFile = mi.getExeFile(); 127 exeType = mi.getExeType(); 126 128 workingDir = mi.getWorkingDir(); 127 129 iconFile = mi.getIconFile(); … … 387 389 388 390 /** 391 * @return Executable type of this tool 392 */ 393 public EExeType getExeType() { 394 return exeType; 395 } 396 397 /** 389 398 * @return Icon file of this tool 390 399 */ -
AE/installer2/src/net/oni2/aeinstaller/gui/MainWin.java
r671 r672 44 44 import net.oni2.aeinstaller.backend.Paths; 45 45 import net.oni2.aeinstaller.backend.Settings; 46 import net.oni2.aeinstaller.backend.ToolLauncher; 46 47 import net.oni2.aeinstaller.backend.Settings.Platform; 47 48 import net.oni2.aeinstaller.backend.SizeFormatter; … … 229 230 TreeSet<Package> tools = PackageManager.getInstance() 230 231 .getUpdatableTools(); 231 int size = 0;232 232 JPanel panPackages = new JPanel(new GridLayout(0, 1)); 233 233 execUpdates = new TreeSet<Package>(); 234 234 execUpdates.addAll(mods); 235 235 execUpdates.addAll(tools); 236 final JLabel lblSize = new JLabel("<html>" 237 + String.format( 238 bundle.getString("updatesAvailableSize.text"), 239 SizeFormatter.format(0, 3)) + "</html>"); 240 int size = 0; 236 241 for (final Package m : mods) { 237 242 size += m.getZipSize(); 238 JCheckBox check = new JCheckBox("Mod: " + m.getName()); 243 JCheckBox check = new JCheckBox("Mod: " + m.getName() 244 + " (" + SizeFormatter.format(size, 1) + ")"); 239 245 check.setSelected(true); 240 246 check.addItemListener(new ItemListener() { … … 245 251 else 246 252 execUpdates.remove(m); 253 int s = 0; 254 for (Package p : execUpdates) 255 s += p.getZipSize(); 256 lblSize.setText("<html>" 257 + String.format( 258 bundle.getString("updatesAvailableSize.text"), 259 SizeFormatter.format(s, 3)) 260 + "</html>"); 247 261 } 248 262 }); … … 251 265 for (final Package m : tools) { 252 266 size += m.getZipSize(); 253 JCheckBox check = new JCheckBox("Tool: " + m.getName()); 267 JCheckBox check = new JCheckBox("Tool: " + m.getName() 268 + " (" + SizeFormatter.format(size, 1) + ")"); 254 269 check.setSelected(true); 270 check.addItemListener(new ItemListener() { 271 @Override 272 public void itemStateChanged(ItemEvent e) { 273 if (e.getStateChange() == ItemEvent.SELECTED) 274 execUpdates.add(m); 275 else 276 execUpdates.remove(m); 277 int s = 0; 278 for (Package p : execUpdates) 279 s += p.getZipSize(); 280 lblSize.setText("<html>" 281 + String.format( 282 bundle.getString("updatesAvailableSize.text"), 283 SizeFormatter.format(s, 3)) 284 + "</html>"); 285 } 286 }); 255 287 panPackages.add(check); 256 288 } 289 lblSize.setText("<html>" 290 + String.format( 291 bundle.getString("updatesAvailableSize.text"), 292 SizeFormatter.format(size, 3)) + "</html>"); 257 293 if (size > 0) { 258 294 // Build info dialog content … … 261 297 + bundle.getString("updatesAvailable.text") 262 298 + "</html>"); 263 JLabel lblSize = new JLabel("<html>"264 + String.format(bundle265 .getString("updatesAvailableSize.text"),266 SizeFormatter.format(size, 3)) + "</html>");267 299 packages.add(lblIntro, BorderLayout.NORTH); 268 300 packages.add(panPackages, BorderLayout.CENTER); … … 433 465 } 434 466 toolsMenuItems.clear(); 435 for ( Package m : PackageManager.getInstance().getInstalledTools()) {467 for (final Package m : PackageManager.getInstance().getInstalledTools()) { 436 468 File exe = m.getExeFile(); 437 469 if (exe != null && exe.exists()) { 438 470 JMenuItem item = new JMenuItem(); 439 final Vector<String> params = new Vector<String>();440 if (exe.getName().toLowerCase().endsWith(".jar")) {441 File jre = null;442 if (Settings.getPlatform() == Platform.WIN)443 jre = new File(System.getProperties().getProperty(444 "java.home"), "bin/javaw.exe");445 else446 jre = new File(System.getProperties().getProperty(447 "java.home"), "bin/java");448 params.add(jre.getPath());449 params.add("-jar");450 }451 params.add(exe.getPath());452 final File wd = m.getWorkingDir();453 471 ImageIcon ico = null; 454 472 if (m.getIconFile() != null && m.getIconFile().exists()) { … … 464 482 465 483 @Override 466 public void actionPerformed(ActionEvent e) { 467 AppExecution.execute(params, wd); 484 public void actionPerformed(ActionEvent evt) { 485 try { 486 ToolLauncher.launch(m); 487 } catch (Exception ex) { 488 if (ex.getMessage().contains("JRE")) 489 JOptionPane.showMessageDialog(null, 490 bundle.getString("jreNotFound.text"), 491 bundle.getString("jreNotFound.title"), 492 JOptionPane.ERROR_MESSAGE); 493 if (ex.getMessage().contains(".NET")) 494 JOptionPane.showMessageDialog(null, 495 bundle.getString("dotNetNotFound.text"), 496 bundle.getString("dotNetNotFound.title"), 497 JOptionPane.ERROR_MESSAGE); 498 } 468 499 } 469 500 }); -
AE/installer2/src/net/oni2/aeinstaller/localization/MainWin.properties
r661 r672 83 83 doUpdate.title=Updating packages 84 84 85 jreNotFound.text=This tool requires a JRE but it was not found. 86 jreNotFound.title=No JRE found 87 88 dotNetNotFound.text=This tool requires a .NET runtime but it was not found. 89 dotNetNotFound.title=No .NET runtime found
Note:
See TracChangeset
for help on using the changeset viewer.