use of net.technicpack.launchercore.modpacks.packinfo.CombinedPackInfo in project LauncherV3 by TechnicPack.
the class ModpackSelector method selectWidget.
protected void selectWidget(ModpackWidget widget) {
if (selectedWidget != null)
selectedWidget.setIsSelected(false);
selectedWidget = widget;
selectedWidget.setIsSelected(true);
selectedWidget.getModpack().select();
selectedWidget.scrollRectToVisible(new Rectangle(selectedWidget.getSize()));
if (modpackInfoPanel != null)
modpackInfoPanel.setModpack(widget.getModpack());
final ModpackWidget refreshWidget = selectedWidget;
Thread thread = new Thread("Modpack redownload " + selectedWidget.getModpack().getDisplayName()) {
@Override
public void run() {
try {
PlatformPackInfo updatedInfo = platformApi.getPlatformPackInfo(refreshWidget.getModpack().getName());
PackInfo infoToUse = updatedInfo;
if (updatedInfo != null && updatedInfo.hasSolder()) {
try {
ISolderPackApi solderPack = solderApi.getSolderPack(updatedInfo.getSolder(), updatedInfo.getName(), solderApi.getMirrorUrl(updatedInfo.getSolder()));
infoToUse = new CombinedPackInfo(solderPack.getPackInfo(), updatedInfo);
} catch (RestfulAPIException ex) {
}
}
if (infoToUse != null)
refreshWidget.getModpack().setPackInfo(infoToUse);
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
if (modpackInfoPanel != null)
modpackInfoPanel.setModpackIfSame(refreshWidget.getModpack());
if (refreshWidget.getModpack().hasRecommendedUpdate()) {
refreshWidget.setToolTipText(resources.getString("launcher.packselector.updatetip"));
} else {
refreshWidget.setToolTipText(null);
}
iconRepo.refreshRetry(refreshWidget.getModpack());
refreshWidget.updateFromPack(iconRepo.startImageJob(refreshWidget.getModpack()));
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
revalidate();
repaint();
}
});
}
});
} catch (RestfulAPIException ex) {
ex.printStackTrace();
return;
}
}
};
thread.start();
}
use of net.technicpack.launchercore.modpacks.packinfo.CombinedPackInfo in project LauncherV3 by TechnicPack.
the class PlatformPackInfoRepository method getInfoFromPlatformInfo.
protected PackInfo getInfoFromPlatformInfo(PlatformPackInfo platformInfo) throws RestfulAPIException {
if (platformInfo != null && platformInfo.hasSolder()) {
try {
ISolderPackApi solderPack = solder.getSolderPack(platformInfo.getSolder(), platformInfo.getName(), solder.getMirrorUrl(platformInfo.getSolder()));
SolderPackInfo solderInfo = solderPack.getPackInfoForBulk();
if (solderInfo == null)
return platformInfo;
else
return new CombinedPackInfo(solderInfo, platformInfo);
} catch (RestfulAPIException ex) {
ex.printStackTrace();
return platformInfo;
}
} else {
return platformInfo;
}
}
Aggregations