diff options
| author | 2016-07-02 20:13:13 +1000 | |
|---|---|---|
| committer | 2016-07-02 20:13:13 +1000 | |
| commit | 74edc74c2c7b3236f00bf92499bb884837673b7d (patch) | |
| tree | 155556b4d6e390574f16082583f2853e35e3c716 /src/main/java/cuchaz/enigma/mapping/MappingsReader.java | |
| parent | Renamed Fields (diff) | |
| download | enigma-fork-74edc74c2c7b3236f00bf92499bb884837673b7d.tar.gz enigma-fork-74edc74c2c7b3236f00bf92499bb884837673b7d.tar.xz enigma-fork-74edc74c2c7b3236f00bf92499bb884837673b7d.zip | |
Reformatting code
Diffstat (limited to 'src/main/java/cuchaz/enigma/mapping/MappingsReader.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/mapping/MappingsReader.java | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/main/java/cuchaz/enigma/mapping/MappingsReader.java b/src/main/java/cuchaz/enigma/mapping/MappingsReader.java index b2c3a5c..d1edb9b 100644 --- a/src/main/java/cuchaz/enigma/mapping/MappingsReader.java +++ b/src/main/java/cuchaz/enigma/mapping/MappingsReader.java | |||
| @@ -31,19 +31,21 @@ public class MappingsReader { | |||
| 31 | public void readDirectory(Mappings mappings, File in) throws IOException, MappingParseException { | 31 | public void readDirectory(Mappings mappings, File in) throws IOException, MappingParseException { |
| 32 | 32 | ||
| 33 | File[] fList = in.listFiles(); | 33 | File[] fList = in.listFiles(); |
| 34 | for (File file : fList) { | 34 | if (fList != null) { |
| 35 | if (file.isFile()) { | 35 | for (File file : fList) { |
| 36 | readFile(mappings, new BufferedReader(new FileReader(file))); | 36 | if (file.isFile()) { |
| 37 | } else if (file.isDirectory()) { | 37 | readFile(mappings, new BufferedReader(new FileReader(file))); |
| 38 | readDirectory(mappings, file.getAbsoluteFile()); | 38 | } else if (file.isDirectory()) { |
| 39 | readDirectory(mappings, file.getAbsoluteFile()); | ||
| 40 | } | ||
| 39 | } | 41 | } |
| 40 | } | 42 | } |
| 41 | } | 43 | } |
| 42 | 44 | ||
| 43 | public void readFile(Mappings mappings, BufferedReader in) throws IOException, MappingParseException { | 45 | public void readFile(Mappings mappings, BufferedReader in) throws IOException, MappingParseException { |
| 44 | 46 | ||
| 45 | StringBuffer buf = new StringBuffer(); | 47 | StringBuilder buf = new StringBuilder(); |
| 46 | String line = null; | 48 | String line; |
| 47 | while ((line = in.readLine()) != null) { | 49 | while ((line = in.readLine()) != null) { |
| 48 | buf.append(line); | 50 | buf.append(line); |
| 49 | } | 51 | } |
| @@ -63,10 +65,10 @@ public class MappingsReader { | |||
| 63 | jsonClass.getField().forEach(jsonField -> classMapping.addFieldMapping(readField(jsonField.getObf(), jsonField.getName(), jsonField.getType()))); | 65 | jsonClass.getField().forEach(jsonField -> classMapping.addFieldMapping(readField(jsonField.getObf(), jsonField.getName(), jsonField.getType()))); |
| 64 | 66 | ||
| 65 | jsonClass.getConstructors().forEach(jsonConstructor -> { | 67 | jsonClass.getConstructors().forEach(jsonConstructor -> { |
| 66 | MethodMapping methodMapping = readMethod(jsonConstructor.isStatics() ? "<clinit>" : "<init>", null, jsonConstructor.getSignature()); | 68 | MethodMapping methodMapping = readMethod(jsonConstructor.isStatics() ? "<clinit>" : "<init>", null, jsonConstructor.getSignature()); |
| 67 | jsonConstructor.getArgs().forEach(jsonArgument -> methodMapping.addArgumentMapping(readArgument(jsonArgument.getIndex(), jsonArgument.getName()))); | 69 | jsonConstructor.getArgs().forEach(jsonArgument -> methodMapping.addArgumentMapping(readArgument(jsonArgument.getIndex(), jsonArgument.getName()))); |
| 68 | classMapping.addMethodMapping(methodMapping); | 70 | classMapping.addMethodMapping(methodMapping); |
| 69 | }); | 71 | }); |
| 70 | 72 | ||
| 71 | jsonClass.getMethod().forEach(jsonMethod -> { | 73 | jsonClass.getMethod().forEach(jsonMethod -> { |
| 72 | MethodMapping methodMapping = readMethod(jsonMethod.getObf(), jsonMethod.getName(), jsonMethod.getSignature()); | 74 | MethodMapping methodMapping = readMethod(jsonMethod.getObf(), jsonMethod.getName(), jsonMethod.getSignature()); |