capacitor-dex-editor 0.0.57 → 0.0.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1158,30 +1158,6 @@ public class DexManager {
|
|
|
1158
1158
|
return "";
|
|
1159
1159
|
}
|
|
1160
1160
|
|
|
1161
|
-
private String replaceMethodInSmali(String classSmali, String methodName,
|
|
1162
|
-
String signature, String newMethodCode) {
|
|
1163
|
-
String methodStart = ".method";
|
|
1164
|
-
String methodEnd = ".end method";
|
|
1165
|
-
|
|
1166
|
-
int searchStart = 0;
|
|
1167
|
-
while (true) {
|
|
1168
|
-
int start = classSmali.indexOf(methodStart, searchStart);
|
|
1169
|
-
if (start == -1) break;
|
|
1170
|
-
|
|
1171
|
-
int end = classSmali.indexOf(methodEnd, start);
|
|
1172
|
-
if (end == -1) break;
|
|
1173
|
-
|
|
1174
|
-
String methodBlock = classSmali.substring(start, end + methodEnd.length());
|
|
1175
|
-
if (methodBlock.contains(methodName)) {
|
|
1176
|
-
return classSmali.substring(0, start) + newMethodCode +
|
|
1177
|
-
classSmali.substring(end + methodEnd.length());
|
|
1178
|
-
}
|
|
1179
|
-
|
|
1180
|
-
searchStart = end + methodEnd.length();
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
return classSmali;
|
|
1184
|
-
}
|
|
1185
1161
|
|
|
1186
1162
|
private String insertMethodToSmali(String classSmali, String methodCode) {
|
|
1187
1163
|
// 在类结束前插入方法
|