Skip to content

Commit

Permalink
Closes #207
Browse files Browse the repository at this point in the history
  • Loading branch information
lmgarret committed Mar 15, 2018
1 parent fbf4a1b commit 7366677
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
20 changes: 11 additions & 9 deletions src/com/gameroom/data/game/scraper/MSStoreScraper.java
Expand Up @@ -27,7 +27,7 @@
* @date 22/02/2018.
*/
public class MSStoreScraper {
private final static String TAG = "MSStoreScraper";
private final static String TAG = "MSStoreScraper: ";

private final static Pattern PATH_PATTERN = Pattern.compile("(.*)([a-z|A-Z]\\:\\\\.*)");
private final static Pattern DISPLAY_NAME_PATTERN = Pattern.compile("<DisplayName>(.*)<\\/DisplayName>");
Expand Down Expand Up @@ -64,6 +64,7 @@ public class MSStoreScraper {
/**
* Scans for a list of installed {@link MSStoreEntry} on the computer, excluding well known ones that are not games.
* Executes a callback function once an entry is found.
*
* @param appFoundHandler callback function/interface to be called when an entry is found
*/
public static void getApps(@NonNull OnMSAppFoundHandler appFoundHandler) {
Expand All @@ -85,13 +86,13 @@ public static void getApps(@NonNull OnMSAppFoundHandler appFoundHandler) {
appFoundHandler.handle(entry);
}
} catch (IOException e) {
LOGGER.error(e);
LOGGER.error(TAG + e);
}
}
}

} catch (IOException e) {
LOGGER.error(e);
LOGGER.error(TAG + e);
}
}

Expand All @@ -108,7 +109,7 @@ public static GameEntry shouldConsiderGame(MSStoreEntry msStoreEntry) {
false,
com.gameroom.data.game.entry.Platform.PC.getIGDBId()
);
return LevenshteinDistance.getClosestEntry(msStoreEntry.getName(),searchResults,MAX_LEVENSHTEIN_DISTANCE);
return LevenshteinDistance.getClosestEntry(msStoreEntry.getName(), searchResults, MAX_LEVENSHTEIN_DISTANCE);
} catch (UnirestException e) {
e.printStackTrace();
}
Expand Down Expand Up @@ -192,7 +193,7 @@ private void findRealIconPath() {
String iconsPath = virtualIconPath.substring(0, virtualIconPath.lastIndexOf(File.separator));
File[] iconFiles = new File(iconsPath).listFiles();
if (iconFiles == null) {
LOGGER.warn(TAG + ": Empty icons folder for " + displayName);
LOGGER.warn(TAG + "Empty icons folder for " + displayName);
return;
}

Expand All @@ -210,17 +211,18 @@ private void findRealIconPath() {
private void findExecutableFilePath() {
File[] subFiles = new File(path).listFiles();
if (subFiles == null) {
LOGGER.warn(TAG + ": Empty folder for " + displayName);
LOGGER.warn(TAG + "Empty folder for " + displayName);
return;
}

for (File f : subFiles) {
if (f.getName().endsWith(".exe")) {
executableFilePath = f.getAbsolutePath();
//LOGGER.debug(TAG + ": Found .exe for " + displayName + ", " + executableFilePath);
LOGGER.debug(TAG + "Found .exe for " + displayName + ", " + executableFilePath);
return;
}

}
LOGGER.debug(TAG + "Found no .exe for " + displayName + " in " + path);
}

/**
Expand Down Expand Up @@ -330,7 +332,7 @@ public boolean isInGameEntryCollection(Collection<GameEntry> entries) {
/**
* Callback interface used for scanning {@link MSStoreEntry}.
*/
public interface OnMSAppFoundHandler{
public interface OnMSAppFoundHandler {
void handle(MSStoreEntry msStoreEntry);
}
}
5 changes: 4 additions & 1 deletion src/com/gameroom/ui/scene/MainScene.java
Expand Up @@ -878,7 +878,10 @@ public ScrollPane getScrollPane() {
private void initKeyShortcuts() {
addEventFilter(javafx.scene.input.KeyEvent.KEY_PRESSED, event -> {
if (event.getCode() == KeyCode.ESCAPE) {
if (drawerMenu.isSubMenuOpened()) {
if(searchBar.isVisible()){
event.consume();
searchBar.hide();
}else if (drawerMenu.isSubMenuOpened()) {
event.consume();
drawerMenu.closeSubMenu(MainScene.this);
} else {
Expand Down

0 comments on commit 7366677

Please sign in to comment.