Skip to content

Commit

Permalink
fix(DecodeFrame.java): 修复解密默认保存文件夹名称错误
Browse files Browse the repository at this point in the history
修复:在解密文件名存在多个"."的时候,默认保存文件夹名称不符合预期。

BREAKING CHANGE: 无

Closes 无
  • Loading branch information
zhanlan123 committed Mar 30, 2023
1 parent 64c1683 commit 17a51a5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ private void initPrivateKey() {
setSelectPrivateKeyModeIsFalse();
}
} catch (IOException | URISyntaxException e) {
LogUtil.e("异常信息:" + ExceptionUtils.getStackTrace(e));
LogUtil.ei("异常信息:" + ExceptionUtils.getStackTrace(e));
setSelectPrivateKeyModeIsFalse();
}

Expand Down Expand Up @@ -230,7 +230,7 @@ private void initOperationSave() {
operationSave.setInputPrivateKeyInfo(inputPrivateKeyInfo);
}
} catch (IOException | URISyntaxException e) {
LogUtil.e("异常信息:" + ExceptionUtils.getStackTrace(e));
LogUtil.ei("异常信息:" + ExceptionUtils.getStackTrace(e));
}

}
Expand Down Expand Up @@ -329,7 +329,7 @@ private void decodeInfoText(String text, FontAttribute fontAttribute) {
try {
decodeInfoDocs.insertString(decodeInfoDocs.getLength(), text + "\n\n", fontAttribute.getAttrSet());
} catch (BadLocationException e) {
LogUtil.e("异常信息:" + ExceptionUtils.getStackTrace(e));
LogUtil.ei("异常信息:" + ExceptionUtils.getStackTrace(e));
}
}

