mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-12 15:08:37 +00:00
Edit AS 1/2 constant pool
This commit is contained in:
@@ -594,11 +594,13 @@ public abstract class Action implements GraphSourceItem {
|
||||
writer.appendNoHilight(Helper.constants).newLine();
|
||||
for (Action a : list) {
|
||||
if (a instanceof ActionConstantPool) {
|
||||
if (poolIdx > 0) {
|
||||
writer.appendNoHilight("---").newLine();
|
||||
}
|
||||
|
||||
ActionConstantPool cPool = (ActionConstantPool) a;
|
||||
int constIdx = 0;
|
||||
for (String c : cPool.constantPool) {
|
||||
writer.appendNoHilight(poolIdx);
|
||||
writer.appendNoHilight("|");
|
||||
writer.appendNoHilight(constIdx);
|
||||
writer.appendNoHilight("|");
|
||||
writer.appendNoHilight(c);
|
||||
|
||||
@@ -848,6 +848,28 @@ public class Helper {
|
||||
return data;
|
||||
}
|
||||
|
||||
public static List<List<String>> getConstantPoolsFromText(String text) {
|
||||
Scanner scanner = new Scanner(text);
|
||||
scanner.nextLine(); // ignore first line
|
||||
List<List<String>> result = new ArrayList<>();
|
||||
List<String> cPool = new ArrayList<>();
|
||||
result.add(cPool);
|
||||
while (scanner.hasNextLine()) {
|
||||
String line = scanner.nextLine();
|
||||
if (line.startsWith("---")) {
|
||||
cPool = new ArrayList<>();
|
||||
result.add(cPool);
|
||||
}
|
||||
|
||||
String[] parts = line.split("\\|", 2);
|
||||
if (parts.length >= 2) {
|
||||
cPool.add(parts[1]);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static boolean contains(int[] array, int value) {
|
||||
if (array == null) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user