use of info.ata4.junity.serialize.SerializedFileReader in project disunity by ata4.
the class AssetCommand method runFileRecursive.
@Override
protected void runFileRecursive(Path file) {
if (BundleUtils.isBundle(file)) {
// file is a bundle, load serialized files from it
try (BundleReader bundleReader = new BundleReader(file)) {
Bundle bundle = bundleReader.read();
bundle.entries().stream().filter(not(BundleEntry::isLibrary)).filter(not(BundleEntry::isResource)).forEach(uncheck(entry -> {
try (SerializedFileReader reader = new SerializedFileReader(BundleUtils.dataReaderForEntry(entry))) {
SerializedFile serialized = reader.read();
runSerializedFile(file.resolve(entry.name()), serialized);
}
}));
} catch (UncheckedIOException | IOException ex) {
L.log(Level.WARNING, "Can't open asset bundle " + file, ex);
}
} else {
// load file directly
try (SerializedFileReader reader = new SerializedFileReader(file)) {
SerializedFile serialized = reader.read();
runSerializedFile(file, serialized);
} catch (IOException ex) {
L.log(Level.WARNING, "Can't open asset file " + file, ex);
}
}
}
Aggregations