#1308 Search by all P-code files

This commit is contained in:
2016-12-19 22:21:53 +01:00
parent 13db993f13
commit 11088fec36
27 changed files with 237 additions and 352 deletions
@@ -1,70 +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.abc;
import com.jpexs.decompiler.flash.helpers.HighlightedText;
import com.jpexs.decompiler.flash.helpers.hilight.Highlighting;
import java.io.Serializable;
import java.util.List;
/**
*
* @author JPEXS
*/
public class CachedDecompilation implements Serializable {
public String text;
public List<Highlighting> traitHilights;
public List<Highlighting> classHilights;
public List<Highlighting> methodHilights;
public List<Highlighting> instructionHilights;
public List<Highlighting> specialHilights;
public List<Highlighting> getInstructionHighlights() {
return instructionHilights;
}
public List<Highlighting> getTraitHighlights() {
return traitHilights;
}
public List<Highlighting> getMethodHighlights() {
return methodHilights;
}
public List<Highlighting> getClassHighlights() {
return classHilights;
}
public List<Highlighting> getSpecialHighligths() {
return specialHilights;
}
public CachedDecompilation(HighlightedText highlightedText) {
this.text = highlightedText.text;
this.traitHilights = highlightedText.traitHilights;
this.classHilights = highlightedText.classHilights;
this.methodHilights = highlightedText.methodHilights;
this.instructionHilights = highlightedText.instructionHilights;
this.specialHilights = highlightedText.specialHilights;
}
}
@@ -37,6 +37,7 @@ import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.flash.exporters.settings.ScriptExportSettings;
import com.jpexs.decompiler.flash.helpers.FileTextWriter;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.flash.helpers.HighlightedText;
import com.jpexs.decompiler.flash.helpers.NulWriter;
import com.jpexs.decompiler.flash.helpers.hilight.Highlighting;
import com.jpexs.decompiler.flash.tags.Tag;
@@ -337,7 +338,7 @@ public class ScriptPack extends AS3ClassTreeItem {
Set<Integer> lonelyBody = new HashSet<>();
try {
CachedDecompilation decompiled = SWF.getCached(this);
HighlightedText decompiled = SWF.getCached(this);
int line = 1;
String txt = decompiled.text;
txt = txt.replace("\r", "");
@@ -345,21 +346,21 @@ public class ScriptPack extends AS3ClassTreeItem {
for (int i = 0; i < txt.length(); i++) {
blk:
{
Highlighting sh = Highlighting.searchPos(decompiled.specialHilights, i);
Highlighting sh = Highlighting.searchPos(decompiled.getSpecialHighlights(), i);
Highlighting cls = Highlighting.searchPos(decompiled.classHilights, i);
Highlighting cls = Highlighting.searchPos(decompiled.getClassHighlights(), i);
/*if (cls == null) {
continue;
}*/
Highlighting trt = Highlighting.searchPos(decompiled.traitHilights, i);
Highlighting trt = Highlighting.searchPos(decompiled.getTraitHighlights(), i);
/*if (trt == null) {
continue;
}*/
Highlighting method = Highlighting.searchPos(decompiled.methodHilights, i);
Highlighting method = Highlighting.searchPos(decompiled.getMethodHighlights(), i);
if (method == null) {
break blk;
}
Highlighting instr = Highlighting.searchPos(decompiled.instructionHilights, i); //h
Highlighting instr = Highlighting.searchPos(decompiled.getInstructionHighlights(), i); //h
/*if (instr == null) {
continue;
}*/
@@ -531,18 +532,18 @@ public class ScriptPack extends AS3ClassTreeItem {
Map<Integer, String> bodyToIdentifier = new HashMap<>();
try {
CachedDecompilation decompiled = SWF.getCached(this);
HighlightedText decompiled = SWF.getCached(this);
String txt = decompiled.text;
txt = txt.replace("\r", "");
for (int i = 0; i < txt.length(); i++) {
blk:
{
Highlighting sh = Highlighting.searchPos(decompiled.specialHilights, i);
Highlighting sh = Highlighting.searchPos(decompiled.getSpecialHighlights(), i);
Highlighting cls = Highlighting.searchPos(decompiled.classHilights, i);
Highlighting trt = Highlighting.searchPos(decompiled.traitHilights, i);
Highlighting method = Highlighting.searchPos(decompiled.methodHilights, i);
Highlighting cls = Highlighting.searchPos(decompiled.getClassHighlights(), i);
Highlighting trt = Highlighting.searchPos(decompiled.getTraitHighlights(), i);
Highlighting method = Highlighting.searchPos(decompiled.getMethodHighlights(), i);
if (method == null) {
break blk;
}