Added 'no info... yet' message while scanning new mods

This commit is contained in:
Vhati 2013-10-18 22:34:12 -04:00
parent b8c788fcfc
commit ac8c41d0bb
4 changed files with 52 additions and 23 deletions

View file

@ -1,6 +1,7 @@
Changelog Changelog
???: ???:
- Added 'no info... yet' message when mods/ scan is still in-progress
- Changed FTLDat to allow opening dats in read-only mode - Changed FTLDat to allow opening dats in read-only mode
1.4: 1.4:

View file

@ -81,6 +81,8 @@ public class ForumScraper {
ignoredURLs.add( "http://www.moddb.com/mods/better-planets-and-backgrounds/downloads/better-asteroids" ); ignoredURLs.add( "http://www.moddb.com/mods/better-planets-and-backgrounds/downloads/better-asteroids" );
ignoredURLs.add( "http://www.ftlgame.com/forum/viewtopic.php?f=4&t=2947" ); ignoredURLs.add( "http://www.ftlgame.com/forum/viewtopic.php?f=4&t=2947" );
ignoredURLs.add( "http://www.ftlgame.com/forum/viewtopic.php?f=12&t=11604" ); ignoredURLs.add( "http://www.ftlgame.com/forum/viewtopic.php?f=12&t=11604" );
// Hissatsu's post on "Advanced Battle Systems".
ignoredURLs.add( "http://www.ftlgame.com/forum/viewtopic.php?f=11&t=11469&start=60#p55171" );
// SpaceDock is an app. // SpaceDock is an app.
ignoredURLs.add( "http://www.ftlgame.com/forum/viewtopic.php?f=11&t=16842" ); ignoredURLs.add( "http://www.ftlgame.com/forum/viewtopic.php?f=11&t=16842" );
// Beginning Scrap Advantage is bundled in GMM. // Beginning Scrap Advantage is bundled in GMM.

View file

@ -122,6 +122,7 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse
private String appAuthor; private String appAuthor;
private HashMap<File,String> modFileHashes = new HashMap<File,String>(); private HashMap<File,String> modFileHashes = new HashMap<File,String>();
private HashMap<String,Date> modFileDates = new HashMap<String,Date>();
private ModDB catalogModDB = new ModDB(); private ModDB catalogModDB = new ModDB();
private ModDB localModDB = new ModDB(); private ModDB localModDB = new ModDB();
@ -635,19 +636,43 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse
infoArea.setDescription( modInfo.getTitle(), modInfo.getAuthor(), modInfo.getVersion(), modInfo.getURL(), modInfo.getDescription() ); infoArea.setDescription( modInfo.getTitle(), modInfo.getAuthor(), modInfo.getVersion(), modInfo.getURL(), modInfo.getDescription() );
} }
else { else {
boolean notYetReady = false;
managerLock.lock();
try {
notYetReady = scanning;
}
finally {
managerLock.unlock();
}
if ( notYetReady ) {
String body = "";
body += "No info is currently available for the selected mod.\n\n";
body += "But Slipstream has not yet finished scanning the mods/ folder. ";
body += "Try clicking this mod again after waiting a few seconds.";
infoArea.setDescription( modFileInfo.getName(), body );
}
else {
Date modDate = modFileDates.get( modHash );
if ( modDate == null ) {
long epochTime = -1; long epochTime = -1;
try { try {
epochTime = ModUtilities.getModFileTime( modFileInfo.getFile() ); epochTime = ModUtilities.getModFileTime( modFileInfo.getFile() );
} catch ( IOException e ) { } catch ( IOException e ) {
log.error( String.format( "Error while getting modified time of mod file contents for \"%s\".", modFileInfo.getFile() ), e ); log.error( String.format( "Error while getting modified time of mod file contents for \"%s\".", modFileInfo.getFile() ), e );
} }
if ( epochTime != -1 ) {
modDate = new Date( epochTime );
modFileDates.put( modHash, modDate );
}
}
String body = ""; String body = "";
body += "No info is available for the selected mod.\n\n"; body += "No info is available for the selected mod.\n\n";
if ( epochTime != -1 ) { if ( modDate != null ) {
SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy/MM/dd" ); SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy/MM/dd" );
String dateString = dateFormat.format( new Date( epochTime ) ); String dateString = dateFormat.format( modDate );
body += "It was released sometime after "+ dateString +".\n\n"; body += "It was released sometime after "+ dateString +".\n\n";
} else { } else {
body += "The date of its release could not be determined.\n\n"; body += "The date of its release could not be determined.\n\n";
@ -661,6 +686,7 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse
infoArea.setDescription( modFileInfo.getName(), body ); infoArea.setDescription( modFileInfo.getName(), body );
} }
} }
}
public void exitApp() { public void exitApp() {
this.setVisible( false ); this.setVisible( false );