From 4cf828a948f13271587ef6445a0c8636fa0f6035 Mon Sep 17 00:00:00 2001 From: Yaroslavik Date: Fri, 31 May 2019 02:11:47 +0200 Subject: [PATCH 1/3] =?UTF-8?q?[FIX]=20=D0=9F=D1=80=D0=B0=D0=B2=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=BE=D1=82=D0=BA=D0=B8=D0=B4=D1=8B=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B9=20=D0=B2=20=D0=BE=D0=BF=D1=86.=20=D0=BC=D0=BE?= =?UTF-8?q?=D0=B4=D0=B0=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Жертвуя Tab-овским выбором чекбоксов. Если кто придумает более элегантное решение - переделайте ;D --- Launcher/runtime/dialog/scenes/options/options.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Launcher/runtime/dialog/scenes/options/options.js b/Launcher/runtime/dialog/scenes/options/options.js index b7749643..88fa0b9c 100644 --- a/Launcher/runtime/dialog/scenes/options/options.js +++ b/Launcher/runtime/dialog/scenes/options/options.js @@ -131,6 +131,7 @@ var options = { } options.update(); }); + testMod.setFocusTraversable(false); checkBoxList.add(testMod); testMod.getStyleClass().add("modname"); if(modDescription != "") { From a0d6c5ad0efcbe18ff84fdca05b1ac21c5fab903 Mon Sep 17 00:00:00 2001 From: zaxar163 Date: Fri, 31 May 2019 09:49:05 +0300 Subject: [PATCH 2/3] =?UTF-8?q?[FEATURE]=20=D0=A1=D0=B5=D1=80=D0=B8=D0=B0?= =?UTF-8?q?=D0=BB=D0=B8=D0=B7=D0=B0=D1=82=D0=BE=D1=80=20byte[]=20=D0=B2=20?= =?UTF-8?q?Base64?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ru/gravit/utils/helper/CommonHelper.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/LauncherCore/src/main/java/ru/gravit/utils/helper/CommonHelper.java b/LauncherCore/src/main/java/ru/gravit/utils/helper/CommonHelper.java index 5f7548e3..11e00272 100644 --- a/LauncherCore/src/main/java/ru/gravit/utils/helper/CommonHelper.java +++ b/LauncherCore/src/main/java/ru/gravit/utils/helper/CommonHelper.java @@ -6,6 +6,18 @@ import javax.script.ScriptEngine; import javax.script.ScriptEngineFactory; import javax.script.ScriptEngineManager; + +import com.google.gson.GsonBuilder; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonParseException; +import com.google.gson.JsonPrimitive; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; + +import java.lang.reflect.Type; +import java.util.Base64; import java.util.Collection; import java.util.LinkedList; import java.util.Locale; @@ -120,4 +132,23 @@ public static String[] parseCommand(CharSequence line) throws CommandException { // Return result as array return result.toArray(new String[0]); } + + @LauncherAPI + public static GsonBuilder newBuilder() { + return new GsonBuilder().registerTypeHierarchyAdapter(byte[].class, + ByteArrayToBase64TypeAdapter.INSTANCE); + } + + private static class ByteArrayToBase64TypeAdapter implements JsonSerializer, JsonDeserializer { + private static final ByteArrayToBase64TypeAdapter INSTANCE = new ByteArrayToBase64TypeAdapter(); + private Base64.Decoder decoder = Base64.getUrlDecoder(); + private Base64.Encoder encoder = Base64.getUrlEncoder(); + public byte[] deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { + return decoder.decode(json.getAsString()); + } + + public JsonElement serialize(byte[] src, Type typeOfSrc, JsonSerializationContext context) { + return new JsonPrimitive(encoder.encodeToString(src)); + } + } } From a1652eaf38b29c2a28bb9c43ceeea75e76b20568 Mon Sep 17 00:00:00 2001 From: zaxar163 Date: Fri, 31 May 2019 10:02:56 +0300 Subject: [PATCH 3/3] =?UTF-8?q?[FEATURE][EXP]=20=D0=9F=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=D1=8C=D0=BD=D0=BE=D0=B5=20=D1=81=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20byte[]=20?= =?UTF-8?q?=D0=B2=20GsonManager.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/ru/gravit/launcher/managers/GsonManager.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/LauncherCore/src/main/java/ru/gravit/launcher/managers/GsonManager.java b/LauncherCore/src/main/java/ru/gravit/launcher/managers/GsonManager.java index bf89bb33..bf93aafd 100644 --- a/LauncherCore/src/main/java/ru/gravit/launcher/managers/GsonManager.java +++ b/LauncherCore/src/main/java/ru/gravit/launcher/managers/GsonManager.java @@ -4,6 +4,7 @@ import com.google.gson.GsonBuilder; import ru.gravit.launcher.hasher.HashedEntry; import ru.gravit.launcher.hasher.HashedEntryAdapter; +import ru.gravit.utils.helper.CommonHelper; public class GsonManager { public GsonBuilder gsonBuilder; @@ -12,8 +13,8 @@ public class GsonManager { public Gson configGson; public void initGson() { - gsonBuilder = new GsonBuilder(); - configGsonBuilder = new GsonBuilder(); + gsonBuilder = CommonHelper.newBuilder(); + configGsonBuilder = CommonHelper.newBuilder(); configGsonBuilder.setPrettyPrinting(); registerAdapters(gsonBuilder); registerAdapters(configGsonBuilder);