From 71362d1f270d66237a1c67b94d24dd00debdc0c1 Mon Sep 17 00:00:00 2001 From: galaxyoyo Date: Thu, 8 Jan 2015 22:43:31 +0100 Subject: [PATCH] =?UTF-8?q?Renforc=C3=A9=20syst=C3=A8me=20de=20cryptage=20?= =?UTF-8?q?des=20maps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../unknown/api/editor/EditorAPI.java | 35 ++++++++----------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/src/main/java/galaxyoyo/unknown/api/editor/EditorAPI.java b/src/main/java/galaxyoyo/unknown/api/editor/EditorAPI.java index cee093b..4ccd0fb 100644 --- a/src/main/java/galaxyoyo/unknown/api/editor/EditorAPI.java +++ b/src/main/java/galaxyoyo/unknown/api/editor/EditorAPI.java @@ -41,7 +41,6 @@ public class EditorAPI builder.enableComplexMapKeySerialization(); builder.serializeNulls(); - builder.setPrettyPrinting(); return builder.create(); } @@ -81,25 +80,21 @@ public class EditorAPI public static void save(File file, RawMap map) { String json = createGson().toJson(map); - String crypted = ""; - - for (char c : json.toCharArray()) - { - char ch = c; - - if (c != '\n') - { - ch = (char) (c * 2); - } - - crypted += ch; - } try { file.createNewFile(); BufferedWriter bw = new BufferedWriter(new FileWriter(file)); - bw.write(crypted); + + for (char c : json.toCharArray()) + { + char ch = c; + + ch = (char) ((((int) c * 2) - 4) * 3); + + bw.append(ch); + } + bw.close(); } catch (IOException ex) @@ -117,7 +112,6 @@ public class EditorAPI { jfc.showOpenDialog(null); file = jfc.getSelectedFile(); - System.out.println(file); } return open(file); @@ -143,13 +137,14 @@ public class EditorAPI { char ch = c; - if (c != '\n') - { - ch = (char) (c / 2); - } + ch = (char) (((c / 3) + 4) / 2); json += ch; } + + json = json.substring(0, json.length() - 1); + + System.out.println(text + "\n\n\n" + json); } catch (IOException e) {