use of com.github.jakz.romlib.data.platforms.Platform in project rom-manager by Jakz.
the class MainFrame method rebuildEnabledDats.
public void rebuildEnabledDats() {
GameSet current = cbRomSets.getSelectedIndex() != -1 ? cbRomSets.getItemAt(cbRomSets.getSelectedIndex()) : null;
cbRomSets.setSelectedIndex(-1);
cbRomSets.removeAllItems();
List<Platform> platforms = Platforms.sortedValues();
List<GameSet> sets = GlobalSettings.settings.getEnabledProviders().stream().map(setManager::byIdent).collect(Collectors.toList());
platforms.forEach(s -> {
sets.stream().filter(rs -> rs.platform().equals(s)).forEach(cbRomSets::addItem);
});
if (current != null && sets.contains(current))
cbRomSets.setSelectedItem(current);
else if (cbRomSets.getItemCount() == 0)
gameListPanel.clearEverything();
}
use of com.github.jakz.romlib.data.platforms.Platform in project rom-manager by Jakz.
the class GameSetManager method buildRomsetList.
@SuppressWarnings("unchecked")
public void buildRomsetList() {
Set<ActualPluginBuilder> parsers = manager.getBuildersByType(PluginRealType.DAT_PARSER);
List<DatParserPlugin> datParsers = parsers.stream().map(b -> (DatParserPlugin) manager.build((Class<DatParserPlugin>) b.getID().getType())).collect(Collectors.toList());
Set<ActualPluginBuilder> builders = manager.getBuildersByType(PluginRealType.PROVIDER);
logger.d("Building available rom sets");
logger.ld("Found %d dat parsers: %s", () -> datParsers.size(), () -> datParsers.stream().map(p -> Arrays.toString(p.getSupportedFormats())).collect(Collectors.joining(", ")));
for (ActualPluginBuilder builder : builders) {
ProviderPlugin plugin = (ProviderPlugin) manager.build((Class<ProviderPlugin>) builder.getID().getType());
logger.d("Found ProviderPlugin: %s", plugin.getClass().getName());
GameSet[] rsets = plugin.buildRomSets(datParsers);
for (GameSet set : rsets) {
helpers.put(set, new MyGameSetFeatures(set));
List<GameSet> setsForPlatform = sets.computeIfAbsent(set.platform(), s -> new ArrayList<>());
setsForPlatform.add(set);
}
}
for (Platform platform : Platforms.values()) sets.computeIfAbsent(platform, s -> new ArrayList<>());
}
Aggregations