This commit is contained in:
Oleg Agafonov 2017-11-27 08:35:21 +04:00
parent c29bac08d8
commit ab7d386689
3 changed files with 7 additions and 12 deletions

View file

@ -98,7 +98,7 @@ public final class Constants {
// resources - sets
public static final String RESOURCE_PATH_SETS = File.separator + "sets";
public static final String RESOURCE_SET_FOLDER_SMALL = "small";
public static final String RESOURCE_SET_FOLDER_MEDIUM = ""; // empty, medium images laydown in "sets" folder
public static final String RESOURCE_SET_FOLDER_MEDIUM = ""; // empty, medium images laydown in "sets" folder, TODO: delete that and auto gen, use png for html, not gif
public static final String RESOURCE_SET_FOLDER_SVG = "svg";
public enum ResourceSetSize {
SMALL,

View file

@ -27,7 +27,6 @@ import mage.cards.repository.CardCriteria;
import mage.cards.repository.CardInfo;
import mage.cards.repository.CardRepository;
import mage.client.MageFrame;
import mage.client.constants.Constants;
import mage.client.dialog.PreferencesDialog;
import mage.client.util.sets.ConstructedFormats;
import mage.remote.Connection;
@ -40,6 +39,8 @@ import org.mage.plugins.card.dl.sources.*;
import org.mage.plugins.card.properties.SettingsManager;
import org.mage.plugins.card.utils.CardImageUtils;
import static org.mage.plugins.card.utils.CardImageUtils.getImagesDir;
public class DownloadPictures extends DefaultBoundedRangeModel implements Runnable {
private static DownloadPictures instance;
@ -541,7 +542,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
public void run() {
this.cardIndex = 0;
File base = new File(Constants.IO.DEFAULT_IMAGES_DIR);
File base = new File(getImagesDir());
if (!base.exists()) {
base.mkdir();
}
@ -694,7 +695,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
}
// gen temp file (download to images folder)
String tempPath = CardImageUtils.getImagesDir() + File.separator + "downloading" + File.separator;
String tempPath = getImagesDir() + File.separator + "downloading" + File.separator;
if(useSpecifiedPaths){
fileTempImage = new TFile(tempPath + actualFilename + "-" + card.hashCode() + ".jpg");
}else{
@ -939,7 +940,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
iwp.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
iwp.setCompressionQuality(0.96f);
File tempFile = new File(Constants.IO.DEFAULT_IMAGES_DIR + File.separator + image.hashCode() + file.getName());
File tempFile = new File(getImagesDir() + File.separator + image.hashCode() + file.getName());
FileImageOutputStream output = new FileImageOutputStream(tempFile);
writer.setOutput(output);
IIOImage image2 = new IIOImage(image, null, null);

View file

@ -237,16 +237,10 @@ public final class CardImageUtils {
}
public static String generateFaceImagePath(String cardname, String set) {
String useDefault = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_USE_DEFAULT, "true");
String imagesPath = Objects.equals(useDefault, "true") ? Constants.IO.DEFAULT_IMAGES_DIR : PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_PATH, null);
String imageDir = imagesPath;
String imageName = set + TFile.separator + cardname + ".jpg";
return imageDir + TFile.separator + "FACE" + TFile.separator + imageName;
return getImagesDir() + File.separator + "FACE" + File.separator + set + File.separator + prepareCardNameForFile(cardname) + File.separator + ".jpg";
}
public static String generateTokenDescriptorImagePath(CardDownloadData card) {
// String useDefault = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_USE_DEFAULT, "true");
// String imagesPath = Objects.equals(useDefault, "true") ? null : PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_PATH, null);
String straightImageFile = buildImagePathToTokenDescriptor(card);
TFile file = new TFile(straightImageFile);