This commit is contained in:
Yutousama 2020-06-03 17:50:55 +08:00
parent afe1407825
commit 4c1aeed350
4 changed files with 51 additions and 28 deletions

View File

@ -1,3 +1,3 @@
Manifest-Version: 1.0
Main-Class: com.qy.utils.CsjTools
Main-Class: com.qy.ui.AppMain

View File

@ -63,6 +63,15 @@ public class AutoRandomAdSDK {
private SmaliApkToolsPath inter;
private boolean isDev = false;
public void clear() {
if (adClass != null)
adClass.clear();
if (nowAdClass != null)
nowAdClass.clear();
if (nowAdFile != null)
nowAdFile.clear();
}
public static void main(String[] args) {
// TODO Auto-generated method stub
// new AutoRandomAdSDK(new File("JooMobAdSDK_6.1.8.jar"), "5600", "5", 1, null);
@ -103,11 +112,13 @@ public class AutoRandomAdSDK {
public AutoRandomAdSDK() {
}
private SmaliApkToolsPath batchInter;
private JSONArray batch;
public AutoRandomAdSDK(JSONArray batch, SmaliApkToolsPath inter) {
batchInter=inter;
this.batch=batch;
batchInter = inter;
this.batch = batch;
for (Object o : batch) {
//System.out.println("循环");
final JSONObject item = (JSONObject) o;
@ -123,10 +134,12 @@ public class AutoRandomAdSDK {
});
}
}
private int outIndex=0;
private int outIndex = 0;
private void outInter(JSONArray array) {
outIndex++;
if(batch.length()==outIndex){
if (batch.length() == outIndex) {
batchInter.smaliPath(batch.toString());
}
}
@ -446,6 +459,7 @@ public class AutoRandomAdSDK {
public void smaliPath(String path) {
// TODO Auto-generated method stub
try {
smalitools.clear();
Thread.sleep(2000);
outManifest();
File lt;
@ -479,6 +493,7 @@ public class AutoRandomAdSDK {
}
if (inter != null)
inter.smaliPath(nLt == null ? rootPath : nLt.getAbsolutePath());
clear();
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
@ -538,7 +553,7 @@ public class AutoRandomAdSDK {
file.delete();
} else {
moveFile(fs, key, nName+fs.getName().substring(fileName.length()), false);
moveFile(fs, key, nName + fs.getName().substring(fileName.length()), false);
}
}
}
@ -625,9 +640,9 @@ public class AutoRandomAdSDK {
if (packageName != null && file.getAbsolutePath().contains(packageName.replace(".", File.separator))) {
continue;
}
String sdkPackageName=config.isNull("regexPackage")?null:config.getString("regexPackage");
if(sdkPackageName!=null){
toPath=toPath.replace(sdkPackageName.replace(".",File.separator),"");
String sdkPackageName = config.isNull("regexPackage") ? null : config.getString("regexPackage");
if (sdkPackageName != null) {
toPath = toPath.replace(sdkPackageName.replace(".", File.separator), "");
}
if (file.isDirectory()) {
@ -645,7 +660,7 @@ public class AutoRandomAdSDK {
//boolean data = file.renameTo(new File(rootPath + toPath, file.getName()));
boolean data=Tools.copyFile(file.getAbsolutePath(),rootPath + toPath,true);
boolean data = Tools.copyFile(file.getAbsolutePath(), rootPath + toPath, true);
file.delete();
// System.out.println("移动文件:" + file.getAbsolutePath().replace(rootPath, "") + "" + (rootPath + toPath) + " > " + fileName + " " + nowAdClass.get(fileName) + " >! " + data);
if (nowAdClass.containsKey(fileName)) {
@ -675,11 +690,11 @@ public class AutoRandomAdSDK {
}
private String getNewName(String name) {
File file=new File(name);
String packageName=file.getAbsolutePath().replace(rootPath + File.separator + "smali" + File.separator,"").replace(file.getName(),"");
String nName = getNewNameForSrc(packageName.replace(File.separator,".")+file.getName());
if(nName.equals(packageName.replace(File.separator,".")+file.getName().replace(".smali",""))){
nName=getNewNameForSrc(file.getName());
File file = new File(name);
String packageName = file.getAbsolutePath().replace(rootPath + File.separator + "smali" + File.separator, "").replace(file.getName(), "");
String nName = getNewNameForSrc(packageName.replace(File.separator, ".") + file.getName());
if (nName.equals(packageName.replace(File.separator, ".") + file.getName().replace(".smali", ""))) {
nName = getNewNameForSrc(file.getName());
}
if (nName.endsWith("[notmover]")) {
nName = nName.replace("[notmover]", "");
@ -751,9 +766,6 @@ public class AutoRandomAdSDK {
}
}
nowAdClass.put(clazzs.getString(i), mkdir);
for (String key : nowAdClass.keySet()) {
// System.out.println("key=" + key + " file=" + nowAdClass.get(key) + " oldFile=" + adClass.get(key));
}
}
}
}

View File

@ -302,6 +302,7 @@ public class CsjTools {
apk_Path = path;
apk_res = apk_Path + File.separator + "res" + File.separator + "values";
runStart();
utils.clear();
}
});
@ -319,6 +320,7 @@ public class CsjTools {
csj_Path = path;
csj_res = csj_Path + File.separator + "res" + File.separator + "values";
_log.smaliPath("开始修改穿山甲");
utils.clear();
new Thread(new Runnable() {
@Override
public void run() {

View File

@ -256,6 +256,15 @@ public class SmaliUtils {
List<String> list;
public void clear() {
if (clazzList != null)
clazzList.clear();
if (list != null)
list.clear();
if (files != null)
files.clear();
}
public void setFilter(List<String> list) {
this.list = list;
}