As3ScriptReplacer as interface

Better handling missing directories
Tip for directories in advanced setting refactored - link to Flex SDK
Use Flex SDK switch in Advanced settings
This commit is contained in:
Jindra Petřík
2016-08-16 23:31:12 +02:00
parent 95785ba218
commit c4e1879b79
21 changed files with 316 additions and 154 deletions

View File

@@ -27,6 +27,7 @@ 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.HighlightedTextWriter;
import com.jpexs.decompiler.flash.importers.FFDecAs3ScriptReplacer;
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
import com.jpexs.decompiler.flash.tags.base.ASMSource;
import com.jpexs.decompiler.graph.CompilationException;
@@ -90,7 +91,7 @@ public class DirectEditingTest extends FileTestBase {
try {
en.toSource(htw, abc.script_info.get(s).traits.traits, new ConvertData(), ScriptExportMode.AS, false);
String original = htw.toString();
abc.replaceScriptPack(en, original);
abc.replaceScriptPack(new FFDecAs3ScriptReplacer() /*TODO: test the otherone*/, en, original);
} catch (Exception ex) {
fail("Exception during decompilation - file: " + filePath + " class: " + classPathString, ex);
throw ex;

View File

@@ -9,15 +9,13 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.testng.annotations.Test;
public class As3ScriptReplacerTest {
@Test
public void testReplace() throws IOException, InterruptedException, Exception {
As3ScriptReplacer replacer = new As3ScriptReplacer(Configuration.flexSdkLocation.get(), new LinkReportExporter());
MxmlcAs3ScriptReplacer replacer = new MxmlcAs3ScriptReplacer(Configuration.flexSdkLocation.get(), new LinkReportExporter());
SWF swf = new SWF(new BufferedInputStream(new FileInputStream("testdata/as3/as3.swf")), false);
String replacement = "package classes\n"
+ "{\n"
@@ -43,7 +41,7 @@ public class As3ScriptReplacerTest {
classNames.add("classes.TestClass1");
List<ScriptPack> packs = swf.getScriptPacksByClassNames(classNames);
for (ScriptPack sp : packs) {
replacer.replaceScript(swf, sp, replacement);
replacer.replaceScript(sp, replacement);
return;
}
}