Skip to content

Commit 15a0671

Browse files
committed
fixed open encrypted files by EasyEdit App
1 parent 6cb3002 commit 15a0671

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

src/wagemaker/co/uk/main/Launcher.java

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,12 @@ public void actionPerformed(ActionEvent event) {
295295
}
296296

297297
if ((codeGet != null) && (codeGet.length() > 0)) {
298-
File varDecryptedFile = new File(filePath);
298+
// Use the same logic as STPFileCrypter to determine the actual decrypted file path
299+
String decryptedPath = filePath;
300+
if (decryptedPath.lastIndexOf(".") == -1 || decryptedPath.lastIndexOf(".") < decryptedPath.lastIndexOf(File.separator)) {
301+
decryptedPath = decryptedPath + ".txt";
302+
}
303+
File varDecryptedFile = new File(decryptedPath);
299304
String decryptFile = varDecryptedFile.toString();
300305

301306
if(decryptFile.endsWith(".txt")) {
@@ -312,7 +317,7 @@ public void actionPerformed(ActionEvent event) {
312317

313318
setTitle(Title+" ~ " + varDecryptedFile.getName());
314319
FileTitle = varDecryptedFile.getName();
315-
FullPathName = filePath;
320+
FullPathName = decryptedPath;
316321
FilePathTrue = file;
317322
}
318323

@@ -683,7 +688,12 @@ public void actionPerformed(ActionEvent evt) {
683688
}
684689

685690
if ((codeGet != null) && (codeGet.length() > 0)) {
686-
File varDecryptedFile = new File(filePath);
691+
// Use the same logic as STPFileCrypter to determine the actual decrypted file path
692+
String decryptedPath = filePath;
693+
if (decryptedPath.lastIndexOf(".") == -1 || decryptedPath.lastIndexOf(".") < decryptedPath.lastIndexOf(File.separator)) {
694+
decryptedPath = decryptedPath + ".txt";
695+
}
696+
File varDecryptedFile = new File(decryptedPath);
687697
String decryptFile = varDecryptedFile.toString();
688698

689699
if(decryptFile.endsWith(".txt")) {
@@ -700,7 +710,7 @@ public void actionPerformed(ActionEvent evt) {
700710

701711
setTitle(Title+" ~ " + varDecryptedFile.getName());
702712
FileTitle = varDecryptedFile.getName();
703-
FullPathName = filePath;
713+
FullPathName = decryptedPath;
704714
FilePathTrue = file;
705715
}
706716
}
@@ -1013,10 +1023,10 @@ public void actionPerformed(ActionEvent ev) {
10131023

10141024
dlg.getContentPane().add(contentPanel);
10151025
dlg.pack();
1016-
// Scale dialog: increase width by 20% and decrease height by 30%
1026+
// Scale dialog: make it wider and taller for better visibility
10171027
java.awt.Dimension d = dlg.getSize();
1018-
int newW = Math.max((int) Math.round(d.width * 1.2), d.width + 20);
1019-
int newH = Math.max((int) Math.round(d.height * 0.7), 48);
1028+
int newW = Math.max((int) Math.round(d.width * 1.5), d.width + 60);
1029+
int newH = Math.max((int) Math.round(d.height * 1.0), d.height + 20);
10201030
dlg.setSize(newW, newH);
10211031
dlg.setResizable(false);
10221032
// Use the same robust centering approach as PasswordPrompter:
@@ -1520,7 +1530,12 @@ public void actionPerformed(ActionEvent event) {
15201530
}
15211531

15221532
if ((codeGet != null) && (codeGet.length() > 0)) {
1523-
File varDecryptedFile = new File(filePath);
1533+
// Use the same logic as STPFileCrypter to determine the actual decrypted file path
1534+
String decryptedPath = filePath;
1535+
if (decryptedPath.lastIndexOf(".") == -1 || decryptedPath.lastIndexOf(".") < decryptedPath.lastIndexOf(File.separator)) {
1536+
decryptedPath = decryptedPath + ".txt";
1537+
}
1538+
File varDecryptedFile = new File(decryptedPath);
15241539
String decryptFile = varDecryptedFile.toString();
15251540

15261541
if(decryptFile.endsWith(".txt")) {
@@ -1537,7 +1552,7 @@ public void actionPerformed(ActionEvent event) {
15371552

15381553
setTitle(Title+" ~ " + varDecryptedFile.getName());
15391554
FileTitle = varDecryptedFile.getName();
1540-
FullPathName = filePath;
1555+
FullPathName = decryptedPath;
15411556
FilePathTrue = file;
15421557
}
15431558
}

0 commit comments

Comments
 (0)