Added 'notice' string to auto-update info
This commit is contained in:
parent
b5f02cbcc7
commit
6ea9e8b783
5 changed files with 39 additions and 12 deletions
|
@ -1,5 +1,8 @@
|
|||
Changelog
|
||||
|
||||
???:
|
||||
- Added "Return FTL to an unmodded state before switching to a new version"
|
||||
|
||||
1.2:
|
||||
- Added a commandline interface
|
||||
- Incorporated strict-then-sloppy XML parsing into the patch process
|
||||
|
|
|
@ -25,7 +25,7 @@ public class FTLModManager {
|
|||
private static final Logger log = LogManager.getLogger(FTLModManager.class);
|
||||
|
||||
public static final String APP_NAME = "Slipstream Mod Manager";
|
||||
public static final ComparableVersion APP_VERSION = new ComparableVersion( "1.2" );
|
||||
public static final ComparableVersion APP_VERSION = new ComparableVersion( "???" );
|
||||
public static final String APP_URL = "http://www.ftlgame.com/forum/viewtopic.php?f=12&t=17102";
|
||||
public static final String APP_AUTHOR = "Vhati";
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import net.vhati.modmanager.core.ComparableVersion;
|
|||
public class AutoUpdateInfo {
|
||||
private ComparableVersion latestVersion = null;
|
||||
private Map<String,String> latestURLs = new TreeMap<String,String>();
|
||||
private String notice = null;
|
||||
private Map<ComparableVersion,List<String>> changelog = new TreeMap<ComparableVersion,List<String>>( Collections.reverseOrder() );
|
||||
|
||||
|
||||
|
@ -26,6 +27,15 @@ public class AutoUpdateInfo {
|
|||
}
|
||||
|
||||
|
||||
public void setNotice( String s ) {
|
||||
notice = s;
|
||||
}
|
||||
|
||||
public String getNotice() {
|
||||
return notice;
|
||||
}
|
||||
|
||||
|
||||
public void putLatestURL( String os, String url ) {
|
||||
latestURLs.put( os, url );
|
||||
}
|
||||
|
@ -35,6 +45,7 @@ public class AutoUpdateInfo {
|
|||
}
|
||||
|
||||
|
||||
|
||||
public Map<String,String> getLatestURLs() {
|
||||
return latestURLs;
|
||||
}
|
||||
|
|
|
@ -49,6 +49,8 @@ public class JacksonAutoUpdateReader {
|
|||
aui.putLatestURL( entry.getKey(), entry.getValue().textValue() );
|
||||
}
|
||||
|
||||
aui.setNotice( latestNode.get( "notice" ).textValue() );
|
||||
|
||||
JsonNode changelogNode = historyNode.get( "changelog" );
|
||||
|
||||
for ( JsonNode releaseNode : changelogNode ) {
|
||||
|
|
|
@ -679,20 +679,11 @@ public class ManagerFrame extends JFrame implements ActionListener, HashObserver
|
|||
public void showAppUpdateInfo() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
|
||||
for ( Map.Entry<ComparableVersion,List<String>> entry : appUpdateInfo.getChangelog().entrySet() ) {
|
||||
if ( appVersion.compareTo( entry.getKey() ) >= 0 ) break;
|
||||
|
||||
if ( buf.length() > 0 ) buf.append( "\n" );
|
||||
buf.append( entry.getKey() ).append( ":\n" );
|
||||
|
||||
for ( String change : entry.getValue() ) {
|
||||
buf.append( " - " ).append( change ).append( "\n" );
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
infoArea.clear();
|
||||
infoArea.appendTitleText( "What's New\n" );
|
||||
|
||||
// Links.
|
||||
infoArea.appendRegularText( String.format( "Version %s: ", appUpdateInfo.getLatestVersion().toString() ) );
|
||||
boolean first = true;
|
||||
for ( Map.Entry<String,String> entry : appUpdateInfo.getLatestURLs().entrySet() ) {
|
||||
|
@ -704,7 +695,27 @@ public class ManagerFrame extends JFrame implements ActionListener, HashObserver
|
|||
}
|
||||
infoArea.appendRegularText( "\n" );
|
||||
infoArea.appendRegularText( "\n" );
|
||||
|
||||
// Notice.
|
||||
if ( appUpdateInfo.getNotice() != null && appUpdateInfo.getNotice().length() > 0 ) {
|
||||
infoArea.appendRegularText( appUpdateInfo.getNotice() );
|
||||
infoArea.appendRegularText( "\n" );
|
||||
infoArea.appendRegularText( "\n" );
|
||||
}
|
||||
|
||||
// Changelog.
|
||||
for ( Map.Entry<ComparableVersion,List<String>> entry : appUpdateInfo.getChangelog().entrySet() ) {
|
||||
if ( appVersion.compareTo( entry.getKey() ) >= 0 ) break;
|
||||
|
||||
if ( buf.length() > 0 ) buf.append( "\n" );
|
||||
buf.append( entry.getKey() ).append( ":\n" );
|
||||
|
||||
for ( String change : entry.getValue() ) {
|
||||
buf.append( " - " ).append( change ).append( "\n" );
|
||||
}
|
||||
}
|
||||
infoArea.appendRegularText( buf.toString() );
|
||||
|
||||
infoArea.setCaretPosition( 0 );
|
||||
}
|
||||
catch ( Exception e ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue