build fixed on Windows, removed some unused libs from ffdec_lib, some fields marked as private

This commit is contained in:
2014-12-07 09:44:54 +01:00
parent c9c957260f
commit 5c73058972
29 changed files with 799 additions and 805 deletions
+69 -69
View File
@@ -1,69 +1,69 @@
/*
* 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.chrome;
import java.io.IOException;
import java.io.InputStream;
/**
*
* @author JPEXS
*/
public class BlockFileHeader {
static final int kBlockHeaderSize = 8192; // Two pages: almost 64k entries
static final int kMaxBlocks = (kBlockHeaderSize - 80) * 8;
long magic; // c3 ca 04 c1
long version; // 00 00 02 00
int this_file;
int next_file;
int entry_size;
int num_entries;
int max_entries;
int empty[] = new int[4];
int hints[] = new int[4];
int updating;
int user[] = new int[5];
long allocation_map[] = new long[kMaxBlocks / 32];
public BlockFileHeader(InputStream is) throws IOException {
IndexInputStream iis = new IndexInputStream(is);
magic = iis.readUInt32();
version = iis.readUInt32();
this_file = iis.readInt16();
next_file = iis.readInt16();
entry_size = iis.readInt32();
num_entries = iis.readInt32();
max_entries = iis.readInt32();
empty = new int[4];
for (int i = 0; i < 4; i++) {
empty[i] = iis.readInt32();
}
hints = new int[4];
for (int i = 0; i < 4; i++) {
hints[i] = iis.readInt32();
}
updating = iis.readInt32();
user = new int[5];
for (int i = 0; i < 5; i++) {
user[i] = iis.readInt32();
}
for (int i = 0; i < allocation_map.length; i++) {
allocation_map[i] = iis.readUInt32();
}
}
}
/*
* 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.chrome;
import java.io.IOException;
import java.io.InputStream;
/**
*
* @author JPEXS
*/
public class BlockFileHeader {
protected static final int kBlockHeaderSize = 8192; // Two pages: almost 64k entries
private static final int kMaxBlocks = (kBlockHeaderSize - 80) * 8;
private long magic; // c3 ca 04 c1
private long version; // 00 00 02 00
private int this_file;
private int next_file;
private int entry_size;
private int num_entries;
private int max_entries;
private int empty[] = new int[4];
private int hints[] = new int[4];
private int updating;
private int user[] = new int[5];
private long allocation_map[] = new long[kMaxBlocks / 32];
public BlockFileHeader(InputStream is) throws IOException {
IndexInputStream iis = new IndexInputStream(is);
magic = iis.readUInt32();
version = iis.readUInt32();
this_file = iis.readInt16();
next_file = iis.readInt16();
entry_size = iis.readInt32();
num_entries = iis.readInt32();
max_entries = iis.readInt32();
empty = new int[4];
for (int i = 0; i < 4; i++) {
empty[i] = iis.readInt32();
}
hints = new int[4];
for (int i = 0; i < 4; i++) {
hints[i] = iis.readInt32();
}
updating = iis.readInt32();
user = new int[5];
for (int i = 0; i < 5; i++) {
user[i] = iis.readInt32();
}
for (int i = 0; i < allocation_map.length; i++) {
allocation_map[i] = iis.readUInt32();
}
}
}
@@ -57,18 +57,18 @@ import javax.swing.filechooser.FileFilter;
*/
public class LoadFromCacheFrame extends AppFrame implements ActionListener {
static final String ACTION_OPEN = "OPEN";
static final String ACTION_SAVE = "SAVE";
static final String ACTION_REFRESH = "REFRESH";
private static final String ACTION_OPEN = "OPEN";
private static final String ACTION_SAVE = "SAVE";
private static final String ACTION_REFRESH = "REFRESH";
private final JList<CacheEntry> list;
private final JTextField searchField;
private List<CacheImplementation> caches;
private List<CacheEntry> entries;
private final JProgressBar progressBar;
JButton saveButton;
JButton refreshButton;
JButton openButton;
private JButton saveButton;
private JButton refreshButton;
private JButton openButton;
public LoadFromCacheFrame() {
setSize(900, 600);
@@ -77,10 +77,10 @@ import javax.swing.table.TableRowSorter;
*/
public class LoadFromMemoryFrame extends AppFrame implements ActionListener {
static final String ACTION_SELECT_PROCESS = "SELECTPROCESS";
static final String ACTION_REFRESH_PROCESS_LIST = "REFRESHPROCESSLIST";
static final String ACTION_OPEN_SWF = "OPENSWF";
static final String ACTION_SAVE = "SAVE";
private static final String ACTION_SELECT_PROCESS = "SELECTPROCESS";
private static final String ACTION_REFRESH_PROCESS_LIST = "REFRESHPROCESSLIST";
private static final String ACTION_OPEN_SWF = "OPENSWF";
private static final String ACTION_SAVE = "SAVE";
private MainFrame mainFrame;
private List<com.jpexs.process.Process> processlist;
@@ -1,69 +1,69 @@
/*
* 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.io.PrintWriter;
import java.io.StringWriter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Formatter;
import java.util.logging.Level;
import java.util.logging.LogRecord;
/**
*
* @author JPEXS
*/
public class LogFormatter extends Formatter {
static final String lineSep = System.getProperty("line.separator");
private DateFormat dateFormat;
@Override
public String format(LogRecord record) {
StringBuilder buf = new StringBuilder(180);
if (dateFormat == null) {
dateFormat = new SimpleDateFormat("HH:mm:ss.SSS");
}
buf.append(dateFormat.format(new Date(record.getMillis())));
buf.append(" > ");
if (record.getLevel().intValue() >= Level.WARNING.intValue()) {
buf.append(record.getLevel());
buf.append(": ");
}
buf.append(formatMessage(record));
buf.append(lineSep);
Throwable throwable = record.getThrown();
if (throwable != null) {
StringWriter sink = new StringWriter();
throwable.printStackTrace(new PrintWriter(sink, true));
buf.append(record.getSourceClassName());
buf.append(' ');
buf.append(record.getSourceMethodName());
buf.append(lineSep);
buf.append(sink.toString());
}
return buf.toString();
}
}
/*
* 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.io.PrintWriter;
import java.io.StringWriter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Formatter;
import java.util.logging.Level;
import java.util.logging.LogRecord;
/**
*
* @author JPEXS
*/
public class LogFormatter extends Formatter {
private static final String lineSep = System.getProperty("line.separator");
private DateFormat dateFormat;
@Override
public String format(LogRecord record) {
StringBuilder buf = new StringBuilder(180);
if (dateFormat == null) {
dateFormat = new SimpleDateFormat("HH:mm:ss.SSS");
}
buf.append(dateFormat.format(new Date(record.getMillis())));
buf.append(" > ");
if (record.getLevel().intValue() >= Level.WARNING.intValue()) {
buf.append(record.getLevel());
buf.append(": ");
}
buf.append(formatMessage(record));
buf.append(lineSep);
Throwable throwable = record.getThrown();
if (throwable != null) {
StringWriter sink = new StringWriter();
throwable.printStackTrace(new PrintWriter(sink, true));
buf.append(record.getSourceClassName());
buf.append(' ');
buf.append(record.getSourceMethodName());
buf.append(lineSep);
buf.append(sink.toString());
}
return buf.toString();
}
}
@@ -45,44 +45,44 @@ import javax.swing.JOptionPane;
*/
public class MainFrameClassicMenu implements MainFrameMenu, ActionListener {
static final String ACTION_RELOAD = "RELOAD";
static final String ACTION_ADVANCED_SETTINGS = "ADVANCEDSETTINGS";
static final String ACTION_LOAD_MEMORY = "LOADMEMORY";
static final String ACTION_LOAD_CACHE = "LOADCACHE";
static final String ACTION_GOTO_DOCUMENT_CLASS_ON_STARTUP = "GOTODOCUMENTCLASSONSTARTUP";
static final String ACTION_AUTO_RENAME_IDENTIFIERS = "AUTORENAMEIDENTIFIERS";
static final String ACTION_CACHE_ON_DISK = "CACHEONDISK";
static final String ACTION_SET_LANGUAGE = "SETLANGUAGE";
static final String ACTION_DISABLE_DECOMPILATION = "DISABLEDECOMPILATION";
static final String ACTION_ASSOCIATE = "ASSOCIATE";
static final String ACTION_GOTO_DOCUMENT_CLASS = "GOTODOCUMENTCLASS";
static final String ACTION_PARALLEL_SPEED_UP = "PARALLELSPEEDUP";
static final String ACTION_INTERNAL_VIEWER_SWITCH = "INTERNALVIEWERSWITCH";
static final String ACTION_SEARCH_AS = "SEARCHAS";
static final String ACTION_AUTO_DEOBFUSCATE = "AUTODEOBFUSCATE";
static final String ACTION_EXIT = "EXIT";
private static final String ACTION_RELOAD = "RELOAD";
private static final String ACTION_ADVANCED_SETTINGS = "ADVANCEDSETTINGS";
private static final String ACTION_LOAD_MEMORY = "LOADMEMORY";
private static final String ACTION_LOAD_CACHE = "LOADCACHE";
private static final String ACTION_GOTO_DOCUMENT_CLASS_ON_STARTUP = "GOTODOCUMENTCLASSONSTARTUP";
private static final String ACTION_AUTO_RENAME_IDENTIFIERS = "AUTORENAMEIDENTIFIERS";
private static final String ACTION_CACHE_ON_DISK = "CACHEONDISK";
private static final String ACTION_SET_LANGUAGE = "SETLANGUAGE";
private static final String ACTION_DISABLE_DECOMPILATION = "DISABLEDECOMPILATION";
private static final String ACTION_ASSOCIATE = "ASSOCIATE";
private static final String ACTION_GOTO_DOCUMENT_CLASS = "GOTODOCUMENTCLASS";
private static final String ACTION_PARALLEL_SPEED_UP = "PARALLELSPEEDUP";
private static final String ACTION_INTERNAL_VIEWER_SWITCH = "INTERNALVIEWERSWITCH";
private static final String ACTION_SEARCH_AS = "SEARCHAS";
private static final String ACTION_AUTO_DEOBFUSCATE = "AUTODEOBFUSCATE";
private static final String ACTION_EXIT = "EXIT";
static final String ACTION_RENAME_ONE_IDENTIFIER = "RENAMEONEIDENTIFIER";
static final String ACTION_ABOUT = "ABOUT";
static final String ACTION_SHOW_PROXY = "SHOWPROXY";
static final String ACTION_SUB_LIMITER = "SUBLIMITER";
static final String ACTION_SAVE = "SAVE";
static final String ACTION_SAVE_AS = "SAVEAS";
static final String ACTION_SAVE_AS_EXE = "SAVEASEXE";
static final String ACTION_OPEN = "OPEN";
static final String ACTION_EXPORT_FLA = "EXPORTFLA";
public static final String ACTION_EXPORT_SEL = "EXPORTSEL";
static final String ACTION_EXPORT = "EXPORT";
static final String ACTION_CHECK_UPDATES = "CHECKUPDATES";
static final String ACTION_HELP_US = "HELPUS";
static final String ACTION_HOMEPAGE = "HOMEPAGE";
static final String ACTION_RESTORE_CONTROL_FLOW = "RESTORECONTROLFLOW";
static final String ACTION_RESTORE_CONTROL_FLOW_ALL = "RESTORECONTROLFLOWALL";
static final String ACTION_RENAME_IDENTIFIERS = "RENAMEIDENTIFIERS";
static final String ACTION_DEOBFUSCATE = "DEOBFUSCATE";
static final String ACTION_DEOBFUSCATE_ALL = "DEOBFUSCATEALL";
static final String ACTION_REMOVE_NON_SCRIPTS = "REMOVENONSCRIPTS";
static final String ACTION_REFRESH_DECOMPILED = "REFRESHDECOMPILED";
private static final String ACTION_RENAME_ONE_IDENTIFIER = "RENAMEONEIDENTIFIER";
private static final String ACTION_ABOUT = "ABOUT";
private static final String ACTION_SHOW_PROXY = "SHOWPROXY";
private static final String ACTION_SUB_LIMITER = "SUBLIMITER";
private static final String ACTION_SAVE = "SAVE";
private static final String ACTION_SAVE_AS = "SAVEAS";
private static final String ACTION_SAVE_AS_EXE = "SAVEASEXE";
private static final String ACTION_OPEN = "OPEN";
private static final String ACTION_EXPORT_FLA = "EXPORTFLA";
private static final String ACTION_EXPORT_SEL = "EXPORTSEL";
private static final String ACTION_EXPORT = "EXPORT";
private static final String ACTION_CHECK_UPDATES = "CHECKUPDATES";
private static final String ACTION_HELP_US = "HELPUS";
private static final String ACTION_HOMEPAGE = "HOMEPAGE";
private static final String ACTION_RESTORE_CONTROL_FLOW = "RESTORECONTROLFLOW";
private static final String ACTION_RESTORE_CONTROL_FLOW_ALL = "RESTORECONTROLFLOWALL";
private static final String ACTION_RENAME_IDENTIFIERS = "RENAMEIDENTIFIERS";
private static final String ACTION_DEOBFUSCATE = "DEOBFUSCATE";
private static final String ACTION_DEOBFUSCATE_ALL = "DEOBFUSCATEALL";
private static final String ACTION_REMOVE_NON_SCRIPTS = "REMOVENONSCRIPTS";
private static final String ACTION_REFRESH_DECOMPILED = "REFRESHDECOMPILED";
private final MainFrameClassic mainFrame;
@@ -75,59 +75,59 @@ import org.pushingpixels.flamingo.internal.ui.ribbon.AbstractBandControlPanel;
*/
public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener {
static final String ACTION_RELOAD = "RELOAD";
static final String ACTION_ADVANCED_SETTINGS = "ADVANCEDSETTINGS";
static final String ACTION_LOAD_MEMORY = "LOADMEMORY";
static final String ACTION_LOAD_CACHE = "LOADCACHE";
static final String ACTION_GOTO_DOCUMENT_CLASS_ON_STARTUP = "GOTODOCUMENTCLASSONSTARTUP";
static final String ACTION_AUTO_RENAME_IDENTIFIERS = "AUTORENAMEIDENTIFIERS";
static final String ACTION_CACHE_ON_DISK = "CACHEONDISK";
static final String ACTION_SET_LANGUAGE = "SETLANGUAGE";
static final String ACTION_DISABLE_DECOMPILATION = "DISABLEDECOMPILATION";
static final String ACTION_ASSOCIATE = "ASSOCIATE";
static final String ACTION_GOTO_DOCUMENT_CLASS = "GOTODOCUMENTCLASS";
static final String ACTION_PARALLEL_SPEED_UP = "PARALLELSPEEDUP";
static final String ACTION_INTERNAL_VIEWER_SWITCH = "INTERNALVIEWERSWITCH";
static final String ACTION_DUMP_VIEW_SWITCH = "DUMPVIEWSWITCH";
static final String ACTION_SEARCH = "SEARCH";
static final String ACTION_TIMELINE = "TIMELINE";
static final String ACTION_AUTO_DEOBFUSCATE = "AUTODEOBFUSCATE";
static final String ACTION_EXIT = "EXIT";
static final String ACTION_DEBUGGER_SWITCH = "DEBUGGER_SWITCH";
static final String ACTION_DEBUGGER_REPLACE_TRACE = "DEBUGGER_REPLACE_TRACE";
static final String ACTION_DEBUGGER_LOG = "DEBUGGER_LOG";
private static final String ACTION_RELOAD = "RELOAD";
private static final String ACTION_ADVANCED_SETTINGS = "ADVANCEDSETTINGS";
private static final String ACTION_LOAD_MEMORY = "LOADMEMORY";
private static final String ACTION_LOAD_CACHE = "LOADCACHE";
private static final String ACTION_GOTO_DOCUMENT_CLASS_ON_STARTUP = "GOTODOCUMENTCLASSONSTARTUP";
private static final String ACTION_AUTO_RENAME_IDENTIFIERS = "AUTORENAMEIDENTIFIERS";
private static final String ACTION_CACHE_ON_DISK = "CACHEONDISK";
private static final String ACTION_SET_LANGUAGE = "SETLANGUAGE";
private static final String ACTION_DISABLE_DECOMPILATION = "DISABLEDECOMPILATION";
private static final String ACTION_ASSOCIATE = "ASSOCIATE";
private static final String ACTION_GOTO_DOCUMENT_CLASS = "GOTODOCUMENTCLASS";
private static final String ACTION_PARALLEL_SPEED_UP = "PARALLELSPEEDUP";
private static final String ACTION_INTERNAL_VIEWER_SWITCH = "INTERNALVIEWERSWITCH";
private static final String ACTION_DUMP_VIEW_SWITCH = "DUMPVIEWSWITCH";
private static final String ACTION_SEARCH = "SEARCH";
private static final String ACTION_TIMELINE = "TIMELINE";
private static final String ACTION_AUTO_DEOBFUSCATE = "AUTODEOBFUSCATE";
private static final String ACTION_EXIT = "EXIT";
private static final String ACTION_DEBUGGER_SWITCH = "DEBUGGER_SWITCH";
private static final String ACTION_DEBUGGER_REPLACE_TRACE = "DEBUGGER_REPLACE_TRACE";
private static final String ACTION_DEBUGGER_LOG = "DEBUGGER_LOG";
static final String ACTION_RENAME_ONE_IDENTIFIER = "RENAMEONEIDENTIFIER";
static final String ACTION_ABOUT = "ABOUT";
static final String ACTION_SHOW_PROXY = "SHOWPROXY";
static final String ACTION_SUB_LIMITER = "SUBLIMITER";
static final String ACTION_SAVE = "SAVE";
static final String ACTION_SAVE_AS = "SAVEAS";
static final String ACTION_SAVE_AS_EXE = "SAVEASEXE";
static final String ACTION_OPEN = "OPEN";
static final String ACTION_CLOSE = "CLOSE";
static final String ACTION_CLOSE_ALL = "CLOSEALL";
static final String ACTION_EXPORT_FLA = "EXPORTFLA";
private static final String ACTION_RENAME_ONE_IDENTIFIER = "RENAMEONEIDENTIFIER";
private static final String ACTION_ABOUT = "ABOUT";
private static final String ACTION_SHOW_PROXY = "SHOWPROXY";
private static final String ACTION_SUB_LIMITER = "SUBLIMITER";
private static final String ACTION_SAVE = "SAVE";
private static final String ACTION_SAVE_AS = "SAVEAS";
private static final String ACTION_SAVE_AS_EXE = "SAVEASEXE";
private static final String ACTION_OPEN = "OPEN";
private static final String ACTION_CLOSE = "CLOSE";
private static final String ACTION_CLOSE_ALL = "CLOSEALL";
private static final String ACTION_EXPORT_FLA = "EXPORTFLA";
public static final String ACTION_EXPORT_SEL = "EXPORTSEL";
static final String ACTION_EXPORT = "EXPORT";
static final String ACTION_IMPORT_TEXT = "IMPORTTEXT";
static final String ACTION_CHECK_UPDATES = "CHECKUPDATES";
static final String ACTION_HELP_US = "HELPUS";
static final String ACTION_HOMEPAGE = "HOMEPAGE";
static final String ACTION_RESTORE_CONTROL_FLOW = "RESTORECONTROLFLOW";
static final String ACTION_RESTORE_CONTROL_FLOW_ALL = "RESTORECONTROLFLOWALL";
static final String ACTION_RENAME_IDENTIFIERS = "RENAMEIDENTIFIERS";
static final String ACTION_DEOBFUSCATE = "DEOBFUSCATE";
static final String ACTION_DEOBFUSCATE_ALL = "DEOBFUSCATEALL";
static final String ACTION_REMOVE_NON_SCRIPTS = "REMOVENONSCRIPTS";
static final String ACTION_REFRESH_DECOMPILED = "REFRESHDECOMPILED";
static final String ACTION_CLEAR_RECENT_FILES = "CLEARRECENTFILES";
static final String ACTION_CHECK_RESOURCES = "CHECKRESOURCES";
static final String ACTION_VIEWMODE_RESOURCES = "VIEWMODERESOURCES";
static final String ACTION_VIEWMODE_HEX = "VIEWMODEHEX";
static final String ACTION_VIEWMODE_TIMELINE = "VIEWMODETIMELINE";
static final String ACTION_DEOBFUSCATION_MODE_OLD = "DEOBFUSCATIONMODEOLD";
static final String ACTION_DEOBFUSCATION_MODE_NEW = "DEOBFUSCATIONMODENEW";
private static final String ACTION_EXPORT = "EXPORT";
private static final String ACTION_IMPORT_TEXT = "IMPORTTEXT";
private static final String ACTION_CHECK_UPDATES = "CHECKUPDATES";
private static final String ACTION_HELP_US = "HELPUS";
private static final String ACTION_HOMEPAGE = "HOMEPAGE";
private static final String ACTION_RESTORE_CONTROL_FLOW = "RESTORECONTROLFLOW";
private static final String ACTION_RESTORE_CONTROL_FLOW_ALL = "RESTORECONTROLFLOWALL";
private static final String ACTION_RENAME_IDENTIFIERS = "RENAMEIDENTIFIERS";
private static final String ACTION_DEOBFUSCATE = "DEOBFUSCATE";
private static final String ACTION_DEOBFUSCATE_ALL = "DEOBFUSCATEALL";
private static final String ACTION_REMOVE_NON_SCRIPTS = "REMOVENONSCRIPTS";
private static final String ACTION_REFRESH_DECOMPILED = "REFRESHDECOMPILED";
private static final String ACTION_CLEAR_RECENT_FILES = "CLEARRECENTFILES";
private static final String ACTION_CHECK_RESOURCES = "CHECKRESOURCES";
private static final String ACTION_VIEWMODE_RESOURCES = "VIEWMODERESOURCES";
private static final String ACTION_VIEWMODE_HEX = "VIEWMODEHEX";
private static final String ACTION_VIEWMODE_TIMELINE = "VIEWMODETIMELINE";
private static final String ACTION_DEOBFUSCATION_MODE_OLD = "DEOBFUSCATIONMODEOLD";
private static final String ACTION_DEOBFUSCATION_MODE_NEW = "DEOBFUSCATIONMODENEW";
private final MainFrameRibbon mainFrame;
@@ -1,188 +1,188 @@
/*
* 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 com.jpexs.helpers.CancellableWorker;
import java.awt.BorderLayout;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Timer;
import java.util.TimerTask;
import javax.swing.BoxLayout;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.BevelBorder;
/**
*
* @author JPEXS
*/
public class MainFrameStatusPanel extends JPanel implements ActionListener {
static final String ACTION_SHOW_ERROR_LOG = "SHOWERRORLOG";
private final MainPanel mainPanel;
private final LoadingPanel loadingPanel = new LoadingPanel(20, 20);
private final JLabel statusLabel = new JLabel("");
private final JButton cancelButton = new JButton();
private JButton errorNotificationButton;
private Icon currentIcon;
private Timer blinkTimer;
private int blinkPos;
private CancellableWorker currentWorker;
public MainFrameStatusPanel(MainPanel mainPanel) {
this.mainPanel = mainPanel;
createStatusPanel();
}
private void createStatusPanel() {
JPanel statusLeftPanel = new JPanel();
statusLeftPanel.setLayout(new BoxLayout(statusLeftPanel, BoxLayout.X_AXIS));
loadingPanel.setPreferredSize(new Dimension(30, 30));
// todo: this button is a little bit ugly in the UI. Maybe it can be changed to an icon (as in NetBeans)
cancelButton.setText(translate("button.cancel"));
cancelButton.setPreferredSize(new Dimension(100, 30));
cancelButton.setBorderPainted(false);
cancelButton.setOpaque(false);
cancelButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (currentWorker != null) {
currentWorker.cancel(true);
}
}
});
statusLeftPanel.add(loadingPanel);
statusLeftPanel.add(statusLabel);
statusLeftPanel.add(cancelButton);
setPreferredSize(new Dimension(1, 30));
setBorder(new BevelBorder(BevelBorder.LOWERED));
setLayout(new BorderLayout());
add(statusLeftPanel, BorderLayout.WEST);
errorNotificationButton = new JButton("");
errorNotificationButton.setIcon(View.getIcon("okay16"));
errorNotificationButton.setBorderPainted(false);
errorNotificationButton.setFocusPainted(false);
errorNotificationButton.setContentAreaFilled(false);
errorNotificationButton.setMargin(new Insets(2, 2, 2, 2));
errorNotificationButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
errorNotificationButton.setActionCommand(ACTION_SHOW_ERROR_LOG);
errorNotificationButton.addActionListener(this);
errorNotificationButton.setToolTipText(translate("errors.none"));
add(errorNotificationButton, BorderLayout.EAST);
loadingPanel.setVisible(false);
cancelButton.setVisible(false);
}
@Override
public void actionPerformed(ActionEvent e) {
switch (e.getActionCommand()) {
case ACTION_SHOW_ERROR_LOG:
Main.displayErrorFrame();
break;
}
}
private String translate(String key) {
return mainPanel.translate(key);
}
public void setStatus(String s) {
statusLabel.setText(s);
}
public void setWorkStatus(String s, CancellableWorker worker) {
if (s.isEmpty()) {
loadingPanel.setVisible(false);
} else {
loadingPanel.setVisible(true);
}
statusLabel.setText(s);
currentWorker = worker;
cancelButton.setVisible(worker != null);
}
public void setErrorState(ErrorState errorState) {
if (errorNotificationButton == null) {
// todo: honfika
// why null?
return;
}
switch (errorState) {
case NO_ERROR:
currentIcon = View.getIcon("okay16");
errorNotificationButton.setToolTipText(translate("errors.none"));
blinkPos = 0;
break;
case INFO:
currentIcon = View.getIcon("information16");
errorNotificationButton.setToolTipText(translate("errors.info"));
break;
case WARNING:
currentIcon = View.getIcon("warning16");
errorNotificationButton.setToolTipText(translate("errors.warning"));
break;
case ERROR:
currentIcon = View.getIcon("error16");
errorNotificationButton.setToolTipText(translate("errors.present"));
break;
}
errorNotificationButton.setIcon(currentIcon);
if (errorState != ErrorState.NO_ERROR) {
if (blinkTimer != null) {
blinkTimer.cancel();
}
blinkTimer = new Timer();
blinkTimer.schedule(new TimerTask() {
@Override
public void run() {
View.execInEventDispatch(new Runnable() {
@Override
public void run() {
blinkPos++;
if ((blinkPos % 2) == 0 || (blinkPos >= 4)) {
errorNotificationButton.setIcon(currentIcon);
} else {
errorNotificationButton.setIcon(null);
errorNotificationButton.setSize(16, 16);
}
}
});
if (blinkPos >= 4) {
cancel();
}
}
}, 500, 500);
}
}
}
/*
* 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 com.jpexs.helpers.CancellableWorker;
import java.awt.BorderLayout;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Timer;
import java.util.TimerTask;
import javax.swing.BoxLayout;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.BevelBorder;
/**
*
* @author JPEXS
*/
public class MainFrameStatusPanel extends JPanel implements ActionListener {
private static final String ACTION_SHOW_ERROR_LOG = "SHOWERRORLOG";
private final MainPanel mainPanel;
private final LoadingPanel loadingPanel = new LoadingPanel(20, 20);
private final JLabel statusLabel = new JLabel("");
private final JButton cancelButton = new JButton();
private JButton errorNotificationButton;
private Icon currentIcon;
private Timer blinkTimer;
private int blinkPos;
private CancellableWorker currentWorker;
public MainFrameStatusPanel(MainPanel mainPanel) {
this.mainPanel = mainPanel;
createStatusPanel();
}
private void createStatusPanel() {
JPanel statusLeftPanel = new JPanel();
statusLeftPanel.setLayout(new BoxLayout(statusLeftPanel, BoxLayout.X_AXIS));
loadingPanel.setPreferredSize(new Dimension(30, 30));
// todo: this button is a little bit ugly in the UI. Maybe it can be changed to an icon (as in NetBeans)
cancelButton.setText(translate("button.cancel"));
cancelButton.setPreferredSize(new Dimension(100, 30));
cancelButton.setBorderPainted(false);
cancelButton.setOpaque(false);
cancelButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (currentWorker != null) {
currentWorker.cancel(true);
}
}
});
statusLeftPanel.add(loadingPanel);
statusLeftPanel.add(statusLabel);
statusLeftPanel.add(cancelButton);
setPreferredSize(new Dimension(1, 30));
setBorder(new BevelBorder(BevelBorder.LOWERED));
setLayout(new BorderLayout());
add(statusLeftPanel, BorderLayout.WEST);
errorNotificationButton = new JButton("");
errorNotificationButton.setIcon(View.getIcon("okay16"));
errorNotificationButton.setBorderPainted(false);
errorNotificationButton.setFocusPainted(false);
errorNotificationButton.setContentAreaFilled(false);
errorNotificationButton.setMargin(new Insets(2, 2, 2, 2));
errorNotificationButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
errorNotificationButton.setActionCommand(ACTION_SHOW_ERROR_LOG);
errorNotificationButton.addActionListener(this);
errorNotificationButton.setToolTipText(translate("errors.none"));
add(errorNotificationButton, BorderLayout.EAST);
loadingPanel.setVisible(false);
cancelButton.setVisible(false);
}
@Override
public void actionPerformed(ActionEvent e) {
switch (e.getActionCommand()) {
case ACTION_SHOW_ERROR_LOG:
Main.displayErrorFrame();
break;
}
}
private String translate(String key) {
return mainPanel.translate(key);
}
public void setStatus(String s) {
statusLabel.setText(s);
}
public void setWorkStatus(String s, CancellableWorker worker) {
if (s.isEmpty()) {
loadingPanel.setVisible(false);
} else {
loadingPanel.setVisible(true);
}
statusLabel.setText(s);
currentWorker = worker;
cancelButton.setVisible(worker != null);
}
public void setErrorState(ErrorState errorState) {
if (errorNotificationButton == null) {
// todo: honfika
// why null?
return;
}
switch (errorState) {
case NO_ERROR:
currentIcon = View.getIcon("okay16");
errorNotificationButton.setToolTipText(translate("errors.none"));
blinkPos = 0;
break;
case INFO:
currentIcon = View.getIcon("information16");
errorNotificationButton.setToolTipText(translate("errors.info"));
break;
case WARNING:
currentIcon = View.getIcon("warning16");
errorNotificationButton.setToolTipText(translate("errors.warning"));
break;
case ERROR:
currentIcon = View.getIcon("error16");
errorNotificationButton.setToolTipText(translate("errors.present"));
break;
}
errorNotificationButton.setIcon(currentIcon);
if (errorState != ErrorState.NO_ERROR) {
if (blinkTimer != null) {
blinkTimer.cancel();
}
blinkTimer = new Timer();
blinkTimer.schedule(new TimerTask() {
@Override
public void run() {
View.execInEventDispatch(new Runnable() {
@Override
public void run() {
blinkPos++;
if ((blinkPos % 2) == 0 || (blinkPos >= 4)) {
errorNotificationButton.setIcon(currentIcon);
} else {
errorNotificationButton.setIcon(null);
errorNotificationButton.setSize(16, 16);
}
}
});
if (blinkPos >= 4) {
cancel();
}
}
}, 500, 500);
}
}
}
+102 -102
View File
@@ -1,102 +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 com.jpexs.decompiler.flash.ApplicationInfo;
import java.awt.Container;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JButton;
import javax.swing.JLabel;
/**
* Frame with selection on application startServer
*
* @author JPEXS
*/
public class ModeFrame extends AppFrame implements ActionListener {
static final String ACTION_OPEN = "OPEN";
static final String ACTION_PROXY = "PROXY";
static final String ACTION_EXIT = "EXIT";
private final JButton openButton = new JButton(translate("button.open"));
private final JButton proxyButton = new JButton(translate("button.proxy"));
private final JButton exitButton = new JButton(translate("button.exit"));
/**
* Constructor
*/
public ModeFrame() {
setSize(350, 200);
openButton.addActionListener(this);
openButton.setActionCommand(ACTION_OPEN);
openButton.setIcon(View.getIcon("open32"));
proxyButton.addActionListener(this);
proxyButton.setActionCommand(ACTION_PROXY);
proxyButton.setIcon(View.getIcon("proxy32"));
exitButton.addActionListener(this);
exitButton.setActionCommand(ACTION_EXIT);
exitButton.setIcon(View.getIcon("exit32"));
setResizable(false);
Container cont = getContentPane();
cont.setLayout(new GridLayout(4, 1));
JLabel logoLabel = new JLabel();
logoLabel.setIcon(View.getIcon("logo"));
cont.add(logoLabel);
cont.add(openButton);
cont.add(proxyButton);
cont.add(exitButton);
View.centerScreen(this);
View.setWindowIcon(this);
setTitle(ApplicationInfo.shortApplicationVerName);
this.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
Main.exit();
}
});
}
/**
* Method handling actions from buttons
*
* @param e event
*/
@Override
public void actionPerformed(ActionEvent e) {
switch (e.getActionCommand()) {
case ACTION_OPEN:
setVisible(false);
if (!Main.openFileDialog()) {
setVisible(true);
}
break;
case ACTION_PROXY:
setVisible(false);
Main.showProxy();
break;
case ACTION_EXIT:
setVisible(false);
Main.exit();
break;
}
}
}
/*
* 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 com.jpexs.decompiler.flash.ApplicationInfo;
import java.awt.Container;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JButton;
import javax.swing.JLabel;
/**
* Frame with selection on application startServer
*
* @author JPEXS
*/
public class ModeFrame extends AppFrame implements ActionListener {
private static final String ACTION_OPEN = "OPEN";
private static final String ACTION_PROXY = "PROXY";
private static final String ACTION_EXIT = "EXIT";
private final JButton openButton = new JButton(translate("button.open"));
private final JButton proxyButton = new JButton(translate("button.proxy"));
private final JButton exitButton = new JButton(translate("button.exit"));
/**
* Constructor
*/
public ModeFrame() {
setSize(350, 200);
openButton.addActionListener(this);
openButton.setActionCommand(ACTION_OPEN);
openButton.setIcon(View.getIcon("open32"));
proxyButton.addActionListener(this);
proxyButton.setActionCommand(ACTION_PROXY);
proxyButton.setIcon(View.getIcon("proxy32"));
exitButton.addActionListener(this);
exitButton.setActionCommand(ACTION_EXIT);
exitButton.setIcon(View.getIcon("exit32"));
setResizable(false);
Container cont = getContentPane();
cont.setLayout(new GridLayout(4, 1));
JLabel logoLabel = new JLabel();
logoLabel.setIcon(View.getIcon("logo"));
cont.add(logoLabel);
cont.add(openButton);
cont.add(proxyButton);
cont.add(exitButton);
View.centerScreen(this);
View.setWindowIcon(this);
setTitle(ApplicationInfo.shortApplicationVerName);
this.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
Main.exit();
}
});
}
/**
* Method handling actions from buttons
*
* @param e event
*/
@Override
public void actionPerformed(ActionEvent e) {
switch (e.getActionCommand()) {
case ACTION_OPEN:
setVisible(false);
if (!Main.openFileDialog()) {
setVisible(true);
}
break;
case ACTION_PROXY:
setVisible(false);
Main.showProxy();
break;
case ACTION_EXIT:
setVisible(false);
Main.exit();
break;
}
}
}
@@ -46,10 +46,10 @@ import javax.swing.UIManager;
*/
public class NewVersionDialog extends AppDialog implements ActionListener {
static final String ACTION_OK = "OK";
static final String ACTION_CANCEL = "CANCEL";
private static final String ACTION_OK = "OK";
private static final String ACTION_CANCEL = "CANCEL";
Version latestVersion;
private Version latestVersion;
public NewVersionDialog(List<Version> versions) {
setSize(new Dimension(500, 300));
@@ -1,121 +1,121 @@
/*
* 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 com.jpexs.decompiler.flash.abc.RenameType;
import com.jpexs.decompiler.flash.configuration.Configuration;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BoxLayout;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
/**
*
* @author JPEXS
*/
public class RenameDialog extends AppDialog implements ActionListener {
static final String ACTION_OK = "OK";
static final String ACTION_CANCEL = "CANCEL";
private final JRadioButton typeNumberRadioButton = new JRadioButton(translate("rename.type.typenumber"));
private final JRadioButton randomWordRadioButton = new JRadioButton(translate("rename.type.randomword"));
private final JButton okButton = new JButton(translate("button.ok"));
private final JButton cancelButton = new JButton(translate("button.cancel"));
private boolean confirmed = false;
public RenameType getRenameType() {
if (!isConfirmed()) {
return null;
}
if (typeNumberRadioButton.isSelected()) {
return RenameType.TYPENUMBER;
}
return RenameType.RANDOMWORD;
}
public RenameDialog() {
setSize(300, 150);
setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
int renameType = Configuration.lastRenameType.get();
ButtonGroup group = new ButtonGroup();
group.add(typeNumberRadioButton);
group.add(randomWordRadioButton);
JPanel pan = new JPanel();
pan.setLayout(new BoxLayout(pan, BoxLayout.Y_AXIS));
pan.add(typeNumberRadioButton);
pan.add(randomWordRadioButton);
typeNumberRadioButton.setSelected(renameType == 1);
randomWordRadioButton.setSelected(renameType == 2);
setLayout(new BorderLayout());
add(new JLabel(translate("rename.type")), BorderLayout.NORTH);
add(pan, BorderLayout.CENTER);
JPanel panButtons = new JPanel(new FlowLayout());
panButtons.add(okButton);
okButton.setActionCommand(ACTION_OK);
okButton.addActionListener(this);
panButtons.add(cancelButton);
cancelButton.setActionCommand(ACTION_CANCEL);
cancelButton.addActionListener(this);
add(panButtons, BorderLayout.SOUTH);
setModalityType(ModalityType.APPLICATION_MODAL);
View.setWindowIcon(this);
setTitle(translate("dialog.title"));
getRootPane().setDefaultButton(okButton);
pack();
View.centerScreen(this);
}
@Override
public void setVisible(boolean b) {
if (b) {
confirmed = false;
}
super.setVisible(b);
}
@Override
public void actionPerformed(ActionEvent e) {
switch (e.getActionCommand()) {
case ACTION_OK:
confirmed = true;
Configuration.lastRenameType.set((Integer) (getRenameType() == RenameType.TYPENUMBER ? 1 : 2));
setVisible(false);
break;
case ACTION_CANCEL:
confirmed = false;
setVisible(false);
break;
}
}
public boolean isConfirmed() {
return confirmed;
}
public RenameType display() {
setVisible(true);
return getRenameType();
}
}
/*
* 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 com.jpexs.decompiler.flash.abc.RenameType;
import com.jpexs.decompiler.flash.configuration.Configuration;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BoxLayout;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
/**
*
* @author JPEXS
*/
public class RenameDialog extends AppDialog implements ActionListener {
private static final String ACTION_OK = "OK";
private static final String ACTION_CANCEL = "CANCEL";
private final JRadioButton typeNumberRadioButton = new JRadioButton(translate("rename.type.typenumber"));
private final JRadioButton randomWordRadioButton = new JRadioButton(translate("rename.type.randomword"));
private final JButton okButton = new JButton(translate("button.ok"));
private final JButton cancelButton = new JButton(translate("button.cancel"));
private boolean confirmed = false;
public RenameType getRenameType() {
if (!isConfirmed()) {
return null;
}
if (typeNumberRadioButton.isSelected()) {
return RenameType.TYPENUMBER;
}
return RenameType.RANDOMWORD;
}
public RenameDialog() {
setSize(300, 150);
setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
int renameType = Configuration.lastRenameType.get();
ButtonGroup group = new ButtonGroup();
group.add(typeNumberRadioButton);
group.add(randomWordRadioButton);
JPanel pan = new JPanel();
pan.setLayout(new BoxLayout(pan, BoxLayout.Y_AXIS));
pan.add(typeNumberRadioButton);
pan.add(randomWordRadioButton);
typeNumberRadioButton.setSelected(renameType == 1);
randomWordRadioButton.setSelected(renameType == 2);
setLayout(new BorderLayout());
add(new JLabel(translate("rename.type")), BorderLayout.NORTH);
add(pan, BorderLayout.CENTER);
JPanel panButtons = new JPanel(new FlowLayout());
panButtons.add(okButton);
okButton.setActionCommand(ACTION_OK);
okButton.addActionListener(this);
panButtons.add(cancelButton);
cancelButton.setActionCommand(ACTION_CANCEL);
cancelButton.addActionListener(this);
add(panButtons, BorderLayout.SOUTH);
setModalityType(ModalityType.APPLICATION_MODAL);
View.setWindowIcon(this);
setTitle(translate("dialog.title"));
getRootPane().setDefaultButton(okButton);
pack();
View.centerScreen(this);
}
@Override
public void setVisible(boolean b) {
if (b) {
confirmed = false;
}
super.setVisible(b);
}
@Override
public void actionPerformed(ActionEvent e) {
switch (e.getActionCommand()) {
case ACTION_OK:
confirmed = true;
Configuration.lastRenameType.set((Integer) (getRenameType() == RenameType.TYPENUMBER ? 1 : 2));
setVisible(false);
break;
case ACTION_CANCEL:
confirmed = false;
setVisible(false);
break;
}
}
public boolean isConfirmed() {
return confirmed;
}
public RenameType display() {
setVisible(true);
return getRenameType();
}
}
@@ -44,8 +44,8 @@ import javax.swing.JTextField;
*/
public class SearchDialog extends AppDialog implements ActionListener {
static final String ACTION_OK = "OK";
static final String ACTION_CANCEL = "CANCEL";
private static final String ACTION_OK = "OK";
private static final String ACTION_CANCEL = "CANCEL";
public JTextField searchField = new MyTextField();
public JCheckBox ignoreCaseCheckBox = new JCheckBox(translate("checkbox.ignorecase"));
@@ -36,9 +36,9 @@ import jsyntaxpane.actions.DocumentSearchData;
*/
public class SearchPanel<E> extends JPanel implements ActionListener {
static final String ACTION_SEARCH_PREV = "SEARCHPREV";
static final String ACTION_SEARCH_NEXT = "SEARCHNEXT";
static final String ACTION_SEARCH_CANCEL = "SEARCHCANCEL";
private static final String ACTION_SEARCH_PREV = "SEARCHPREV";
private static final String ACTION_SEARCH_NEXT = "SEARCHNEXT";
private static final String ACTION_SEARCH_CANCEL = "SEARCHCANCEL";
private final SearchListener<E> listener;
@@ -44,8 +44,8 @@ public class SearchResultsDialog<E> extends AppDialog implements ActionListener
private final DefaultListModel<E> model;
private final SearchListener<E> listener;
static final String ACTION_GOTO = "GOTO";
static final String ACTION_CANCEL = "CLOSE";
private static final String ACTION_GOTO = "GOTO";
private static final String ACTION_CANCEL = "CLOSE";
private final JButton gotoButton = new JButton(translate("button.goto"));
private final JButton closeButton = new JButton(translate("button.close"));
@@ -38,8 +38,8 @@ import jsyntaxpane.DefaultSyntaxKit;
*/
public class SelectLanguageDialog extends AppDialog implements ActionListener {
static final String ACTION_OK = "OK";
static final String ACTION_CANCEL = "CANCEL";
private static final String ACTION_OK = "OK";
private static final String ACTION_CANCEL = "CANCEL";
JComboBox<Language> languageCombobox = new JComboBox<>();
public String languageCode = null;
@@ -135,16 +135,16 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se
private NewTraitDialog newTraitDialog;
public JLabel scriptNameLabel;
static final String ACTION_SAVE_DECOMPILED = "SAVEDECOMPILED";
static final String ACTION_EDIT_DECOMPILED = "EDITDECOMPILED";
static final String ACTION_CANCEL_DECOMPILED = "CANCELDECOMPILED";
private static final String ACTION_SAVE_DECOMPILED = "SAVEDECOMPILED";
private static final String ACTION_EDIT_DECOMPILED = "EDITDECOMPILED";
private static final String ACTION_CANCEL_DECOMPILED = "CANCELDECOMPILED";
public JLabel experimentalLabel = new JLabel(AppStrings.translate("action.edit.experimental"));
public JButton editDecompiledButton = new JButton(AppStrings.translate("button.edit"), View.getIcon("edit16"));
public JButton saveDecompiledButton = new JButton(AppStrings.translate("button.save"), View.getIcon("save16"));
public JButton cancelDecompiledButton = new JButton(AppStrings.translate("button.cancel"), View.getIcon("cancel16"));
static final String ACTION_ADD_TRAIT = "ADDTRAIT";
private static final String ACTION_ADD_TRAIT = "ADDTRAIT";
public MainPanel getMainPanel() {
return mainPanel;
@@ -38,8 +38,8 @@ import javax.swing.JSlider;
*/
public class DeobfuscationDialog extends AppDialog implements ActionListener {
static final String ACTION_OK = "OK";
static final String ACTION_CANCEL = "CANCEL";
private static final String ACTION_OK = "OK";
private static final String ACTION_CANCEL = "CANCEL";
public JCheckBox processAllCheckbox = new JCheckBox(translate("processallclasses"));
public JSlider codeProcessingLevel;
@@ -43,9 +43,9 @@ import javax.swing.border.BevelBorder;
*/
public class DetailPanel extends JPanel implements ActionListener {
static final String ACTION_SAVE_DETAIL = "SAVEDETAIL";
static final String ACTION_EDIT_DETAIL = "EDITDETAIL";
static final String ACTION_CANCEL_DETAIL = "CANCELDETAIL";
private static final String ACTION_SAVE_DETAIL = "SAVEDETAIL";
private static final String ACTION_EDIT_DETAIL = "EDITDETAIL";
private static final String ACTION_CANCEL_DETAIL = "CANCELDETAIL";
public MethodTraitDetailPanel methodTraitPanel;
public JPanel unsupportedTraitPanel;
@@ -40,9 +40,9 @@ import javax.swing.JToggleButton;
*/
public class MethodCodePanel extends JPanel implements ActionListener {
static final String ACTION_GRAPH = "GRAPH";
static final String ACTION_HEX = "HEX";
static final String ACTION_HEX_ONLY = "HEXONLY";
private static final String ACTION_GRAPH = "GRAPH";
private static final String ACTION_HEX = "HEX";
private static final String ACTION_HEX_ONLY = "HEXONLY";
private final ASMSourceEditorPane sourceTextArea;
public JPanel buttonsPanel;
@@ -43,8 +43,8 @@ import javax.swing.event.AncestorListener;
*/
public class NewTraitDialog extends AppDialog implements ActionListener {
static final String ACTION_OK = "OK";
static final String ACTION_CANCEL = "CANCEL";
private static final String ACTION_OK = "OK";
private static final String ACTION_CANCEL = "CANCEL";
private static final int modifiers[] = new int[]{
Namespace.KIND_PACKAGE,
@@ -46,8 +46,8 @@ import javax.swing.JScrollPane;
*/
public class UsageFrame extends AppDialog implements ActionListener, MouseListener {
static final String ACTION_GOTO = "GOTO";
static final String ACTION_CANCEL = "CANCEL";
private static final String ACTION_GOTO = "GOTO";
private static final String ACTION_CANCEL = "CANCEL";
private final JButton gotoButton = new JButton(translate("button.goto"));
private final JButton cancelButton = new JButton(translate("button.cancel"));
@@ -90,15 +90,15 @@ import jsyntaxpane.actions.ActionUtils;
public class ActionPanel extends JPanel implements ActionListener, SearchListener<ActionSearchResult> {
static final String ACTION_GRAPH = "GRAPH";
static final String ACTION_HEX = "HEX";
static final String ACTION_HEX_ONLY = "HEXONLY";
static final String ACTION_SAVE_ACTION = "SAVEACTION";
static final String ACTION_EDIT_ACTION = "EDITACTION";
static final String ACTION_CANCEL_ACTION = "CANCELACTION";
static final String ACTION_SAVE_DECOMPILED = "SAVEDECOMPILED";
static final String ACTION_EDIT_DECOMPILED = "EDITDECOMPILED";
static final String ACTION_CANCEL_DECOMPILED = "CANCELDECOMPILED";
private static final String ACTION_GRAPH = "GRAPH";
private static final String ACTION_HEX = "HEX";
private static final String ACTION_HEX_ONLY = "HEXONLY";
private static final String ACTION_SAVE_ACTION = "SAVEACTION";
private static final String ACTION_EDIT_ACTION = "EDITACTION";
private static final String ACTION_CANCEL_ACTION = "CANCELACTION";
private static final String ACTION_SAVE_DECOMPILED = "SAVEDECOMPILED";
private static final String ACTION_EDIT_DECOMPILED = "EDITDECOMPILED";
private static final String ACTION_CANCEL_DECOMPILED = "CANCELDECOMPILED";
private MainPanel mainPanel;
public LineMarkedEditorPane editor;
@@ -31,10 +31,10 @@ public class Debugger {
private static class DebugHandler extends Thread {
Socket s;
int serverPort;
static int maxid = 0;
int id;
private Socket s;
private int serverPort;
private static int maxid = 0;
private int id;
public boolean finished = false;
public DebugHandler(int serverPort, Socket s) {
@@ -66,17 +66,17 @@ import javax.swing.event.AncestorListener;
*/
public class PlayerControls extends JPanel implements ActionListener {
static final String ACTION_PAUSE = "PAUSE";
static final String ACTION_STOP = "STOP";
static final String ACTION_SELECT_BKCOLOR = "SELECTCOLOR";
static final String ACTION_ZOOMIN = "ZOOMIN";
static final String ACTION_ZOOMOUT = "ZOOMOUT";
static final String ACTION_ZOOMFIT = "ZOOMFIT";
static final String ACTION_ZOOMNONE = "ZOOMNONE";
static final String ACTION_SNAPSHOT = "SNAPSHOT";
static final String ACTION_NEXTFRAME = "NEXTFRAME";
static final String ACTION_PREVFRAME = "PREVFRAME";
static final String ACTION_GOTOFRAME = "SELECTFRAME";
private static final String ACTION_PAUSE = "PAUSE";
private static final String ACTION_STOP = "STOP";
private static final String ACTION_SELECT_BKCOLOR = "SELECTCOLOR";
private static final String ACTION_ZOOMIN = "ZOOMIN";
private static final String ACTION_ZOOMOUT = "ZOOMOUT";
private static final String ACTION_ZOOMFIT = "ZOOMFIT";
private static final String ACTION_ZOOMNONE = "ZOOMNONE";
private static final String ACTION_SNAPSHOT = "SNAPSHOT";
private static final String ACTION_NEXTFRAME = "NEXTFRAME";
private static final String ACTION_PREVFRAME = "PREVFRAME";
private static final String ACTION_GOTOFRAME = "SELECTFRAME";
private final JButton pauseButton;
private boolean paused = false;
@@ -27,6 +27,8 @@ import com.jpexs.decompiler.flash.gui.MainFrame;
import com.jpexs.decompiler.flash.gui.View;
import com.jpexs.decompiler.flash.helpers.SWFDecompilerPlugin;
import com.jpexs.helpers.Helper;
import com.jpexs.helpers.utf8.Utf8InputStreamReader;
import com.jpexs.helpers.utf8.Utf8OutputStreamWriter;
import com.jpexs.proxy.CatchedListener;
import com.jpexs.proxy.ReplacedListener;
import com.jpexs.proxy.Replacement;
@@ -46,12 +48,16 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.nio.file.Files;
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
import java.nio.file.StandardCopyOption;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
@@ -83,14 +89,16 @@ import javax.swing.table.DefaultTableModel;
*/
public class ProxyFrame extends AppFrame implements ActionListener, CatchedListener, MouseListener, ReplacedListener {
static final String ACTION_SWITCH_STATE = "SWITCHSTATE";
static final String ACTION_OPEN = "OPEN";
static final String ACTION_CLEAR = "CLEAR";
static final String ACTION_RENAME = "RENAME";
static final String ACTION_REMOVE = "REMOVE";
static final String ACTION_COPYURL = "COPYURL";
static final String ACTION_SAVEAS = "SAVEAS";
static final String ACTION_REPLACE = "REPLACE";
private static final String REPLACEMENTS_NAME = "replacements.cfg";
private static final String ACTION_SWITCH_STATE = "SWITCHSTATE";
private static final String ACTION_OPEN = "OPEN";
private static final String ACTION_CLEAR = "CLEAR";
private static final String ACTION_RENAME = "RENAME";
private static final String ACTION_REMOVE = "REMOVE";
private static final String ACTION_COPYURL = "COPYURL";
private static final String ACTION_SAVEAS = "SAVEAS";
private static final String ACTION_REPLACE = "REPLACE";
private JTable replacementsTable;
private JButton switchButton = new JButton(translate("proxy.start"));
@@ -142,7 +150,58 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe
DefaultTableModel tableModel;
private SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss");
List<Replacement> reps;
/**
* List of replacements
*/
private static List<Replacement> replacements = new ArrayList<>();
/**
* Saves replacements to file for future use
*/
private static void saveReplacements() {
String replacementsFile = getReplacementsFile();
if (replacements.isEmpty()) {
File rf = new File(replacementsFile);
if (rf.exists()) {
if (!rf.delete()) {
Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, "Cannot delete replacements file");
}
}
} else {
try (PrintWriter pw = new PrintWriter(new Utf8OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(replacementsFile))))) {
for (Replacement r : replacements) {
pw.println(r.urlPattern);
pw.println(r.targetFile);
}
} catch (IOException ex) {
Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, "Exception during saving replacements", ex);
}
}
}
/**
* Load replacements from file
*/
private static void loadReplacements() {
String replacementsFile = getReplacementsFile();
if (!(new File(replacementsFile)).exists()) {
return;
}
replacements = new ArrayList<>();
try (BufferedReader br = new BufferedReader(new Utf8InputStreamReader(new FileInputStream(replacementsFile)))) {
String s;
while ((s = br.readLine()) != null) {
Replacement r = new Replacement(s, br.readLine());
replacements.add(r);
}
} catch (IOException e) {
//ignore
}
}
private static String getReplacementsFile() {
return Configuration.getFFDecHome() + REPLACEMENTS_NAME;
}
/**
* Constructor
@@ -156,12 +215,12 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe
translate("column.size"),
translate("column.url")};
reps = Configuration.getReplacements();
loadReplacements();
Object data[][] = new Object[reps.size()][3];
Object data[][] = new Object[replacements.size()][3];
for (int i = 0; i < reps.size(); i++) {
Replacement r = reps.get(i);
for (int i = 0; i < replacements.size(); i++) {
Replacement r = replacements.get(i);
data[i][0] = r.lastAccess == null ? "" : format.format(r.lastAccess.getTime());
data[i][1] = new SizeItem(r.targetFile);
data[i][2] = r.urlPattern;
@@ -301,7 +360,7 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe
private void open() {
if (replacementsTable.getSelectedRow() > -1) {
Replacement r = reps.get(replacementsTable.getRowSorter().convertRowIndexToModel(replacementsTable.getSelectedRow()));
Replacement r = replacements.get(replacementsTable.getRowSorter().convertRowIndexToModel(replacementsTable.getSelectedRow()));
Main.openFile(r.targetFile, r.urlPattern);
}
}
@@ -337,7 +396,7 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe
break;
case ACTION_SAVEAS:
if (sel.length == 1) {
Replacement r = reps.get(sel[0]);
Replacement r = replacements.get(sel[0]);
JFileChooser fc = new JFileChooser();
fc.setCurrentDirectory(new File(Configuration.lastSaveDir.get()));
String n = r.urlPattern;
@@ -369,7 +428,7 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe
if (fc.showSaveDialog(f) == JFileChooser.APPROVE_OPTION) {
File file = Helper.fixDialogFile(fc.getSelectedFile());
try {
Files.copy(new File(r.targetFile).toPath(), file.toPath(), REPLACE_EXISTING);
Files.copy(new File(r.targetFile).toPath(), file.toPath(), StandardCopyOption.REPLACE_EXISTING);
} catch (IOException ex) {
View.showMessageDialog(this, translate("error.save.as") + "\r\n" + ex.getLocalizedMessage(), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
}
@@ -378,7 +437,7 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe
GuiAbortRetryIgnoreHandler handler = new GuiAbortRetryIgnoreHandler();
File exportDir = new File(selectExportDir());
for (int s : sel) {
final Replacement r = reps.get(s);
final Replacement r = replacements.get(s);
String n = r.urlPattern;
if (n.contains("?")) {
n = n.substring(0, n.indexOf('?'));
@@ -404,7 +463,7 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe
new RetryTask(new RunnableIOEx() {
@Override
public void run() throws IOException {
Files.copy(new File(r.targetFile).toPath(), outfile.toPath(), REPLACE_EXISTING);
Files.copy(new File(r.targetFile).toPath(), outfile.toPath(), StandardCopyOption.REPLACE_EXISTING);
}
}, handler).run();
} catch (IOException ex) {
@@ -415,7 +474,7 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe
break;
case ACTION_REPLACE:
if (sel.length > 0) {
Replacement r = reps.get(sel[0]);
Replacement r = replacements.get(sel[0]);
JFileChooser fc = new JFileChooser();
fc.setCurrentDirectory(new File(Configuration.lastOpenDir.get()));
String n = r.urlPattern;
@@ -445,7 +504,7 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe
if (fc.showOpenDialog(f) == JFileChooser.APPROVE_OPTION) {
File file = Helper.fixDialogFile(fc.getSelectedFile());
try {
Files.copy(file.toPath(), new File(r.targetFile).toPath(), REPLACE_EXISTING);
Files.copy(file.toPath(), new File(r.targetFile).toPath(), StandardCopyOption.REPLACE_EXISTING);
tableModel.fireTableCellUpdated(sel[0], 1/*size*/);
} catch (IOException ex) {
View.showMessageDialog(f, translate("error.replace") + "\r\n" + ex.getLocalizedMessage(), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
@@ -456,7 +515,7 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe
case ACTION_COPYURL:
String copyText = "";
for (int sc : sel) {
Replacement r = reps.get(sc);
Replacement r = replacements.get(sc);
if (!copyText.isEmpty()) {
copyText += System.lineSeparator();
}
@@ -471,7 +530,7 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe
break;
case ACTION_RENAME:
if (sel.length > 0) {
Replacement r = reps.get(sel[0]);
Replacement r = replacements.get(sel[0]);
String s = View.showInputDialog("URL", r.urlPattern);
if (s != null) {
r.urlPattern = s;
@@ -480,7 +539,7 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe
}
break;
case ACTION_CLEAR:
for (Replacement r : reps) {
for (Replacement r : replacements) {
File f;
try {
f = (new File(Main.tempFile(r.targetFile)));
@@ -492,14 +551,16 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe
}
}
tableModel.setRowCount(0);
reps.clear();
replacements.clear();
saveReplacements();
break;
case ACTION_REMOVE:
Arrays.sort(sel);
for (int i = sel.length - 1; i >= 0; i--) {
tableModel.removeRow(sel[i]);
Replacement r = reps.remove(sel[i]);
Replacement r = replacements.remove(sel[i]);
saveReplacements();
File f = (new File(r.targetFile));
if (f.exists()) {
f.delete();
@@ -537,7 +598,7 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe
catchedContentTypes.add("text/xml");
catchedContentTypes.add("application/xml");
catchedContentTypes.add("application/octet-stream");
if (!Server.startServer(port, reps, catchedContentTypes, this, this)) {
if (!Server.startServer(port, replacements, catchedContentTypes, this, this)) {
JOptionPane.showMessageDialog(this, translate("error.start.server").replace("%port%", "" + port), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
started = false;
return;
@@ -631,7 +692,7 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe
byte[] result = null;
boolean cont = false;
for (Replacement r : reps) {
for (Replacement r : replacements) {
if (r.matches(url)) {
cont = true;
break;
@@ -657,7 +718,8 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe
Replacement r = new Replacement(url, tempFilePath);
r.lastAccess = Calendar.getInstance();
reps.add(r);
replacements.add(r);
saveReplacements();
tableModel.addRow(new Object[]{
r.lastAccess == null ? "" : format.format(r.lastAccess.getTime()),
new SizeItem(r.targetFile),
@@ -697,7 +759,7 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe
@Override
public void replaced(Replacement replacement, String url, String contentType) {
int index = reps.indexOf(replacement);
int index = replacements.indexOf(replacement);
tableModel.setValueAt(replacement.lastAccess == null ? "" : format.format(replacement.lastAccess.getTime()), index, 0);
tableModel.setValueAt(new SizeItem(replacement.targetFile), index, 1);
tableModel.setValueAt(replacement.urlPattern, index, 2);