|
5 | 5 | import java.awt.Font; |
6 | 6 | import java.awt.event.ActionEvent; |
7 | 7 | import java.awt.event.ActionListener; |
| 8 | +import java.awt.event.MouseAdapter; |
| 9 | +import java.awt.event.MouseEvent; |
8 | 10 | import java.io.BufferedReader; |
9 | 11 | import java.io.File; |
10 | 12 | import java.io.FileInputStream; |
@@ -101,7 +103,7 @@ private void initialize() |
101 | 103 | frame.getContentPane().add(deobfuscatorArguments); |
102 | 104 |
|
103 | 105 | JLabel successOrFail = new JLabel("Select deobfuscator.jar to begin!"); |
104 | | - successOrFail.setBounds(166, 70, 181, 14); |
| 106 | + successOrFail.setBounds(203, 70, 181, 14); |
105 | 107 | frame.getContentPane().add(successOrFail); |
106 | 108 |
|
107 | 109 | JButton selectDeob = new JButton("Select"); |
@@ -156,6 +158,20 @@ public void actionPerformed(ActionEvent e) |
156 | 158 | "<html>Here you will select the transformers to run.<br>\r\nIf you see no transformers, you have not loaded deobfuscator.jar<br>\r\nor your jar file is corrupt.</html>"); |
157 | 159 | transformerJList.setBounds(10, 23, 179, 165); |
158 | 160 | transformerJList.setModel(transformerList); |
| 161 | + transformerJList.addMouseListener(new MouseAdapter() |
| 162 | + { |
| 163 | + @Override |
| 164 | + public void mouseClicked(MouseEvent e) |
| 165 | + { |
| 166 | + JList<String> list = (JList<String>)e.getSource(); |
| 167 | + if(e.getClickCount() == 2) |
| 168 | + { |
| 169 | + int index = list.locationToIndex(e.getPoint()); |
| 170 | + selectedTransformers.add(selectedTransformers.size(), |
| 171 | + transformerList.getElementAt(index)); |
| 172 | + } |
| 173 | + } |
| 174 | + }); |
159 | 175 | transformerListScroll.setViewportView(transformerJList); |
160 | 176 | transformerListScroll.setBounds(transformerJList.getBounds()); |
161 | 177 | transformers.add(transformerListScroll); |
@@ -214,6 +230,18 @@ public void actionPerformed(ActionEvent e) |
214 | 230 | JLabel lblTransformersSelected = new JLabel("Transformers Selected"); |
215 | 231 | lblTransformersSelected.setBounds(323, 6, 133, 14); |
216 | 232 | transformers.add(lblTransformersSelected); |
| 233 | + |
| 234 | + JButton btnDeselectAll = new JButton("Deselect All"); |
| 235 | + btnDeselectAll.setBounds(213, 153, 89, 23); |
| 236 | + btnDeselectAll.addActionListener(new ActionListener() |
| 237 | + { |
| 238 | + @Override |
| 239 | + public void actionPerformed(ActionEvent e) |
| 240 | + { |
| 241 | + selectedTransformers.clear(); |
| 242 | + } |
| 243 | + }); |
| 244 | + transformers.add(btnDeselectAll); |
217 | 245 | tabbedPane.addTab("Libraries", libraries); |
218 | 246 |
|
219 | 247 | JScrollPane scrollPane = new JScrollPane(); |
@@ -329,12 +357,71 @@ public void actionPerformed(ActionEvent e) |
329 | 357 | }); |
330 | 358 |
|
331 | 359 | JButton btnLoadConfig = new JButton("Load Config"); |
332 | | - btnLoadConfig.setBounds(10, 474, 89, 26); |
| 360 | + btnLoadConfig.setBounds(26, 474, 89, 26); |
333 | 361 | frame.getContentPane().add(btnLoadConfig); |
| 362 | + btnLoadConfig.addActionListener(new ActionListener() |
| 363 | + { |
| 364 | + @Override |
| 365 | + public void actionPerformed(ActionEvent e) |
| 366 | + { |
| 367 | + JFrame newFrame = new JFrame(); |
| 368 | + newFrame.setTitle("Load Config"); |
| 369 | + newFrame.setBounds(100, 100, 450, 150); |
| 370 | + newFrame.getContentPane().setLayout(null); |
| 371 | + |
| 372 | + JLabel lblPasteYourCommand = new JLabel("<html>Paste your command that you use to run java-deobfuscator here.<br>\r\nThis should be the command you paste via the command line.</html>"); |
| 373 | + lblPasteYourCommand.setBounds(10, 11, 379, 34); |
| 374 | + newFrame.getContentPane().add(lblPasteYourCommand); |
| 375 | + |
| 376 | + JTextField command = new JTextField(); |
| 377 | + command.setBounds(20, 56, 369, 20); |
| 378 | + command.setColumns(10); |
| 379 | + newFrame.getContentPane().add(command); |
| 380 | + |
| 381 | + JButton btnSubmit = new JButton("Submit"); |
| 382 | + btnSubmit.setBounds(157, 77, 89, 23); |
| 383 | + newFrame.getContentPane().add(btnSubmit); |
| 384 | + newFrame.setVisible(true); |
| 385 | + btnSubmit.addActionListener(new ActionListener() |
| 386 | + { |
| 387 | + @Override |
| 388 | + public void actionPerformed(ActionEvent e) |
| 389 | + { |
| 390 | + String args = command.getText(); |
| 391 | + String[] split = args.split(" "); |
| 392 | + for(int i = 0; i < split.length; i++) |
| 393 | + { |
| 394 | + String arg = split[i]; |
| 395 | + if(arg.equals("-jar") && split.length > i + 1) |
| 396 | + { |
| 397 | + deobfuscatorField.setText(split[i + 1]); |
| 398 | + loadTransformers(split[i + 1], successOrFail); |
| 399 | + }else if(arg.equals("-input") && split.length > i + 1) |
| 400 | + inputField.setText(split[i + 1]); |
| 401 | + else if(arg.equals("-output") && split.length > i + 1) |
| 402 | + outputField.setText(split[i + 1]); |
| 403 | + else if(arg.equals("-transformer") && split.length > i + 1) |
| 404 | + selectedTransformers.addElement(split[i + 1]); |
| 405 | + else if(arg.equals("-path") && split.length > i + 1) |
| 406 | + librariesList.addElement(split[i + 1]); |
| 407 | + newFrame.dispose(); |
| 408 | + } |
| 409 | + } |
| 410 | + }); |
| 411 | + } |
| 412 | + }); |
334 | 413 |
|
335 | 414 | JButton btnSaveConfig = new JButton("Save Config"); |
336 | | - btnSaveConfig.setBounds(117, 474, 99, 26); |
| 415 | + btnSaveConfig.setBounds(130, 474, 99, 26); |
337 | 416 | frame.getContentPane().add(btnSaveConfig); |
| 417 | + btnSaveConfig.addActionListener(new ActionListener() |
| 418 | + { |
| 419 | + @Override |
| 420 | + public void actionPerformed(ActionEvent e) |
| 421 | + { |
| 422 | + |
| 423 | + } |
| 424 | + }); |
338 | 425 |
|
339 | 426 | JButton btnRun = new JButton("Run"); |
340 | 427 | btnRun.setBounds(465, 474, 89, 23); |
@@ -368,7 +455,7 @@ public void actionPerformed(ActionEvent e) |
368 | 455 | JFrame newFrame = new JFrame(); |
369 | 456 | newFrame.setTitle("Console"); |
370 | 457 | JTextArea area = new JTextArea(); |
371 | | - newFrame.add(new JScrollPane(area)); |
| 458 | + newFrame.getContentPane().add(new JScrollPane(area)); |
372 | 459 | newFrame.pack(); |
373 | 460 | newFrame.setSize(800, 600); |
374 | 461 | newFrame.setVisible(true); |
@@ -433,7 +520,7 @@ private void loadTransformers(String path, JLabel displayLabel) |
433 | 520 | { |
434 | 521 | e.printStackTrace(); |
435 | 522 | displayLabel |
436 | | - .setText("Failed to load transformers (corrupted jar?)"); |
| 523 | + .setText("Failed to load transformers!"); |
437 | 524 | displayLabel.setForeground(Color.red); |
438 | 525 | } |
439 | 526 | } |
|
0 commit comments