2013-04-12 19:32:25 -07:00
|
|
|
package magic.data;
|
|
|
|
|
2014-08-16 03:22:28 -07:00
|
|
|
import java.net.MalformedURLException;
|
2013-04-12 19:32:25 -07:00
|
|
|
import java.net.URL;
|
2020-01-15 12:02:42 -08:00
|
|
|
|
2016-10-12 10:37:34 -07:00
|
|
|
import magic.model.IRenderableCard;
|
2014-08-16 03:22:28 -07:00
|
|
|
import magic.model.MagicCardDefinition;
|
2014-08-17 00:37:58 -07:00
|
|
|
import magic.utility.MagicFileSystem;
|
2013-04-12 19:32:25 -07:00
|
|
|
|
2014-08-28 08:50:30 -07:00
|
|
|
public class CardImageFile extends DownloadableFile {
|
2013-04-12 19:32:25 -07:00
|
|
|
|
2016-02-06 03:43:03 -08:00
|
|
|
private final MagicCardDefinition card;
|
2013-06-23 18:33:35 -07:00
|
|
|
|
2016-10-12 10:37:34 -07:00
|
|
|
public CardImageFile(IRenderableCard face) throws MalformedURLException {
|
|
|
|
super(
|
2017-01-21 00:21:40 -08:00
|
|
|
MagicFileSystem.getPrintedCardImage(face),
|
2016-10-12 10:37:34 -07:00
|
|
|
new URL(face.getImageUrl())
|
|
|
|
);
|
|
|
|
this.card = face.getCardDefinition();
|
|
|
|
}
|
|
|
|
|
2016-02-06 03:43:03 -08:00
|
|
|
public CardImageFile(final MagicCardDefinition aCard) throws MalformedURLException {
|
2015-12-12 01:26:22 -08:00
|
|
|
super(
|
2017-01-21 00:21:40 -08:00
|
|
|
MagicFileSystem.getPrintedCardImage(aCard),
|
2016-02-06 03:43:03 -08:00
|
|
|
new URL(aCard.getImageURL())
|
2015-12-12 01:26:22 -08:00
|
|
|
);
|
2016-02-06 03:43:03 -08:00
|
|
|
this.card = aCard;
|
2013-04-12 19:32:25 -07:00
|
|
|
}
|
|
|
|
|
2014-08-16 03:22:28 -07:00
|
|
|
public String getCardName() {
|
2016-02-06 03:43:03 -08:00
|
|
|
return card.getDistinctName();
|
|
|
|
}
|
|
|
|
|
|
|
|
public MagicCardDefinition getCard() {
|
|
|
|
return card;
|
2013-04-12 19:32:25 -07:00
|
|
|
}
|
2014-05-03 01:15:11 -07:00
|
|
|
|
2013-04-12 19:32:25 -07:00
|
|
|
}
|