diff --git a/.gitattributes b/.gitattributes index 1e667eead24..442e0176eb0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -17,7 +17,6 @@ res/blockdata/boosters.txt -text res/blockdata/formats.txt -text res/blockdata/setdata.txt svneol=native#text/plain res/booster-decks -text -res/card-pictures-token.txt -text res/cardTemplateScript.py -text svneol=unset#text/x-python res/cardsfolder/a/abandoned_outpost.txt svneol=native#text/plain res/cardsfolder/a/abattoir_ghoul.txt -text diff --git a/res/card-pictures-token.txt b/res/card-pictures-token.txt deleted file mode 100644 index 3a2ea239040..00000000000 --- a/res/card-pictures-token.txt +++ /dev/null @@ -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 [T]g_1_1_snake.jpg http://www.mtgmintcard.com/images/products/408/MAGIC-THE-GATHERING-SNAKE-TOKEN-ZENC112.jpg [T]g_1_1_squirrel.jpg http://www.magickartenmarkt.de/img/cards/Player_Rewards_Promos/squirrel_token.jpg [T]g_2_2_bear.jpg http://www.magickartenmarkt.de/img/cards/Player_Rewards_Promos/bear_token1.jpg [T]g_2_2_lizard.jpg http://www.magickartenmarkt.de/img/cards/Alara_Reborn/lizard_token_green_22.jpg [T]g_2_2_wolf.jpg http://www.magickartenmarkt.de/img/cards/Zendikar/wolf_token_green_22.jpg [T]g_2_5_treefolk_shaman.jpg http://www.magickartenmarkt.de/img/cards/Morningtide/treefolk_shaman_token.jpg [T]g_3_3_beast.jpg http://www.magickartenmarkt.de/img/cards/Eventide/beast_token_green_33.jpg [T]g_3_3_elephant.jpg http://www.magickartenmarkt.de/img/cards/Player_Rewards_Promos/elephant_token2.jpg [T]g_4_4_beast.jpg http://www.magickartenmarkt.de/img/cards/Player_Rewards_Promos/beast_token_green_44.jpg [T]g_6_6_wurm.jpg http://www.magickartenmarkt.de/img/cards/Player_Rewards_Promos/wurm_token.jpg [T]gw_1_1_elf_warrior.jpg http://www.mtgmintcard.com/images/products/144/MAGIC-THE-GATHERING-TOKEN-ELF-WARRIOR-TOKEN-SHMC128.jpg -[T]r_1_1_goblin.jpg http://www.magickartenmarkt.de/img/cards/Shards_of_Alara/goblin_token_red_11.jpg [T]r_3_1_elemental.jpg http://www.magickartenmarkt.de/img/cards/Conflux/elemental_token_red_31.jpg [T]r_3_1_elemental_haste.jpg http://www.mtgmintcard.com/images/products/448/MAGIC-THE-GATHERING-TOKEN-ELEMENTAL-TOKEN-SHMC129.jpg -[T]r_4_4_bird.jpg http://serv4.tcgimages.eu/img/cards/Player_Rewards_Promos/rukh_token.jpg -[T]r_4_4_dragon.jpg http://www.magickartenmarkt.de/img/cards/Shards_of_Alara/dragon_token_red_44.jpg [T]r_4_4_hellion.jpg http://www.mtgmintcard.com/images/products/304/MAGIC-THE-GATHERING-HELLION-TOKEN-ROET003.jpg [T]r_5_5_dragon.jpg http://www.magickartenmarkt.de/img/cards/Tenth_Edition/dragon_token.jpg [T]rg_1_1_dragon.jpg http://www.magickartenmarkt.de/img/cards/Alara_Reborn/dragon_token_red_and_green_11.jpg [T]rgw_8_8_beast.jpg http://www.magickartenmarkt.de/img/cards/Shards_of_Alara/beast_token_red_green_and_white_88.jpg [T]rw_1_1_goblin_soldier.jpg http://www.magickartenmarkt.de/img/cards/Eventide/goblin_soldier_token_red_and_white_11.jpg [T]u_1_1_bird.jpg http://www.magickartenmarkt.de/img/cards/Player_Rewards_Promos/bird_token_blue_11.jpg -[T]u_1_1_merfolk_wizard.jpg http://serv2.tcgimages.eu/img/cards/Lorwyn/merfolk_wizard_token.jpg [T]u_1_1_thopter.jpg http://serv3.tcgimages.eu/img/cards/Shards_of_Alara/thopter_token_blue_artifact_11.jpg -[T]ub_1_1_zombie_wizard.jpg http://www.magickartenmarkt.de/img/cards/Alara_Reborn/zombie_wizard_token_blue_and_black_11.jpg [T]w_0_1_goat.jpg http://www.magickartenmarkt.de/img/cards/Eventide/goat_token_white_01.jpg [T]w_1_1_bird.jpg http://www.magickartenmarkt.de/img/cards/Zendikar/bird_token_white_11.jpg [T]w_1_1_kithkin_soldier.jpg http://www.magickartenmarkt.de/img/cards/Lorwyn/kithkin_soldier_token_white_11.jpg [T]w_1_1_kor_soldier.jpg http://www.mtgmintcard.com/images/products/396/MAGIC-THE-GATHERING-KOR-SOLDIER-TOKEN-ZENC103.jpg [T]w_1_1_soldier.jpg http://www.magickartenmarkt.de/img/cards/Shards_of_Alara/soldier_token_white_11.jpg [T]w_1_1_soldier_ally.jpg http://www.mtgmintcard.com/images/products/5/MAGIC-THE-GATHERING-SOLDIER-ALLY-WWKC066.jpg -[T]w_1_1_spirit.jpg http://www.magickartenmarkt.de/img/cards/Shadowmoor/spirit_token_white_11.jpg [T]w_3_3_bird.jpg http://serv1.tcgimages.eu/img/cards/Magic_2011/bird_token_white_33.jpg [T]w_4_4_angel.jpg http://www.magickartenmarkt.de/img/cards/Conflux/angel_token_white_44.jpg [T]w_4_4_elemental.jpg http://www.mtgmintcard.com/images/products/286/MAGIC-THE-GATHERING-TOKEN-ELEMENTAL-TOKEN-LORC130.jpg [T]w_4_4_mirror_sigil_sergeant.jpg http://www.wizards.com/global/images/magic/general/mirror_sigil_sergeant.jpg [T]w_5_5_giant_warrior.jpg http://www.magickartenmarkt.de/img/cards/Morningtide/giant_warrior_token.jpg [T]w_n_n_avatar.jpg http://www.magickartenmarkt.de/img/cards/Lorwyn/avatar_token_white_xx.jpg -[T]b_X_X_minion.jpg http://serv4.tcgimages.eu/img/cards/Duel_Decks_Phyrexia_vs._The_Coalition/minion_token_black_xx.jpg -[T]c_1_1_myr.jpg http://serv3.tcgimages.eu/img/cards/New_Phyrexia/myr_token.jpg -[T]c_3_3_golem.jpg http://serv2.tcgimages.eu/img/cards/New_Phyrexia/golem_token_artifact_33.jpg -[T]r_X_X_elemental.jpg http://serv1.tcgimages.eu/img/cards/Rise_of_the_Eldrazi/elemental_token_red_xx.jpg -[T]ub_1_1_faerie_rogue.jpg http://serv2.tcgimages.eu/img/cards/Shadowmoor/faerie_rogue_token_blue_and_black_11.jpg \ No newline at end of file diff --git a/res/main.properties b/res/main.properties index 9700678f9bb..36bba05f513 100644 --- a/res/main.properties +++ b/res/main.properties @@ -13,7 +13,6 @@ booster-decks--file=booster-deck decks-dir--file=decks card-pictures--file=card-pictures.txt -card-pictures_token_lq--file=card-pictures-token.txt token-images--file=token-images.txt card-pictures_a--file=pics_link/card-pictures_a.txt card-pictures_b--file=pics_link/card-pictures_b.txt diff --git a/src/main/java/forge/Gui_DownloadSetPictures_LQ.java b/src/main/java/forge/Gui_DownloadSetPictures_LQ.java index 444d076ad32..248190d8032 100644 --- a/src/main/java/forge/Gui_DownloadSetPictures_LQ.java +++ b/src/main/java/forge/Gui_DownloadSetPictures_LQ.java @@ -26,7 +26,7 @@ import java.net.Proxy; import java.net.URL; import java.util.ArrayList; import java.util.Random; -//import java.util.StringTokenizer; +import java.util.StringTokenizer; import static java.lang.Integer.parseInt; import static javax.swing.JOptionPane.DEFAULT_OPTION; @@ -123,14 +123,6 @@ public class Gui_DownloadSetPictures_LQ extends DefaultBoundedRangeModel impleme //Proxy config p0.add(addr); 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 final JButton b = new JButton(ForgeProps.getLocalized(BUTTONS.START)); @@ -141,16 +133,13 @@ public class Gui_DownloadSetPictures_LQ extends DefaultBoundedRangeModel impleme b.setEnabled(false); } }); -// p0.add(b); p0.add(Box.createVerticalStrut(5)); //Progress p0.add(bar); bar.setStringPainted(true); - //bar.setString(ForgeProps.getLocalized(BAR_BEFORE_START)); 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(); d.width = 300; 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)); 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); } } @@ -273,6 +260,10 @@ public class Gui_DownloadSetPictures_LQ extends DefaultBoundedRangeModel impleme BufferedOutputStream out; File base = ForgeProps.getFile(IMAGE_BASE); + File tokenBase = ForgeProps.getFile(IMAGE_TOKEN); + if (!tokenBase.exists()) { + tokenBase.mkdirs(); + } Random r = MyRandom.random; @@ -283,7 +274,6 @@ public class Gui_DownloadSetPictures_LQ extends DefaultBoundedRangeModel impleme } catch (Exception ex) { ErrorViewer.showError(ex, ForgeProps.getLocalized(ERRORS.PROXY_CONNECT), addr.getText(), port.getText()); -// throw new RuntimeException("Gui_DownloadPictures : error 1 - " +ex); return; } @@ -295,6 +285,7 @@ public class Gui_DownloadSetPictures_LQ extends DefaultBoundedRangeModel impleme try { String url = cards[card].url; String cName; + if (cards[card].name.substring(0, 3).equals("[T]")) { base = ForgeProps.getFile(IMAGE_TOKEN); 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) { 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) { 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. */ private static mCard[] getNeededCards() { - //read all card names and urls - //mCard[] cardPlay = readFile(CARD_PICTURES); - //mCard[] cardTokenLQ = readFile(CARD_PICTURES_TOKEN_LQ); + //read token names and urls + mCard[] cardTokenLQ = readFile(TOKEN_IMAGES); - ArrayList CList = new ArrayList(); + ArrayList cList = new ArrayList(); //File imgBase = ForgeProps.getFile(NewConstants.IMAGE_BASE); 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(); String fn = CardUtil.buildIdealFilename(c.getName(), c.getArtIndex(), artsCnt); //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 - mCard[] out = new mCard[CList.size()]; - CList.toArray(out); + mCard[] out = new mCard[cList.size()]; + cList.toArray(out); for (int i = 0; i < out.length; i++) { System.out.println(out[i].name + " " + out[i].url); } return out; }//getNeededCards() -/* *//** + /** *

