summaryrefslogtreecommitdiff
path: root/src/main/java/cuchaz/enigma/bytecode
diff options
context:
space:
mode:
authorGravatar Thomas Guillemard2016-08-12 19:23:54 +0200
committerGravatar Adrian Siekierka2016-08-12 19:23:54 +0200
commitc4970cc4addedd4565cf8c3ed9ea92b6a4487e0c (patch)
treea6f00a59cd0d5bc41014768506d9c4d3aad48de8 /src/main/java/cuchaz/enigma/bytecode
parentAllow exporting mappings as SRG or Enigma (diff)
downloadenigma-fork-c4970cc4addedd4565cf8c3ed9ea92b6a4487e0c.tar.gz
enigma-fork-c4970cc4addedd4565cf8c3ed9ea92b6a4487e0c.tar.xz
enigma-fork-c4970cc4addedd4565cf8c3ed9ea92b6a4487e0c.zip
Implement Enigma directory format (#1)
Others changes: ~ Rework File menu ~ Force UTF-8 for all I/O operations ~ Enigma now detect the original file format and use the correct one when you save a mapping
Diffstat (limited to 'src/main/java/cuchaz/enigma/bytecode')
-rw-r--r--src/main/java/cuchaz/enigma/bytecode/accessors/ConstInfoAccessor.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/cuchaz/enigma/bytecode/accessors/ConstInfoAccessor.java b/src/main/java/cuchaz/enigma/bytecode/accessors/ConstInfoAccessor.java
index 0ea2d02..474a3ef 100644
--- a/src/main/java/cuchaz/enigma/bytecode/accessors/ConstInfoAccessor.java
+++ b/src/main/java/cuchaz/enigma/bytecode/accessors/ConstInfoAccessor.java
@@ -11,10 +11,13 @@
11package cuchaz.enigma.bytecode.accessors; 11package cuchaz.enigma.bytecode.accessors;
12 12
13import java.io.ByteArrayOutputStream; 13import java.io.ByteArrayOutputStream;
14import java.io.FileOutputStream;
15import java.io.OutputStreamWriter;
14import java.io.PrintWriter; 16import java.io.PrintWriter;
15import java.lang.reflect.Field; 17import java.lang.reflect.Field;
16import java.lang.reflect.Method; 18import java.lang.reflect.Method;
17 19
20import com.google.common.base.Charsets;
18import cuchaz.enigma.bytecode.InfoType; 21import cuchaz.enigma.bytecode.InfoType;
19 22
20public class ConstInfoAccessor { 23public class ConstInfoAccessor {
@@ -56,12 +59,12 @@ public class ConstInfoAccessor {
56 public String toString() { 59 public String toString() {
57 try { 60 try {
58 ByteArrayOutputStream buf = new ByteArrayOutputStream(); 61 ByteArrayOutputStream buf = new ByteArrayOutputStream();
59 PrintWriter out = new PrintWriter(buf); 62 PrintWriter out = new PrintWriter(new OutputStreamWriter(buf, Charsets.UTF_8));
60 Method print = this.item.getClass().getMethod("print", PrintWriter.class); 63 Method print = this.item.getClass().getMethod("print", PrintWriter.class);
61 print.setAccessible(true); 64 print.setAccessible(true);
62 print.invoke(this.item, out); 65 print.invoke(this.item, out);
63 out.close(); 66 out.close();
64 return buf.toString().replace("\n", ""); 67 return buf.toString("UTF-8").replace("\n", "");
65 } catch (Exception ex) { 68 } catch (Exception ex) {
66 throw new Error(ex); 69 throw new Error(ex);
67 } 70 }