aboutsummaryrefslogtreecommitdiff
path: root/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java
diff options
context:
space:
mode:
authorsyeyoung <cyoung06@naver.com>2022-11-16 17:45:55 +0900
committersyeyoung <cyoung06@naver.com>2022-11-16 17:59:56 +0900
commit60032db80aefe4a9f58b354b5a26938ed76f5c46 (patch)
tree17a7b6e873db2ea3c40aef508134842ce69c5991 /loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java
parent3708965c0c22c216336f8aa28158ba22bfc03b60 (diff)
parent241893934ef119566693165589fce0921c35e4af (diff)
downloadSkyblock-Dungeons-Guide-60032db80aefe4a9f58b354b5a26938ed76f5c46.tar.gz
Skyblock-Dungeons-Guide-60032db80aefe4a9f58b354b5a26938ed76f5c46.tar.bz2
Skyblock-Dungeons-Guide-60032db80aefe4a9f58b354b5a26938ed76f5c46.zip
- Update Downloading and Signature Verification
Signed-off-by: syeyoung <cyoung06@naver.com>
Diffstat (limited to 'loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java')
-rwxr-xr-xloader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java19
1 files changed, 17 insertions, 2 deletions
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java
index 0ec65780..e8d3e36b 100755
--- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java
@@ -19,7 +19,9 @@
package kr.syeyoung.dungeonsguide.launcher;
import kr.syeyoung.dungeonsguide.launcher.auth.AuthManager;
+import kr.syeyoung.dungeonsguide.launcher.branch.UpdateRetrieverUtil;
import kr.syeyoung.dungeonsguide.launcher.exceptions.NoSuitableLoaderFoundException;
+import kr.syeyoung.dungeonsguide.launcher.exceptions.NoVersionFoundException;
import kr.syeyoung.dungeonsguide.launcher.exceptions.ReferenceLeakedException;
import kr.syeyoung.dungeonsguide.launcher.gui.screen.GuiDisplayer;
import kr.syeyoung.dungeonsguide.launcher.gui.screen.GuiLoadingError;
@@ -28,6 +30,7 @@ import kr.syeyoung.dungeonsguide.launcher.gui.screen.SpecialGuiScreen;
import kr.syeyoung.dungeonsguide.launcher.loader.IDGLoader;
import kr.syeyoung.dungeonsguide.launcher.loader.JarLoader;
import kr.syeyoung.dungeonsguide.launcher.loader.LocalLoader;
+import kr.syeyoung.dungeonsguide.launcher.loader.RemoteLoader;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.IReloadableResourceManager;
import net.minecraftforge.common.MinecraftForge;
@@ -96,7 +99,7 @@ public class Main
}
currentLoader = null;
}
- private void load(IDGLoader newLoader) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
+ private void load(IDGLoader newLoader) throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException {
if (dgInterface != null) throw new IllegalStateException("DG is loaded");
dgInterface = newLoader.loadDungeonsGuide();
currentLoader = newLoader;
@@ -157,7 +160,19 @@ public class Main
return new JarLoader();
} else if (loader.equals("auto") ){
// remote load
- throw new UnsupportedOperationException(""); // yet
+ String branch = System.getProperty("branch") == null ? configuration.get("loader", "remoteBranch", "$default").getString() : System.getProperty("branch");
+ String version = System.getProperty("version") == null ? configuration.get("loader", "remoteVersion", "latest").getString() : System.getProperty("version");
+ try {
+ UpdateRetrieverUtil.VersionInfo versionInfo = UpdateRetrieverUtil.getIds(
+ branch,
+ version
+ );
+ if (versionInfo == null) throw new NoVersionFoundException(branch, version);
+
+ return new RemoteLoader(versionInfo.getFriendlyBranchName(), versionInfo.getBranchId(), versionInfo.getUpdateId());
+ } catch (IOException e) {
+ throw new NoVersionFoundException(branch, version, e);
+ }
} else {
throw new NoSuitableLoaderFoundException(System.getProperty("dg.loader"), configuration.get("loader", "modsource", "auto").getString());
}