From 6cc7f214b389c0f838aa8f3f06b088419a5591b0 Mon Sep 17 00:00:00 2001 From: Zaxar163 Date: Sun, 7 Apr 2019 07:48:54 +0300 Subject: [PATCH] =?UTF-8?q?[FEATURE]=20=D0=92=D1=8B=20=D0=BC=D0=BE=D0=B6?= =?UTF-8?q?=D0=B5=D1=82=D0=B5=20=D0=BF=D0=BE=D1=81=D1=82=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D0=BB=D0=B8=D1=81=D1=82=D1=8B=20ClientProfile?= =?UTF-8?q?=20=D0=BC=D0=BE=D0=B4=D1=83=D0=BB=D0=B5=D0=BC.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ru/gravit/launchserver/LaunchServer.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java index 53118da0..7b803dcf 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java @@ -45,6 +45,7 @@ import java.io.File; import java.io.IOException; import java.lang.ProcessBuilder.Redirect; +import java.lang.reflect.InvocationTargetException; import java.net.InetSocketAddress; import java.net.SocketAddress; import java.nio.file.*; @@ -354,6 +355,8 @@ public static void main(String... args) throws Throwable { public final JARLauncherBinary launcherBinary; + public Class launcherEXEBinaryClass; + public final LauncherBinary launcherEXEBinary; // HWID ban + anti-brutforce @@ -459,6 +462,9 @@ public LaunchServer(Path dir, String[] args) throws IOException, InvalidKeySpecE crc.update(publicKey.getModulus().toByteArray()); // IDEA говорит, что это Java 9 API. WTF? LogHelper.subInfo("Modulus CRC32: 0x%08x", crc.getValue()); + // Load class bindings. + launcherEXEBinaryClass = null; + // pre init modules modulesManager = new ModulesManager(this); modulesManager.autoload(dir.resolve("modules")); @@ -589,6 +595,14 @@ public static void initGson() { } private LauncherBinary binary() { + if (launcherEXEBinaryClass != null) { + try { + return (LauncherBinary)launcherEXEBinaryClass.getConstructor(LaunchServer.class).newInstance(this); + } catch (InstantiationException | IllegalAccessException | IllegalArgumentException + | InvocationTargetException | NoSuchMethodException | SecurityException e) { + LogHelper.error(e); + } + } try { Class.forName("net.sf.launch4j.Builder"); if (config.launch4j.enabled) return new EXEL4JLauncherBinary(this); @@ -686,10 +700,13 @@ private void generateConfigIfNotExists() throws IOException { } } - public Collection getProfiles() { + public List getProfiles() { return profilesList; } + public void setProfiles(List profilesList) { + this.profilesList = Collections.unmodifiableList(profilesList); + } public SignedObjectHolder getUpdateDir(String name) { return updatesDirMap.get(name);