mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-27 23:40:45 +00:00
#1308 Search by all P-code files
This commit is contained in:
@@ -62,9 +62,7 @@ import com.jpexs.decompiler.flash.ecma.EcmaScript;
|
||||
import com.jpexs.decompiler.flash.ecma.Null;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
import com.jpexs.decompiler.flash.helpers.CodeFormatting;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.HighlightedTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.NulWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.SWFDecompilerPlugin;
|
||||
import com.jpexs.decompiler.flash.helpers.collections.MyEntry;
|
||||
@@ -475,23 +473,6 @@ public abstract class Action implements GraphSourceItem {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts list of actions to ASM source
|
||||
*
|
||||
* @param listeners
|
||||
* @param address
|
||||
* @param list List of actions
|
||||
* @param version SWF version
|
||||
* @param exportMode PCode or hex?
|
||||
* @return source ASM
|
||||
*
|
||||
*/
|
||||
public static String actionsToString(List<DisassemblyListener> listeners, long address, ActionList list, int version, ScriptExportMode exportMode) {
|
||||
HighlightedTextWriter writer = new HighlightedTextWriter(new CodeFormatting(), false);
|
||||
actionsToString(listeners, address, list, version, exportMode, writer);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
private static void informListeners(List<DisassemblyListener> listeners, int pos, int count) {
|
||||
if (pos % INFORM_LISTENER_RESOLUTION == 0) {
|
||||
DisassemblyListener[] listenersArray = listeners.toArray(new DisassemblyListener[listeners.size()]);
|
||||
@@ -855,21 +836,6 @@ public abstract class Action implements GraphSourceItem {
|
||||
return actionsToTree(new HashMap<>(), new HashMap<>(), new HashMap<>(), actions, version, staticOperation, path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts list of actions to ActionScript source code
|
||||
*
|
||||
* @param asm
|
||||
* @param actions List of actions
|
||||
* @param path
|
||||
* @return source
|
||||
* @throws java.lang.InterruptedException
|
||||
*/
|
||||
public static String actionsToSource(final ASMSource asm, final List<Action> actions, final String path) throws InterruptedException {
|
||||
HighlightedTextWriter writer = new HighlightedTextWriter(new CodeFormatting(), false);
|
||||
actionsToSource(asm, actions, path, writer);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts list of actions to ActionScript source code
|
||||
*
|
||||
@@ -877,9 +843,10 @@ public abstract class Action implements GraphSourceItem {
|
||||
* @param actions List of actions
|
||||
* @param path
|
||||
* @param writer
|
||||
* @return
|
||||
* @throws java.lang.InterruptedException
|
||||
*/
|
||||
public static void actionsToSource(final ASMSource asm, final List<Action> actions, final String path, GraphTextWriter writer) throws InterruptedException {
|
||||
public static GraphTextWriter actionsToSource(final ASMSource asm, final List<Action> actions, final String path, GraphTextWriter writer) throws InterruptedException {
|
||||
writer.suspendMeasure();
|
||||
List<GraphTargetItem> tree = null;
|
||||
Throwable convertException = null;
|
||||
@@ -932,6 +899,8 @@ public abstract class Action implements GraphSourceItem {
|
||||
if (asm != null) {
|
||||
asm.getActionSourceSuffix(writer);
|
||||
}
|
||||
|
||||
return writer;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
package com.jpexs.decompiler.flash.action;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import static com.jpexs.decompiler.flash.action.Action.actionsToSource;
|
||||
import static com.jpexs.decompiler.flash.action.Action.actionsToString;
|
||||
import com.jpexs.decompiler.flash.action.special.ActionNop;
|
||||
import com.jpexs.decompiler.flash.action.special.ActionStore;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionIf;
|
||||
@@ -26,7 +28,9 @@ import com.jpexs.decompiler.flash.action.swf4.ConstantIndex;
|
||||
import com.jpexs.decompiler.flash.action.swf5.ActionConstantPool;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
import com.jpexs.decompiler.flash.helpers.CodeFormatting;
|
||||
import com.jpexs.decompiler.flash.helpers.FileTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.HighlightedTextWriter;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItemContainer;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
@@ -97,7 +101,6 @@ public class ActionList extends ArrayList<Action> {
|
||||
|
||||
public Iterator<Action> getReferencesFor(final Action target) {
|
||||
return new Iterator<Action>() {
|
||||
|
||||
private final Iterator<Action> iterator = ActionList.this.iterator();
|
||||
|
||||
private Action action = getNext();
|
||||
@@ -160,7 +163,6 @@ public class ActionList extends ArrayList<Action> {
|
||||
|
||||
public Iterable<ActionConstantPool> getConstantPools() {
|
||||
return () -> new Iterator<ActionConstantPool>() {
|
||||
|
||||
private final Iterator<Action> iterator = ActionList.this.iterator();
|
||||
|
||||
private ActionConstantPool action = getNext();
|
||||
@@ -197,7 +199,6 @@ public class ActionList extends ArrayList<Action> {
|
||||
|
||||
public Iterable<ActionPush> getPushes() {
|
||||
return () -> new Iterator<ActionPush>() {
|
||||
|
||||
private final Iterator<Action> iterator = ActionList.this.iterator();
|
||||
|
||||
private ActionPush action = getNext();
|
||||
@@ -547,12 +548,16 @@ public class ActionList extends ArrayList<Action> {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Action.actionsToString(new ArrayList<>(), 0, this, SWF.DEFAULT_VERSION, ScriptExportMode.PCODE);
|
||||
HighlightedTextWriter writer = new HighlightedTextWriter(new CodeFormatting(), false);
|
||||
actionsToString(new ArrayList<>(), 0, this, SWF.DEFAULT_VERSION, ScriptExportMode.PCODE, writer);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
public String toSource() {
|
||||
try {
|
||||
return Action.actionsToSource(null, this, "");
|
||||
HighlightedTextWriter writer = new HighlightedTextWriter(new CodeFormatting(), false);
|
||||
actionsToSource(null, this, "", writer);
|
||||
return writer.toString();
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(ActionList.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2016 JPEXS, All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action;
|
||||
|
||||
import com.jpexs.decompiler.flash.helpers.hilight.Highlighting;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class CachedScript implements Serializable {
|
||||
|
||||
public String text;
|
||||
|
||||
public List<Highlighting> hilights;
|
||||
|
||||
public List<Highlighting> methodHilights;
|
||||
|
||||
public List<Highlighting> classHilights;
|
||||
|
||||
public List<Highlighting> specialHilights;
|
||||
|
||||
public CachedScript(String text, List<Highlighting> hilights, List<Highlighting> methodHilights, List<Highlighting> classHilights, List<Highlighting> specialHilights) {
|
||||
this.text = text;
|
||||
this.hilights = hilights;
|
||||
this.methodHilights = methodHilights;
|
||||
this.classHilights = classHilights;
|
||||
this.specialHilights = specialHilights;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user