diff options
| author | 2014-07-26 19:24:00 -0400 | |
|---|---|---|
| committer | 2014-07-26 19:24:00 -0400 | |
| commit | 295eceece371b516e771de93b6127bf728999483 (patch) | |
| tree | 20ff6a35de79997fc338d922cae934b8872b11a9 /src/cuchaz/enigma/Main.java | |
| download | enigma-fork-295eceece371b516e771de93b6127bf728999483.tar.gz enigma-fork-295eceece371b516e771de93b6127bf728999483.tar.xz enigma-fork-295eceece371b516e771de93b6127bf728999483.zip | |
initial commit
so far source analysis is working. =)
Diffstat (limited to 'src/cuchaz/enigma/Main.java')
| -rw-r--r-- | src/cuchaz/enigma/Main.java | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/cuchaz/enigma/Main.java b/src/cuchaz/enigma/Main.java new file mode 100644 index 0000000..e08c16e --- /dev/null +++ b/src/cuchaz/enigma/Main.java | |||
| @@ -0,0 +1,63 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * Copyright (c) 2014 Jeff Martin. | ||
| 3 | * All rights reserved. This program and the accompanying materials | ||
| 4 | * are made available under the terms of the GNU Public License v3.0 | ||
| 5 | * which accompanies this distribution, and is available at | ||
| 6 | * http://www.gnu.org/licenses/gpl.html | ||
| 7 | * | ||
| 8 | * Contributors: | ||
| 9 | * Jeff Martin - initial API and implementation | ||
| 10 | ******************************************************************************/ | ||
| 11 | package cuchaz.enigma; | ||
| 12 | |||
| 13 | import java.io.File; | ||
| 14 | |||
| 15 | import cuchaz.enigma.analysis.Analyzer; | ||
| 16 | import cuchaz.enigma.analysis.SourceIndex; | ||
| 17 | import cuchaz.enigma.gui.ClassSelectionHandler; | ||
| 18 | import cuchaz.enigma.gui.Gui; | ||
| 19 | |||
| 20 | public class Main | ||
| 21 | { | ||
| 22 | public static void main( String[] args ) | ||
| 23 | throws Exception | ||
| 24 | { | ||
| 25 | startGui(); | ||
| 26 | } | ||
| 27 | |||
| 28 | private static void startGui( ) | ||
| 29 | throws Exception | ||
| 30 | { | ||
| 31 | final Gui gui = new Gui(); | ||
| 32 | |||
| 33 | // settings | ||
| 34 | final File jarFile = new File( "/home/jeff/.minecraft/versions/1.7.10/1.7.10.jar" ); | ||
| 35 | gui.setTitle( jarFile.getName() ); | ||
| 36 | |||
| 37 | // init the deobfuscator | ||
| 38 | final Deobfuscator deobfuscator = new Deobfuscator( jarFile ); | ||
| 39 | gui.setObfClasses( deobfuscator.getObfuscatedClasses() ); | ||
| 40 | |||
| 41 | // handle events | ||
| 42 | gui.setClassSelectionHandler( new ClassSelectionHandler( ) | ||
| 43 | { | ||
| 44 | @Override | ||
| 45 | public void classSelected( final ClassFile classFile ) | ||
| 46 | { | ||
| 47 | gui.setSource( "(deobfuscating...)" ); | ||
| 48 | |||
| 49 | // run the deobfuscator in a separate thread so we don't block the GUI event queue | ||
| 50 | new Thread( ) | ||
| 51 | { | ||
| 52 | @Override | ||
| 53 | public void run( ) | ||
| 54 | { | ||
| 55 | String source = deobfuscator.getSource( classFile ); | ||
| 56 | SourceIndex index = Analyzer.analyze( classFile.getName(), source ); | ||
| 57 | gui.setSource( source, index ); | ||
| 58 | } | ||
| 59 | }.start(); | ||
| 60 | } | ||
| 61 | } ); | ||
| 62 | } | ||
| 63 | } | ||