- Timestamp:
- May 3, 2013, 11:52:50 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
java/installer2/src/net/oni2/aeinstaller/backend/packages/Package.java
r804 r857 37 37 private String submitter = ""; 38 38 private String creator = ""; 39 private EBSLInstallType bslInstallType = EBSLInstallType.NORMAL;39 private transient EBSLInstallType bslInstallType = EBSLInstallType.NORMAL; 40 40 private String description = ""; 41 private double aeVersion = 0;41 private transient double aeVersion = 0; 42 42 private int zipSize = 0; 43 private NodeMod node = null; 44 private net.oni2.moddepot.model.File file = null; 45 46 private File exeFile = null; 47 private EExeType exeType = EExeType.OSBINARY; 48 private File iconFile = null; 49 private String workingDir = "Base"; 50 51 private HashSet<Integer> incompatibilities = new HashSet<Integer>(); 52 private HashSet<Integer> dependencies = new HashSet<Integer>(); 53 private HashSet<Integer> unlockLevel = new HashSet<Integer>(); 54 55 private long localTimestamp = 0; 43 44 private URI nodeUrl = null; 45 private String fileUrl = null; 46 47 private long createdMillis = -1; 48 private long updatedMillis = -1; 49 50 private transient File exeFile = null; 51 private transient EExeType exeType = EExeType.OSBINARY; 52 private transient File iconFile = null; 53 private transient String workingDir = "Base"; 54 55 private transient HashSet<Integer> incompatibilities = new HashSet<Integer>(); 56 private transient HashSet<Integer> dependencies = new HashSet<Integer>(); 57 private transient HashSet<Integer> unlockLevel = new HashSet<Integer>(); 58 59 private transient long localTimestamp = 0; 56 60 57 61 /** … … 62 66 */ 63 67 public Package(NodeMod nm) { 64 node = nm;65 68 name = nm.getTitle(); 66 69 packageNumber = nm.getPackageNumber(); … … 73 76 t.addEntry(this); 74 77 } 78 79 createdMillis = nm.getCreated(); 80 updatedMillis = nm.getUploads().firstElement().getTimestamp(); 81 82 try { 83 nodeUrl = new URI(nm.getPath()); 84 } catch (URISyntaxException e) { 85 e.printStackTrace(); 86 } 87 88 fileUrl = nm.getUploads().firstElement().getUri_full(); 89 zipSize = nm.getUploads().firstElement().getFilesize(); 90 75 91 version = nm.getVersion(); 76 92 submitter = nm.getName(); … … 81 97 description = "<p>" + description + "</p>"; 82 98 } 83 file = nm.getUploads().firstElement();84 zipSize = file.getFilesize();85 99 86 100 if (isLocalAvailable()) … … 115 129 aeVersion = mi.getAeVersion(); 116 130 bslInstallType = mi.getBslInstallType(); 117 if ( node == null) {131 if (isLocalOnly()) { 118 132 name = mi.getName(); 119 133 creator = mi.getCreator(); … … 132 146 } else { 133 147 clearLocalOnlyInfo(); 134 System.err.println("No config found for mod folder: "135 + getLocalPath().getPath());148 // System.err.println("No config found for mod folder: " 149 // + getLocalPath().getPath()); 136 150 } 137 151 if (aeicfg.exists()) { … … 159 173 } 160 174 } 161 if ( node == null)175 if (isLocalOnly()) 162 176 tool = plain.exists(); 163 177 } … … 212 226 */ 213 227 public boolean isNewerAvailable() { 214 if ( file != null)215 return file.getTimestamp()> localTimestamp;228 if (!isLocalOnly()) 229 return updatedMillis > localTimestamp; 216 230 else 217 231 return false; … … 226 240 227 241 /** 242 * @return If this mod is only locally available (not on Depot) 243 */ 244 public boolean isLocalOnly() { 245 return nodeUrl == null; 246 } 247 248 /** 228 249 * @return Is mod installed? 229 250 */ 230 251 public boolean isInstalled() { 231 252 if (tool) 232 return ToolInstallationList.getInstance().isInstalled(packageNumber); 253 return ToolInstallationList.getInstance() 254 .isInstalled(packageNumber); 233 255 else 234 256 return PackageManager.getInstance().isModInstalled(this); … … 320 342 321 343 /** 344 * @return the createdMillis 345 */ 346 public long getCreatedMillis() { 347 return createdMillis; 348 } 349 350 /** 351 * @return the updatedMillis 352 */ 353 public long getUpdatedMillis() { 354 return updatedMillis; 355 } 356 357 /** 358 * @return the fileUrl 359 */ 360 public String getFileUrl() { 361 return fileUrl; 362 } 363 364 /** 322 365 * @return Is a package that is always installed? 323 366 */ … … 327 370 328 371 /** 329 * @return Get the depot file entry330 */331 public net.oni2.moddepot.model.File getFile() {332 return file;333 }334 335 /**336 * @return Get the depot Node337 */338 public NodeMod getNode() {339 return node;340 }341 342 /**343 372 * @return Depot page URI 344 373 */ 345 374 public URI getUrl() { 346 if (node == null) 347 return null; 348 if (node.getPath() == null) 349 return null; 350 URI res = null; 351 try { 352 res = new URI(node.getPath()); 353 } catch (URISyntaxException e) { 354 e.printStackTrace(); 355 } 356 return res; 375 return nodeUrl; 357 376 } 358 377
Note:
See TracChangeset
for help on using the changeset viewer.