From cf18ce61107e776edee9d14d2e0777ca902ccf9b Mon Sep 17 00:00:00 2001 From: Gravit Date: Thu, 5 Sep 2019 19:37:46 +0700 Subject: [PATCH] =?UTF-8?q?[FIX]=20=D0=93=D0=B5=D0=BD=D0=B5=D1=80=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D1=8F=20=D1=81=D0=BB=D0=BE=D0=B2=D0=B0=D1=80=D1=8F?= =?UTF-8?q?=20=D1=83=D1=87=D0=B8=D1=82=D1=8B=D0=B2=D0=B0=D0=B5=D1=82=20?= =?UTF-8?q?=D1=80=D0=B0=D0=B7=D0=BC=D0=B5=D1=80=20projectName?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/pro/gravit/launchserver/binary/ProguardConf.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/ProguardConf.java b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/ProguardConf.java index 78246022..a5286aec 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/ProguardConf.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/ProguardConf.java @@ -19,11 +19,12 @@ public class ProguardConf { private static final String chars = "1aAbBcC2dDeEfF3gGhHiI4jJkKl5mMnNoO6pPqQrR7sStT8uUvV9wWxX0yYzZ"; private static String generateString(SecureRandom rand, String lowString, String upString, int il) { - StringBuilder sb = new StringBuilder(il + lowString.length()); + StringBuilder sb = new StringBuilder(Math.max(il, lowString.length())); for (int i = 0; i < lowString.length(); ++i) { sb.append(rand.nextBoolean() ? lowString.charAt(i) : upString.charAt(i)); } - for (int i = 0; i < il - 1; i++) sb.append(chars.charAt(rand.nextInt(chars.length()))); + int toI = il - lowString.length(); + for (int i = 0; i < toI; i++) sb.append(chars.charAt(rand.nextInt(chars.length()))); return sb.toString(); } @@ -74,7 +75,7 @@ public void genWords(boolean force) throws IOException { String projectName = srv.config.projectName.replaceAll("\\W", ""); String lowName = projectName.toLowerCase(); String upName = projectName.toUpperCase(); - for (int i = 0; i < Short.MAX_VALUE; i++) out.println(generateString(rand, lowName, upName, 3)); + for (int i = 0; i < Short.MAX_VALUE; i++) out.println(generateString(rand, lowName, upName, 14)); } }