mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
In-Game downloading Part 2:
1) Download Set Pictures will now download token images also 2) removed the old card-pictures-tokens.txt file
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -17,7 +17,6 @@ res/blockdata/boosters.txt -text
|
|||||||
res/blockdata/formats.txt -text
|
res/blockdata/formats.txt -text
|
||||||
res/blockdata/setdata.txt svneol=native#text/plain
|
res/blockdata/setdata.txt svneol=native#text/plain
|
||||||
res/booster-decks -text
|
res/booster-decks -text
|
||||||
res/card-pictures-token.txt -text
|
|
||||||
res/cardTemplateScript.py -text svneol=unset#text/x-python
|
res/cardTemplateScript.py -text svneol=unset#text/x-python
|
||||||
res/cardsfolder/a/abandoned_outpost.txt svneol=native#text/plain
|
res/cardsfolder/a/abandoned_outpost.txt svneol=native#text/plain
|
||||||
res/cardsfolder/a/abattoir_ghoul.txt -text
|
res/cardsfolder/a/abattoir_ghoul.txt -text
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
[T]b_0_1_Thrull.jpg http://serv1.tcgimages.eu/img/cards/Duel_Decks_Divine_vs._Demonic/thrull_token_black_01.jpg
|
|
||||||
[T]b_1_1_faerie_rogue.jpg http://www.magickartenmarkt.de/img/cards/Morningtide/faerie_rogue_token.jpg
|
|
||||||
[T]b_1_1_rat.jpg http://www.magickartenmarkt.de/img/cards/Shadowmoor/rat_token_black_11.jpg
|
|
||||||
[T]b_20_20_marit_lage.jpg http://www.magickartenmarkt.de/img/cards/Game_Day_Cards/marit_lage_token.jpg
|
|
||||||
[T]b_2_2_zombie.jpg http://www.magickartenmarkt.de/img/cards/Shards_of_Alara/zombie_token_black_22.jpg
|
|
||||||
[T]bg_1_1_worm.jpg http://serv4.tcgimages.eu/img/cards/Eventide/worm_token_black_and_green_11.jpg
|
|
||||||
[T]c_0_1_eldrazi_spawn.jpg http://www.mtgmintcard.com/images/products/50/MAGIC-THE-GATHERING-EKDRAZI-SPAWN-1A-ROET001A.jpg
|
|
||||||
[T]c_1_1_shapeshifter.jpg http://www.magickartenmarkt.de/img/cards/Lorwyn/shapeshifter_token.jpg
|
|
||||||
[T]c_1_1_sliver.jpg http://www.magickartenmarkt.de/img/cards/Player_Rewards_Promos/sliver_token.jpg
|
|
||||||
[T]c_1_1_spirit.jpg http://serv3.tcgimages.eu/img/cards/Player_Rewards_Promos/spirit_token_white_112.jpg
|
|
||||||
[T]c_1_1_wasp.jpg http://www.magickartenmarkt.de/img/cards/Tenth_Edition/wasp_token.jpg
|
|
||||||
[T]c_3_4_gargoyle.jpg http://www.mtgmintcard.com/images/products/458/MAGIC-THE-GATHERING-GARGOYLE-TOKEN-M10C8.jpg
|
|
||||||
[T]c_5_5_tuktuk_the_returned.jpg http://www.mtgmintcard.com/images/products/89/MAGIC-THE-GATHERING-TUKTUK-THE-RETURNED-TOKEN-ROET005.jpg
|
|
||||||
[T]g_0_1_plant.jpg http://www.mtgmintcard.com/images/products/174/MAGIC-THE-GATHERING-PLANT-TOKEN-WWKC065.jpg
|
|
||||||
[T]g_1_1_elf_warrior.jpg http://www.magickartenmarkt.de/img/cards/Lorwyn/elf_warrior_token_green_11.jpg
|
|
||||||
[T]g_1_1_insect.jpg http://www.mtgmintcard.com/images/products/413/MAGIC-THE-GATHERING-INSECT-TOKEN-M10C6.jpg
|
|
||||||
[T]g_1_1_saproling.jpg http://www.magickartenmarkt.de/img/cards/Shards_of_Alara/saproling_token_green_11.jpg
|
|
||||||
@@ -13,7 +13,6 @@ booster-decks--file=booster-deck
|
|||||||
decks-dir--file=decks
|
decks-dir--file=decks
|
||||||
|
|
||||||
card-pictures--file=card-pictures.txt
|
card-pictures--file=card-pictures.txt
|
||||||
card-pictures_token_lq--file=card-pictures-token.txt
|
|
||||||
token-images--file=token-images.txt
|
token-images--file=token-images.txt
|
||||||
card-pictures_a--file=pics_link/card-pictures_a.txt
|
card-pictures_a--file=pics_link/card-pictures_a.txt
|
||||||
card-pictures_b--file=pics_link/card-pictures_b.txt
|
card-pictures_b--file=pics_link/card-pictures_b.txt
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import java.net.Proxy;
|
|||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
//import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import static java.lang.Integer.parseInt;
|
import static java.lang.Integer.parseInt;
|
||||||
import static javax.swing.JOptionPane.DEFAULT_OPTION;
|
import static javax.swing.JOptionPane.DEFAULT_OPTION;
|
||||||
@@ -123,14 +123,6 @@ public class Gui_DownloadSetPictures_LQ extends DefaultBoundedRangeModel impleme
|
|||||||
//Proxy config
|
//Proxy config
|
||||||
p0.add(addr);
|
p0.add(addr);
|
||||||
p0.add(port);
|
p0.add(port);
|
||||||
// JTextField[] tfs = {addr, port};
|
|
||||||
// String[] labels = {"Address", "Port"};
|
|
||||||
// for(int i = 0; i < labels.length; i++) {
|
|
||||||
// JPanel p1 = new JPanel(new BorderLayout());
|
|
||||||
// p0.add(p1);
|
|
||||||
//// p1.add(new JLabel(labels[i]), WEST);
|
|
||||||
// p1.add(tfs[i]);
|
|
||||||
// }
|
|
||||||
|
|
||||||
//Start
|
//Start
|
||||||
final JButton b = new JButton(ForgeProps.getLocalized(BUTTONS.START));
|
final JButton b = new JButton(ForgeProps.getLocalized(BUTTONS.START));
|
||||||
@@ -141,16 +133,13 @@ public class Gui_DownloadSetPictures_LQ extends DefaultBoundedRangeModel impleme
|
|||||||
b.setEnabled(false);
|
b.setEnabled(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// p0.add(b);
|
|
||||||
|
|
||||||
p0.add(Box.createVerticalStrut(5));
|
p0.add(Box.createVerticalStrut(5));
|
||||||
|
|
||||||
//Progress
|
//Progress
|
||||||
p0.add(bar);
|
p0.add(bar);
|
||||||
bar.setStringPainted(true);
|
bar.setStringPainted(true);
|
||||||
//bar.setString(ForgeProps.getLocalized(BAR_BEFORE_START));
|
|
||||||
bar.setString(card + "/" + cards.length);
|
bar.setString(card + "/" + cards.length);
|
||||||
//bar.setString(String.format(ForgeProps.getLocalized(card == cards.length? BAR_CLOSE:BAR_WAIT), this.card, cards.length));
|
|
||||||
Dimension d = bar.getPreferredSize();
|
Dimension d = bar.getPreferredSize();
|
||||||
d.width = 300;
|
d.width = 300;
|
||||||
bar.setPreferredSize(d);
|
bar.setPreferredSize(d);
|
||||||
@@ -230,8 +219,6 @@ public class Gui_DownloadSetPictures_LQ extends DefaultBoundedRangeModel impleme
|
|||||||
sb.append(String.format(ForgeProps.getLocalized(BAR_CLOSE), card, cards.length));
|
sb.append(String.format(ForgeProps.getLocalized(BAR_CLOSE), card, cards.length));
|
||||||
|
|
||||||
bar.setString(sb.toString());
|
bar.setString(sb.toString());
|
||||||
//bar.setString(String.format(ForgeProps.getLocalized(card == cards.length? BAR_CLOSE:BAR_WAIT), card,
|
|
||||||
// cards.length));
|
|
||||||
System.out.println(card + "/" + cards.length + " - " + a);
|
System.out.println(card + "/" + cards.length + " - " + a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -273,6 +260,10 @@ public class Gui_DownloadSetPictures_LQ extends DefaultBoundedRangeModel impleme
|
|||||||
BufferedOutputStream out;
|
BufferedOutputStream out;
|
||||||
|
|
||||||
File base = ForgeProps.getFile(IMAGE_BASE);
|
File base = ForgeProps.getFile(IMAGE_BASE);
|
||||||
|
File tokenBase = ForgeProps.getFile(IMAGE_TOKEN);
|
||||||
|
if (!tokenBase.exists()) {
|
||||||
|
tokenBase.mkdirs();
|
||||||
|
}
|
||||||
|
|
||||||
Random r = MyRandom.random;
|
Random r = MyRandom.random;
|
||||||
|
|
||||||
@@ -283,7 +274,6 @@ public class Gui_DownloadSetPictures_LQ extends DefaultBoundedRangeModel impleme
|
|||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ErrorViewer.showError(ex, ForgeProps.getLocalized(ERRORS.PROXY_CONNECT), addr.getText(),
|
ErrorViewer.showError(ex, ForgeProps.getLocalized(ERRORS.PROXY_CONNECT), addr.getText(),
|
||||||
port.getText());
|
port.getText());
|
||||||
// throw new RuntimeException("Gui_DownloadPictures : error 1 - " +ex);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,6 +285,7 @@ public class Gui_DownloadSetPictures_LQ extends DefaultBoundedRangeModel impleme
|
|||||||
try {
|
try {
|
||||||
String url = cards[card].url;
|
String url = cards[card].url;
|
||||||
String cName;
|
String cName;
|
||||||
|
|
||||||
if (cards[card].name.substring(0, 3).equals("[T]")) {
|
if (cards[card].name.substring(0, 3).equals("[T]")) {
|
||||||
base = ForgeProps.getFile(IMAGE_TOKEN);
|
base = ForgeProps.getFile(IMAGE_TOKEN);
|
||||||
cName = cards[card].name.substring(3, cards[card].name.length());
|
cName = cards[card].name.substring(3, cards[card].name.length());
|
||||||
@@ -344,7 +335,6 @@ public class Gui_DownloadSetPictures_LQ extends DefaultBoundedRangeModel impleme
|
|||||||
}
|
}
|
||||||
catch (MalformedURLException mURLe) {
|
catch (MalformedURLException mURLe) {
|
||||||
System.out.println("Error - possibly missing URL for: " + cards[card].name);
|
System.out.println("Error - possibly missing URL for: " + cards[card].name);
|
||||||
//Log.error("LQ Pictures", "Malformed URL for: "+cards[card].name, mURLe);
|
|
||||||
}
|
}
|
||||||
} catch (FileNotFoundException fnfe) {
|
} catch (FileNotFoundException fnfe) {
|
||||||
System.out.println("Error - the LQ picture for " + cards[card].name + " could not be found on the server. [" + cards[card].url + "] - " + fnfe.getMessage());
|
System.out.println("Error - the LQ picture for " + cards[card].name + " could not be found on the server. [" + cards[card].url + "] - " + fnfe.getMessage());
|
||||||
@@ -390,11 +380,10 @@ public class Gui_DownloadSetPictures_LQ extends DefaultBoundedRangeModel impleme
|
|||||||
* @return an array of {@link forge.Gui_DownloadSetPictures_LQ.mCard} objects.
|
* @return an array of {@link forge.Gui_DownloadSetPictures_LQ.mCard} objects.
|
||||||
*/
|
*/
|
||||||
private static mCard[] getNeededCards() {
|
private static mCard[] getNeededCards() {
|
||||||
//read all card names and urls
|
//read token names and urls
|
||||||
//mCard[] cardPlay = readFile(CARD_PICTURES);
|
mCard[] cardTokenLQ = readFile(TOKEN_IMAGES);
|
||||||
//mCard[] cardTokenLQ = readFile(CARD_PICTURES_TOKEN_LQ);
|
|
||||||
|
|
||||||
ArrayList<mCard> CList = new ArrayList<mCard>();
|
ArrayList<mCard> cList = new ArrayList<mCard>();
|
||||||
|
|
||||||
//File imgBase = ForgeProps.getFile(NewConstants.IMAGE_BASE);
|
//File imgBase = ForgeProps.getFile(NewConstants.IMAGE_BASE);
|
||||||
String URLBase = "http://cardforge.org/fpics/";
|
String URLBase = "http://cardforge.org/fpics/";
|
||||||
@@ -413,25 +402,32 @@ public class Gui_DownloadSetPictures_LQ extends DefaultBoundedRangeModel impleme
|
|||||||
int artsCnt = c.getCard().getSetInfo(SC3).getCopiesCount();
|
int artsCnt = c.getCard().getSetInfo(SC3).getCopiesCount();
|
||||||
String fn = CardUtil.buildIdealFilename(c.getName(), c.getArtIndex(), artsCnt);
|
String fn = CardUtil.buildIdealFilename(c.getName(), c.getArtIndex(), artsCnt);
|
||||||
//System.out.println(fn);
|
//System.out.println(fn);
|
||||||
CList.add(new mCard(SC3 + "/" + fn, URLBase + SC2 + "/" + Base64Coder.encodeString(fn, true), SC3));
|
cList.add(new mCard(SC3 + "/" + fn, URLBase + SC2 + "/" + Base64Coder.encodeString(fn, true), SC3));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File file;
|
||||||
|
File base = ForgeProps.getFile(IMAGE_TOKEN);
|
||||||
|
for (int i = 0; i < cardTokenLQ.length; i++) {
|
||||||
|
file = new File(base, cardTokenLQ[i].name.substring(3, cardTokenLQ[i].name.length()));
|
||||||
|
if (!file.exists()) cList.add(cardTokenLQ[i]);
|
||||||
|
}
|
||||||
|
|
||||||
//return all card names and urls that are needed
|
//return all card names and urls that are needed
|
||||||
mCard[] out = new mCard[CList.size()];
|
mCard[] out = new mCard[cList.size()];
|
||||||
CList.toArray(out);
|
cList.toArray(out);
|
||||||
|
|
||||||
for (int i = 0; i < out.length; i++) { System.out.println(out[i].name + " " + out[i].url); }
|
for (int i = 0; i < out.length; i++) { System.out.println(out[i].name + " " + out[i].url); }
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}//getNeededCards()
|
}//getNeededCards()
|
||||||
|
|
||||||
/* *//**
|
/**
|
||||||
* <p>readFile.</p>
|
* <p>readFile.</p>
|
||||||
*
|
*
|
||||||
* @param ABC a {@link java.lang.String} object.
|
* @param ABC a {@link java.lang.String} object.
|
||||||
* @return an array of {@link forge.Gui_DownloadSetPictures_LQ.mCard} objects.
|
* @return an array of {@link forge.Gui_DownloadSetPictures_LQ.mCard} objects.
|
||||||
*//*
|
*/
|
||||||
private static mCard[] readFile(String ABC) {
|
private static mCard[] readFile(String ABC) {
|
||||||
try {
|
try {
|
||||||
FileReader zrc = new FileReader(ForgeProps.getFile(ABC));
|
FileReader zrc = new FileReader(ForgeProps.getFile(ABC));
|
||||||
@@ -441,7 +437,7 @@ public class Gui_DownloadSetPictures_LQ extends DefaultBoundedRangeModel impleme
|
|||||||
StringTokenizer tok;
|
StringTokenizer tok;
|
||||||
|
|
||||||
line = in.readLine();
|
line = in.readLine();
|
||||||
while (line != null && (!line.equals(""))) {
|
while (line != null && (!line.equals("")) && !line.startsWith("#")) {
|
||||||
tok = new StringTokenizer(line);
|
tok = new StringTokenizer(line);
|
||||||
list.add(new mCard(tok.nextToken(), tok.nextToken(), ""));
|
list.add(new mCard(tok.nextToken(), tok.nextToken(), ""));
|
||||||
|
|
||||||
@@ -457,7 +453,7 @@ public class Gui_DownloadSetPictures_LQ extends DefaultBoundedRangeModel impleme
|
|||||||
throw new RuntimeException("Gui_DownloadPictures : readFile() error");
|
throw new RuntimeException("Gui_DownloadPictures : readFile() error");
|
||||||
}
|
}
|
||||||
}//readFile()
|
}//readFile()
|
||||||
*/
|
|
||||||
private class ProxyHandler implements ChangeListener {
|
private class ProxyHandler implements ChangeListener {
|
||||||
private int type;
|
private int type;
|
||||||
|
|
||||||
|
|||||||
@@ -32,8 +32,6 @@ public interface NewConstants {
|
|||||||
String TOKENS = "tokens";
|
String TOKENS = "tokens";
|
||||||
/** Constant <code>CARD_PICTURES="card-pictures"</code>. */
|
/** Constant <code>CARD_PICTURES="card-pictures"</code>. */
|
||||||
String CARD_PICTURES = "card-pictures";
|
String CARD_PICTURES = "card-pictures";
|
||||||
/** Constant <code>CARD_PICTURES_TOKEN_LQ="card-pictures_token_lq"</code>. */
|
|
||||||
String CARD_PICTURES_TOKEN_LQ = "card-pictures_token_lq";
|
|
||||||
/** Constant <code>CARD_PICTURES_A="card-pictures_a"</code>. */
|
/** Constant <code>CARD_PICTURES_A="card-pictures_a"</code>. */
|
||||||
String CARD_PICTURES_A = "card-pictures_a";
|
String CARD_PICTURES_A = "card-pictures_a";
|
||||||
/** Constant <code>CARD_PICTURES_B="card-pictures_b"</code>. */
|
/** Constant <code>CARD_PICTURES_B="card-pictures_b"</code>. */
|
||||||
|
|||||||
Reference in New Issue
Block a user