From 676bd9f74b0ffadc8a4b42dda60c7351387c6445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Tue, 20 Dec 2022 09:34:47 +0100 Subject: [PATCH] Added Warning before switching auto rename identifiers on Changed Warning before switching deobfuscation is now optional Czech translation fixes --- CHANGELOG.md | 4 ++++ .../decompiler/flash/configuration/Configuration.java | 4 ++++ src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java | 9 +++++++-- .../flash/gui/locales/AdvancedSettingsDialog.properties | 5 ++++- .../gui/locales/AdvancedSettingsDialog_cs.properties | 5 ++++- .../decompiler/flash/gui/locales/MainFrame.properties | 4 +++- .../decompiler/flash/gui/locales/MainFrame_cs.properties | 9 +++++++++ 7 files changed, 35 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e515302c..8c06dd39b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,10 +4,14 @@ All notable changes to this project will be documented in this file. ## [Unreleased] ### Added - Deobfuscation and its options as icons on script panel toolbar +- Warning before switching auto rename identifiers on ### Fixed - [#1904] NullpointerException when renaming invalid identifiers in AS1/2 files caused by missing charset +### Changed +- Warning before switching deobfuscation is now optional + ## [18.0.0] - 2022-12-18 ### Added - [#1898] Keyboard shortcut to remove tags (DEL, SHIFT+DEL) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java index d88428054..a0f1159d9 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java @@ -867,6 +867,10 @@ public final class Configuration { @ConfigurationCategory("script") public static ConfigurationItem warningDeobfuscation = null; + @ConfigurationDefaultBoolean(true) + @ConfigurationCategory("script") + public static ConfigurationItem warningRenameIdentifiers = null; + private enum OSId { WINDOWS, OSX, UNIX } diff --git a/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java b/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java index ab425ea1f..40bc865b9 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java +++ b/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java @@ -792,8 +792,13 @@ public abstract class MainFrameMenu implements MenuBuilder { protected void autoRenameIdentifiersActionPerformed(ActionEvent evt) { AbstractButton button = (AbstractButton) evt.getSource(); boolean selected = button.isSelected(); - - Configuration.autoRenameIdentifiers.set(selected); + + if (!selected || ViewMessages.showConfirmDialog(Main.getDefaultMessagesComponent(), translate("message.confirm.autoRenameIdentifiers") + "\r\n" + translate("message.confirm.on"), translate("message.confirm"), JOptionPane.OK_CANCEL_OPTION, Configuration.warningRenameIdentifiers, JOptionPane.OK_OPTION) == JOptionPane.OK_OPTION) { + Configuration.autoRenameIdentifiers.set(selected); + mainFrame.getPanel().autoDeobfuscateChanged(); + } else { + button.setSelected(Configuration.autoRenameIdentifiers.get()); + } } /*protected void cacheOnDiskActionPerformed(ActionEvent evt) { diff --git a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties index 981400f1d..ac3b93653 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties @@ -655,4 +655,7 @@ config.name.doubleClickNodeToEdit = Double click to start editing config.description.doubleClickNodeToEdit = Double clicking tree node starts its editation. config.name.warningDeobfuscation = Warn on switching deobfuscation -config.description.warningDeobfuscation = Show warning on switching deobfuscation on/off \ No newline at end of file +config.description.warningDeobfuscation = Show warning on switching deobfuscation on/off. + +config.name.warningRenameIdentifiers = Warn on switching auto rename identifiers +config.description.warningRenameIdentifiers = Show warning when turning on auto rename identifiers feature. \ No newline at end of file diff --git a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_cs.properties b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_cs.properties index 7d3f0ba36..1e5e0d558 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_cs.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_cs.properties @@ -645,4 +645,7 @@ config.name.doubleClickNodeToEdit = Dvojit\u00fd klik za\u010dne editaci config.description.doubleClickNodeToEdit = Dvojit\u00e9 kliknut\u00ed na polo\u017eku ve stromu za\u010dne jej\u00ed editaci. config.name.warningDeobfuscation = Varovat p\u0159i p\u0159ep\u00edn\u00e1n\u00ed deobfuskace -config.description.warningDeobfuscation = Zobrazovst varov\u00e1n\u00ed b\u011bhem zap\u00edn\u00e1n\u00ed/vyp\u00edn\u00e1n\u00ed deobfuskace. \ No newline at end of file +config.description.warningDeobfuscation = Zobrazovat varov\u00e1n\u00ed b\u011bhem zap\u00edn\u00e1n\u00ed/vyp\u00edn\u00e1n\u00ed deobfuskace. + +config.name.warningRenameIdentifiers = Varovat p\u0159i p\u0159ep\u00edn\u00e1n\u00ed autop\u0159ejm\u00e9nov\u00e1n\u00ed identifik\u00e1tor\u016f +config.description.warningRenameIdentifiers = Zobrazovat varov\u00e1n\u00ed b\u011bhem zap\u00edn\u00e1n\u00ed featury automatick\u00e9ho p\u0159ejmenov\u00e1n\u00ed identifik\u00e1tor\u016f. \ No newline at end of file diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties index 5f3011e4f..d3c21b2d5 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties @@ -1051,4 +1051,6 @@ button.deobfuscate = Deobfuscate button.deobfuscate_options = Deobfuscation options deobfuscate_options.simplify_expressions = Simplify expressions -deobfuscate_options.remove_obfuscated_declarations = Remove single assigned obfuscated declarations \ No newline at end of file +deobfuscate_options.remove_obfuscated_declarations = Remove single assigned obfuscated declarations + +message.confirm.autoRenameIdentifiers = Automatic identifiers renaming feature will walk AS code\r\nupon opening SWF file and renames all nonstandard names to valid identifiers.\r\nThis feature may damage the SWF file upon saving - USE IT AT YOUR OWN RISK. diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties index 0c3bf8998..d830e6557 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties @@ -1030,3 +1030,12 @@ transform.apply = Pou\u017e\u00edt transform.clear = Vy\u010distit status.editing = Jste v EDITA\u010cN\u00cdM re\u017eimu. Prove\u010fte zm\u011bny a stiskn\u011bte tla\u010d\u00edtko Ulo\u017eit. Nebo zru\u0161te zm\u011bny tla\u010d\u00edtkem Storno. B\u011bhem editace nelze p\u0159ep\u00ednat na jin\u00e9 polo\u017eky. + +#after 18.0.0 +button.deobfuscate = Deobfuskovat +button.deobfuscate_options = Mo\u017enosti deobfuskace + +deobfuscate_options.simplify_expressions = Zjednodu\u0161it v\u00fdrazy +deobfuscate_options.remove_obfuscated_declarations = Odstranit jednor\u00e1zov\u011b p\u0159i\u0159azen\u00e9 obfuskovan\u00e9 deklarace + +message.confirm.autoRenameIdentifiers = Mo\u017enost automatick\u00e9ho p\u0159ejmenov\u00e1n\u00ed prom\u011bnn\u00fdch projde AS k\u00f3d\r\npo otev\u0159en\u00ed SWF souboru a p\u0159ejmenuje v\u0161echny nestandardn\u00ed n\u00e1zvy na platn\u00e9 identifik\u00e1tory.\r\nTato mo\u017enost m\u016f\u017ee po ulo\u017een\u00ed po\u0161kodit SWF soubor - POU\u017d\u00cdVAT NA VLASTN\u00cd RIZIKO.