From 80c3f208e3d8533199bd84aca0d08450d84be4ca Mon Sep 17 00:00:00 2001 From: Yutousama <583819556@qq.com> Date: Wed, 3 Jun 2020 21:54:11 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A9=BF=E5=B1=B1=E7=94=B2=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=8C=85=E7=94=9F=E6=88=90=20API=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/qy/ui/AppMain.java | 65 +++++++++++++++++++++++++++++++++++--- 1 file changed, 61 insertions(+), 4 deletions(-) diff --git a/src/com/qy/ui/AppMain.java b/src/com/qy/ui/AppMain.java index ed9db1b..053076c 100755 --- a/src/com/qy/ui/AppMain.java +++ b/src/com/qy/ui/AppMain.java @@ -54,10 +54,67 @@ public class AppMain extends JFrame { private JMenuItem mntmbase; private JMenuItem mntmBase; - public static void main(String[] args) { - // TODO Auto-generated method stub + private static String cscPath = null; - new AppMain(); + public static void main(String[] args) { + /*args = new String[]{"-package=com.test.abc" + , "-version=5800" + , "-apk=E:\\idea\\tools\\tmp\\app-release-1.apk" + , "-csj=E:\\idea\\tools\\csj\\demo.apk" + , "-csc=E:\\idea\\tools\\csj\\out\\csc"};*/ + // TODO Auto-generated method stub + if (args.length == 0) { + new AppMain(); + } else { + String packageName = null; + String version = null; + String apkPath = null; + String csjPath = null; + + for (String arg : args) { + if (arg.startsWith("-package")) { + packageName = arg.replace("-package=", ""); + } + if (arg.startsWith("-version")) { + version = arg.replace("-version=", ""); + } + if (arg.startsWith("-apk")) { + apkPath = arg.replace("-apk=", ""); + } + if (arg.startsWith("-csj")) { + csjPath = arg.replace("-csj=", ""); + } + if (arg.startsWith("-csc")) { + cscPath = arg.replace("-csc=", ""); + } + if (arg.trim().equals("-h")) { + System.err.println("-package packageName " + + "\n-version CsjVersion" + + "\n-apk apkFilePath" + + "\n-csj csjDemoApkFilePath" + + "\n-csc csc save Path"); + 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)); + } + + } + }); + } else { + System.err.println("-package packageName " + + "\n-version CsjVersion" + + "\n-apk apkFilePath" + + "\n-csj csjDemoApkFilePath" + + "\n-csc csc save Path"); + } + } } public AppMain() { @@ -536,7 +593,7 @@ public class AppMain extends JFrame { new EditToDalog("提示", "请输入版本号", "", path -> { if (!Tools.stringIsNull(path)) { version = path; - packageName="com."+Tools.getRandomString(5).toLowerCase()+"."+ Tools.getRandomString(5).toLowerCase(); + packageName = "com." + Tools.getRandomString(5).toLowerCase() + "." + Tools.getRandomString(5).toLowerCase(); new EditToDalog("提示", "请输入包名", packageName, path1 -> { if (!Tools.stringIsNull(path1)) { packageName = path1;