Changeset 602 for AE/installer2/src/net
- Timestamp:
- Jan 10, 2013, 4:39:53 PM (12 years ago)
- Location:
- AE/installer2/src/net/oni2/aeinstaller
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/installer2/src/net/oni2/aeinstaller/AEInstaller.properties
r600 r602 1 1 appname=AE Installer 2 2 appversion=0.5 02 appversion=0.55 3 3 4 4 invalidPath.title=Wrong directory -
AE/installer2/src/net/oni2/aeinstaller/AEInstaller2.java
r600 r602 132 132 System.out.println("Architect: " + Settings.getArchitecture()); 133 133 System.out.println(".NET: " + OniSplit.isDotNETInstalled()); 134 System.out.println("OniSplit: " + OniSplit.isOniSplitInstalled()); 134 135 System.out.println("Globalized:" + Installer.isEditionInitialized()); 135 136 -
AE/installer2/src/net/oni2/aeinstaller/backend/Paths.java
r598 r602 16 16 */ 17 17 public static File getInstallerPath() { 18 String jarPath = Settings.class.getProtectionDomain().getCodeSource() 19 .getLocation().getPath(); 20 String decodedPath = null; 21 try { 22 decodedPath = URLDecoder.decode(jarPath, "UTF-8"); 23 } catch (UnsupportedEncodingException e) { 24 e.printStackTrace(); 25 } 26 return new File(decodedPath).getParentFile(); 18 // String jarPath = Settings.class.getProtectionDomain().getCodeSource() 19 // .getLocation().getPath(); 20 // String decodedPath = null; 21 // try { 22 // decodedPath = URLDecoder.decode(jarPath, "UTF-8"); 23 // } catch (UnsupportedEncodingException e) { 24 // e.printStackTrace(); 25 // } 26 // return new File(decodedPath).getParentFile(); 27 String wd = System.getProperty("user.dir"); 28 return new File(wd); 27 29 } 28 30 -
AE/installer2/src/net/oni2/aeinstaller/backend/depot/DepotConfig.java
r592 r602 61 61 return "Package"; 62 62 } 63 64 /** 65 * @return Taxonomy term name for modtype Tool 66 */ 67 public static String getTaxonomyName_ModType_Tool() { 68 return "Tool"; 69 } 63 70 } -
AE/installer2/src/net/oni2/aeinstaller/backend/mods/Mod.java
r600 r602 13 13 import net.oni2.aeinstaller.backend.Settings; 14 14 import net.oni2.aeinstaller.backend.Settings.Platform; 15 import net.oni2.aeinstaller.backend.depot.DepotConfig; 15 16 import net.oni2.aeinstaller.backend.depot.DepotManager; 16 17 import net.oni2.aeinstaller.backend.depot.model.NodeMod; … … 22 23 public class Mod implements Comparable<Mod> { 23 24 // TODO: Dependencies/Conflicts 24 25 25 26 private String name = ""; 26 27 private int packageNumber = 0; … … 37 38 private net.oni2.aeinstaller.backend.depot.model.File file = null; 38 39 40 private HashSet<Integer> conflicts = new HashSet<Integer>(); 41 private HashSet<Integer> dependencies = new HashSet<Integer>(); 42 39 43 private long localTimestamp = 0; 40 44 … … 52 56 Type t = ModManager.getInstance().getTypeByName(tt.getName()); 53 57 types.add(t); 54 t.addEntry(this); 58 if (!t.getName().equals(DepotConfig.getTaxonomyName_ModType_Tool())) 59 t.addEntry(this); 55 60 } 56 61 platform = nm.getPlatform(); … … 268 273 * @return Is a mod that is always installed? 269 274 */ 270 public boolean is DefaultMod() {275 public boolean isMandatoryMod() { 271 276 return packageNumber < 10000; 272 277 } … … 282 287 public String toString() { 283 288 return name; 289 } 290 291 /** 292 * @return the conflicts 293 */ 294 public HashSet<Integer> getConflicts() { 295 return conflicts; 296 } 297 298 /** 299 * @return the dependencies 300 */ 301 public HashSet<Integer> getDependencies() { 302 return dependencies; 284 303 } 285 304 -
AE/installer2/src/net/oni2/aeinstaller/backend/mods/ModManager.java
r600 r602 5 5 import java.util.Collection; 6 6 import java.util.HashMap; 7 import java.util.HashSet; 8 import java.util.TreeSet; 7 9 import java.util.Vector; 8 10 9 11 import net.oni2.aeinstaller.backend.Paths; 12 import net.oni2.aeinstaller.backend.depot.DepotConfig; 10 13 import net.oni2.aeinstaller.backend.depot.DepotManager; 11 14 import net.oni2.aeinstaller.backend.depot.model.NodeMod; … … 23 26 private HashMap<String, Type> types = new HashMap<String, Type>(); 24 27 private HashMap<Integer, Mod> mods = new HashMap<Integer, Mod>(); 28 private HashMap<Integer, Mod> tools = new HashMap<Integer, Mod>(); 25 29 26 30 /** … … 52 56 } 53 57 58 TaxonomyTerm toolTerm = DepotManager.getInstance().getTaxonomyTerm( 59 DepotConfig.getTaxonomyName_ModType_Tool()); 54 60 for (NodeMod nm : DepotManager.getInstance().getModPackageNodes()) { 55 61 if (nm.getUploads().size() == 1) { 56 62 Mod m = new Mod(nm); 57 mods.put(m.getPackageNumber(), m); 63 if (nm.getTypes().contains(toolTerm)) 64 tools.put(m.getPackageNumber(), m); 65 else 66 mods.put(m.getPackageNumber(), m); 58 67 modFolders.remove(m.getPackageNumber()); 59 68 } … … 102 111 * @return Mods which are always installed 103 112 */ 104 public Collection<Mod> get DefaultMods() {113 public Collection<Mod> getMandatoryMods() { 105 114 Vector<Mod> res = new Vector<Mod>(); 106 115 for (Mod m : mods.values()) { 107 if (m.is DefaultMod())116 if (m.isMandatoryMod()) 108 117 res.add(m); 109 118 } 110 119 return res; 111 120 } 121 122 /** 123 * @return Collection of tools 124 */ 125 public Collection<Mod> getTools() { 126 return tools.values(); 127 } 128 129 /** 130 * @return Tools which are always installed 131 */ 132 public Collection<Mod> getMandatoryTools() { 133 Vector<Mod> res = new Vector<Mod>(); 134 for (Mod m : tools.values()) { 135 if (m.isMandatoryMod()) 136 res.add(m); 137 } 138 return res; 139 } 140 141 /** 142 * Get a mod by its package number 143 * 144 * @param number 145 * Package number 146 * @return Mod or null 147 */ 148 public Mod getModByNumber(int number) { 149 for (Mod m : mods.values()) { 150 if (m.getPackageNumber() == number) 151 return m; 152 } 153 return null; 154 } 155 156 /** 157 * Check for unresolved dependencies within the given mods 158 * 159 * @param mods 160 * Mods to check 161 * @return Unmet dependencies 162 */ 163 public HashMap<Mod, HashSet<Mod>> checkDependencies(TreeSet<Mod> mods) { 164 // TODO: Verify functionality 165 HashMap<Mod, HashSet<Mod>> res = new HashMap<Mod, HashSet<Mod>>(); 166 167 for (Mod m : mods) { 168 for (int depNum : m.getDependencies()) { 169 Mod other = getModByNumber(depNum); 170 if (!mods.contains(other)) { 171 if (!res.containsKey(m)) 172 res.put(m, new HashSet<Mod>()); 173 res.get(m).add(other); 174 } 175 } 176 } 177 178 return res; 179 } 180 181 /** 182 * Check for conflicts between given mods 183 * 184 * @param mods 185 * Mods to check 186 * @return Conflicting mods 187 */ 188 public HashMap<Mod, HashSet<Mod>> checkConflicts(TreeSet<Mod> mods) { 189 // TODO: Verify functionality 190 HashMap<Mod, HashSet<Mod>> res = new HashMap<Mod, HashSet<Mod>>(); 191 192 for (Mod m : mods) { 193 for (int confNum : m.getConflicts()) { 194 Mod other = getModByNumber(confNum); 195 if (mods.contains(other)) { 196 if (!res.containsKey(m)) 197 res.put(m, new HashSet<Mod>()); 198 res.get(m).add(other); 199 } 200 } 201 } 202 203 return res; 204 } 205 112 206 } -
AE/installer2/src/net/oni2/aeinstaller/backend/oni/Installer.java
r600 r602 39 39 } 40 40 41 /** 42 * Install the given set of mods 43 * 44 * @param mods 45 * Mods to install 46 * @param listener 47 * Listener for install progress updates 48 */ 41 49 public static void install(TreeSet<Mod> mods, 42 50 InstallProgressListener listener) { 43 44 51 Vector<File> folders = new Vector<File>(); 45 52 folders.add(Paths.getVanillaOnisPath()); … … 65 72 } 66 73 67 // for (File f : Paths.getModsPath().listFiles()) {68 // File oni = new File(f, "oni");69 // if (oni.exists())70 // folders.add(oni);71 // }72 74 combineBinaryFiles(folders, listener); 73 75 … … 140 142 log.println(); 141 143 } 142 144 143 145 Date end = new Date(); 144 146 log.println("Initialization ended at " + sdf.format(end)); -
AE/installer2/src/net/oni2/aeinstaller/backend/oni/OniSplit.java
r600 r602 77 77 78 78 /** 79 * @return Is Onisplit installed? 80 */ 81 public static boolean isOniSplitInstalled() { 82 return getProgramFile().exists(); 83 } 84 85 /** 79 86 * Export given dat-file to target folder 80 87 * … … 112 119 * @return OniSplit output 113 120 */ 114 public static Vector<String> importLevel(Vector<File> sourceFolders, File targetFile) { 121 public static Vector<String> importLevel(Vector<File> sourceFolders, 122 File targetFile) { 115 123 Vector<String> cmdLine = getProgramInvocation(); 116 124 cmdLine.add(getImportParam()); … … 212 220 if (Settings.getPlatform() != Platform.WIN) 213 221 res.add("mono"); 214 res.add(new File(new File(Paths.getEditionBasePath(), "Tools"), 215 "Onisplit.exe").getPath()); 216 return res; 222 res.add(getProgramFile().getPath()); 223 return res; 224 } 225 226 private static File getProgramFile() { 227 return new File(new File(Paths.getEditionBasePath(), "Tools"), 228 "Onisplit.exe"); 217 229 } 218 230 } -
AE/installer2/src/net/oni2/aeinstaller/gui/MainWin.java
r600 r602 264 264 } 265 265 266 @DoInBackground(progressMessage = "mandatoryFiles.title", cancelable = false, indeterminateProgress = false) 267 private void checkMandatoryFiles(final BackgroundEvent evt) { 268 System.out.println("Tools:"); 269 for (Mod m : ModManager.getInstance().getTools()) { 270 System.out.format(" %05d %s", m.getPackageNumber(), m.getName()); 271 } 272 System.out.println(); 273 274 System.out.println("Mandatory tools:"); 275 for (Mod m : ModManager.getInstance().getMandatoryTools()) { 276 System.out.format(" %05d %s", m.getPackageNumber(), m.getName()); 277 } 278 } 279 266 280 @DoInBackground(progressMessage = "installing.title", cancelable = false, indeterminateProgress = false) 267 281 private void install(final BackgroundEvent evt) { 282 // TODO: Conflicts/Dependencies 283 268 284 TreeSet<Mod> mods = new TreeSet<Mod>(); 269 mods.addAll(ModManager.getInstance().get DefaultMods());285 mods.addAll(ModManager.getInstance().getMandatoryMods()); 270 286 mods.addAll(model.getSelectedMods()); 271 287 … … 284 300 } 285 301 }); 286 287 // TODO method stub288 JOptionPane.showMessageDialog(this, "install", "todo",289 JOptionPane.INFORMATION_MESSAGE);290 302 } 291 303 -
AE/installer2/src/net/oni2/aeinstaller/gui/MainWin.properties
r600 r602 46 46 initializingEdition.title=Initializing Edition core 47 47 installing.title=Installing mods 48 mandatoryFiles.title=Checking for mandatory files -
AE/installer2/src/net/oni2/aeinstaller/gui/MainWin.yml
r600 r602 6 6 locationRelativeTo: null 7 7 defaultCloseOperation: doNothingOnClose 8 onWindowOpened: [execDepotUpdate,check Updates,initialize,focus]8 onWindowOpened: [execDepotUpdate,checkMandatoryFiles,initialize,checkUpdates,focus] 9 9 onWindowClosing: [askClose,saveLocalData,exit] 10 10 iconImage: img.ae -
AE/installer2/src/net/oni2/aeinstaller/gui/modtable/ModTableFilter.java
r600 r602 26 26 Mod mod = (Mod) entry.getModel().getValueAt(entry.getIdentifier(), -1); 27 27 28 if (mod.is DefaultMod())28 if (mod.isMandatoryMod()) 29 29 return false; 30 30
Note:
See TracChangeset
for help on using the changeset viewer.