Comment and code additions

More comments are added.
More work on downloading server jars is done.
Server test added.
This commit is contained in:
2018-01-25 11:38:47 +01:00
parent b6685edc6f
commit 0c2c26e153
2 changed files with 14 additions and 6 deletions

View File

@ -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));
}
}