diff options
| author | 2019-05-12 15:34:42 +0200 | |
|---|---|---|
| committer | 2019-05-12 15:34:42 +0200 | |
| commit | 5afc4472807f71f30f5d5be2d4c4632ed3204ec4 (patch) | |
| tree | 967f6ef774e960ecc0ab6542e7024e24ff7c2f2a /src/main/java/cuchaz/enigma/Deobfuscator.java | |
| parent | Simplify Plugin API and support all entry types (diff) | |
| download | enigma-fork-5afc4472807f71f30f5d5be2d4c4632ed3204ec4.tar.gz enigma-fork-5afc4472807f71f30f5d5be2d4c4632ed3204ec4.tar.xz enigma-fork-5afc4472807f71f30f5d5be2d4c4632ed3204ec4.zip | |
Separate JarProcessor and EntryNameProposer
Diffstat (limited to 'src/main/java/cuchaz/enigma/Deobfuscator.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/Deobfuscator.java | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/main/java/cuchaz/enigma/Deobfuscator.java b/src/main/java/cuchaz/enigma/Deobfuscator.java index 9060c1f..32f7aa7 100644 --- a/src/main/java/cuchaz/enigma/Deobfuscator.java +++ b/src/main/java/cuchaz/enigma/Deobfuscator.java | |||
| @@ -24,7 +24,8 @@ import cuchaz.enigma.analysis.EntryReference; | |||
| 24 | import cuchaz.enigma.analysis.IndexTreeBuilder; | 24 | import cuchaz.enigma.analysis.IndexTreeBuilder; |
| 25 | import cuchaz.enigma.analysis.ParsedJar; | 25 | import cuchaz.enigma.analysis.ParsedJar; |
| 26 | import cuchaz.enigma.analysis.index.JarIndex; | 26 | import cuchaz.enigma.analysis.index.JarIndex; |
| 27 | import cuchaz.enigma.api.EnigmaPlugin; | 27 | import cuchaz.enigma.api.EntryNameProposer; |
| 28 | import cuchaz.enigma.api.JarProcessor; | ||
| 28 | import cuchaz.enigma.bytecode.translators.SourceFixVisitor; | 29 | import cuchaz.enigma.bytecode.translators.SourceFixVisitor; |
| 29 | import cuchaz.enigma.bytecode.translators.TranslationClassVisitor; | 30 | import cuchaz.enigma.bytecode.translators.TranslationClassVisitor; |
| 30 | import cuchaz.enigma.translation.Translatable; | 31 | import cuchaz.enigma.translation.Translatable; |
| @@ -59,7 +60,9 @@ import java.util.stream.Stream; | |||
| 59 | 60 | ||
| 60 | public class Deobfuscator { | 61 | public class Deobfuscator { |
| 61 | 62 | ||
| 62 | private final ServiceLoader<EnigmaPlugin> plugins = ServiceLoader.load(EnigmaPlugin.class); | 63 | private final ServiceLoader<JarProcessor> jarProcessors = ServiceLoader.load(JarProcessor.class); |
| 64 | private final ServiceLoader<EntryNameProposer> nameProposers = ServiceLoader.load(EntryNameProposer.class); | ||
| 65 | |||
| 63 | private final ParsedJar parsedJar; | 66 | private final ParsedJar parsedJar; |
| 64 | private final JarIndex jarIndex; | 67 | private final JarIndex jarIndex; |
| 65 | private final IndexTreeBuilder indexTreeBuilder; | 68 | private final IndexTreeBuilder indexTreeBuilder; |
| @@ -75,10 +78,8 @@ public class Deobfuscator { | |||
| 75 | this.jarIndex = JarIndex.empty(); | 78 | this.jarIndex = JarIndex.empty(); |
| 76 | this.jarIndex.indexJar(this.parsedJar, listener); | 79 | this.jarIndex.indexJar(this.parsedJar, listener); |
| 77 | 80 | ||
| 78 | getPlugins().forEach(plugin -> { | 81 | listener.accept("Processing jar"); |
| 79 | listener.accept("Initializing plugin '" + plugin.getClass().getSimpleName() + "'"); | 82 | this.jarProcessors.forEach(processor -> processor.accept(parsedJar, jarIndex)); |
| 80 | plugin.indexJar(parsedJar, jarIndex); | ||
| 81 | }); | ||
| 82 | 83 | ||
| 83 | this.indexTreeBuilder = new IndexTreeBuilder(jarIndex); | 84 | this.indexTreeBuilder = new IndexTreeBuilder(jarIndex); |
| 84 | 85 | ||
| @@ -107,8 +108,8 @@ public class Deobfuscator { | |||
| 107 | }); | 108 | }); |
| 108 | } | 109 | } |
| 109 | 110 | ||
| 110 | public Stream<EnigmaPlugin> getPlugins() { | 111 | public Stream<EntryNameProposer> getNameProposers() { |
| 111 | return Streams.stream(plugins); | 112 | return Streams.stream(nameProposers); |
| 112 | } | 113 | } |
| 113 | 114 | ||
| 114 | public ParsedJar getJar() { | 115 | public ParsedJar getJar() { |