A hardcode to use cards from 6ED whenever S00 card is not found

This commit is contained in:
Maxmtg
2013-03-09 06:50:53 +00:00
parent be80c5582e
commit 3e6d4ecc0c

View File

@@ -32,14 +32,14 @@ final class ImageLoader extends CacheLoader<String, BufferedImage> {
path = ForgeProps.getFile(NewConstants.IMAGE_BASE); path = ForgeProps.getFile(NewConstants.IMAGE_BASE);
} }
File file = null; File file = makeImageFile(path, filename);
boolean isPng = filename.endsWith(".png"); boolean fileExists = file.exists();
final String fName = isPng || filename.endsWith(".jpg") ? filename : filename + ".jpg"; if (!fileExists && filename.startsWith("S00") ) {
file = new File(path, fName); file = makeImageFile(path, filename.replace("S00", "6ED"));
if (!file.exists()) { fileExists = file.exists();
// DEBUG }
//System.out.println("File not found, no image created: " if (!fileExists ) {
//+ file); //System.out.println("File not found, no image created: " + file);
return null; return null;
} }
final BufferedImage image = getImage(file); final BufferedImage image = getImage(file);
@@ -47,6 +47,18 @@ final class ImageLoader extends CacheLoader<String, BufferedImage> {
return image; return image;
} }
/**
* TODO: Write javadoc for this method.
* @param path
* @param filename
* @return
*/
private File makeImageFile(File path, String filename) {
boolean isPng = filename.endsWith(".png");
final String fName = isPng || filename.endsWith(".jpg") ? filename : filename + ".jpg";
return new File(path, fName);
}
/** /**
* <p> * <p>
* getImage. * getImage.