@@ -44,6 +44,7 @@ public class SwingWindow
4444 private static List <Class <?>> transformers ;
4545 private static File inputOutputPath = new File (System .getProperty ("user.dir" ));
4646 private static File libPath = new File (System .getProperty ("user.dir" ));
47+ private static JCheckBoxMenuItem shouldLimitLines ;
4748 private static final Map <Class <?>, String > TRANSFORMER_TO_NAME = new HashMap <>();
4849 private static final Map <String , Class <?>> NAME_TO_TRANSFORMER = new HashMap <>();
4950
@@ -66,6 +67,14 @@ public static void main(String[] args)
6667 frame .getContentPane ().setLayout (new GridBagLayout ());
6768 frame .setDefaultCloseOperation (WindowConstants .EXIT_ON_CLOSE );
6869
70+ //Menu
71+ JMenuBar menuBar = new JMenuBar ();
72+ JMenu menu = new JMenu ("Options" );
73+ menuBar .add (menu );
74+ shouldLimitLines = new JCheckBoxMenuItem ("Limit Console Lines" );
75+ menu .add (shouldLimitLines );
76+ frame .setJMenuBar (menuBar );
77+
6978 //Deobfuscator Input
7079 GridBagConstraints gbc_IPanel = new GridBagConstraints ();
7180 gbc_IPanel .fill = GridBagConstraints .HORIZONTAL ;
@@ -770,7 +779,6 @@ public void actionPerformed(ActionEvent e)
770779 {
771780 run .setEnabled (false );
772781 // Start
773- area .setText (null );
774782 JFrame newFrame = new JFrame ();
775783 newFrame .setTitle ("Console" );
776784 area .setEditable (false );
@@ -871,6 +879,8 @@ public void run()
871879 @ Override
872880 public void windowClosing (WindowEvent e )
873881 {
882+ print .flush ();
883+ area .setText (null );
874884 run .setEnabled (true );
875885 if (thread .isAlive ())
876886 thread .stop ();
@@ -953,6 +963,16 @@ public DeobfuscatorOutputStream(JTextArea console)
953963 public void write (int b ) throws IOException
954964 {
955965 console .append (String .valueOf ((char )b ));
966+ if (shouldLimitLines .isSelected () && console .getLineCount () > 100 )
967+ {
968+ try
969+ {
970+ console .replaceRange ("" , 0 , console .getLineEndOffset (0 ));
971+ }catch (Exception e )
972+ {
973+
974+ }
975+ }
956976 }
957977 }
958978}
0 commit comments