diff --git a/src/de/mas/wiiu/jnus/NUSTitle.java b/src/de/mas/wiiu/jnus/NUSTitle.java index c0de858..7ebcda2 100644 --- a/src/de/mas/wiiu/jnus/NUSTitle.java +++ b/src/de/mas/wiiu/jnus/NUSTitle.java @@ -26,6 +26,7 @@ import java.util.Optional; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; +import java.util.stream.Stream; import de.mas.wiiu.jnus.entities.TMD; import de.mas.wiiu.jnus.entities.Ticket; @@ -66,6 +67,25 @@ public class NUSTitle { return getFSTEntriesFlatByContents(new ArrayList(getTMD().getAllContents().values())); } + public Stream getAllFSTEntriesAsStream() { + return getAllFSTEntryChildrenAsStream(FST.getRoot()); + } + + public Stream getAllFSTEntryChildrenAsStream(FSTEntry cur) { + return getAllFSTEntryChildrenAsStream(cur, false); + } + + public Stream getAllFSTEntryChildrenAsStream(FSTEntry cur, boolean allowNotInPackage) { + return cur.getChildren().stream() // + .filter(e -> allowNotInPackage || !e.isNotInPackage()) // + .flatMap(e -> { + if (!e.isDir()) { + return Stream.empty(); + } + return getAllFSTEntryChildrenAsStream(e, allowNotInPackage); + }); + } + public FSTEntry getFSTEntryByFullPath(String givenFullPath) { String fullPath = givenFullPath.replace("/", File.separator); if (!fullPath.startsWith(File.separator)) {