Package com.skcraft.launcher.model.modpack

Examples of com.skcraft.launcher.model.modpack.Manifest


        // Initialize
        SimpleLogFormatter.configureGlobalLogger();
        ObjectMapper mapper = new ObjectMapper();
        mapper.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT);

        Manifest manifest = new Manifest();
        manifest.setMinimumVersion(Manifest.MIN_PROTOCOL_VERSION);
        PackageBuilder builder = new PackageBuilder(mapper, manifest);
        builder.setPrettyPrint(options.isPrettyPrinting());

        // From config
        builder.readConfig(options.getConfigPath());
        builder.readVersionManifest(options.getVersionManifestPath());

        // From options
        manifest.updateName(options.getName());
        manifest.updateTitle(options.getTitle());
        manifest.updateGameVersion(options.getGameVersion());
        manifest.setVersion(options.getVersion());
        manifest.setLibrariesLocation(options.getLibrariesLocation());
        manifest.setObjectsLocation(options.getObjectsLocation());

        builder.scan(options.getFilesDir());
        builder.addFiles(options.getFilesDir(), options.getObjectsDir());
        builder.writeManifest(options.getManifestPath());
View Full Code Here


        Persistence.commitAndForget(instance);

        // Read manifest
        log.info("Reading package manifest...");
        progress = new DefaultProgress(-1, _("instanceUpdater.readingManifest"));
        Manifest manifest = installPackage(installer, instance);

        // Update instance from manifest
        manifest.update(instance);

        // Read version manifest
        log.info("Reading version manifest...");
        progress = new DefaultProgress(-1, _("instanceUpdater.readingVersion"));
        VersionManifest version = readVersionManifest(manifest);

        progress = new DefaultProgress(-1, _("instanceUpdater.buildingDownloadList"));

        // Install the .jar
        File jarPath = launcher.getJarPath(version);
        URL jarSource = launcher.propUrl("jarUrl", version.getId());
        log.info("JAR at " + jarPath.getAbsolutePath() + ", fetched from " + jarSource);
        installJar(installer, jarPath, jarSource);

        // Download libraries
        log.info("Enumerating libraries to download...");

        URL url = manifest.getLibrariesUrl();
        if (url != null) {
            log.info("Added library source: " + url);
            librarySources.add(url);
        }

        progress = new DefaultProgress(-1, _("instanceUpdater.collectingLibraries"));
        installLibraries(installer, version, launcher.getLibrariesDir(), librarySources);

        // Download assets
        log.info("Enumerating assets to download...");
        progress = new DefaultProgress(-1, _("instanceUpdater.collectingAssets"));
        installAssets(installer, version, launcher.propUrl("assetsIndexUrl", version.getAssetsIndex()), assetsSources);

        log.info("Executing download phase...");
        progress = ProgressFilter.between(installer.getDownloader(), 0, 0.98);
        installer.download();

        log.info("Executing install phase...");
        progress = ProgressFilter.between(installer, 0.98, 1);
        installer.execute();

        log.info("Completing...");
        complete();

        // Update the instance's information
        log.info("Writing instance information...");
        instance.setVersion(manifest.getVersion());
        instance.setUpdatePending(false);
        instance.setInstalled(true);
        instance.setLocal(true);
        Persistence.commitAndForget(instance);

        log.log(Level.INFO, instance.getName() +
                " has been updated to version " + manifest.getVersion() + ".");
    }
View Full Code Here

        final InstallLog currentLog = new InstallLog();
        currentLog.setBaseDir(contentDir);
        final UpdateCache updateCache = Persistence.read(cachePath, UpdateCache.class);
        final FeatureCache featuresCache = Persistence.read(featuresPath, FeatureCache.class);

        Manifest manifest = HttpRequest
                .get(instance.getManifestURL())
                .execute()
                .expectResponseCode(200)
                .returnContent()
                .saveContent(instance.getManifestPath())
                .asJson(Manifest.class);

        if (manifest.getMinimumVersion() > Launcher.PROTOCOL_VERSION) {
            throw new LauncherException("Update required", _("errors.updateRequiredError"));
        }

        if (manifest.getBaseUrl() == null) {
            manifest.setBaseUrl(instance.getManifestURL());
        }

        final List<Feature> features = manifest.getFeatures();
        if (!features.isEmpty()) {
            for (Feature feature : features) {
                Boolean last = featuresCache.getSelected().get(feature.getName());
                if (last != null) {
                    feature.setSelected(last);
                }
            }

            Collections.sort(features);

            SwingUtilities.invokeAndWait(new Runnable() {
                @Override
                public void run() {
                    new FeatureSelectionDialog(ProgressDialog.getLastDialog(), features).setVisible(true);
                }
            });

            for (Feature feature : features) {
                featuresCache.getSelected().put(Strings.nullToEmpty(feature.getName()), feature.isSelected());
            }
        }

        for (ManifestEntry entry : manifest.getTasks()) {
            entry.install(installer, currentLog, updateCache, contentDir);
        }

        executeOnCompletion.add(new Runnable() {
            @Override
View Full Code Here

TOP

Related Classes of com.skcraft.launcher.model.modpack.Manifest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.