v1.1 setTitle中添加try-catch

This commit is contained in:
2024-08-16 15:53:31 +08:00
parent 292551fbc7
commit 7b036cccc1
2 changed files with 13 additions and 8 deletions

View File

@ -204,7 +204,6 @@ public class MWindow extends Frame {
File directory = null;
JFileChooser fileChooser = new JFileChooser();
fileChooser.setDialogTitle("Choose Jetbrains path");
// fileChooser.setCurrentDirectory(new File("d:\\software\\jetbrains"));
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int option = fileChooser.showOpenDialog(this);
if (option == JFileChooser.APPROVE_OPTION) {

View File

@ -115,13 +115,19 @@ public class ModifyDialogWrapperPeerImpl {
}
setTitleMethod.insertBefore("{ System.out.println(\"即将打开窗口-->\"+$1);" +
"boolean isLicenseWindow = false;" +
"if($1.indexOf(\"许可证\")>-1) {isLicenseWindow=true; this.dispose();}" +
"if($1.indexOf(\"Licenses\")>-1) {isLicenseWindow=true; this.dispose();}" +
"if(isLicenseWindow)System.out.println(\"发现激活窗口,即将关闭\");" +
"Exception e = new Exception(\"↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓\");\n" +
"System.out.println(\"调用栈信息-->\");" +
"e.printStackTrace();" +
" }"); // 注入的代码
"try {\n"+
" if($1.indexOf(\"许可证\")>-1) {isLicenseWindow=true; this.dispose();}\n" +
" if($1.indexOf(\"Licenses\")>-1) {isLicenseWindow=true; this.dispose();}\n" +
" if(isLicenseWindow) System.out.println(\"发现激活窗口,即将关闭\");\n" +
" Exception e = new Exception(\"↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓\");\n" +
" System.out.println(\"调用栈信息-->\");\n" +
" e.printStackTrace();\n" +
" }\n" +
"catch (Exception ex) {\n" +
" System.out.println(\"出现错误-->\");\n" +
" ex.printStackTrace();\n" +
" }" +
"}"); // 注入的代码
logList.add("[#] Modifying class: " + ctClass.getName());
ctClass.writeFile(middlePath);
ctClass.detach();