generic config get/set methods

This commit is contained in:
Honfika
2013-08-25 08:29:56 +02:00
parent a72ece0d1d
commit 91eb780db3
17 changed files with 60 additions and 56 deletions

View File

@@ -218,7 +218,7 @@ public class Main {
public void progress(int p) {
startWork(translate("work.reading.swf"), p);
}
}, (Boolean) Configuration.getConfig("parallelSpeedUp", Boolean.TRUE));
}, Configuration.getConfig("parallelSpeedUp", Boolean.TRUE));
locswf.addEventListener(new EventListener() {
@Override
public void handleEvent(String event, Object data) {
@@ -387,7 +387,7 @@ public class Main {
public static boolean saveFileDialog() {
JFileChooser fc = new JFileChooser();
fc.setCurrentDirectory(new File((String) Configuration.getConfig("lastSaveDir", ".")));
fc.setCurrentDirectory(new File(Configuration.getConfig("lastSaveDir", ".")));
fc.setFileFilter(new FileFilter() {
@Override
public boolean accept(File f) {
@@ -425,7 +425,7 @@ public class Main {
public static boolean openFileDialog() {
fileTitle = null;
JFileChooser fc = new JFileChooser();
fc.setCurrentDirectory(new File((String) Configuration.getConfig("lastOpenDir", ".")));
fc.setCurrentDirectory(new File(Configuration.getConfig("lastOpenDir", ".")));
fc.setFileFilter(new FileFilter() {
@Override
public boolean accept(File f) {
@@ -604,7 +604,7 @@ public class Main {
}
private static void offerAssociation() {
boolean offered = (Boolean) Configuration.getConfig("offeredAssociation", Boolean.FALSE);
boolean offered = Configuration.getConfig("offeredAssociation", Boolean.FALSE);
if (!offered) {
if (Platform.isWindows()) {
if ((!isAddedToContextMenu()) && View.showConfirmDialog(null, "Do you want to add FFDec to context menu of SWF files?\n(Can be changed later from main menu)", "Context menu", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) {
@@ -617,7 +617,7 @@ public class Main {
public static void initLang() {
if (Configuration.containsConfig("locale")) {
Locale.setDefault(Locale.forLanguageTag((String) 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"));
@@ -751,7 +751,7 @@ public class Main {
View.setLookAndFeel();
if ((Boolean) Configuration.getConfig("cacheOnDisk", Boolean.TRUE)) {
if (Configuration.getConfig("cacheOnDisk", Boolean.TRUE)) {
Cache.setStorageType(Cache.STORAGE_FILES);
} else {
Cache.setStorageType(Cache.STORAGE_MEMORY);
@@ -914,7 +914,7 @@ public class Main {
boolean exportOK;
try {
printHeader();
SWF exfile = new SWF(new FileInputStream(inFile), (Boolean) Configuration.getConfig("parallelSpeedUp", Boolean.TRUE));
SWF exfile = new SWF(new FileInputStream(inFile), Configuration.getConfig("parallelSpeedUp", Boolean.TRUE));
exfile.addEventListener(new EventListener() {
@Override
public void handleEvent(String event, Object data) {
@@ -931,7 +931,7 @@ public class Main {
System.out.println("Exporting shapes...");
exfile.exportShapes(handler, outDir.getAbsolutePath() + File.separator + "shapes");
System.out.println("Exporting scripts...");
exfile.exportActionScript(handler, outDir.getAbsolutePath() + File.separator + "scripts", false, (Boolean) Configuration.getConfig("parallelSpeedUp", Boolean.TRUE));
exfile.exportActionScript(handler, outDir.getAbsolutePath() + File.separator + "scripts", false, Configuration.getConfig("parallelSpeedUp", Boolean.TRUE));
System.out.println("Exporting movies...");
exfile.exportMovies(handler, outDir.getAbsolutePath() + File.separator + "movies");
System.out.println("Exporting sounds...");
@@ -955,10 +955,10 @@ public class Main {
if ((pos + 5 < args.length) && (args[pos + 4].equals("-selectas3class"))) {
exportOK = true;
for (int i = pos + 5; i < args.length; i++) {
exportOK = exportOK && exfile.exportAS3Class(args[i], outDir.getAbsolutePath(), exportFormat.equals("pcode"), (Boolean) Configuration.getConfig("parallelSpeedUp", Boolean.TRUE));
exportOK = exportOK && exfile.exportAS3Class(args[i], outDir.getAbsolutePath(), exportFormat.equals("pcode"), Configuration.getConfig("parallelSpeedUp", Boolean.TRUE));
}
} else {
exportOK = !exfile.exportActionScript(handler, outDir.getAbsolutePath(), exportFormat.equals("pcode"), (Boolean) Configuration.getConfig("parallelSpeedUp", Boolean.TRUE)).isEmpty();
exportOK = !exfile.exportActionScript(handler, outDir.getAbsolutePath(), exportFormat.equals("pcode"), Configuration.getConfig("parallelSpeedUp", Boolean.TRUE)).isEmpty();
}
break;
case "movie":
@@ -982,11 +982,11 @@ public class Main {
exportOK = true;
break;
case "fla":
exfile.exportFla(handler, outDir.getAbsolutePath(), inFile.getName(), applicationName, applicationVerName, version, (Boolean) Configuration.getConfig("parallelSpeedUp", Boolean.TRUE));
exfile.exportFla(handler, outDir.getAbsolutePath(), inFile.getName(), applicationName, applicationVerName, version, Configuration.getConfig("parallelSpeedUp", Boolean.TRUE));
exportOK = true;
break;
case "xfl":
exfile.exportXfl(handler, outDir.getAbsolutePath(), inFile.getName(), applicationName, applicationVerName, version, (Boolean) Configuration.getConfig("parallelSpeedUp", Boolean.TRUE));
exfile.exportXfl(handler, outDir.getAbsolutePath(), inFile.getName(), applicationName, applicationVerName, version, Configuration.getConfig("parallelSpeedUp", Boolean.TRUE));
exportOK = true;
break;
default:
@@ -1170,7 +1170,7 @@ public class Main {
}
public static void autoCheckForUpdates() {
Calendar lastUpdatesCheckDate = (Calendar) Configuration.getConfig("lastUpdatesCheckDate", null);
Calendar lastUpdatesCheckDate = Configuration.getConfig("lastUpdatesCheckDate", null);
if ((lastUpdatesCheckDate == null) || (lastUpdatesCheckDate.getTime().getTime() < Calendar.getInstance().getTime().getTime() - 1000 * 60 * 60 * 24)) {
checkForUpdates();
}