From d99f8943b729da286ec563e7ea23d31275f5828b Mon Sep 17 00:00:00 2001 From: Honfika Date: Thu, 7 Nov 2013 11:07:49 +0100 Subject: [PATCH] application releated constants moved to applicationinfo class (name, version, urls), 1000th source file:) --- .../decompiler/flash/ApplicationInfo.java | 56 +++++++ .../jpexs/decompiler/flash/Configuration.java | 114 ++++++++++++-- .../console/CommandLineArgumentParser.java | 15 +- .../decompiler/flash/gui/AboutDialog.java | 5 +- .../decompiler/flash/gui/LoadingDialog.java | 3 +- .../com/jpexs/decompiler/flash/gui/Main.java | 146 ++---------------- .../jpexs/decompiler/flash/gui/MainFrame.java | 19 +-- .../jpexs/decompiler/flash/gui/ModeFrame.java | 3 +- .../flash/gui/NewVersionDialog.java | 5 +- 9 files changed, 197 insertions(+), 169 deletions(-) create mode 100644 trunk/src/com/jpexs/decompiler/flash/ApplicationInfo.java diff --git a/trunk/src/com/jpexs/decompiler/flash/ApplicationInfo.java b/trunk/src/com/jpexs/decompiler/flash/ApplicationInfo.java new file mode 100644 index 000000000..dd33cd89e --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/ApplicationInfo.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2013 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 . + */ +package com.jpexs.decompiler.flash; + +import java.io.IOException; +import java.util.Properties; + +/** + * + * @author JPEXS + */ +public class ApplicationInfo { + + public static final String applicationName = "JPEXS Free Flash Decompiler"; + public static final String shortApplicationName = "FFDec"; + public static final String vendor = "JPEXS"; + public static String version = ""; + public static String applicationVerName; + public static String shortApplicationVerName; + public static final String projectPage = "http://www.free-decompiler.com/flash"; + public static String updatePageStub = "http://www.free-decompiler.com/flash/update.html?currentVersion="; + public static String updatePage; + + static { + loadProperties(); + } + + private static void loadProperties() { + Properties prop = new Properties(); + try { + prop.load(ApplicationInfo.class.getResourceAsStream("/project.properties")); + version = prop.getProperty("version"); + applicationVerName = applicationName + " v." + version; + updatePage = updatePageStub + version; + shortApplicationVerName = shortApplicationName + " v." + version; + } catch (IOException ex) { + //ignore + version = "unknown"; + } + } + +} diff --git a/trunk/src/com/jpexs/decompiler/flash/Configuration.java b/trunk/src/com/jpexs/decompiler/flash/Configuration.java index b7aff0ea5..6e2b7de80 100644 --- a/trunk/src/com/jpexs/decompiler/flash/Configuration.java +++ b/trunk/src/com/jpexs/decompiler/flash/Configuration.java @@ -18,16 +18,22 @@ package com.jpexs.decompiler.flash; import com.jpexs.proxy.Replacement; import java.io.*; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JOptionPane; public class Configuration { + private static final String CONFIG_NAME = "config.bin"; + private static final String REPLACEMENTS_NAME = "replacements.cfg"; + private static final File unspecifiedFile = new File("unspecified"); + private static File directory = unspecifiedFile; + public static final boolean DISPLAY_FILENAME = true; public static boolean DEBUG_COPY = false; public static boolean dump_tags = false; @@ -92,6 +98,85 @@ public class Configuration { } }; + private enum OSId { + + WINDOWS, OSX, UNIX + } + + private static OSId getOSId() { + PrivilegedAction doGetOSName = new PrivilegedAction() { + @Override + public String run() { + return System.getProperty("os.name"); + } + }; + OSId id = OSId.UNIX; + String osName = AccessController.doPrivileged(doGetOSName); + if (osName != null) { + if (osName.toLowerCase().startsWith("mac os x")) { + id = OSId.OSX; + } else if (osName.contains("Windows")) { + id = OSId.WINDOWS; + } + } + return id; + } + + public static String getFFDecHome() throws IOException { + if (directory == unspecifiedFile) { + directory = null; + String userHome = null; + try { + userHome = System.getProperty("user.home"); + } catch (SecurityException ignore) { + } + if (userHome != null) { + String applicationId = ApplicationInfo.shortApplicationName; + OSId osId = getOSId(); + if (osId == OSId.WINDOWS) { + File appDataDir = null; + try { + String appDataEV = System.getenv("APPDATA"); + if ((appDataEV != null) && (appDataEV.length() > 0)) { + appDataDir = new File(appDataEV); + } + } catch (SecurityException ignore) { + } + String vendorId = ApplicationInfo.vendor; + if ((appDataDir != null) && appDataDir.isDirectory()) { + // ${APPDATA}\{vendorId}\${applicationId} + String path = vendorId + "\\" + applicationId + "\\"; + directory = new File(appDataDir, path); + } else { + // ${userHome}\Application Data\${vendorId}\${applicationId} + String path = "Application Data\\" + vendorId + "\\" + applicationId + "\\"; + directory = new File(userHome, path); + } + } else if (osId == OSId.OSX) { + // ${userHome}/Library/Application Support/${applicationId} + String path = "Library/Application Support/" + applicationId + "/"; + directory = new File(userHome, path); + } else { + // ${userHome}/.${applicationId}/ + String path = "." + applicationId + "/"; + directory = new File(userHome, path); + } + } + } + if (!directory.exists()) { + if (!directory.mkdirs()) { + if (!directory.exists()) { + throw new IOException("cannot create directory " + directory); + } + } + } + String ret = directory.getAbsolutePath(); + if (!ret.endsWith(File.separator)) { + ret += File.separator; + } + return ret; + } + /** * Saves replacements to file for future use */ @@ -166,13 +251,12 @@ public class Configuration { return result; } - public static void unsetConfig(String cfg) { - config.remove(cfg); + private static String getReplacementsFile() throws IOException { + return getFFDecHome() + REPLACEMENTS_NAME; } - public static void loadFromMap(Map map) { - config.clear(); - config.putAll(map); + private static String getConfigFile() throws IOException { + return getFFDecHome() + CONFIG_NAME; } @SuppressWarnings("unchecked") @@ -189,16 +273,16 @@ public class Configuration { } if (containsConfig("paralelSpeedUp")) { setConfig("parallelSpeedUp", getConfig("paralelSpeedUp")); - unsetConfig("paralelSpeedUp"); + config.remove("paralelSpeedUp"); } } - public static void saveToFile(String file, String replacementsFile) { + private static void saveToFile(String file, String replacementsFile) { try (ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(file))) { oos.writeObject(config); } catch (IOException ex) { JOptionPane.showMessageDialog(null, "Cannot save configuration.", "Error", JOptionPane.ERROR_MESSAGE); - Logger.getLogger(SWFInputStream.class.getName()).severe("Configuration directory is read only."); + Logger.getLogger(Configuration.class.getName()).severe("Configuration directory is read only."); } if (replacementsFile != null) { saveReplacements(replacementsFile); @@ -208,4 +292,16 @@ public class Configuration { public static List getReplacements() { return replacements; } + + public static void loadConfig() throws IOException { + loadFromFile(getConfigFile(), getReplacementsFile()); + } + + public static void saveConfig() { + try { + saveToFile(getConfigFile(), getReplacementsFile()); + } catch (IOException ex) { + Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex); + } + } } diff --git a/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java b/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java index 755c35dbd..1f55dada2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java +++ b/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.console; import com.jpexs.decompiler.flash.AbortRetryIgnoreHandler; +import com.jpexs.decompiler.flash.ApplicationInfo; import com.jpexs.decompiler.flash.Configuration; import com.jpexs.decompiler.flash.ConsoleAbortRetryIgnoreHandler; import com.jpexs.decompiler.flash.EventListener; @@ -123,7 +124,7 @@ public class CommandLineArgumentParser { case "-config": parseConfig(args); if (args.isEmpty()) { - Main.saveConfig(); + Configuration.saveConfig(); System.out.println("Configuration saved"); return null; } @@ -183,8 +184,8 @@ public class CommandLineArgumentParser { } public static void printHeader() { - System.out.println(Main.applicationVerName); - for (int i = 0; i < Main.applicationVerName.length(); i++) { + System.out.println(ApplicationInfo.applicationVerName); + for (int i = 0; i < ApplicationInfo.applicationVerName.length(); i++) { System.out.print("-"); } System.out.println(); @@ -511,11 +512,11 @@ public class CommandLineArgumentParser { exportOK = true; break; case "fla": - exfile.exportFla(handler, outDir.getAbsolutePath(), inFile.getName(), Main.applicationName, Main.applicationVerName, Main.version, Configuration.getConfig("parallelSpeedUp", true)); + exfile.exportFla(handler, outDir.getAbsolutePath(), inFile.getName(), ApplicationInfo.applicationName, ApplicationInfo.applicationVerName, ApplicationInfo.version, Configuration.getConfig("parallelSpeedUp", true)); exportOK = true; break; case "xfl": - exfile.exportXfl(handler, outDir.getAbsolutePath(), inFile.getName(), Main.applicationName, Main.applicationVerName, Main.version, Configuration.getConfig("parallelSpeedUp", true)); + exfile.exportXfl(handler, outDir.getAbsolutePath(), inFile.getName(), ApplicationInfo.applicationName, ApplicationInfo.applicationVerName, ApplicationInfo.version, Configuration.getConfig("parallelSpeedUp", true)); exportOK = true; break; default: @@ -524,7 +525,7 @@ public class CommandLineArgumentParser { } catch (OutOfMemoryError | Exception ex) { exportOK = false; System.err.print("FAIL: Exporting Failed on Exception - "); - Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); + Logger.getLogger(CommandLineArgumentParser.class.getName()).log(Level.SEVERE, null, ex); System.exit(1); } long stopTime = System.currentTimeMillis(); @@ -574,7 +575,7 @@ public class CommandLineArgumentParser { Configuration.setConfig("parallelSpeedUp", false); SWF swf = Main.parseSWF(args.remove()); } catch (Exception ex) { - Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); + Logger.getLogger(CommandLineArgumentParser.class.getName()).log(Level.SEVERE, null, ex); System.exit(1); } System.exit(0); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/AboutDialog.java b/trunk/src/com/jpexs/decompiler/flash/gui/AboutDialog.java index b2d80c204..54d2399b0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/AboutDialog.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/AboutDialog.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.gui; +import com.jpexs.decompiler.flash.ApplicationInfo; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -77,7 +78,7 @@ public class AboutDialog extends AppDialog { appNamePanel.setAlignmentX(0.5f); cp.add(appNamePanel); - JLabel verLabel = new JLabel(translate("version") + " " + Main.version); + JLabel verLabel = new JLabel(translate("version") + " " + ApplicationInfo.version); verLabel.setAlignmentX(0.5f); //verLabel.setPreferredSize(new Dimension(300, 15)); verLabel.setFont(new Font("Tahoma", Font.BOLD, 15)); @@ -137,7 +138,7 @@ public class AboutDialog extends AppDialog { cp.add(Box.createVerticalStrut(10)); - LinkLabel wwwLabel = new LinkLabel(Main.projectPage); + LinkLabel wwwLabel = new LinkLabel(ApplicationInfo.projectPage); wwwLabel.setAlignmentX(0.5f); wwwLabel.setForeground(Color.blue); //wwwLabel.setPreferredSize(new Dimension(300, 25)); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/LoadingDialog.java b/trunk/src/com/jpexs/decompiler/flash/gui/LoadingDialog.java index 4fa2a4a30..ea0b0bb95 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/LoadingDialog.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/LoadingDialog.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.gui; +import com.jpexs.decompiler.flash.ApplicationInfo; import java.awt.BorderLayout; import java.awt.Container; import java.awt.Dimension; @@ -65,7 +66,7 @@ public class LoadingDialog extends AppDialog implements ImageObserver { */ public LoadingDialog() { setResizable(false); - setTitle(Main.shortApplicationVerName); + setTitle(ApplicationInfo.shortApplicationVerName); Container cntp = getContentPane(); JPanel cnt = new JPanel(); cntp.setLayout(new BorderLayout()); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java index 03babe603..60a863ddc 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.gui; +import com.jpexs.decompiler.flash.ApplicationInfo; import com.jpexs.decompiler.flash.Configuration; import com.jpexs.decompiler.flash.EventListener; import com.jpexs.decompiler.flash.SWF; @@ -46,8 +47,6 @@ import java.awt.event.MouseEvent; import java.io.*; import java.net.Socket; import java.net.URLDecoder; -import java.security.AccessController; -import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.Calendar; import java.util.Locale; @@ -80,15 +79,6 @@ public class Main { public static InputStream inputStream; public static String fileTitle; public static SWF swf; - public static String version = ""; - public static final String applicationName = "JPEXS Free Flash Decompiler"; - public static String applicationVerName; - public static final String shortApplicationName = "FFDec"; - public static String shortApplicationVerName; - public static final String projectPage = "http://www.free-decompiler.com/flash"; - public static String updatePageStub = "http://www.free-decompiler.com/flash/update.html?currentVersion="; - public static String updatePage; - public static final String vendor = "JPEXS"; public static LoadingDialog loadingDialog; public static ModeFrame modeFrame; private static boolean working = false; @@ -116,20 +106,6 @@ public class Main { loadFromMemoryFrame.setVisible(true); } - private static void loadProperties() { - Properties prop = new Properties(); - try { - prop.load(Main.class.getResourceAsStream("/project.properties")); - version = prop.getProperty("version"); - applicationVerName = applicationName + " v." + version; - updatePage = updatePageStub + version; - shortApplicationVerName = shortApplicationName + " v." + version; - } catch (IOException ex) { - //ignore - version = "unknown"; - } - } - /** * Get title of the file * @@ -693,9 +669,7 @@ public class Main { } public static void initLang() { - if (Configuration.containsConfig("locale")) { - Locale.setDefault(Locale.forLanguageTag(Configuration.getConfig("locale", "en"))); - } + Locale.setDefault(Locale.forLanguageTag(Configuration.getConfig("locale", "en"))); UIManager.put("OptionPane.okButtonText", AppStrings.translate("button.ok")); UIManager.put("OptionPane.yesButtonText", AppStrings.translate("button.yes")); UIManager.put("OptionPane.noButtonText", AppStrings.translate("button.no")); @@ -813,8 +787,7 @@ public class Main { */ public static void main(String[] args) throws IOException { startFreeMemThread(); - loadProperties(); - Configuration.loadFromFile(getConfigFile(), getReplacementsFile()); + Configuration.loadConfig(); initLogging(Configuration.debugMode); initLang(); @@ -840,7 +813,7 @@ public class Main { } public static String tempFile(String url) throws IOException { - File f = new File(getFFDecHome() + "saved" + File.separator); + File f = new File(Configuration.getFFDecHome() + "saved" + File.separator); if (!f.exists()) { if (!f.mkdirs()) { if (!f.exists()) { @@ -848,7 +821,7 @@ public class Main { } } } - return getFFDecHome() + "saved" + File.separator + "asdec_" + Integer.toHexString(url.hashCode()) + ".tmp"; + return Configuration.getFFDecHome() + "saved" + File.separator + "asdec_" + Integer.toHexString(url.hashCode()) + ".tmp"; } @@ -879,7 +852,7 @@ public class Main { } if (SystemTray.isSupported()) { SystemTray tray = SystemTray.getSystemTray(); - trayIcon = new TrayIcon(View.loadImage("proxy16"), vendor + " " + shortApplicationName + " " + AppStrings.translate("proxy")); + trayIcon = new TrayIcon(View.loadImage("proxy16"), ApplicationInfo.vendor + " " + ApplicationInfo.shortApplicationName + " " + AppStrings.translate("proxy")); trayIcon.setImageAutoSize(true); PopupMenu trayPopup = new PopupMenu(); @@ -936,16 +909,8 @@ public class Main { } } - public static void saveConfig() { - try { - Configuration.saveToFile(getConfigFile(), getReplacementsFile()); - } catch (IOException ex) { - Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); - } - } - public static void exit() { - saveConfig(); + Configuration.saveConfig(); FlashPlayerPanel.unload(); System.exit(0); } @@ -969,7 +934,7 @@ public class Main { try { Socket sock = new Socket("www.free-decompiler.com", 80); OutputStream os = sock.getOutputStream(); - os.write(("GET /flash/update.html?action=check¤tVersion=" + version + " HTTP/1.1\r\nHost: www.free-decompiler.com\r\nUser-Agent: " + shortApplicationVerName + "\r\nConnection: close\r\n\r\n").getBytes()); + os.write(("GET /flash/update.html?action=check¤tVersion=" + ApplicationInfo.version + " HTTP/1.1\r\nHost: www.free-decompiler.com\r\nUser-Agent: " + ApplicationInfo.shortApplicationVerName + "\r\nConnection: close\r\n\r\n").getBytes()); BufferedReader br = new BufferedReader(new InputStreamReader(sock.getInputStream())); String s; boolean start = false; @@ -1068,13 +1033,13 @@ public class Main { logger.removeHandler(fileTxt); } try { - File f = new File(getFFDecHome() + File.separator + "log.txt"); + File f = new File(Configuration.getFFDecHome() + File.separator + "log.txt"); FileOutputStream fos = new FileOutputStream(f); fos.close(); } catch (IOException ex) { } try { - fileTxt = new FileHandler(getFFDecHome() + File.separator + "log.txt"); + fileTxt = new FileHandler(Configuration.getFFDecHome() + File.separator + "log.txt"); } catch (IOException | SecurityException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } @@ -1105,97 +1070,6 @@ public class Main { throw new RuntimeException("Problems with creating the log files"); } } - private static final String CONFIG_NAME = "config.bin"; - private static final String REPLACEMENTS_NAME = "replacements.cfg"; - private static final File unspecifiedFile = new File("unspecified"); - private static File directory = unspecifiedFile; - - private enum OSId { - - WINDOWS, OSX, UNIX - } - - private static OSId getOSId() { - PrivilegedAction doGetOSName = new PrivilegedAction() { - @Override - public String run() { - return System.getProperty("os.name"); - } - }; - OSId id = OSId.UNIX; - String osName = AccessController.doPrivileged(doGetOSName); - if (osName != null) { - if (osName.toLowerCase().startsWith("mac os x")) { - id = OSId.OSX; - } else if (osName.contains("Windows")) { - id = OSId.WINDOWS; - } - } - return id; - } - - public static String getFFDecHome() throws IOException { - if (directory == unspecifiedFile) { - directory = null; - String userHome = null; - try { - userHome = System.getProperty("user.home"); - } catch (SecurityException ignore) { - } - if (userHome != null) { - String applicationId = Main.shortApplicationName; - OSId osId = getOSId(); - if (osId == OSId.WINDOWS) { - File appDataDir = null; - try { - String appDataEV = System.getenv("APPDATA"); - if ((appDataEV != null) && (appDataEV.length() > 0)) { - appDataDir = new File(appDataEV); - } - } catch (SecurityException ignore) { - } - String vendorId = Main.vendor; - if ((appDataDir != null) && appDataDir.isDirectory()) { - // ${APPDATA}\{vendorId}\${applicationId} - String path = vendorId + "\\" + applicationId + "\\"; - directory = new File(appDataDir, path); - } else { - // ${userHome}\Application Data\${vendorId}\${applicationId} - String path = "Application Data\\" + vendorId + "\\" + applicationId + "\\"; - directory = new File(userHome, path); - } - } else if (osId == OSId.OSX) { - // ${userHome}/Library/Application Support/${applicationId} - String path = "Library/Application Support/" + applicationId + "/"; - directory = new File(userHome, path); - } else { - // ${userHome}/.${applicationId}/ - String path = "." + applicationId + "/"; - directory = new File(userHome, path); - } - } - } - if (!directory.exists()) { - if (!directory.mkdirs()) { - if (!directory.exists()) { - throw new IOException("cannot create directory " + directory); - } - } - } - String ret = directory.getAbsolutePath(); - if (!ret.endsWith(File.separator)) { - ret += File.separator; - } - return ret; - } - - private static String getReplacementsFile() throws IOException { - return getFFDecHome() + REPLACEMENTS_NAME; - } - - private static String getConfigFile() throws IOException { - return getFFDecHome() + CONFIG_NAME; - } public static boolean isAddedToContextMenu() { if (!Platform.isWindows()) { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java index 08c525a11..31eeecfa7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.gui; import com.jpexs.decompiler.flash.AbortRetryIgnoreHandler; +import com.jpexs.decompiler.flash.ApplicationInfo; import com.jpexs.decompiler.flash.Configuration; import com.jpexs.decompiler.flash.FrameNode; import com.jpexs.decompiler.flash.PackageNode; @@ -622,7 +623,7 @@ public final class MainFrame extends AppRibbonFrame implements ActionListener, T Main.exit(); } }); - setTitle(Main.applicationVerName + ((swf != null && Configuration.DISPLAY_FILENAME) ? " - " + Main.getFileTitle() : "")); + setTitle(ApplicationInfo.applicationVerName + ((swf != null && Configuration.DISPLAY_FILENAME) ? " - " + Main.getFileTitle() : "")); JMenuBar menuBar = new JMenuBar(); @@ -2646,7 +2647,7 @@ public final class MainFrame extends AppRibbonFrame implements ActionListener, T break; case "SAVEAS": if (Main.saveFileDialog()) { - setTitle(Main.applicationVerName + (Configuration.DISPLAY_FILENAME ? " - " + Main.getFileTitle() : "")); + setTitle(ApplicationInfo.applicationVerName + (Configuration.DISPLAY_FILENAME ? " - " + Main.getFileTitle() : "")); saveCommandButton.setEnabled(!Main.readOnly); } break; @@ -2709,9 +2710,9 @@ public final class MainFrame extends AppRibbonFrame implements ActionListener, T Helper.freeMem(); try { if (compressed) { - swf.exportFla(errorHandler, selfile.getAbsolutePath(), new File(Main.file).getName(), Main.applicationName, Main.applicationVerName, Main.version, Configuration.getConfig("parallelSpeedUp", true)); + swf.exportFla(errorHandler, selfile.getAbsolutePath(), new File(Main.file).getName(), ApplicationInfo.applicationName, ApplicationInfo.applicationVerName, ApplicationInfo.version, Configuration.getConfig("parallelSpeedUp", true)); } else { - swf.exportXfl(errorHandler, selfile.getAbsolutePath(), new File(Main.file).getName(), Main.applicationName, Main.applicationVerName, Main.version, Configuration.getConfig("parallelSpeedUp", true)); + swf.exportXfl(errorHandler, selfile.getAbsolutePath(), new File(Main.file).getName(), ApplicationInfo.applicationName, ApplicationInfo.applicationVerName, ApplicationInfo.version, Configuration.getConfig("parallelSpeedUp", true)); } } catch (IOException ex) { View.showMessageDialog(null, translate("error.export") + ": " + ex.getLocalizedMessage(), translate("error"), JOptionPane.ERROR_MESSAGE); @@ -2728,11 +2729,7 @@ public final class MainFrame extends AppRibbonFrame implements ActionListener, T export.setVisible(true); if (!export.cancelled) { JFileChooser chooser = new JFileChooser(); - if (Configuration.containsConfig("lastExportDir")) { - chooser.setCurrentDirectory(new java.io.File(Configuration.getConfig("lastExportDir", "."))); - } else { - chooser.setCurrentDirectory(new File(".")); - } + chooser.setCurrentDirectory(new File(Configuration.getConfig("lastExportDir", "."))); chooser.setDialogTitle(translate("export.select.directory")); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.setAcceptAllFileFilterUsed(false); @@ -2783,7 +2780,7 @@ public final class MainFrame extends AppRibbonFrame implements ActionListener, T break; case "HELPUS": - String helpUsURL = Main.projectPage + "/help_us.html"; + String helpUsURL = ApplicationInfo.projectPage + "/help_us.html"; if (java.awt.Desktop.isDesktopSupported()) { java.awt.Desktop desktop = java.awt.Desktop.getDesktop(); try { @@ -2797,7 +2794,7 @@ public final class MainFrame extends AppRibbonFrame implements ActionListener, T break; case "HOMEPAGE": - String homePageURL = Main.projectPage; + String homePageURL = ApplicationInfo.projectPage; if (java.awt.Desktop.isDesktopSupported()) { java.awt.Desktop desktop = java.awt.Desktop.getDesktop(); try { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/ModeFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/ModeFrame.java index b8d12ddd4..f826854b9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/ModeFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/ModeFrame.java @@ -16,6 +16,7 @@ */ 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; @@ -61,7 +62,7 @@ public class ModeFrame extends AppFrame implements ActionListener { cont.add(exitButton); View.centerScreen(this); View.setWindowIcon(this); - setTitle(Main.shortApplicationVerName); + setTitle(ApplicationInfo.shortApplicationVerName); this.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/NewVersionDialog.java b/trunk/src/com/jpexs/decompiler/flash/gui/NewVersionDialog.java index 62843067f..11b778bc2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/NewVersionDialog.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/NewVersionDialog.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.gui; +import com.jpexs.decompiler.flash.ApplicationInfo; import com.jpexs.decompiler.flash.Version; import java.awt.Container; import java.awt.Dimension; @@ -115,7 +116,7 @@ public class NewVersionDialog extends AppDialog implements ActionListener { java.net.URI uri = new java.net.URI(latestVersion.updateLink); desktop.browse(uri); } else { - java.net.URI uri = new java.net.URI(Main.updatePage); + java.net.URI uri = new java.net.URI(ApplicationInfo.updatePage); desktop.browse(uri); } Main.exit(); @@ -126,7 +127,7 @@ public class NewVersionDialog extends AppDialog implements ActionListener { } } if (desktop == null) { - View.showMessageDialog(null, translate("newvermessage").replace("%oldAppName%", Main.shortApplicationName).replace("%newAppName%", latestVersion.appName).replace("%projectPage%", Main.projectPage), translate("newversion"), JOptionPane.INFORMATION_MESSAGE); + View.showMessageDialog(null, translate("newvermessage").replace("%oldAppName%", ApplicationInfo.shortApplicationName).replace("%newAppName%", latestVersion.appName).replace("%projectPage%", ApplicationInfo.projectPage), translate("newversion"), JOptionPane.INFORMATION_MESSAGE); } } setVisible(false);