readFile.

* * @param ABC a {@link java.lang.String} object. * @return an array of {@link forge.Gui_DownloadSetPictures_LQ.mCard} objects. - *//* + */ private static mCard[] readFile(String ABC) { try { FileReader zrc = new FileReader(ForgeProps.getFile(ABC)); @@ -441,7 +437,7 @@ public class Gui_DownloadSetPictures_LQ extends DefaultBoundedRangeModel impleme StringTokenizer tok; line = in.readLine(); - while (line != null && (!line.equals(""))) { + while (line != null && (!line.equals("")) && !line.startsWith("#")) { tok = new StringTokenizer(line); 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"); } }//readFile() -*/ + private class ProxyHandler implements ChangeListener { private int type; diff --git a/src/main/java/forge/properties/NewConstants.java b/src/main/java/forge/properties/NewConstants.java index 710f2a2489d..1149c8ffd9a 100644 --- a/src/main/java/forge/properties/NewConstants.java +++ b/src/main/java/forge/properties/NewConstants.java @@ -32,8 +32,6 @@ public interface NewConstants { String TOKENS = "tokens"; /** Constant CARD_PICTURES="card-pictures". */ String CARD_PICTURES = "card-pictures"; - /** Constant CARD_PICTURES_TOKEN_LQ="card-pictures_token_lq". */ - String CARD_PICTURES_TOKEN_LQ = "card-pictures_token_lq"; /** Constant CARD_PICTURES_A="card-pictures_a". */ String CARD_PICTURES_A = "card-pictures_a"; /** Constant CARD_PICTURES_B="card-pictures_b". */