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

@ -91,7 +91,7 @@ public class FTLModManager {
if ( !useDefaultUI.equals("true") ) { if ( !useDefaultUI.equals("true") ) {
try { try {
log.trace( "Using system Look and Feel" ); log.trace( "Using system Look and Feel" );
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
} }
catch (Exception e) { catch (Exception e) {
log.error( "Error setting system Look and Feel.", e ); log.error( "Error setting system Look and Feel.", e );
@ -120,7 +120,7 @@ public class FTLModManager {
if ( datsDir == null ) { if ( datsDir == null ) {
datsDir = FTLUtilities.findDatsDir(); datsDir = FTLUtilities.findDatsDir();
if ( datsDir != null ) { if ( datsDir != null ) {
int response = JOptionPane.showConfirmDialog(null, "FTL resources were found in:\n"+ datsDir.getPath() +"\nIs this correct?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); int response = JOptionPane.showConfirmDialog( null, "FTL resources were found in:\n"+ datsDir.getPath() +"\nIs this correct?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE );
if ( response == JOptionPane.NO_OPTION ) datsDir = null; if ( response == JOptionPane.NO_OPTION ) datsDir = null;
} }
@ -196,6 +196,6 @@ public class FTLModManager {
private static void showErrorDialog( String message ) { private static void showErrorDialog( String message ) {
JOptionPane.showMessageDialog(null, message, "Error", JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog( null, message, "Error", JOptionPane.ERROR_MESSAGE );
} }
} }

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,30 +636,55 @@ 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 {
long epochTime = -1; boolean notYetReady = false;
managerLock.lock();
try { try {
epochTime = ModUtilities.getModFileTime( modFileInfo.getFile() ); notYetReady = scanning;
} catch ( IOException e ) {
log.error( String.format( "Error while getting modified time of mod file contents for \"%s\".", modFileInfo.getFile() ), e );
} }
finally {
String body = ""; managerLock.unlock();
body += "No info is available for the selected mod.\n\n";
if ( epochTime != -1 ) {
SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy/MM/dd" );
String dateString = dateFormat.format( new Date( epochTime ) );
body += "It was released sometime after "+ dateString +".\n\n";
} else {
body += "The date of its release could not be determined.\n\n";
} }
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.";
body += "If it is stable and has been out for over a month,\n"; infoArea.setDescription( modFileInfo.getName(), body );
body += "please let the Slipstream devs know where you "; }
body += "found it.\n\n"; else {
body += "Include the mod's version, and this hash.\n"; Date modDate = modFileDates.get( modHash );
body += "MD5: "+ modHash +"\n"; if ( modDate == null ) {
infoArea.setDescription( modFileInfo.getName(), body ); long epochTime = -1;
try {
epochTime = ModUtilities.getModFileTime( modFileInfo.getFile() );
} catch ( IOException 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 = "";
body += "No info is available for the selected mod.\n\n";
if ( modDate != null ) {
SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy/MM/dd" );
String dateString = dateFormat.format( modDate );
body += "It was released sometime after "+ dateString +".\n\n";
} else {
body += "The date of its release could not be determined.\n\n";
}
body += "If it is stable and has been out for over a month,\n";
body += "please let the Slipstream devs know where you ";
body += "found it.\n\n";
body += "Include the mod's version, and this hash.\n";
body += "MD5: "+ modHash +"\n";
infoArea.setDescription( modFileInfo.getName(), body );
}
} }
} }