mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-27 02:10:44 +00:00
Added Opening ABC file format (*.abc)
This commit is contained in:
@@ -22,12 +22,14 @@ import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.ClassPath;
|
||||
import com.jpexs.decompiler.flash.abc.ScriptPack;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.flash.treeitems.Openable;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -56,7 +58,7 @@ public class ABCSearchResult implements Serializable, ScriptSearchResult {
|
||||
private static final int SERIAL_VERSION_MINOR = 0;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public ABCSearchResult(SWF swf, InputStream is) throws IOException, ScriptNotFoundException {
|
||||
public ABCSearchResult(Openable openable, InputStream is) throws IOException, ScriptNotFoundException {
|
||||
ObjectInputStream ois = new ObjectInputStream(is);
|
||||
int versionMajor = ois.read();
|
||||
ois.read(); //minor
|
||||
@@ -78,7 +80,19 @@ public class ABCSearchResult implements Serializable, ScriptSearchResult {
|
||||
this.classIndex = ois.readInt();
|
||||
this.traitId = ois.readInt();
|
||||
boolean packFound = false;
|
||||
for (ScriptPack pack : swf.getAS3Packs()) {
|
||||
|
||||
List<ScriptPack> packs;
|
||||
|
||||
if (openable instanceof SWF) {
|
||||
packs = ((SWF)openable).getAS3Packs();
|
||||
} else {
|
||||
ABC abc = (ABC)openable;
|
||||
List<ABC> allAbcs = new ArrayList<>();
|
||||
allAbcs.add(abc);
|
||||
packs = abc.getScriptPacks(null, allAbcs);
|
||||
}
|
||||
|
||||
for (ScriptPack pack : packs) {
|
||||
if (cp.equals(pack.getClassPath()) && traitIndices.equals(pack.traitIndices)) {
|
||||
this.scriptPack = pack;
|
||||
packFound = true;
|
||||
@@ -176,7 +190,7 @@ public class ABCSearchResult implements Serializable, ScriptSearchResult {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SWF getSWF() {
|
||||
return scriptPack.getSwf();
|
||||
public Openable getOpenable() {
|
||||
return scriptPack.getOpenable();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
import com.jpexs.decompiler.flash.helpers.HighlightedText;
|
||||
import com.jpexs.decompiler.flash.helpers.HighlightedTextWriter;
|
||||
import com.jpexs.decompiler.flash.tags.base.ASMSource;
|
||||
import com.jpexs.decompiler.flash.treeitems.Openable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -121,20 +122,27 @@ public class ActionScriptSearch {
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<ABCSearchResult> searchAs3(final SWF swf, final String txt, boolean ignoreCase, boolean regexp, boolean pcode, ScriptSearchListener listener, List<ScriptPack> scope) {
|
||||
public List<ABCSearchResult> searchAs3(final Openable openable, final String txt, boolean ignoreCase, boolean regexp, boolean pcode, ScriptSearchListener listener, List<ScriptPack> scope) {
|
||||
// todo: pcode seach
|
||||
if (txt != null && !txt.isEmpty()) {
|
||||
List<String> ignoredClasses = new ArrayList<>();
|
||||
List<String> ignoredNss = new ArrayList<>();
|
||||
|
||||
if (Configuration._ignoreAdditionalFlexClasses.get()) {
|
||||
swf.getFlexMainClass(ignoredClasses, ignoredNss);
|
||||
if (Configuration._ignoreAdditionalFlexClasses.get() && (openable instanceof SWF)) {
|
||||
((SWF)openable).getFlexMainClass(ignoredClasses, ignoredNss);
|
||||
}
|
||||
|
||||
final List<ABCSearchResult> found = Collections.synchronizedList(new ArrayList<>());
|
||||
final List<ScriptPack> fscope;
|
||||
if (scope == null) {
|
||||
fscope = swf.getAS3Packs();
|
||||
if (openable instanceof SWF) {
|
||||
fscope = ((SWF)openable).getAS3Packs();
|
||||
} else {
|
||||
ABC abc = (ABC)openable;
|
||||
List<ABC> allAbcs = new ArrayList<>();
|
||||
allAbcs.add(abc);
|
||||
fscope = abc.getScriptPacks(null, allAbcs);
|
||||
}
|
||||
} else {
|
||||
fscope = scope;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.search;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.tags.base.ASMSource;
|
||||
import com.jpexs.decompiler.flash.treeitems.Openable;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
@@ -87,7 +88,7 @@ public class ActionSearchResult implements ScriptSearchResult {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SWF getSWF() {
|
||||
public Openable getOpenable() {
|
||||
return src.getSwf();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,11 +17,12 @@
|
||||
package com.jpexs.decompiler.flash.search;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.treeitems.Openable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public interface SearchResult {
|
||||
public SWF getSWF();
|
||||
public Openable getOpenable();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user