Expand Down Expand Up @@ -389,7 +389,7 @@ public boolean importData(TransferHandler.TransferSupport support) {
logDecodeSavePathTextField.setText("");
return true;
} catch (UnsupportedFlavorException | IOException e) {
LogUtil.e("异常信息:" + ExceptionUtils.getStackTrace(e));
LogUtil.ei("异常信息:" + ExceptionUtils.getStackTrace(e));
}
return false;
}
Expand Down Expand Up @@ -549,8 +549,6 @@ private void addLogPrivateKeyView() {
*/
private int privateKeyMode = 0;

private boolean isSelectPrivateMode = false;

private final ItemListener itemListener = e -> {
JCheckBox selectJCheckBox = (JCheckBox)(e.getSource());
String actionCommand = selectJCheckBox.getActionCommand();
Expand Down Expand Up @@ -578,7 +576,6 @@ private void addLogPrivateKeyView() {

private void selectPrivateKeyOperation() {
privateKeyMode = 1;
isSelectPrivateMode = true;
inputPrivateKeyCheckBox.setSelected(false);
inputPrivateKeyTextArea.setText("");
inputPrivateKeyTextArea.setText(privateKeyInfo.getPrivateKeyValue());
Expand All @@ -588,7 +585,6 @@ private void selectPrivateKeyOperation() {

private void inputPrivateKeyOperation() {
privateKeyMode = 2;
isSelectPrivateMode = true;
selectPrivateKeyCheckBox.setSelected(false);
selectPrivateKeyInfoComboBox.setEnabled(false);
btnDeletePrivateKeyInfoButton.setEnabled(false);
Expand All @@ -597,7 +593,6 @@ private void inputPrivateKeyOperation() {
private void noSelectJude() {
if (!inputPrivateKeyCheckBox.isSelected() && !selectPrivateKeyCheckBox.isSelected()) {
privateKeyMode = 0;
isSelectPrivateMode = false;
}
}

Expand Down Expand Up @@ -639,7 +634,7 @@ private void updateDecodePrivateKey(String name, String privateKey) {
ini.put(IniSelectionEnum.PRIVATE_KEY.getName(), name, privateKey);
ini.store();
} catch (IOException | URISyntaxException e) {
LogUtil.e("异常信息:" + ExceptionUtils.getStackTrace(e));
LogUtil.ei("异常信息:" + ExceptionUtils.getStackTrace(e));
}
}

Expand All @@ -655,7 +650,7 @@ private void addDecodePrivateKey(String name, String privateKey) {
ini.put(IniSelectionEnum.PRIVATE_KEY.getName(), name, privateKey);
ini.store();
} catch (IOException | URISyntaxException e) {
LogUtil.e("异常信息:" + ExceptionUtils.getStackTrace(e));
LogUtil.ei("异常信息:" + ExceptionUtils.getStackTrace(e));
}
}

Expand All @@ -674,7 +669,7 @@ private void deleteDecodePrivateKey(String name) {
ini.remove(IniSelectionEnum.PRIVATE_KEY.getName(), name);
ini.store();
} catch (IOException | URISyntaxException e) {
LogUtil.e("异常信息:" + ExceptionUtils.getStackTrace(e));
LogUtil.ei("异常信息:" + ExceptionUtils.getStackTrace(e));
}
}

Expand Down Expand Up @@ -800,15 +795,18 @@ public void actionPerformed(ActionEvent e) {
File saveLogFileTemp = new File(saveLogPath);
if (saveLogFileTemp.exists()) {
if (!saveLogFileTemp.isDirectory()) {
saveLogPath = logFile.getParentFile().getAbsolutePath() + File.separator + logFile.getName().split("\\.")[0];
saveLogPath = logFile.getParentFile().getAbsolutePath() + File.separator + logFile.getName().substring(0, logFile.getName().lastIndexOf("."));
LogUtil.ei("选择保存的地址不是文件夹!");
}
} else {
if (!saveLogFileTemp.mkdirs()) {
saveLogPath = logFile.getParentFile().getAbsolutePath() + File.separator + logFile.getName().split("\\.")[0];
saveLogPath = logFile.getParentFile().getAbsolutePath() + File.separator + logFile.getName().substring(0, logFile.getName().lastIndexOf("."));
LogUtil.ei("选择的保存的地址,不能创建!");
}
}
if (!saveLogFileTemp.getAbsolutePath().equals(saveLogPath)) {
LogUtil.ei("保存到默认地址:" + saveLogPath);
}
File saveLogFile = new File(saveLogPath);
if (!saveLogFile.exists()) {
saveLogFile.mkdirs();
Expand All @@ -832,7 +830,7 @@ private void updateOperationSave(String logFilePath, String saveLogPath, int pri
ini.put(IniSelectionEnum.OPERATION_SAVE.getName(), IniOptionNameEnum.INPUT_PRIVATE_KEY_INFO.getName(), inputPrivateKeyInfo);
ini.store();
} catch (IOException | URISyntaxException e) {
LogUtil.e("异常信息:" + ExceptionUtils.getStackTrace(e));
LogUtil.ei("异常信息:" + ExceptionUtils.getStackTrace(e));
}
}

Expand Down Expand Up @@ -937,7 +935,7 @@ protected void done() {
decodeLogCompleteViewStatus();
}
} catch (InterruptedException | ExecutionException e) {
LogUtil.e("异常信息:" + ExceptionUtils.getStackTrace(e));
LogUtil.ei("异常信息:" + ExceptionUtils.getStackTrace(e));
decodeLogCompleteViewStatus();
}
}
Expand Down Expand Up @@ -1005,7 +1003,7 @@ protected void done() {
decodeSuccessCount++;
}
} catch (InterruptedException | ExecutionException e) {
LogUtil.e("异常信息:" + ExceptionUtils.getStackTrace(e));
LogUtil.ei("异常信息:" + ExceptionUtils.getStackTrace(e));
decodeFailureCount++;
} finally {
updateTotalView();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ public class Utils {
/**
* 判决是否存在文件
* @Title: judeFileExists
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param 参数说明
* @return boolean 返回类型
* @throws
* @Description: 判决是否存在文件
* @param filePath 文件路径
* @return boolean 是否存在
*/
public static boolean judeFileExists(String filePath) {
if (filePath != null && filePath.length() > 0) {
Expand Down

0 comments on commit 17a51a5

Please sign in to comment.