@@ -44,6 +44,7 @@ public class SwingWindow
44
44
private static List <Class <?>> transformers ;
45
45
private static File inputOutputPath = new File (System .getProperty ("user.dir" ));
46
46
private static File libPath = new File (System .getProperty ("user.dir" ));
47
+ private static JCheckBoxMenuItem shouldLimitLines ;
47
48
private static final Map <Class <?>, String > TRANSFORMER_TO_NAME = new HashMap <>();
48
49
private static final Map <String , Class <?>> NAME_TO_TRANSFORMER = new HashMap <>();
49
50
@@ -66,6 +67,14 @@ public static void main(String[] args)
66
67
frame .getContentPane ().setLayout (new GridBagLayout ());
67
68
frame .setDefaultCloseOperation (WindowConstants .EXIT_ON_CLOSE );
68
69
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
+
69
78
//Deobfuscator Input
70
79
GridBagConstraints gbc_IPanel = new GridBagConstraints ();
71
80
gbc_IPanel .fill = GridBagConstraints .HORIZONTAL ;
@@ -770,7 +779,6 @@ public void actionPerformed(ActionEvent e)
770
779
{
771
780
run .setEnabled (false );
772
781
// Start
773
- area .setText (null );
774
782
JFrame newFrame = new JFrame ();
775
783
newFrame .setTitle ("Console" );
776
784
area .setEditable (false );
@@ -871,6 +879,8 @@ public void run()
871
879
@ Override
872
880
public void windowClosing (WindowEvent e )
873
881
{
882
+ print .flush ();
883
+ area .setText (null );
874
884
run .setEnabled (true );
875
885
if (thread .isAlive ())
876
886
thread .stop ();
@@ -953,6 +963,16 @@ public DeobfuscatorOutputStream(JTextArea console)
953
963
public void write (int b ) throws IOException
954
964
{
955
965
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
+ }
956
976
}
957
977
}
958
978
}
0 commit comments