Search in sources :

Example 1 with BundleExternalEntry

use of info.ata4.junity.bundle.BundleExternalEntry in project disunity by ata4.

the class BundleProps method read.

static void read(Path propsFile, Bundle bundle) throws IOException {
    BundleProps props;
    try (Reader reader = Files.newBufferedReader(propsFile, CHARSET)) {
        props = new Gson().fromJson(reader, BundleProps.class);
    }
    BundleHeader header = bundle.header();
    header.compressed(props.compressed);
    header.streamVersion(props.streamVersion);
    header.unityVersion(new UnityVersion(props.unityVersion));
    header.unityRevision(new UnityVersion(props.unityRevision));
    String bundleName = PathUtils.getBaseName(propsFile);
    Path bundleDir = propsFile.resolveSibling(bundleName);
    props.files.stream().map(bundleDir::resolve).forEach(file -> {
        bundle.entries().add(new BundleExternalEntry(file));
    });
}
Also used : Path(java.nio.file.Path) BundleExternalEntry(info.ata4.junity.bundle.BundleExternalEntry) BundleHeader(info.ata4.junity.bundle.BundleHeader) Reader(java.io.Reader) Gson(com.google.gson.Gson) UnityVersion(info.ata4.junity.UnityVersion)

Aggregations

Gson (com.google.gson.Gson)1 UnityVersion (info.ata4.junity.UnityVersion)1 BundleExternalEntry (info.ata4.junity.bundle.BundleExternalEntry)1 BundleHeader (info.ata4.junity.bundle.BundleHeader)1 Reader (java.io.Reader)1 Path (java.nio.file.Path)1