mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-08-02 15:32:15 +00:00
small fixes, cleanup
This commit is contained in:
@@ -3,26 +3,44 @@ import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import com.jpexs.decompiler.flash.action.ActionList;
|
||||
import com.jpexs.decompiler.flash.helpers.SWFDecompilerListener;
|
||||
import com.jpexs.decompiler.flash.tags.base.ASMSource;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class DeobfuscatorSample implements SWFDecompilerListener {
|
||||
|
||||
@Override
|
||||
public byte[] proxyFileCatched(byte[] data) {
|
||||
System.out.println("proxyFileCatched");
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionListParsed(ActionList actions, SWF swf) {
|
||||
System.out.println("actionListParsed");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void swfParsed(SWF swf) {
|
||||
System.out.println("swfParsed");
|
||||
Map<String, ASMSource> asms = swf.getASMs();
|
||||
for (ASMSource asm : asms.values()) {
|
||||
try {
|
||||
asm.getActions();
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(DeobfuscatorSample.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void abcParsed(ABC abc, SWF swf) {
|
||||
System.out.println("abcParsed");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void methodBodyParsed(MethodBody body, SWF swf) {
|
||||
System.out.println("methodBodyParsed");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.ResourceBundle;
|
||||
*/
|
||||
public class AppResources {
|
||||
|
||||
private static final ResourceBundle resourceBundle = ResourceBundle.getBundle("com.jpexs.decompiler.flash.gui.locales.AppResources");
|
||||
private static final ResourceBundle resourceBundle = ResourceBundle.getBundle("com.jpexs.decompiler.flash.locales.AppResources");
|
||||
|
||||
public static String translate(String key) {
|
||||
return resourceBundle.getString(key);
|
||||
|
||||
@@ -1185,6 +1185,31 @@ public final class SWF implements TreeItem, Timelined {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public Map<String, ASMSource> getASMs() {
|
||||
List<TreeNode> list = createASTagList(tags, this);
|
||||
Map<String, ASMSource> asms = new HashMap<>();
|
||||
getASMs("", list, asms);
|
||||
return asms;
|
||||
}
|
||||
|
||||
private static void getASMs(String path, List<TreeNode> nodes, Map<String, ASMSource> result) {
|
||||
for (TreeNode n : nodes) {
|
||||
String subPath = path + "/" + n.toString();
|
||||
if (n.getItem() instanceof ASMSource) {
|
||||
//cacheScript((ASMSource) n.tag);
|
||||
String npath = subPath;
|
||||
int ppos = 1;
|
||||
while (result.containsKey(npath)) {
|
||||
ppos++;
|
||||
npath = subPath + "[" + ppos + "]";
|
||||
}
|
||||
result.put(npath, (ASMSource) n.getItem());
|
||||
}
|
||||
|
||||
getASMs(subPath, n.subNodes, result);
|
||||
}
|
||||
}
|
||||
|
||||
public static void getTagsFromTreeNodes(List<TreeNode> treeNodes, List<Tag> result) {
|
||||
for (TreeNode treeNode : treeNodes) {
|
||||
TreeItem treeItem = treeNode.getItem();
|
||||
|
||||
@@ -56,7 +56,7 @@ public class MethodBody implements Cloneable, Serializable {
|
||||
public ABCException[] exceptions = new ABCException[0];
|
||||
public Traits traits = new Traits();
|
||||
public transient List<GraphTargetItem> convertedItems;
|
||||
public transient Exception convertException;
|
||||
public transient Throwable convertException;
|
||||
|
||||
public List<Integer> getExceptionEntries() {
|
||||
List<Integer> ret = new ArrayList<>();
|
||||
@@ -152,11 +152,12 @@ public class MethodBody implements Cloneable, Serializable {
|
||||
}
|
||||
} catch (InterruptedException ex) {
|
||||
throw ex;
|
||||
} catch (Exception ex) {
|
||||
} catch (Exception | OutOfMemoryError | StackOverflowError ex) {
|
||||
Logger.getLogger(MethodBody.class.getName()).log(Level.SEVERE, "Decompilation error", ex);
|
||||
convertException = ex;
|
||||
if (ex instanceof ExecutionException && ex.getCause() instanceof Exception) {
|
||||
convertException = (Exception) ex.getCause();
|
||||
Throwable cause = ex.getCause();
|
||||
if (ex instanceof ExecutionException && cause instanceof Exception) {
|
||||
convertException = (Exception) cause;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -693,11 +693,14 @@ public class Action implements GraphSourceItem {
|
||||
return tree;
|
||||
}
|
||||
}, timeout, TimeUnit.SECONDS);
|
||||
} catch (TimeoutException | ExecutionException | OutOfMemoryError | TranslateException | StackOverflowError ex) {
|
||||
} catch (InterruptedException ex) {
|
||||
throw ex;
|
||||
} catch (Exception | OutOfMemoryError | StackOverflowError ex) {
|
||||
Logger.getLogger(Action.class.getName()).log(Level.SEVERE, "Decompilation error in: " + path, ex);
|
||||
convertException = ex;
|
||||
if (ex instanceof ExecutionException && ex.getCause() instanceof Exception) {
|
||||
convertException = (Exception) ex.getCause();
|
||||
Throwable cause = ex.getCause();
|
||||
if (ex instanceof ExecutionException && cause instanceof Exception) {
|
||||
convertException = cause;
|
||||
}
|
||||
}
|
||||
writer.continueMeasure();
|
||||
|
||||
257
src/com/jpexs/browsers/cache/firefox/MapBucket.java
vendored
257
src/com/jpexs/browsers/cache/firefox/MapBucket.java
vendored
@@ -1,129 +1,128 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.browsers.cache.firefox;
|
||||
|
||||
import com.jpexs.browsers.cache.CacheEntry;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class MapBucket extends CacheEntry {
|
||||
|
||||
public long hash;
|
||||
public long enviction;
|
||||
public Location dataLocation;
|
||||
public Location metadataLocation;
|
||||
private MetaData metadata;
|
||||
|
||||
public MapBucket(InputStream is, File rootDir, Map<Integer, RandomAccessFile> dataFiles) throws IOException {
|
||||
CacheInputStream cis = new CacheInputStream(is);
|
||||
hash = cis.readInt32();
|
||||
enviction = cis.readInt32();
|
||||
dataLocation = new Location(cis.readInt32(), false, hash, rootDir, dataFiles);
|
||||
metadataLocation = new Location(cis.readInt32(), true, hash, rootDir, dataFiles);
|
||||
}
|
||||
|
||||
public InputStream getMetaDataStream() throws IOException {
|
||||
return metadataLocation.getInputStream();
|
||||
}
|
||||
|
||||
public MetaData getMetaData() {
|
||||
if (metadata == null) {
|
||||
try {
|
||||
metadata = new MetaData(getMetaDataStream());
|
||||
} catch (IncompatibleVersionException ie) {
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(MapBucket.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
return metadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRequestURL() {
|
||||
String req = null;
|
||||
MetaData m = getMetaData();
|
||||
if (m == null) {
|
||||
return null;
|
||||
}
|
||||
req = m.request;
|
||||
if (req == null) {
|
||||
return null;
|
||||
}
|
||||
if (req.startsWith("HTTP:")) {
|
||||
req = req.substring("HTTP:".length());
|
||||
}
|
||||
return req;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getResponseHeaders() {
|
||||
MetaData m = getMetaData();
|
||||
if (m == null) {
|
||||
return null;
|
||||
}
|
||||
String responseHead = m.response.get("response-head");
|
||||
if (responseHead == null) {
|
||||
return null;
|
||||
}
|
||||
String headers[] = responseHead.split("\r\n");
|
||||
Map<String, String> ret = new HashMap<>();
|
||||
for (int h = 1; h < headers.length; h++) {
|
||||
String hs = headers[h];
|
||||
if (hs.contains(":")) {
|
||||
String hp[] = hs.split(":");
|
||||
ret.put(hp[0].trim(), hp[1].trim());
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatusLine() {
|
||||
MetaData m = getMetaData();
|
||||
if (m == null) {
|
||||
return null;
|
||||
}
|
||||
String responseHead = m.response.get("response-head");
|
||||
String headers[] = responseHead.split("\r\n");
|
||||
return headers[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRequestMethod() {
|
||||
return "GET"; //No POST caching in Firefox
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getResponseRawDataStream() {
|
||||
try {
|
||||
return dataLocation.getInputStream();
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(MapBucket.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.browsers.cache.firefox;
|
||||
|
||||
import com.jpexs.browsers.cache.CacheEntry;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class MapBucket extends CacheEntry {
|
||||
|
||||
public long hash;
|
||||
public long enviction;
|
||||
public Location dataLocation;
|
||||
public Location metadataLocation;
|
||||
private MetaData metadata;
|
||||
|
||||
public MapBucket(InputStream is, File rootDir, Map<Integer, RandomAccessFile> dataFiles) throws IOException {
|
||||
CacheInputStream cis = new CacheInputStream(is);
|
||||
hash = cis.readInt32();
|
||||
enviction = cis.readInt32();
|
||||
dataLocation = new Location(cis.readInt32(), false, hash, rootDir, dataFiles);
|
||||
metadataLocation = new Location(cis.readInt32(), true, hash, rootDir, dataFiles);
|
||||
}
|
||||
|
||||
public InputStream getMetaDataStream() throws IOException {
|
||||
return metadataLocation.getInputStream();
|
||||
}
|
||||
|
||||
public MetaData getMetaData() {
|
||||
if (metadata == null) {
|
||||
try {
|
||||
metadata = new MetaData(getMetaDataStream());
|
||||
} catch (IncompatibleVersionException ie) {
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(MapBucket.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
return metadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRequestURL() {
|
||||
MetaData m = getMetaData();
|
||||
if (m == null) {
|
||||
return null;
|
||||
}
|
||||
String req = m.request;
|
||||
if (req == null) {
|
||||
return null;
|
||||
}
|
||||
if (req.startsWith("HTTP:")) {
|
||||
req = req.substring("HTTP:".length());
|
||||
}
|
||||
return req;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getResponseHeaders() {
|
||||
MetaData m = getMetaData();
|
||||
if (m == null) {
|
||||
return null;
|
||||
}
|
||||
String responseHead = m.response.get("response-head");
|
||||
if (responseHead == null) {
|
||||
return null;
|
||||
}
|
||||
String headers[] = responseHead.split("\r\n");
|
||||
Map<String, String> ret = new HashMap<>();
|
||||
for (int h = 1; h < headers.length; h++) {
|
||||
String hs = headers[h];
|
||||
if (hs.contains(":")) {
|
||||
String hp[] = hs.split(":");
|
||||
ret.put(hp[0].trim(), hp[1].trim());
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatusLine() {
|
||||
MetaData m = getMetaData();
|
||||
if (m == null) {
|
||||
return null;
|
||||
}
|
||||
String responseHead = m.response.get("response-head");
|
||||
String headers[] = responseHead.split("\r\n");
|
||||
return headers[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRequestMethod() {
|
||||
return "GET"; //No POST caching in Firefox
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getResponseRawDataStream() {
|
||||
try {
|
||||
return dataLocation.getInputStream();
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(MapBucket.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -990,7 +990,6 @@ public class CommandLineArgumentParser {
|
||||
|
||||
}
|
||||
} catch (OutOfMemoryError | Exception ex) {
|
||||
exportOK = false;
|
||||
System.err.print("FAIL: Exporting Failed on Exception - ");
|
||||
Logger.getLogger(CommandLineArgumentParser.class.getName()).log(Level.SEVERE, null, ex);
|
||||
System.exit(1);
|
||||
|
||||
@@ -1,71 +1,70 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.console;
|
||||
|
||||
import com.jpexs.decompiler.flash.AbortRetryIgnoreHandler;
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class ConsoleAbortRetryIgnoreHandler implements AbortRetryIgnoreHandler {
|
||||
|
||||
int errorCount = 0;
|
||||
int errorMode;
|
||||
int retryCount;
|
||||
|
||||
public ConsoleAbortRetryIgnoreHandler(int errorMode, int retryCount) {
|
||||
this.errorMode = errorMode;
|
||||
this.retryCount = retryCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int handle(Throwable thrown) {
|
||||
if (errorMode != AbortRetryIgnoreHandler.UNDEFINED) {
|
||||
int result = errorMode;
|
||||
|
||||
if (errorMode == AbortRetryIgnoreHandler.RETRY && errorCount < retryCount) {
|
||||
errorCount++;
|
||||
} else {
|
||||
result = AbortRetryIgnoreHandler.IGNORE;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
Scanner sc = new Scanner(System.in);
|
||||
System.out.println("Error occured: " + thrown.getLocalizedMessage());
|
||||
String n = null;
|
||||
do {
|
||||
System.out.print("Select action: (A)bort, (R)Retry, (I)Ignore:");
|
||||
n = sc.nextLine();
|
||||
switch (n.toLowerCase()) {
|
||||
case "a":
|
||||
return AbortRetryIgnoreHandler.ABORT;
|
||||
case "r":
|
||||
return AbortRetryIgnoreHandler.RETRY;
|
||||
case "i":
|
||||
return AbortRetryIgnoreHandler.IGNORE;
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbortRetryIgnoreHandler getNewInstance() {
|
||||
return new ConsoleAbortRetryIgnoreHandler(errorMode, retryCount);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.console;
|
||||
|
||||
import com.jpexs.decompiler.flash.AbortRetryIgnoreHandler;
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class ConsoleAbortRetryIgnoreHandler implements AbortRetryIgnoreHandler {
|
||||
|
||||
int errorCount = 0;
|
||||
int errorMode;
|
||||
int retryCount;
|
||||
|
||||
public ConsoleAbortRetryIgnoreHandler(int errorMode, int retryCount) {
|
||||
this.errorMode = errorMode;
|
||||
this.retryCount = retryCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int handle(Throwable thrown) {
|
||||
if (errorMode != AbortRetryIgnoreHandler.UNDEFINED) {
|
||||
int result = errorMode;
|
||||
|
||||
if (errorMode == AbortRetryIgnoreHandler.RETRY && errorCount < retryCount) {
|
||||
errorCount++;
|
||||
} else {
|
||||
result = AbortRetryIgnoreHandler.IGNORE;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
Scanner sc = new Scanner(System.in);
|
||||
System.out.println("Error occured: " + thrown.getLocalizedMessage());
|
||||
do {
|
||||
System.out.print("Select action: (A)bort, (R)Retry, (I)Ignore:");
|
||||
String n = sc.nextLine();
|
||||
switch (n.toLowerCase()) {
|
||||
case "a":
|
||||
return AbortRetryIgnoreHandler.ABORT;
|
||||
case "r":
|
||||
return AbortRetryIgnoreHandler.RETRY;
|
||||
case "i":
|
||||
return AbortRetryIgnoreHandler.IGNORE;
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbortRetryIgnoreHandler getNewInstance() {
|
||||
return new ConsoleAbortRetryIgnoreHandler(errorMode, retryCount);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,103 +1,102 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Insets;
|
||||
import java.awt.LayoutManager;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class ListLayout implements LayoutManager {
|
||||
|
||||
private int border;
|
||||
|
||||
public ListLayout() {
|
||||
this(5);
|
||||
}
|
||||
|
||||
public ListLayout(int border) {
|
||||
this.border = border;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addLayoutComponent(String name, Component comp) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeLayoutComponent(Component comp) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension preferredLayoutSize(Container parent) {
|
||||
int h = 0;
|
||||
int maxw = 0;
|
||||
Insets ins = parent.getInsets();
|
||||
boolean first = true;
|
||||
for (Component c : parent.getComponents()) {
|
||||
if (!c.isVisible()) {
|
||||
continue;
|
||||
}
|
||||
if (true) { //!first) {
|
||||
h += border;
|
||||
}
|
||||
Dimension pref = c.getPreferredSize();
|
||||
if (pref.width > maxw) {
|
||||
maxw = pref.width;
|
||||
}
|
||||
h += pref.height;
|
||||
first = false;
|
||||
}
|
||||
h += border;
|
||||
|
||||
maxw = (parent.getSize().width == 0 ? maxw : parent.getSize().width) - ins.left - ins.right;
|
||||
return new Dimension(maxw, h);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension minimumLayoutSize(Container parent) {
|
||||
return preferredLayoutSize(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void layoutContainer(Container parent) {
|
||||
Dimension dim = preferredLayoutSize(parent);
|
||||
int top = 0;
|
||||
Insets ins = parent.getInsets();
|
||||
top = ins.top;
|
||||
boolean first = true;
|
||||
for (Component c : parent.getComponents()) {
|
||||
if (!c.isVisible()) {
|
||||
continue;
|
||||
}
|
||||
if (!first) {
|
||||
top += border;
|
||||
}
|
||||
Dimension pref = c.getPreferredSize();
|
||||
c.setPreferredSize(new Dimension(dim.width, pref.height));
|
||||
c.setMinimumSize(new Dimension(dim.width, pref.height));
|
||||
c.setBounds(0, top, dim.width, pref.height);
|
||||
top += pref.height;
|
||||
first = false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Insets;
|
||||
import java.awt.LayoutManager;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class ListLayout implements LayoutManager {
|
||||
|
||||
private int border;
|
||||
|
||||
public ListLayout() {
|
||||
this(5);
|
||||
}
|
||||
|
||||
public ListLayout(int border) {
|
||||
this.border = border;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addLayoutComponent(String name, Component comp) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeLayoutComponent(Component comp) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension preferredLayoutSize(Container parent) {
|
||||
int h = 0;
|
||||
int maxw = 0;
|
||||
Insets ins = parent.getInsets();
|
||||
boolean first = true;
|
||||
for (Component c : parent.getComponents()) {
|
||||
if (!c.isVisible()) {
|
||||
continue;
|
||||
}
|
||||
if (true) { //!first) {
|
||||
h += border;
|
||||
}
|
||||
Dimension pref = c.getPreferredSize();
|
||||
if (pref.width > maxw) {
|
||||
maxw = pref.width;
|
||||
}
|
||||
h += pref.height;
|
||||
first = false;
|
||||
}
|
||||
h += border;
|
||||
|
||||
maxw = (parent.getSize().width == 0 ? maxw : parent.getSize().width) - ins.left - ins.right;
|
||||
return new Dimension(maxw, h);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension minimumLayoutSize(Container parent) {
|
||||
return preferredLayoutSize(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void layoutContainer(Container parent) {
|
||||
Dimension dim = preferredLayoutSize(parent);
|
||||
Insets ins = parent.getInsets();
|
||||
int top = ins.top;
|
||||
boolean first = true;
|
||||
for (Component c : parent.getComponents()) {
|
||||
if (!c.isVisible()) {
|
||||
continue;
|
||||
}
|
||||
if (!first) {
|
||||
top += border;
|
||||
}
|
||||
Dimension pref = c.getPreferredSize();
|
||||
c.setPreferredSize(new Dimension(dim.width, pref.height));
|
||||
c.setMinimumSize(new Dimension(dim.width, pref.height));
|
||||
c.setBounds(0, top, dim.width, pref.height);
|
||||
top += pref.height;
|
||||
first = false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,8 +93,7 @@ public class LoadingPanel extends JPanel {
|
||||
lastSize = size;
|
||||
drawTimer = new Timer();
|
||||
int timeSpin = 1000;
|
||||
double delay = 0;
|
||||
delay = timeSpin / o;
|
||||
double delay = timeSpin / o;
|
||||
while (delay < 10) {
|
||||
o--;
|
||||
delay = timeSpin / o;
|
||||
|
||||
@@ -329,7 +329,7 @@ public class Main {
|
||||
if (mode == SaveFileMode.EXE) {
|
||||
InputStream exeStream = View.class.getClassLoader().getResourceAsStream("com/jpexs/helpers/resource/Swf2Exe.bin");
|
||||
byte[] buffer = new byte[4096];
|
||||
int bytesRead = 0;
|
||||
int bytesRead;
|
||||
while ((bytesRead = exeStream.read(buffer)) != -1) {
|
||||
fos.write(buffer, 0, bytesRead);
|
||||
}
|
||||
|
||||
@@ -1255,7 +1255,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
SearchPanel<TextTag> textSearchPanel = previewPanel.getTextPanel().getSearchPanel();
|
||||
textSearchPanel.setOptions(ignoreCase, regexp);
|
||||
List<TextTag> found = new ArrayList<>();
|
||||
Pattern pat = null;
|
||||
Pattern pat;
|
||||
if (regexp) {
|
||||
pat = Pattern.compile(txt, ignoreCase ? Pattern.CASE_INSENSITIVE : 0);
|
||||
} else {
|
||||
@@ -1379,7 +1379,6 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
List<FileFilter> flaFilters = new ArrayList<>();
|
||||
List<FileFilter> xflFilters = new ArrayList<>();
|
||||
List<FLAVersion> versions = new ArrayList<>();
|
||||
FileFilter defaultFilter = null;
|
||||
for (int i = FLAVersion.values().length - 1; i >= 0; i--) {
|
||||
final FLAVersion v = FLAVersion.values()[i];
|
||||
if (!swf.isAS3 && v.minASVersion() > 2) {
|
||||
@@ -1398,7 +1397,6 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
}
|
||||
};
|
||||
if (v == FLAVersion.CS6) {
|
||||
defaultFilter = f;
|
||||
fc.setFileFilter(f);
|
||||
} else {
|
||||
fc.addChoosableFileFilter(f);
|
||||
@@ -1419,9 +1417,6 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
xflFilters.add(f);
|
||||
}
|
||||
}
|
||||
if (defaultFilter == null) {
|
||||
defaultFilter = flaFilters.get(0);
|
||||
}
|
||||
|
||||
fc.setAcceptAllFileFilterUsed(false);
|
||||
JFrame f = new JFrame();
|
||||
@@ -2302,7 +2297,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
final Tag tag = (Tag) tagObj;
|
||||
showCard(CARDPREVIEWPANEL);
|
||||
DrawableTag d = (DrawableTag) tag;
|
||||
Timelined timelined = null;
|
||||
Timelined timelined;
|
||||
if (tagObj instanceof Timelined && !(tagObj instanceof ButtonTag)) {
|
||||
timelined = (Timelined) tag;
|
||||
} else {
|
||||
|
||||
@@ -169,7 +169,6 @@ public class PreviewImage extends JPanel {
|
||||
|
||||
private Image renderImage(SWF swf, TreeItem treeItem) {
|
||||
|
||||
double scale = 1;
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
SerializableImage imgSrc = null;
|
||||
@@ -206,7 +205,7 @@ public class PreviewImage extends JPanel {
|
||||
w = w2;
|
||||
}
|
||||
|
||||
scale = (double) w / (double) w1;
|
||||
double scale = (double) w / (double) w1;
|
||||
if (w1 <= w2 && h1 <= h2) {
|
||||
scale = 1;
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ public class SoundTagPlayer implements MediaDisplay {
|
||||
public void run() {
|
||||
boolean playAgain = true;
|
||||
while (playAgain) {
|
||||
int startPos = 0;
|
||||
int startPos;
|
||||
synchronized (playLock) {
|
||||
startPos = actualPos * FRAME_DIVISOR;
|
||||
}
|
||||
|
||||
@@ -759,7 +759,7 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se
|
||||
|
||||
View.navigateUrl(adobePage);
|
||||
|
||||
int ret = 0;
|
||||
int ret;
|
||||
do {
|
||||
ret = View.showConfirmDialog(this, AppStrings.translate("message.action.playerglobal.place").replace("%libpath%", Configuration.getFlashLibPath().getAbsolutePath()), AppStrings.translate("message.action.playerglobal.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE);
|
||||
swc = Configuration.getPlayerSWC();
|
||||
|
||||
@@ -459,7 +459,6 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL
|
||||
public void cacheScriptPack(ScriptPack scriptLeaf, List<ABCContainerTag> abcList) throws InterruptedException {
|
||||
int maxCacheSize = 50;
|
||||
int scriptIndex = scriptLeaf.scriptIndex;
|
||||
HilightedText hilightedCode = null;
|
||||
ScriptInfo script = null;
|
||||
ABC abc = scriptLeaf.abc;
|
||||
if (scriptIndex > -1) {
|
||||
@@ -469,7 +468,7 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL
|
||||
boolean parallel = Configuration.parallelSpeedUp.get();
|
||||
HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), true);
|
||||
scriptLeaf.toSource(writer, abcList, script.traits.traits, ScriptExportMode.AS, parallel);
|
||||
hilightedCode = new HilightedText(writer);
|
||||
HilightedText hilightedCode = new HilightedText(writer);
|
||||
cache.put(scriptLeaf, new CachedDecompilation(hilightedCode));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,33 +200,13 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene
|
||||
}
|
||||
}
|
||||
|
||||
private void getASMs(String path, List<TreeNode> nodes, Map<String, ASMSource> result) {
|
||||
for (TreeNode n : nodes) {
|
||||
String subPath = path + "/" + n.toString();
|
||||
if (n.getItem() instanceof ASMSource) {
|
||||
//cacheScript((ASMSource) n.tag);
|
||||
String npath = subPath;
|
||||
int ppos = 1;
|
||||
while (result.containsKey(npath)) {
|
||||
ppos++;
|
||||
npath = subPath + "[" + ppos + "]";
|
||||
}
|
||||
result.put(npath, (ASMSource) n.getItem());
|
||||
}
|
||||
|
||||
getASMs(subPath, n.subNodes, result);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean search(final String txt, boolean ignoreCase, boolean regexp) {
|
||||
if ((txt != null) && (!txt.isEmpty())) {
|
||||
searchPanel.setOptions(ignoreCase, regexp);
|
||||
SWF swf = mainPanel.getCurrentSwf();
|
||||
List<TreeNode> list = SWF.createASTagList(swf.tags, swf);
|
||||
Map<String, ASMSource> asms = new HashMap<>();
|
||||
getASMs("", list, asms);
|
||||
Map<String, ASMSource> asms = swf.getASMs();
|
||||
final List<ActionSearchResult> found = new ArrayList<>();
|
||||
Pattern pat = null;
|
||||
Pattern pat;
|
||||
if (regexp) {
|
||||
pat = Pattern.compile(txt, ignoreCase ? Pattern.CASE_INSENSITIVE : 0);
|
||||
} else {
|
||||
|
||||
@@ -386,7 +386,6 @@ public class Win32ProcessTools extends ProcessTools {
|
||||
}
|
||||
|
||||
long actualPos = 0;
|
||||
byte[] prevBytes = new byte[0];
|
||||
List<Integer> guardedPages = new ArrayList<>();
|
||||
for (int pg = 0; pg < pages.size(); pg++) {
|
||||
MEMORY_BASIC_INFORMATION mbi = pages.get(pg);
|
||||
@@ -408,7 +407,7 @@ public class Win32ProcessTools extends ProcessTools {
|
||||
|
||||
byte[] data = buf.getByteArray(0, bytesReadRef.getValue().intValue());
|
||||
|
||||
prevBytes = Arrays.copyOfRange(data, data.length - maxFindLen, data.length);
|
||||
byte[] prevBytes = Arrays.copyOfRange(data, data.length - maxFindLen, data.length);
|
||||
byte[] dataPlusPrev = mergeArrays(prevBytes, data);
|
||||
loopi:
|
||||
for (int i = 0; i < dataPlusPrev.length - maxFindLen; i++) {
|
||||
|
||||
Reference in New Issue
Block a user