mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-05-29 10:24:38 +00:00
Fixed #1908 Shape/image import must accept also filenames in the form "CHARID_xxx.ext" instead of just "CHARID.ext"
Changed Shape/image/script/text import does not require specific folder name inside (but still preffers it when exists)
This commit is contained in:
@@ -24,10 +24,12 @@ All notable changes to this project will be documented in this file.
|
||||
- Show Hex dump for AS1/2 script tags
|
||||
- Speaker image when sound selected not in the center
|
||||
- [#1908] Slow commandline opening SWF
|
||||
- [#1908] Shape/image import must accept also filenames in the form "CHARID_xxx.ext" instead of just "CHARID.ext"
|
||||
|
||||
### Changed
|
||||
- Warning before switching deobfuscation is now optional
|
||||
- [#1690] Redesigned Deobfuscation tool dialog.
|
||||
- Shape/image/script/text import does not require specific folder name inside (but still preffers it when exists)
|
||||
|
||||
### Removed
|
||||
- "Restore control flow" deobfuscation level as it was the same as "Remove traps"
|
||||
|
||||
@@ -219,6 +219,7 @@ import com.jpexs.decompiler.flash.Bundle;
|
||||
import com.jpexs.decompiler.flash.gui.translator.Translator;
|
||||
import com.jpexs.decompiler.flash.importers.SymbolClassImporter;
|
||||
import java.awt.Font;
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -2267,7 +2268,7 @@ public class CommandLineArgumentParser {
|
||||
OpenableSourceInfo sourceInfo = new OpenableSourceInfo(null, inFile.getAbsolutePath(), inFile.getName());
|
||||
SWF swf;
|
||||
try {
|
||||
swf = new SWF(new BufferedInputStream(new StdInAwareFileInputStream(inFile)), sourceInfo.getFile(), sourceInfo.getFileTitle(),null, Configuration.parallelSpeedUp.get(), false, true, charset);
|
||||
swf = new SWF(new BufferedInputStream(new StdInAwareFileInputStream(inFile)), sourceInfo.getFile(), sourceInfo.getFileTitle(), null, Configuration.parallelSpeedUp.get(), false, true, charset);
|
||||
} catch (FileNotFoundException | SwfOpenException ex) {
|
||||
// FileNotFoundException when anti virus software blocks to open the file
|
||||
logger.log(Level.SEVERE, "Failed to open swf: " + inFile.getName(), ex);
|
||||
@@ -3688,32 +3689,64 @@ public class CommandLineArgumentParser {
|
||||
String selFile = args.pop();
|
||||
|
||||
File shapesDir = new File(Path.combine(selFile, ShapeExportSettings.EXPORT_FOLDER_NAME));
|
||||
if (shapesDir.exists()) {
|
||||
System.out.println("Using the directory: " + shapesDir.getAbsolutePath());
|
||||
} else {
|
||||
shapesDir = new File(selFile);
|
||||
}
|
||||
if (!shapesDir.exists()) {
|
||||
System.err.println("Shapes directory does not exist: " + shapesDir.getAbsolutePath());
|
||||
System.exit(1);
|
||||
}
|
||||
ShapeImporter shapeImporter = new ShapeImporter();
|
||||
SvgImporter svgImporter = new SvgImporter();
|
||||
|
||||
Map<Integer, CharacterTag> characters = swf.getCharacters();
|
||||
int shapeCount = 0;
|
||||
List<String> extensions = Arrays.asList("svg", "png", "jpg", "jpeg", "gif", "bmp");
|
||||
File allFiles[] = shapesDir.listFiles(new FilenameFilter(){
|
||||
@Override
|
||||
public boolean accept(File dir, String name) {
|
||||
String nameLower = name.toLowerCase();
|
||||
for(String ext:extensions) {
|
||||
if (nameLower.endsWith("." + ext)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
for (int characterId : characters.keySet()) {
|
||||
CharacterTag tag = characters.get(characterId);
|
||||
if (tag instanceof ShapeTag) {
|
||||
ShapeTag shapeTag = (ShapeTag) tag;
|
||||
List<File> existingFilesForImageTag = new ArrayList<>();
|
||||
for (String ext : extensions) {
|
||||
File sourceFile = new File(Path.combine(shapesDir.getPath(), "" + characterId + "." + ext));
|
||||
if (sourceFile.exists()) {
|
||||
existingFilesForImageTag.add(sourceFile);
|
||||
List<File> existingFilesForShapeTag = new ArrayList<>();
|
||||
for (File f:allFiles) {
|
||||
if (f.getName().startsWith(""+characterId+".") || f.getName().startsWith(""+characterId+"_")) {
|
||||
existingFilesForShapeTag.add(f);
|
||||
}
|
||||
}
|
||||
existingFilesForShapeTag.sort(new Comparator<File>(){
|
||||
@Override
|
||||
public int compare(File o1, File o2) {
|
||||
String ext1 = o1.getName().substring(o1.getName().lastIndexOf(".") + 1);
|
||||
String ext2 = o2.getName().substring(o2.getName().lastIndexOf(".") + 1);
|
||||
int ret = extensions.indexOf(ext1) - extensions.indexOf(ext2);
|
||||
if (ret == 0) {
|
||||
return o1.getName().compareTo(o2.getName());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
});
|
||||
|
||||
if (existingFilesForImageTag.isEmpty()) {
|
||||
if (existingFilesForShapeTag.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (existingFilesForImageTag.size() > 1) {
|
||||
logger.log(Level.WARNING, "Multiple matching files for shape tag {0} exists, {1} selected", new Object[]{characterId, existingFilesForImageTag.get(0).getName()});
|
||||
if (existingFilesForShapeTag.size() > 1) {
|
||||
logger.log(Level.WARNING, "Multiple matching files for shape tag {0} exists, {1} selected", new Object[]{characterId, existingFilesForShapeTag.get(0).getName()});
|
||||
}
|
||||
File sourceFile = existingFilesForImageTag.get(0);
|
||||
File sourceFile = existingFilesForShapeTag.get(0);
|
||||
|
||||
try {
|
||||
System.out.println("Importing character " + characterId + " from file " + sourceFile.getName());
|
||||
@@ -3753,6 +3786,11 @@ public class CommandLineArgumentParser {
|
||||
String selFile = args.pop();
|
||||
|
||||
File imagesDir = new File(Path.combine(selFile, ImageExportSettings.EXPORT_FOLDER_NAME));
|
||||
if (imagesDir.exists()) {
|
||||
System.out.println("Using the directory: " + imagesDir.getAbsolutePath());
|
||||
} else {
|
||||
imagesDir = new File(selFile);
|
||||
}
|
||||
if (!imagesDir.exists()) {
|
||||
System.err.println("Images directory does not exist: " + imagesDir.getAbsolutePath());
|
||||
System.exit(1);
|
||||
@@ -3760,7 +3798,19 @@ public class CommandLineArgumentParser {
|
||||
ImageImporter imageImporter = new ImageImporter();
|
||||
int imageCount = 0;
|
||||
Map<Integer, CharacterTag> characters = swf.getCharacters();
|
||||
List<String> extensions = Arrays.asList("png", "jpg", "jpeg", "gif", "bmp");
|
||||
final List<String> extensions = Arrays.asList("png", "jpg", "jpeg", "gif", "bmp");
|
||||
File allFiles[] = imagesDir.listFiles(new FilenameFilter(){
|
||||
@Override
|
||||
public boolean accept(File dir, String name) {
|
||||
String nameLower = name.toLowerCase();
|
||||
for(String ext:extensions) {
|
||||
if (nameLower.endsWith("." + ext)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
for (int characterId : characters.keySet()) {
|
||||
CharacterTag tag = characters.get(characterId);
|
||||
if (tag instanceof ImageTag) {
|
||||
@@ -3769,13 +3819,24 @@ public class CommandLineArgumentParser {
|
||||
continue;
|
||||
}
|
||||
List<File> existingFilesForImageTag = new ArrayList<>();
|
||||
for (String ext : extensions) {
|
||||
File sourceFile = new File(Path.combine(imagesDir.getPath(), "" + characterId + "." + ext));
|
||||
if (sourceFile.exists()) {
|
||||
existingFilesForImageTag.add(sourceFile);
|
||||
for (File f:allFiles) {
|
||||
if (f.getName().startsWith(""+characterId+".") || f.getName().startsWith(""+characterId+"_")) {
|
||||
existingFilesForImageTag.add(f);
|
||||
}
|
||||
}
|
||||
|
||||
existingFilesForImageTag.sort(new Comparator<File>(){
|
||||
@Override
|
||||
public int compare(File o1, File o2) {
|
||||
String ext1 = o1.getName().substring(o1.getName().lastIndexOf(".") + 1);
|
||||
String ext2 = o2.getName().substring(o2.getName().lastIndexOf(".") + 1);
|
||||
int ret = extensions.indexOf(ext1) - extensions.indexOf(ext2);
|
||||
if (ret == 0) {
|
||||
return o1.getName().compareTo(o2.getName());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
});
|
||||
|
||||
if (existingFilesForImageTag.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
@@ -3816,7 +3877,11 @@ public class CommandLineArgumentParser {
|
||||
SWF swf = new SWF(is, Configuration.parallelSpeedUp.get(), charset);
|
||||
|
||||
String selFile = args.pop();
|
||||
boolean textsFolderExists = new File(Path.combine(selFile, TextExportSettings.EXPORT_FOLDER_NAME)).exists();
|
||||
File textsFile = new File(Path.combine(selFile, TextExportSettings.EXPORT_FOLDER_NAME, TextExporter.TEXT_EXPORT_FILENAME_FORMATTED));
|
||||
if (!textsFolderExists) {
|
||||
textsFile = new File(Path.combine(selFile, TextExporter.TEXT_EXPORT_FILENAME_FORMATTED));
|
||||
}
|
||||
TextImporter textImporter = new TextImporter(new MissingCharacterHandler() {
|
||||
@Override
|
||||
public boolean getIgnoreMissingCharacters() {
|
||||
@@ -3866,10 +3931,13 @@ public class CommandLineArgumentParser {
|
||||
});
|
||||
|
||||
// try to import formatted texts
|
||||
if (textsFile.exists()) {
|
||||
if (textsFile.exists()) {
|
||||
textImporter.importTextsSingleFileFormatted(textsFile, swf);
|
||||
} else {
|
||||
textsFile = new File(Path.combine(selFile, TextExportSettings.EXPORT_FOLDER_NAME, TextExporter.TEXT_EXPORT_FILENAME_PLAIN));
|
||||
if (!textsFolderExists) {
|
||||
textsFile = new File(Path.combine(selFile, TextExporter.TEXT_EXPORT_FILENAME_PLAIN));
|
||||
}
|
||||
// try to import plain texts
|
||||
if (textsFile.exists()) {
|
||||
textImporter.importTextsSingleFile(textsFile, swf);
|
||||
@@ -3903,7 +3971,11 @@ public class CommandLineArgumentParser {
|
||||
try {
|
||||
try (StdInAwareFileInputStream is = new StdInAwareFileInputStream(inFile)) {
|
||||
SWF swf = new SWF(is, Configuration.parallelSpeedUp.get(), charset);
|
||||
String scriptsFolder = Path.combine(args.pop(), ScriptExportSettings.EXPORT_FOLDER_NAME);
|
||||
String baseFolder = args.pop();
|
||||
String scriptsFolder = Path.combine(baseFolder, ScriptExportSettings.EXPORT_FOLDER_NAME);
|
||||
if (!new File(scriptsFolder).exists()) {
|
||||
scriptsFolder = baseFolder;
|
||||
}
|
||||
new AS2ScriptImporter().importScripts(scriptsFolder, swf.getASMs(true));
|
||||
new AS3ScriptImporter().importScripts(As3ScriptReplacerFactory.createByConfig(air), scriptsFolder, swf.getAS3Packs());
|
||||
|
||||
|
||||
@@ -237,6 +237,7 @@ import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.ref.WeakReference;
|
||||
@@ -244,6 +245,7 @@ import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.ConcurrentModificationException;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@@ -3052,7 +3054,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
}
|
||||
|
||||
public void importShape(final SWF swf, boolean noFill) {
|
||||
ViewMessages.showMessageDialog(MainPanel.this, translate("message.info.importShapes"), translate("message.info"), JOptionPane.INFORMATION_MESSAGE, Configuration.showImportShapeInfo);
|
||||
ViewMessages.showMessageDialog(MainPanel.this, translate("message.info.importShapes2"), translate("message.info"), JOptionPane.INFORMATION_MESSAGE, Configuration.showImportShapeInfo);
|
||||
JFileChooser chooser = new JFileChooser();
|
||||
chooser.setCurrentDirectory(new File(Configuration.lastExportDir.get()));
|
||||
chooser.setDialogTitle(translate("import.select.directory"));
|
||||
@@ -3061,6 +3063,10 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
|
||||
String selFile = Helper.fixDialogFile(chooser.getSelectedFile()).getAbsolutePath();
|
||||
File shapesDir = new File(Path.combine(selFile, ShapeExportSettings.EXPORT_FOLDER_NAME));
|
||||
if (!shapesDir.exists()) {
|
||||
shapesDir = new File(selFile);
|
||||
}
|
||||
final File fShapesDir = shapesDir;
|
||||
ShapeImporter shapeImporter = new ShapeImporter();
|
||||
SvgImporter svgImporter = new SvgImporter();
|
||||
|
||||
@@ -3074,26 +3080,49 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
try {
|
||||
Map<Integer, CharacterTag> characters = swf.getCharacters();
|
||||
List<String> extensions = Arrays.asList("svg", "png", "jpg", "jpeg", "gif", "bmp");
|
||||
File allFiles[] = fShapesDir.listFiles(new FilenameFilter() {
|
||||
@Override
|
||||
public boolean accept(File dir, String name) {
|
||||
String nameLower = name.toLowerCase();
|
||||
for (String ext : extensions) {
|
||||
if (nameLower.endsWith("." + ext)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
for (int characterId : characters.keySet()) {
|
||||
CharacterTag tag = characters.get(characterId);
|
||||
if (tag instanceof ShapeTag) {
|
||||
ShapeTag shapeTag = (ShapeTag) tag;
|
||||
List<File> existingFilesForImageTag = new ArrayList<>();
|
||||
for (String ext : extensions) {
|
||||
File sourceFile = new File(Path.combine(shapesDir.getPath(), "" + characterId + "." + ext));
|
||||
if (sourceFile.exists()) {
|
||||
existingFilesForImageTag.add(sourceFile);
|
||||
List<File> existingFilesForShapeTag = new ArrayList<>();
|
||||
for (File f : allFiles) {
|
||||
if (f.getName().startsWith("" + characterId + ".") || f.getName().startsWith("" + characterId + "_")) {
|
||||
existingFilesForShapeTag.add(f);
|
||||
}
|
||||
}
|
||||
existingFilesForShapeTag.sort(new Comparator<File>() {
|
||||
@Override
|
||||
public int compare(File o1, File o2) {
|
||||
String ext1 = o1.getName().substring(o1.getName().lastIndexOf(".") + 1);
|
||||
String ext2 = o2.getName().substring(o2.getName().lastIndexOf(".") + 1);
|
||||
int ret = extensions.indexOf(ext1) - extensions.indexOf(ext2);
|
||||
if (ret == 0) {
|
||||
return o1.getName().compareTo(o2.getName());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
});
|
||||
|
||||
if (existingFilesForImageTag.isEmpty()) {
|
||||
if (existingFilesForShapeTag.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (existingFilesForImageTag.size() > 1) {
|
||||
Logger.getLogger(MainPanel.class.getName()).log(Level.WARNING, "Multiple matching files for shape tag {0} exists, {1} selected", new Object[]{characterId, existingFilesForImageTag.get(0).getName()});
|
||||
if (existingFilesForShapeTag.size() > 1) {
|
||||
Logger.getLogger(MainPanel.class.getName()).log(Level.WARNING, "Multiple matching files for shape tag {0} exists, {1} selected", new Object[]{characterId, existingFilesForShapeTag.get(0).getName()});
|
||||
}
|
||||
File sourceFile = existingFilesForImageTag.get(0);
|
||||
File sourceFile = existingFilesForShapeTag.get(0);
|
||||
|
||||
try {
|
||||
if (sourceFile.getAbsolutePath().toLowerCase().endsWith(".svg")) {
|
||||
@@ -3145,7 +3174,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
}
|
||||
|
||||
public void importImage(final SWF swf) {
|
||||
ViewMessages.showMessageDialog(MainPanel.this, translate("message.info.importImages"), translate("message.info"), JOptionPane.INFORMATION_MESSAGE, Configuration.showImportImageInfo);
|
||||
ViewMessages.showMessageDialog(MainPanel.this, translate("message.info.importImages2"), translate("message.info"), JOptionPane.INFORMATION_MESSAGE, Configuration.showImportImageInfo);
|
||||
JFileChooser chooser = new JFileChooser();
|
||||
chooser.setCurrentDirectory(new File(Configuration.lastExportDir.get()));
|
||||
chooser.setDialogTitle(translate("import.select.directory"));
|
||||
@@ -3154,6 +3183,10 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
|
||||
String selFile = Helper.fixDialogFile(chooser.getSelectedFile()).getAbsolutePath();
|
||||
File imagesDir = new File(Path.combine(selFile, ImageExportSettings.EXPORT_FOLDER_NAME));
|
||||
if (!imagesDir.exists()) {
|
||||
imagesDir = new File(selFile);
|
||||
}
|
||||
final File fImagesDir = imagesDir;
|
||||
ImageImporter imageImporter = new ImageImporter();
|
||||
|
||||
final long timeBefore = System.currentTimeMillis();
|
||||
@@ -3166,6 +3199,18 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
try {
|
||||
Map<Integer, CharacterTag> characters = swf.getCharacters();
|
||||
List<String> extensions = Arrays.asList("png", "jpg", "jpeg", "gif", "bmp");
|
||||
File allFiles[] = fImagesDir.listFiles(new FilenameFilter() {
|
||||
@Override
|
||||
public boolean accept(File dir, String name) {
|
||||
String nameLower = name.toLowerCase();
|
||||
for (String ext : extensions) {
|
||||
if (nameLower.endsWith("." + ext)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
for (int characterId : characters.keySet()) {
|
||||
CharacterTag tag = characters.get(characterId);
|
||||
if (tag instanceof ImageTag) {
|
||||
@@ -3174,12 +3219,23 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
continue;
|
||||
}
|
||||
List<File> existingFilesForImageTag = new ArrayList<>();
|
||||
for (String ext : extensions) {
|
||||
File sourceFile = new File(Path.combine(imagesDir.getPath(), "" + characterId + "." + ext));
|
||||
if (sourceFile.exists()) {
|
||||
existingFilesForImageTag.add(sourceFile);
|
||||
for (File f : allFiles) {
|
||||
if (f.getName().startsWith("" + characterId + ".") || f.getName().startsWith("" + characterId + "_")) {
|
||||
existingFilesForImageTag.add(f);
|
||||
}
|
||||
}
|
||||
existingFilesForImageTag.sort(new Comparator<File>() {
|
||||
@Override
|
||||
public int compare(File o1, File o2) {
|
||||
String ext1 = o1.getName().substring(o1.getName().lastIndexOf(".") + 1);
|
||||
String ext2 = o2.getName().substring(o2.getName().lastIndexOf(".") + 1);
|
||||
int ret = extensions.indexOf(ext1) - extensions.indexOf(ext2);
|
||||
if (ret == 0) {
|
||||
return o1.getName().compareTo(o2.getName());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
});
|
||||
|
||||
if (existingFilesForImageTag.isEmpty()) {
|
||||
continue;
|
||||
@@ -3234,7 +3290,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
}
|
||||
|
||||
public void importText(final SWF swf) {
|
||||
ViewMessages.showMessageDialog(MainPanel.this, translate("message.info.importTexts"), translate("message.info"), JOptionPane.INFORMATION_MESSAGE, Configuration.showImportTextInfo);
|
||||
ViewMessages.showMessageDialog(MainPanel.this, translate("message.info.importTexts2"), translate("message.info"), JOptionPane.INFORMATION_MESSAGE, Configuration.showImportTextInfo);
|
||||
JFileChooser chooser = new JFileChooser();
|
||||
chooser.setCurrentDirectory(new File(Configuration.lastExportDir.get()));
|
||||
chooser.setDialogTitle(translate("import.select.directory"));
|
||||
@@ -3242,7 +3298,11 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
chooser.setAcceptAllFileFilterUsed(false);
|
||||
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
|
||||
String selFile = Helper.fixDialogFile(chooser.getSelectedFile()).getAbsolutePath();
|
||||
boolean textsFolderExists = new File(Path.combine(selFile, TextExportSettings.EXPORT_FOLDER_NAME)).exists();
|
||||
File textsFile = new File(Path.combine(selFile, TextExportSettings.EXPORT_FOLDER_NAME, TextExporter.TEXT_EXPORT_FILENAME_FORMATTED));
|
||||
if (!textsFolderExists) {
|
||||
textsFile = new File(Path.combine(selFile, TextExporter.TEXT_EXPORT_FILENAME_FORMATTED));
|
||||
}
|
||||
TextImporter textImporter = new TextImporter(getMissingCharacterHandler(), new TextImportErrorHandler() {
|
||||
// "configuration items" for the current replace only
|
||||
private final ConfigurationItem<Boolean> showAgainImportError = new ConfigurationItem<>("showAgainImportError", true, true);
|
||||
@@ -3278,6 +3338,9 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
textImporter.importTextsSingleFileFormatted(textsFile, swf);
|
||||
} else {
|
||||
textsFile = new File(Path.combine(selFile, TextExportSettings.EXPORT_FOLDER_NAME, TextExporter.TEXT_EXPORT_FILENAME_PLAIN));
|
||||
if (!textsFolderExists) {
|
||||
textsFile = new File(Path.combine(selFile, TextExporter.TEXT_EXPORT_FILENAME_PLAIN));
|
||||
}
|
||||
// try to import plain texts
|
||||
if (textsFile.exists()) {
|
||||
textImporter.importTextsSingleFile(textsFile, swf);
|
||||
@@ -3324,7 +3387,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
if (as3ScriptReplacer == null) {
|
||||
return;
|
||||
}
|
||||
ViewMessages.showMessageDialog(MainPanel.this, translate("message.info.importScripts"), translate("message.info"), JOptionPane.INFORMATION_MESSAGE, Configuration.showImportScriptsInfo);
|
||||
ViewMessages.showMessageDialog(MainPanel.this, translate("message.info.importScripts2"), translate("message.info"), JOptionPane.INFORMATION_MESSAGE, Configuration.showImportScriptsInfo);
|
||||
|
||||
JFileChooser chooser = new JFileChooser();
|
||||
chooser.setCurrentDirectory(new File(Configuration.lastExportDir.get()));
|
||||
@@ -3334,6 +3397,10 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
|
||||
String selFile = Helper.fixDialogFile(chooser.getSelectedFile()).getAbsolutePath();
|
||||
String scriptsFolder = Path.combine(selFile, ScriptExportSettings.EXPORT_FOLDER_NAME);
|
||||
if (!new File(scriptsFolder).exists()) {
|
||||
scriptsFolder = selFile;
|
||||
}
|
||||
final String fScriptsFolder = scriptsFolder;
|
||||
final long timeBefore = System.currentTimeMillis();
|
||||
new CancellableWorker<Void>() {
|
||||
private int countAs2 = 0;
|
||||
@@ -3344,7 +3411,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
|
||||
SWF swf = (openable instanceof SWF) ? (SWF) openable : ((ABC) openable).getSwf();
|
||||
|
||||
new AS2ScriptImporter().importScripts(scriptsFolder, swf.getASMs(true), new ScriptImporterProgressListener() {
|
||||
new AS2ScriptImporter().importScripts(fScriptsFolder, swf.getASMs(true), new ScriptImporterProgressListener() {
|
||||
@Override
|
||||
public void scriptImported() {
|
||||
countAs2++;
|
||||
@@ -3361,7 +3428,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
packs = abc.getScriptPacks(null, allAbcs);
|
||||
}
|
||||
|
||||
new AS3ScriptImporter().importScripts(as3ScriptReplacer, scriptsFolder, packs, new ScriptImporterProgressListener() {
|
||||
new AS3ScriptImporter().importScripts(as3ScriptReplacer, fScriptsFolder, packs, new ScriptImporterProgressListener() {
|
||||
@Override
|
||||
public void scriptImported() {
|
||||
countAs3++;
|
||||
@@ -3673,7 +3740,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
body.deobfuscate(level, t, scriptIndex, methodIndex, isStatic, "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void deobfuscateTraits(int scriptIndex, DeobfuscationLevel level, List<Trait> traits, ABC abc, boolean isStatic) throws InterruptedException {
|
||||
for (Trait t : traits) {
|
||||
int methodIndex = -1;
|
||||
@@ -3687,13 +3754,13 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
deobfuscateMethod(t, scriptIndex, level, isStatic, methodIndex, abc);
|
||||
}
|
||||
if (t instanceof TraitClass) {
|
||||
TraitClass tc = (TraitClass)t;
|
||||
TraitClass tc = (TraitClass) t;
|
||||
ClassInfo ci = abc.class_info.get(tc.class_info);
|
||||
deobfuscateMethod(t, scriptIndex, level, true, ci.cinit_index, abc);
|
||||
deobfuscateTraits(scriptIndex, level, ci.static_traits.traits, abc, true);
|
||||
InstanceInfo ii = abc.instance_info.get(tc.class_info);
|
||||
deobfuscateMethod(t, scriptIndex, level, false, ii.iinit_index, abc);
|
||||
deobfuscateTraits(scriptIndex, level, ii.instance_traits.traits, abc, false);
|
||||
deobfuscateTraits(scriptIndex, level, ii.instance_traits.traits, abc, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3737,7 +3804,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
logger.log(Level.SEVERE, "Deobfuscation error", ex);
|
||||
ViewMessages.showMessageDialog(MainPanel.this, translate("error.deobfuscation"),translate ("error"), JOptionPane.ERROR_MESSAGE);
|
||||
ViewMessages.showMessageDialog(MainPanel.this, translate("error.deobfuscation"), translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -1055,4 +1055,25 @@ deobfuscate_options.remove_obfuscated_declarations = Remove single assigned obfu
|
||||
|
||||
message.confirm.autoRenameIdentifiers = Automatic identifiers renaming feature will walk AS code\r\nupon opening SWF file and renames all nonstandard names to valid identifiers.\r\nThis feature may damage the SWF file upon saving - USE IT AT YOUR OWN RISK.
|
||||
|
||||
error.deobfuscation = Deobfuscation failed for some of the methods.
|
||||
error.deobfuscation = Deobfuscation failed for some of the methods.
|
||||
|
||||
message.info.importShapes2 = During importing shapes, you need to select a FOLDER.\r\n \
|
||||
Filenames inside the folder must match existing shapes in current selected SWF.\r\n \
|
||||
If there exist "shapes" folder inside, it is selected instead.\r\n \
|
||||
The best way to get the structure right is to export shapes in current SWF file first.
|
||||
|
||||
message.info.importScripts2 = During importing scripts, you need to select a FOLDER.\r\n \
|
||||
Its tree must match existing script tree in current selected SWF.\r\n \
|
||||
If there exist "scripts" folder inside, it is selected instead.\r\n \
|
||||
The best way to get the structure right is to export scripts in current SWF file first. \r\n\r\n \
|
||||
Also note that this import uses same compiler as in standard AS editation in FFDec window (Experimental for AS3).
|
||||
|
||||
message.info.importTexts2 = During importing text, you need to select a FOLDER.\r\n \
|
||||
Filenames inside the folder must match existing texts in current selected SWF.\r\n \
|
||||
If there exist "texts" folder inside, it is selected instead.\r\n \
|
||||
The best way to get the structure right is to export texts in current SWF file first.
|
||||
|
||||
message.info.importImages2 = During importing images, you need to select a FOLDER.\r\n \
|
||||
Filenames inside the folder must match existing images in current selected SWF.\r\n \
|
||||
If there exist "images" folder inside, it is selected instead.\r\n \
|
||||
The best way to get the structure right is to export images in current SWF file first.
|
||||
|
||||
@@ -1040,4 +1040,26 @@ deobfuscate_options.remove_obfuscated_declarations = Odstranit jednor\u00e1zov\u
|
||||
|
||||
message.confirm.autoRenameIdentifiers = Mo\u017enost automatick\u00e9ho p\u0159ejmenov\u00e1n\u00ed prom\u011bnn\u00fdch projde AS k\u00f3d\r\npo otev\u0159en\u00ed SWF souboru a p\u0159ejmenuje v\u0161echny nestandardn\u00ed n\u00e1zvy na platn\u00e9 identifik\u00e1tory.\r\nTato mo\u017enost m\u016f\u017ee po ulo\u017een\u00ed po\u0161kodit SWF soubor - POU\u017d\u00cdVAT NA VLASTN\u00cd RIZIKO.
|
||||
|
||||
error.deobfuscation = Deobfuskace pro n\u011bkter\u00e9 metody selhala.
|
||||
error.deobfuscation = Deobfuskace pro n\u011bkter\u00e9 metody selhala.
|
||||
|
||||
message.info.importShapes2 = B\u011bhem importu tvar\u016f mus\u00edte vybrat SLO\u017dKU.\r\n \
|
||||
N\u00e1zvy soubor\u016f uvnit\u0159 mus\u00ed souhlasit s existuj\u00edc\u00edmi tvary v pr\u00e1v\u011b vybran\u00e9m SWF.\r\n \
|
||||
Pokud je uvnit\u0159 slo\u017eka "shapes", pak je vybr\u00e1na m\u00edsto n\u00ed.\r\n \
|
||||
Nejlep\u0161\u00ed zp\u016fsob jak m\u00edt tuto strukturu spr\u00e1vn\u011b je nejprve exportovat tvary v aktu\u00e1ln\u00edm SWF souboru.
|
||||
|
||||
message.info.importScripts2 = B\u011bhem importu skript\u016f mus\u00edte vybrat SLO\u017dKU.\r\n \
|
||||
Jej\u00ed strom mus\u00ed souhlasit s existuj\u00edc\u00edm stromem skript\u016f v pr\u00e1v\u011b vybran\u00e9m SWF.\r\n \
|
||||
Pokud je uvnit\u0159 slo\u017eka "scripts", pak je vybr\u00e1na m\u00edsto n\u00ed.\r\n \
|
||||
Nejlep\u0161\u00ed zp\u016fsob jak m\u00edt tuto strukturu spr\u00e1vn\u011b je nejprve exportovat skripty v aktu\u00e1ln\u00edm SWF souboru. \r\n\r\n \
|
||||
Tak\u00e9 nezapome\u0148te, \u017ee tento import pou\u017e\u00edv\u00e1 stejn\u00fd kompil\u00e1tor jako p\u0159i standardn\u00ed AS editaci v okn\u011b FFDec (Experiment\u00e1ln\u00ed pro AS3).
|
||||
|
||||
message.info.importTexts2 = B\u011bhem importu text\u016f mus\u00edte vybrat SLO\u017dKU.\r\n \
|
||||
N\u00e1zvy soubor\u016f uvnit\u0159 mus\u00ed souhlasit s existuj\u00edc\u00edmi texty v pr\u00e1v\u011b vybran\u00e9m SWF.\r\n \
|
||||
Pokud je uvnit\u0159 slo\u017eka "texts", pak je vybr\u00e1na m\u00edsto n\u00ed.\r\n \
|
||||
Nejlep\u0161\u00ed zp\u016fsob jak m\u00edt tuto strukturu spr\u00e1vn\u011b je nejprve exportovat texty v aktu\u00e1ln\u00edm SWF souboru.
|
||||
|
||||
message.info.importImages2 = B\u011bhem importu text\u016f mus\u00edte vybrat SLO\u017dKU.\r\n \
|
||||
N\u00e1zvy soubor\u016f uvnit\u0159 mus\u00ed souhlasit s existuj\u00edc\u00edmi obr\u00e1zky v pr\u00e1v\u011b vybran\u00e9m SWF.\r\n \
|
||||
Pokud je uvnit\u0159 slo\u017eka "images", pak je vybr\u00e1na m\u00edsto n\u00ed.\r\n \
|
||||
Nejlep\u0161\u00ed zp\u016fsob jak m\u00edt tuto strukturu spr\u00e1vn\u011b je nejprve exportovat obr\u00e1zky v aktu\u00e1ln\u00edm SWF souboru.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user