diff --git a/skel_common/readme_changelog.txt b/skel_common/readme_changelog.txt index 767c889..a14b3d9 100644 --- a/skel_common/readme_changelog.txt +++ b/skel_common/readme_changelog.txt @@ -1,6 +1,7 @@ Changelog ???: +- Added 'no info... yet' message when mods/ scan is still in-progress - Changed FTLDat to allow opening dats in read-only mode 1.4: diff --git a/src/main/java/net/vhati/modmanager/FTLModManager.java b/src/main/java/net/vhati/modmanager/FTLModManager.java index 2c886b1..bd4d8b5 100644 --- a/src/main/java/net/vhati/modmanager/FTLModManager.java +++ b/src/main/java/net/vhati/modmanager/FTLModManager.java @@ -91,7 +91,7 @@ public class FTLModManager { if ( !useDefaultUI.equals("true") ) { try { log.trace( "Using system Look and Feel" ); - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() ); } catch (Exception e) { log.error( "Error setting system Look and Feel.", e ); @@ -120,7 +120,7 @@ public class FTLModManager { if ( datsDir == null ) { datsDir = FTLUtilities.findDatsDir(); 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; } @@ -196,6 +196,6 @@ public class FTLModManager { private static void showErrorDialog( String message ) { - JOptionPane.showMessageDialog(null, message, "Error", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog( null, message, "Error", JOptionPane.ERROR_MESSAGE ); } } diff --git a/src/main/java/net/vhati/modmanager/scraper/ForumScraper.java b/src/main/java/net/vhati/modmanager/scraper/ForumScraper.java index 0235cb1..52b38ce 100644 --- a/src/main/java/net/vhati/modmanager/scraper/ForumScraper.java +++ b/src/main/java/net/vhati/modmanager/scraper/ForumScraper.java @@ -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.ftlgame.com/forum/viewtopic.php?f=4&t=2947" ); 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. ignoredURLs.add( "http://www.ftlgame.com/forum/viewtopic.php?f=11&t=16842" ); // Beginning Scrap Advantage is bundled in GMM. diff --git a/src/main/java/net/vhati/modmanager/ui/ManagerFrame.java b/src/main/java/net/vhati/modmanager/ui/ManagerFrame.java index 1a1f1cf..f6938c1 100644 --- a/src/main/java/net/vhati/modmanager/ui/ManagerFrame.java +++ b/src/main/java/net/vhati/modmanager/ui/ManagerFrame.java @@ -122,6 +122,7 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse private String appAuthor; private HashMap modFileHashes = new HashMap(); + private HashMap modFileDates = new HashMap(); private ModDB catalogModDB = 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() ); } else { - long epochTime = -1; + boolean notYetReady = false; + managerLock.lock(); 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 ); + notYetReady = scanning; } - - String body = ""; - 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"; + 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."; - 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 ); + infoArea.setDescription( modFileInfo.getName(), body ); + } + else { + Date modDate = modFileDates.get( modHash ); + if ( modDate == null ) { + 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 ); + } } }