Changeset 641 for AE/installer2/src/net/oni2
- Timestamp:
- Jan 21, 2013, 12:14:52 PM (12 years ago)
- Location:
- AE/installer2/src/net/oni2/aeinstaller
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/installer2/src/net/oni2/aeinstaller/AEInstaller.properties
r640 r641 1 1 appname=AE Installer 2 2 appversion=0.9 72 appversion=0.98 -
AE/installer2/src/net/oni2/aeinstaller/backend/depot/DepotManager.java
r635 r641 27 27 28 28 import org.apache.http.HttpResponse; 29 import org.apache.http.client.methods.Http Get;29 import org.apache.http.client.methods.HttpHead; 30 30 import org.apache.http.client.methods.HttpRequestBase; 31 31 import org.apache.http.impl.client.DefaultHttpClient; … … 196 196 try { 197 197 DefaultHttpClient httpclient = new DefaultHttpClient(); 198 httpQuery = new Http Get(DepotConfig.getDepotUrl());198 httpQuery = new HttpHead(DepotConfig.getDepotUrl()); 199 199 200 200 HttpResponse response = httpclient.execute(httpQuery); -
AE/installer2/src/net/oni2/aeinstaller/backend/network/FileDownloader.java
r634 r641 48 48 private URL url = null; 49 49 private File target = null; 50 private int size = -1;50 private int fileLength = Integer.MAX_VALUE; 51 51 private int downloaded = 0; 52 52 … … 64 64 this.url = new URL(url); 65 65 this.target = target; 66 67 URLConnection connection = this.url.openConnection();68 connection.connect();69 size = connection.getContentLength();70 66 } 71 67 … … 94 90 t.start(); 95 91 state = EState.RUNNING; 96 updateStatus(downloaded, size);97 92 } 98 93 } … … 108 103 else 109 104 state = EState.RUNNING; 110 updateStatus(downloaded, size);105 updateStatus(downloaded, fileLength); 111 106 } 112 107 } … … 149 144 public void run() { 150 145 int downloaded = 0; 151 int fileLength = Integer.MAX_VALUE;152 146 String strLastModified = null; 153 147 String strEtag = null; … … 181 175 try { 182 176 URLConnection connection = url.openConnection(); 177 connection.setRequestProperty("Cache-Control", "no-cache"); 183 178 if (downloaded == 0) { 184 179 connection.connect(); … … 257 252 258 253 /** 259 * @return the size260 */261 public int getSize() {262 return size;263 }264 265 /**266 254 * @return the downloaded size 267 255 */ -
AE/installer2/src/net/oni2/aeinstaller/gui/MainWin.java
r640 r641 82 82 private JMenu mainMenu; 83 83 private JMenu toolsMenu; 84 private TreeSet<JMenuItem> toolsMenuItems = new TreeSet<JMenuItem>();84 private Vector<JMenuItem> toolsMenuItems = new Vector<JMenuItem>(); 85 85 86 86 private JSplitPane contents; … … 94 94 95 95 private JLabel lblTitleVal; 96 private JLabel lblSubmitterVal;97 96 private JLabel lblCreatorVal; 98 97 private JLabel lblTypesVal; … … 106 105 private TreeSet<Mod> execUpdates = null; 107 106 108 private enum EInstall Result{107 private enum EInstallState { 109 108 DONE, 109 READY, 110 ABORTED, 110 111 OFFLINE, 111 INCOMPATIBLE 112 INCOMPATIBLE, 113 CHECKING 112 114 }; 113 115 114 private EInstallResult installDone = EInstallResult.DONE; 116 private EInstallState installState = EInstallState.DONE; 117 private TreeSet<Mod> installMods = null; 115 118 116 119 /** … … 468 471 } 469 472 470 @ DoInBackground(progressMessage = "installing.title", cancelable = false, indeterminateProgress = false)471 private void install( final BackgroundEvent evt) {473 @SuppressWarnings("unused") 474 private void install() { 472 475 TreeSet<Mod> mods = new TreeSet<Mod>(); 473 476 mods.addAll(ModManager.getInstance().getMandatoryMods()); 474 477 mods.addAll(tblMods.getSelectedMods()); 475 478 476 boolean instReady = false; 477 installDone = EInstallResult.DONE; 478 479 while (!instReady) { 479 installState = EInstallState.CHECKING; 480 481 while (installState == EInstallState.CHECKING) { 480 482 TreeSet<Mod> toDownload = new TreeSet<Mod>(); 481 483 for (Mod m : mods) { … … 484 486 } 485 487 if (Settings.getInstance().isOfflineMode()) { 486 install Done = EInstallResult.OFFLINE;488 installState = EInstallState.OFFLINE; 487 489 break; 488 490 } … … 491 493 try { 492 494 dl.setVisible(true); 493 if (!dl.isFinished()) 495 if (!dl.isFinished()) { 496 installState = EInstallState.ABORTED; 494 497 break; 498 } 495 499 } finally { 496 500 dl.dispose(); … … 500 504 .checkDependencies(mods); 501 505 if (dependencies.size() > 0) { 502 System.out.println("Unmet dependencies: " 503 + dependencies.toString()); 506 int size = 0; 507 String depsLocalString = ""; 508 String depsDownloadString = ""; 504 509 for (Mod m : dependencies.keySet()) { 505 for (Mod mDep : dependencies.get(m)) 506 mods.add(mDep); 510 for (Mod mDep : dependencies.get(m)) { 511 if (!mods.contains(mDep)) { 512 mods.add(mDep); 513 if (!mDep.isLocalAvailable()) { 514 size += mDep.getZipSize(); 515 if (depsDownloadString.length() > 0) 516 depsDownloadString += "\n"; 517 depsDownloadString += " - " + mDep.getName(); 518 } else { 519 if (depsLocalString.length() > 0) 520 depsLocalString += "\n"; 521 depsLocalString += " - " + mDep.getName(); 522 } 523 } 524 } 525 } 526 if (depsLocalString.length() == 0) 527 depsLocalString = bundle.getString("installDependencies.none"); 528 if (depsDownloadString.length() == 0) 529 depsDownloadString = bundle.getString("installDependencies.none"); 530 531 int res = JOptionPane.showConfirmDialog(this, String.format( 532 bundle.getString("installDependencies.text"), 533 depsLocalString, depsDownloadString, 534 SizeFormatter.format(size, 3)), bundle 535 .getString("installDependencies.title"), 536 JOptionPane.YES_NO_OPTION, 537 JOptionPane.INFORMATION_MESSAGE); 538 if (res == JOptionPane.NO_OPTION) { 539 installState = EInstallState.ABORTED; 540 break; 507 541 } 508 542 } else { … … 510 544 .checkIncompabitilites(mods); 511 545 if (conflicts.size() > 0) { 512 install Done = EInstallResult.INCOMPATIBLE;546 installState = EInstallState.INCOMPATIBLE; 513 547 System.err.println("Incompatible mods: " 514 548 + conflicts.toString()); 549 // TODO: Message window with incompatibilities 515 550 break; 516 551 } else { 517 inst Ready = true;518 } 519 } 520 } 521 522 if (inst Ready) {523 TreeSet<Mod> actuallyMods = new TreeSet<Mod>();552 installState = EInstallState.READY; 553 } 554 } 555 } 556 557 if (installState == EInstallState.READY) { 558 installMods = new TreeSet<Mod>(); 524 559 TreeSet<Mod> actuallyTools = new TreeSet<Mod>(); 525 560 … … 528 563 actuallyTools.add(m); 529 564 else 530 actuallyMods.add(m);565 installMods.add(m); 531 566 } 532 567 … … 534 569 Installer.installTools(actuallyTools); 535 570 } 536 537 Installer.install(actuallyMods, new InstallProgressListener() { 571 } 572 573 } 574 575 @DoInBackground(progressMessage = "installing.title", cancelable = false, indeterminateProgress = false) 576 private void installExec(final BackgroundEvent evt) { 577 if (installState == EInstallState.READY) { 578 Installer.install(installMods, new InstallProgressListener() { 538 579 @Override 539 580 public void installProgressUpdate(int done, int total, … … 544 585 } 545 586 }); 546 installDone = EInstallResult.DONE; 547 } 587 installState = EInstallState.DONE; 588 } 589 installMods = null; 548 590 } 549 591 … … 551 593 private void installDone() { 552 594 ModManager.getInstance().updateInstalledMods(); 553 revertSelection(); 554 switch (installDone) { 595 switch (installState) { 555 596 case DONE: 597 revertSelection(); 556 598 JOptionPane.showMessageDialog(this, 557 599 bundle.getString("installDone.text"), … … 565 607 JOptionPane.WARNING_MESSAGE); 566 608 break; 567 case INCOMPATIBLE:609 default: 568 610 break; 569 611 } … … 573 615 public void modSelectionChanged(ModTable source, Mod m) { 574 616 lblTitleVal.setText(""); 575 lblSubmitterVal.setText("");576 617 lblCreatorVal.setText(""); 577 618 lblDescriptionVal.setText(""); … … 582 623 if (m != null) { 583 624 lblTitleVal.setText(m.getName()); 584 lblSubmitterVal.setText(m.getSubmitter());585 625 lblCreatorVal.setText(m.getCreator()); 586 626 lblDescriptionVal.setText(m.getDescription()); -
AE/installer2/src/net/oni2/aeinstaller/gui/MainWin.yml
r639 r641 58 58 ModTable(name=tblMods, visible=false) 59 59 - JButton(name=btnRevertSelection, icon=img.undo16, text=btnRevertSelection.text, toolTipText=btnRevertSelection.tooltip, onAction=[revertSelection]) 60 - JButton(name=btnInstall, icon=img.install, text=btnInstall.text, toolTipText=btnInstall.tooltip, onAction=[install,install Done])60 - JButton(name=btnInstall, icon=img.install, text=btnInstall.text, toolTipText=btnInstall.tooltip, onAction=[install,installExec,installDone]) 61 61 - JLabel(name=lblDownloadSize, text=lblDownloadSize.text) 62 62 - JLabel(name=lblDownloadSizeVal) … … 71 71 - JLabel(name=lblTitle, text=lblTitle.text) 72 72 - JLabel(name=lblTitleVal) 73 - JLabel(name=lblSubmitter, text=lblSubmitter.text)74 - JLabel(name=lblSubmitterVal)75 73 - JLabel(name=lblCreator, text=lblCreator.text) 76 74 - JLabel(name=lblCreatorVal) … … 89 87 [min] [grow] 90 88 >lblTitle lblTitleVal [min] 91 >lblSubmitter lblSubmitterVal [min]92 89 >lblCreator lblCreatorVal [min] 93 90 >lblTypes lblTypesVal [min] -
AE/installer2/src/net/oni2/aeinstaller/gui/about/AboutDialog.java
r593 r641 55 55 .put(ksCtrlW, "close"); 56 56 getRootPane().getActionMap().put("close", closeAction); 57 58 setLocationRelativeTo(null); 57 59 } 58 60 -
AE/installer2/src/net/oni2/aeinstaller/gui/settings/SettingsDialog.java
r629 r641 60 60 61 61 initValues(); 62 63 setLocationRelativeTo(null); 62 64 } 63 65 -
AE/installer2/src/net/oni2/aeinstaller/gui/toolmanager/ToolManager.java
r640 r641 52 52 53 53 private JLabel lblTitleVal; 54 private JLabel lblSubmitterVal;55 54 private JLabel lblCreatorVal; 56 55 private JLabel lblPlatformVal; … … 101 100 icoUninstall = new ImageIcon(getClass().getResource( 102 101 SwingJavaBuilder.getConfig().getResource("img.uninstall"))); 102 103 setLocationRelativeTo(null); 103 104 } 104 105 … … 147 148 public void valueChanged(ListSelectionEvent evt) { 148 149 lblTitleVal.setText(""); 149 lblSubmitterVal.setText("");150 150 lblCreatorVal.setText(""); 151 151 lblDescriptionVal.setText(""); … … 159 159 Mod m = (Mod) lstTools.getSelectedValue(); 160 160 lblTitleVal.setText(m.getName()); 161 lblSubmitterVal.setText(m.getSubmitter());162 161 lblCreatorVal.setText(m.getCreator()); 163 162 lblDescriptionVal.setText(m.getDescription()); -
AE/installer2/src/net/oni2/aeinstaller/gui/toolmanager/ToolManager.yml
r640 r641 18 18 - JLabel(name=lblTitle, text=lblTitle.text) 19 19 - JLabel(name=lblTitleVal) 20 - JLabel(name=lblSubmitter, text=lblSubmitter.text)21 - JLabel(name=lblSubmitterVal)22 20 - JLabel(name=lblCreator, text=lblCreator.text) 23 21 - JLabel(name=lblCreatorVal) … … 35 33 [min] [grow] 36 34 >lblTitle lblTitleVal [min] 37 >lblSubmitter lblSubmitterVal [min]38 35 >lblCreator lblCreatorVal [min] 39 36 >lblPlatform lblPlatformVal [min] -
AE/installer2/src/net/oni2/aeinstaller/localization/MainWin.properties
r640 r641 43 43 44 44 lblTitle.text=Name: 45 lblSubmitter.text=Submitter:46 45 lblCreator.text=Creator: 47 46 lblTypes.text=Types: … … 54 53 updateDepot.title=Updating Mod Depot cache 55 54 55 installDependencies.title=Unmet dependencies 56 installDependencies.text=There are unmet dependencies for some mods.\n\n\ 57 Following mods are already downloaded and will be selected:\n%s\n\n\ 58 These mods will have to be additionally downloaded:\n%s\n\n\ 59 Size of files to be downloaded: %s.\n\nContinue? 60 installDependencies.none=<None> 56 61 installDone.title=Installation done 57 62 installDone.text=You can now play AE Oni. -
AE/installer2/src/net/oni2/aeinstaller/localization/ToolManager.properties
r640 r641 7 7 8 8 lblTitle.text=Name: 9 lblSubmitter.text=Submitter:10 9 lblCreator.text=Creator: 11 10 lblPlatform.text=Platform:
Note:
See TracChangeset
for help on using the changeset viewer.