-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathPackHookPlugin.java
54 lines (46 loc) · 1.48 KB
/
PackHookPlugin.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package com.example.yixianglin.antidex2jar;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by yixianglin on 2018/3/12.
*/
public class PackHookPlugin {
private int a;
private Map<String,List<String>> methodDesciption;
public PackHookPlugin(int i){
this.methodDesciption=new HashMap();
this.a=i;
}
public void addMethod(String key,String value){
if(!this.methodDesciption.containsKey(key)){
List arrayList=new ArrayList();
arrayList.add(value);
this.methodDesciption.put(key,arrayList);
}else if(!((List)this.methodDesciption.get(key)).contains(value)){
((List)this.methodDesciption.get(key)).add(value);
}
}
public JSONArray defineMethod(){
if(this.methodDesciption.isEmpty()){
return null;
}
JSONArray jsonArray=new JSONArray();
for(String key:this.methodDesciption.keySet()){
JSONObject jsonObject=new JSONObject();
JSONArray jsonArray1=new JSONArray((Collection)this.methodDesciption.get(key));
try {
jsonObject.put("function",jsonArray1);
} catch (JSONException e) {
e.printStackTrace();
}
jsonArray.put(jsonObject);
}
return jsonArray;
}
}