Comment and code additions
More comments are added. More work on downloading server jars is done. Server test added.
This commit is contained in:
@ -127,6 +127,7 @@ public class Server {
|
||||
throw new FileNotFoundException("Version file could not be downloaded.");
|
||||
}
|
||||
newestVersion = stringBetween(versionText, type.getSrcStart(), type.getSrcEnd());
|
||||
System.out.println(newestVersion);
|
||||
success = downloadFile(type.getDownloadURL() + newestVersion + type.getDownloadURLPart() + newestVersion + ".jar", filePath);
|
||||
//TODO: Register the new version number, and only download if version mismatch or missing file.
|
||||
if (!success) {
|
||||
@ -208,6 +209,7 @@ public class Server {
|
||||
* @return The wanted substring.
|
||||
*/
|
||||
private String stringBetween(String string, String start, String end) {
|
||||
return string.substring(string.indexOf(start) + 1 + start.length(), string.indexOf(end));
|
||||
int startPos = string.indexOf(start) + start.length();
|
||||
return string.substring(startPos, string.indexOf(end, startPos));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user