capacitor-dex-editor 0.0.7 → 0.0.8
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.
|
@@ -1306,34 +1306,18 @@ public class DexManager {
|
|
|
1306
1306
|
// 解析 DEX 文件
|
|
1307
1307
|
DexBackedDexFile dexFile = new DexBackedDexFile(Opcodes.getDefault(), dexBytes);
|
|
1308
1308
|
|
|
1309
|
-
//
|
|
1310
|
-
|
|
1311
|
-
int
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
if (instrStr.contains("\"")) {
|
|
1322
|
-
int start = instrStr.indexOf("\"");
|
|
1323
|
-
int end = instrStr.lastIndexOf("\"");
|
|
1324
|
-
if (start != -1 && end > start) {
|
|
1325
|
-
String str = instrStr.substring(start + 1, end);
|
|
1326
|
-
if (!uniqueStrings.contains(str)) {
|
|
1327
|
-
uniqueStrings.add(str);
|
|
1328
|
-
JSObject item = new JSObject();
|
|
1329
|
-
item.put("index", index++);
|
|
1330
|
-
item.put("value", str);
|
|
1331
|
-
strings.put(item);
|
|
1332
|
-
}
|
|
1333
|
-
}
|
|
1334
|
-
}
|
|
1335
|
-
}
|
|
1336
|
-
}
|
|
1309
|
+
// 直接从 DEX 字符串表中读取所有字符串
|
|
1310
|
+
int stringCount = dexFile.getStringCount();
|
|
1311
|
+
for (int i = 0; i < stringCount; i++) {
|
|
1312
|
+
try {
|
|
1313
|
+
String str = dexFile.getStringSection().get(i);
|
|
1314
|
+
JSObject item = new JSObject();
|
|
1315
|
+
item.put("index", i);
|
|
1316
|
+
item.put("value", str != null ? str : "");
|
|
1317
|
+
strings.put(item);
|
|
1318
|
+
} catch (Exception e) {
|
|
1319
|
+
// 跳过无法读取的字符串
|
|
1320
|
+
Log.w(TAG, "Failed to read string at index " + i, e);
|
|
1337
1321
|
}
|
|
1338
1322
|
}
|
|
1339
1323
|
|