-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSelectDel.java
76 lines (71 loc) · 2.5 KB
/
SelectDel.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import java.util.*;
import java.io.*;
import javax.swing.*;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.BorderLayout;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.Base64;
import java.util.Scanner;
import javax.imageio.ImageIO;
import javax.swing.*;
class SelectDel
{
static void selectDel()
{
if(Login.login())
{
try
{
FileReader file;BufferedReader fileinput;String txt="",stxt="";
file=new FileReader(Path.path()+"\\logs.txt");
fileinput=new BufferedReader (file);
int i=0;
while((txt=fileinput.readLine())!=null)
{
++i;
}
if(i==0)
JOptionPane.showMessageDialog(null, "No saved Passwords Found", "Error 404", JOptionPane.ERROR_MESSAGE);
else
{
fileinput.close();
file=new FileReader(Path.path()+"\\logs.txt");
fileinput=new BufferedReader (file);
Object possibleValues[] = new Object[i];
for(int j=0;j<i;j++)
{
possibleValues[j]=txt=fileinput.readLine();
}
try
{
Object selectedValue = JOptionPane.showInputDialog(null,"Choose one to delete", "DELETE",
JOptionPane.INFORMATION_MESSAGE, null,possibleValues, possibleValues[0]);
try
{
txt=""+selectedValue;
LogManager.lM(txt);
txt=Path.path()+"\\"+selectedValue+"-Encrypted.txt";
Delete.delete(txt);
}
catch(Exception e)
{
//Nothing
}
}
catch(Exception e)
{
//Nothing
}
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null, "No saved Passwords Found", "Error 404", JOptionPane.ERROR_MESSAGE);
}
}
}
}