Skip to content

Commit

Permalink
Added #2005 Export files to directories by bundle names on multiple b…
Browse files Browse the repository at this point in the history
…undle (zips, etc.) selection
  • Loading branch information
jindrapetrik committed Oct 18, 2023
1 parent 1c41c54 commit 2f5a186
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
opening dialogs on same screen as the main window,
do not restore window size to larger value that actual screen size
- [#1717] AS1/2/3 Option to hide P-code panel
- [#2005] Export files to directories by bundle names on multiple bundle (zips, etc.) selection

### Fixed
- [#1306], [#1768] Maximizing window on other than main monitor
Expand Down Expand Up @@ -3195,6 +3196,7 @@ Major version of SWF to XML export changed to 2.
[#1130]: https://www.free-decompiler.com/flash/issues/1130
[#1220]: https://www.free-decompiler.com/flash/issues/1220
[#1717]: https://www.free-decompiler.com/flash/issues/1717
[#2005]: https://www.free-decompiler.com/flash/issues/2005
[#1306]: https://www.free-decompiler.com/flash/issues/1306
[#1768]: https://www.free-decompiler.com/flash/issues/1768
[#2013]: https://www.free-decompiler.com/flash/issues/2013
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public boolean isBundle() {

@Override
public Openable getOpenable() {
throw new UnsupportedOperationException("Not supported.");
return null;
}

@Override
Expand Down
24 changes: 19 additions & 5 deletions src/com/jpexs/decompiler/flash/gui/MainPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -1899,11 +1899,18 @@ public List<File> exportSelection(List<TreeItem> selection, AbortRetryIgnoreHand
List<TreeItem> sel = getSelection(null, selection);

Set<Openable> usedOpenables = new HashSet<>();
Set<OpenableList> usedOpenableLists = new HashSet<>();

Map<OpenableList, Map<String, Integer>> usedSwfIdsInBundles = new HashMap<>();

for (TreeItem d : sel) {
Openable selectedNodeOpenable = d.getOpenable();
if (!usedOpenables.contains(selectedNodeOpenable)) {
usedOpenables.add(selectedNodeOpenable);
}
usedOpenables.add(selectedNodeOpenable);

OpenableList list = selectedNodeOpenable.getOpenableList();
if (list != null) {
usedOpenableLists.add(list);
}
}

Map<String, Integer> usedSwfsIds = new HashMap<>();
Expand Down Expand Up @@ -2026,8 +2033,15 @@ public List<File> exportSelection(List<TreeItem> selection, AbortRetryIgnoreHand
}

String selFile2;
if (usedOpenables.size() > 1) {
selFile2 = selFile + File.separator + Helper.getNextId(openable.getTitleOrShortFileName(), usedSwfsIds);
if (usedOpenables.size() > 1) {
if (usedOpenableLists.size() > 1 && openable.getOpenableList() != null && openable.getOpenableList().isBundle()) {
if (!usedSwfIdsInBundles.containsKey(openable.getOpenableList())) {
usedSwfIdsInBundles.put(openable.getOpenableList(), new HashMap<>());
}
selFile2 = selFile + File.separator + openable.getOpenableList().name + File.separator + Helper.getNextId(openable.getTitleOrShortFileName(), usedSwfIdsInBundles.get(openable.getOpenableList()));
} else {
selFile2 = selFile + File.separator + Helper.getNextId(openable.getTitleOrShortFileName(), usedSwfsIds);
}
} else {
selFile2 = selFile;
}
Expand Down

0 comments on commit 2f5a186

Please sign in to comment.