From a017fc434dd392413e5f90126bf3efabcb676e5c Mon Sep 17 00:00:00 2001 From: Yutousama <583819556@qq.com> Date: Fri, 5 Jun 2020 17:24:39 +0800 Subject: [PATCH] update --- src/com/qy/ui/AppMain.java | 51 +++++++------ src/com/qy/ui/TestAdSrc.form | 29 ++++++++ src/com/qy/ui/TestAdSrc.java | 135 +++++++++++++++++++++++++++++++++++ 3 files changed, 194 insertions(+), 21 deletions(-) create mode 100644 src/com/qy/ui/TestAdSrc.form create mode 100644 src/com/qy/ui/TestAdSrc.java diff --git a/src/com/qy/ui/AppMain.java b/src/com/qy/ui/AppMain.java index 053076c..c940022 100755 --- a/src/com/qy/ui/AppMain.java +++ b/src/com/qy/ui/AppMain.java @@ -70,6 +70,7 @@ public class AppMain extends JFrame { String version = null; String apkPath = null; String csjPath = null; + String model = "csj"; for (String arg : args) { if (arg.startsWith("-package")) { @@ -87,36 +88,44 @@ public class AppMain extends JFrame { if (arg.startsWith("-csc")) { cscPath = arg.replace("-csc=", ""); } + if (arg.startsWith("-model")) { + model = arg.replace("-model=", ""); + } if (arg.trim().equals("-h")) { - System.err.println("-package packageName " + - "\n-version CsjVersion" + - "\n-apk apkFilePath" + - "\n-csj csjDemoApkFilePath" + - "\n-csc csc save Path"); + outHelp(); return; } } - if (packageName != null && version != null && apkPath != null && csjPath != null) { - new CsjTools(apkPath, csjPath, packageName, version, new SmaliApkToolsPath() { - @Override - public void smaliPath(String path) { - if (cscPath != null) { - File file = new File(path); - file.renameTo(new File(cscPath)); - } + if (model.equals("csj")) { + if (packageName != null && version != null && apkPath != null && csjPath != null) { + new CsjTools(apkPath, csjPath, packageName, version, new SmaliApkToolsPath() { + @Override + public void smaliPath(String path) { + if (cscPath != null) { + File file = new File(path); + file.renameTo(new File(cscPath)); + } + + } + }); + } else { + outHelp(); + } + }else if(model.equals("sdk")){ - } - }); - } else { - System.err.println("-package packageName " + - "\n-version CsjVersion" + - "\n-apk apkFilePath" + - "\n-csj csjDemoApkFilePath" + - "\n-csc csc save Path"); } + } } + private static void outHelp() { + System.err.println("-package packageName " + + "\n-version CsjVersion" + + "\n-apk apkFilePath" + + "\n-csj csjDemoApkFilePath" + + "\n-csc csc save Path"); + } + public AppMain() { setResizable(false); diff --git a/src/com/qy/ui/TestAdSrc.form b/src/com/qy/ui/TestAdSrc.form new file mode 100644 index 0000000..b65844f --- /dev/null +++ b/src/com/qy/ui/TestAdSrc.form @@ -0,0 +1,29 @@ + +
diff --git a/src/com/qy/ui/TestAdSrc.java b/src/com/qy/ui/TestAdSrc.java new file mode 100644 index 0000000..36524c7 --- /dev/null +++ b/src/com/qy/ui/TestAdSrc.java @@ -0,0 +1,135 @@ +package com.qy.ui; + +import javax.swing.*; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.io.File; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + +public class TestAdSrc { + private JCheckBox checkBox; + private JPanel panel1; + private JLabel jLable; + + public TestAdSrc() { + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (Exception e) { + // TODO: handle exception + e.printStackTrace(); + } + JFrame frame = new JFrame("广告源分析工具1.0"); + frame.setContentPane(panel1); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.pack(); + frame.setSize(420, 400); + frame.setVisible(true); + adSrcList(); + initView(); + } + + public void initView() { + panel1.setTransferHandler(new TransferHandler() { + @Override + public boolean importData(JComponent comp, Transferable t) { + try { + Object obj = t.getTransferData(DataFlavor.javaFileListFlavor); + File file = new File(obj.toString().substring(1, obj.toString().length() - 1)); + System.out.println(file.getAbsolutePath()); + if (!file.getName().endsWith(".apk")) { + new TextToDalog("警告", "并非一个apk文件:" + file.getAbsolutePath()); + return true; + } + if (checkBox.isSelected()) { + completeAnalysis(file); + } else { + analysis(file); + } + } catch (Exception e) { + e.printStackTrace(); + } + return true; + } + + @Override + public boolean canImport(JComponent comp, DataFlavor[] transferFlavors) { + return true; + } + }); + } + + private List