diff --git a/.gitattributes b/.gitattributes
index cf342a07787..5194c947597 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -12402,25 +12402,22 @@ res/decks/cube/RtRPromoIzzet.dck -text
res/decks/cube/RtRPromoRakdos.dck -text
res/decks/cube/RtRPromoSelesnya.dck -text
res/decks/cube/SkieraCube.dck -text
-res/draft/common.txt svneol=native#text/plain
+res/defaults/editor.preferences svneol=native#text/xml
+res/defaults/editor.xml svneol=native#text/xml
+res/defaults/home.xml svneol=native#text/xml
+res/defaults/match.xml svneol=native#text/xml
res/draft/cube_juzamjedi.draft -text
res/draft/cube_skiera.draft -text
-res/draft/draft.properties svneol=native#text/plain
res/draft/rankings.txt -text
-res/draft/rare.txt svneol=native#text/plain
-res/draft/uncommon.txt svneol=native#text/plain
res/gamedata/NonStackingKWList.txt svneol=native#text/plain
res/gamedata/TypeLists.txt svneol=native#text/plain
res/gauntlet/LOCKED_DotP[!!-~]Preconstructed.dat -text
res/gauntlet/LOCKED_Swimming[!!-~]With[!!-~]Sharks.dat -text
+res/howto.txt svneol=native#text/plain
res/lang/de.properties svneol=native#text/plain
res/lang/en.properties svneol=native#text/plain
res/lang/howTo/de.properties svneol=native#text/plain
-res/lang/howTo/en.properties svneol=native#text/plain
res/lang/lang.properties svneol=native#text/plain
-res/layouts/editor_default.xml svneol=native#text/xml
-res/layouts/home_default.xml svneol=native#text/xml
-res/layouts/match_default.xml svneol=native#text/xml
res/licenses/java-yield-license.txt svneol=native#text/plain
res/licenses/log4j-license.txt svneol=native#text/plain
res/licenses/multiline-label-license.txt svneol=native#text/plain
@@ -12741,10 +12738,6 @@ res/pics_product/tournamentpacks/SHM.jpg -text
res/pics_product/tournamentpacks/TMP.jpg -text
res/pics_product/tournamentpacks/TSP.jpg -text
res/pics_product/tournamentpacks/USG.jpg -text
-res/preferences/.project -text
-res/preferences/editor.default.preferences svneol=native#text/xml
-res/preferences/main.properties -text
-res/product-images.txt -text
res/quest/all-prices.txt svneol=native#text/plain
res/quest/bazaar/ape_pet_l1.txt -text
res/quest/bazaar/ape_pet_l2.txt -text
@@ -13315,7 +13308,6 @@ res/quest/price.txt svneol=native#text/plain
res/quest/quest-opponent-icons.txt -text
res/quest/quest-pet-shop-icons.txt -text
res/quest/quest-pet-token-images.txt -text
-res/quest/quest.properties svneol=native#text/plain
res/quest/themes/-1[!!-~]-1[!!-~]Counters[!!-~]BG.thm -text
res/quest/themes/Anti[!!-~]Black[!!-~]WB.thm -text
res/quest/themes/Anti[!!-~]Black[!!-~]WG.thm -text
@@ -14175,7 +14167,6 @@ src/main/java/forge/game/limited/BoosterDraftAI.java svneol=native#text/plain
src/main/java/forge/game/limited/CCnt.java svneol=native#text/plain
src/main/java/forge/game/limited/CardPoolLimitation.java -text
src/main/java/forge/game/limited/CardRankingComparator.java -text
-src/main/java/forge/game/limited/CardRatings.java -text
src/main/java/forge/game/limited/CustomLimited.java svneol=native#text/plain
src/main/java/forge/game/limited/DeckColors.java svneol=native#text/plain
src/main/java/forge/game/limited/DraftRankCache.java -text
@@ -14445,7 +14436,6 @@ src/main/java/forge/model/package-info.java svneol=native#text/plain
src/main/java/forge/net/package-info.java -text
src/main/java/forge/package-info.java svneol=native#text/plain
src/main/java/forge/properties/ForgePreferences.java svneol=native#text/plain
-src/main/java/forge/properties/ForgeProps.java svneol=native#text/plain
src/main/java/forge/properties/NewConstants.java svneol=native#text/plain
src/main/java/forge/properties/Preferences.java svneol=native#text/plain
src/main/java/forge/properties/SavePreferencesListener.java svneol=native#text/plain
@@ -14521,7 +14511,6 @@ src/main/java/forge/util/PredicateString.java -text
src/main/java/forge/util/ReflectionUtil.java -text
src/main/java/forge/util/TextUtil.java -text
src/main/java/forge/util/ThreadUtil.java svneol=native#text/plain
-src/main/java/forge/util/TreeProperties.java svneol=native#text/plain
src/main/java/forge/util/XmlUtil.java -text
src/main/java/forge/util/package-info.java -text
src/main/java/forge/util/storage/IStorage.java -text
diff --git a/res/preferences/editor.default.preferences b/res/defaults/editor.preferences
similarity index 100%
rename from res/preferences/editor.default.preferences
rename to res/defaults/editor.preferences
diff --git a/res/layouts/editor_default.xml b/res/defaults/editor.xml
similarity index 100%
rename from res/layouts/editor_default.xml
rename to res/defaults/editor.xml
diff --git a/res/defaults/forge.preferences b/res/defaults/forge.preferences
new file mode 100644
index 00000000000..816af584120
--- /dev/null
+++ b/res/defaults/forge.preferences
@@ -0,0 +1,66 @@
+UI_USE_OLD=false
+UI_RANDOM_FOIL=false
+UI_SMOOTH_LAND=false
+UI_AVATARS=0,1
+UI_CARD_OVERLAY=true
+UI_UPLOAD_DRAFT=false
+UI_SCALE_LARGER=true
+UI_MAX_STACK=3
+UI_STACK_OFFSET=tiny
+UI_CARD_SIZE=small
+UI_BUGZ_NAME=
+UI_BUGZ_PWD=
+UI_ANTE=false
+UI_MANABURN=false
+UI_SKIN=default
+UI_PREFERRED_AVATARS_ONLY=false
+UI_TARGETING_OVERLAY=2
+UI_ENABLE_SOUNDS=true
+UI_RANDOM_CARD_ART=false
+SUBMENU_CURRENTMENU=HOME_CONSTRUCTED
+SUBMENU_SANCTIONED=false
+SUBMENU_GAUNTLET=false
+SUBMENU_VARIANT=false
+SUBMENU_QUEST=false
+SUBMENU_SETTINGS=false
+SUBMENU_UTILITIES=false
+ENFORCE_DECK_LEGALITY=true
+DEV_MODE_ENABLED=false
+DEV_MILLING_LOSS=true
+DEV_UNLIMITED_LAND=false
+DECKGEN_SINGLETONS=false
+DECKGEN_ARTIFACTS=false
+DECKGEN_NOSMALL=false
+PHASE_AI_UPKEEP=true
+PHASE_AI_DRAW=true
+PHASE_AI_MAIN1=true
+PHASE_AI_BEGINCOMBAT=true
+PHASE_AI_DECLAREATTACKERS=true
+PHASE_AI_DECLAREBLOCKERS=true
+PHASE_AI_FIRSTSTRIKE=true
+PHASE_AI_COMBATDAMAGE=true
+PHASE_AI_ENDCOMBAT=true
+PHASE_AI_MAIN2=true
+PHASE_AI_EOT=true
+PHASE_AI_CLEANUP=true
+PHASE_HUMAN_UPKEEP=true
+PHASE_HUMAN_DRAW=true
+PHASE_HUMAN_MAIN1=true
+PHASE_HUMAN_BEGINCOMBAT=true
+PHASE_HUMAN_DECLAREATTACKERS=true
+PHASE_HUMAN_DECLAREBLOCKERS=true
+PHASE_HUMAN_FIRSTSTRIKE=true
+PHASE_HUMAN_COMBATDAMAGE=true
+PHASE_HUMAN_ENDCOMBAT=true
+PHASE_HUMAN_MAIN2=true
+PHASE_HUMAN_EOT=true
+PHASE_HUMAN_CLEANUP=true
+SHORTCUT_SHOWSTACK=83
+SHORTCUT_SHOWCOMBAT=67
+SHORTCUT_SHOWCONSOLE=76
+SHORTCUT_SHOWPLAYERS=80
+SHORTCUT_SHOWDEV=68
+SHORTCUT_CONCEDE=17
+SHORTCUT_ENDTURN=69
+SHORTCUT_ALPHASTRIKE=65
+SHORTCUT_SHOWTARGETING=84
diff --git a/res/layouts/home_default.xml b/res/defaults/home.xml
similarity index 100%
rename from res/layouts/home_default.xml
rename to res/defaults/home.xml
diff --git a/res/layouts/match_default.xml b/res/defaults/match.xml
similarity index 100%
rename from res/layouts/match_default.xml
rename to res/defaults/match.xml
diff --git a/res/draft/common.txt b/res/draft/common.txt
deleted file mode 100644
index acef2735370..00000000000
--- a/res/draft/common.txt
+++ /dev/null
@@ -1,106 +0,0 @@
-Akrasan Squire
-Alpha Myr
-Anarchist
-Aven Squire
-Azorius Chancery
-Battering Sliver
-Blade of the Sixth Pride
-Blastoderm
-Blightning
-Bonesplitter Sliver
-Brainstorm
-Brilliant Halo
-Capsize
-Carnophage
-Cavern Harpy
-Child of Night
-Cloud of Faeries
-Coiled Tinviper
-Colossal Might
-Corrupt
-Dark Ritual
-Darksteel Ingot
-Dauthi Marauder
-Dauthi Slayer
-Deep Analysis
-Deft Duelist
-Diabolic Edict
-Dimir Aqueduct
-Disenchant
-Divination
-Drift of Phantasms
-Duress
-Elephant Ambush
-Elvish Fury
-Exclude
-Faceless Butcher
-False Defeat
-Firebolt
-Fledgling Djinn
-Foul Imp
-Frostling
-Gemhide Sliver
-Giant Spider
-Gruul Turf
-Guardians of Akrasa
-Hymn to Tourach
-Imperious Perfect
-Impulse
-Kindle
-Kird Ape
-Kitesail
-Kodama's Reach
-Kor Skyfisher
-Lightning Blast
-Lightning Bolt
-Lignify
-Llanowar Elves
-Mana Leak
-Metallic Sliver
-Moaning Spirit
-Molten Rain
-Mudbutton Torchrunner
-Mulldrifter
-Multani's Acolyte
-Muscle Sliver
-Naturalize
-Nightguard Patrol
-Oblivion Ring
-Order of the Ebon Hand
-Pacifism
-Pestermite
-Phyrexian Rager
-Plated Geopede
-Plated Sliver
-Pouncing Jaguar
-Qasali Pridemage
-Rakdos Carnarium
-Rancor
-Repulse
-Rishadan Airship
-River Boa
-Selesnya Sanctuary
-Serum Visions
-Shock
-Sign in Blood
-Sinew Sliver
-Snapping Drake
-Sprout Swarm
-Steppe Lynx
-Stone Rain
-Sunlance
-Synchronous Sliver
-Talruum Minotaur
-Tarfire
-Tendrils of Corruption
-Trinket Mage
-Vampire Lacerator
-Veteran Armorer
-Veteran Armorsmith
-Veteran Swordsmith
-Viashino Fangtail
-Vulshok Morningstar
-Vulshok Sorcerer
-Wild Nacatl
-Winged Sliver
-Yavimaya Wurm
diff --git a/res/draft/draft.properties b/res/draft/draft.properties
deleted file mode 100644
index 6344efeaa1d..00000000000
--- a/res/draft/draft.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-common--file=common.txt
-uncommon--file=uncommon.txt
-rare--file=rare.txt
diff --git a/res/draft/rare.txt b/res/draft/rare.txt
deleted file mode 100644
index b0dfa02bb6c..00000000000
--- a/res/draft/rare.txt
+++ /dev/null
@@ -1,68 +0,0 @@
-Absorb
-Armageddon
-Badlands
-Baneslayer Angel
-Beacon of Destruction
-Birds of Paradise
-Bitterblossom
-Bloodghast
-Bribery
-Captain of the Watch
-Chameleon Colossus
-Chandra Nalaar
-Char
-Day of Judgment
-Dragon Roost
-Elspeth, Knight-Errant
-Gaea's Anthem
-Garruk Wildspeaker
-Goblin Guide
-Goblin Piledriver
-Honor of the Pure
-Iona, Shield of Emeria
-Jace, the Mind Sculptor
-Jeska, Warrior Adept
-Juzam Djinn
-Keiga, the Tide Star
-Knight of the White Orchid
-Kokusho, the Evening Star
-Liliana Vess
-Loxodon Hierarch
-Meloku the Clouded Mirror
-Morphling
-Mycoloth
-Nantuko Shade
-Nevinyrral's Disk
-Noble Hierarch
-Ob Nixilis, the Fallen
-Paladin en-Vec
-Phyrexian Arena
-Rakka Mar
-Rampaging Baloths
-Rolling Earthquake
-Rorix Bladewing
-Sarkhan Vol
-Savannah
-Scion of Oona
-Serendib Efreet
-Shadowmage Infiltrator
-Siege-Gang Commander
-Solemn Simulacrum
-Sower of Temptation
-Sphinx of Jwar Isle
-Squall Line
-Survival of the Fittest
-Taiga
-Tarmogoyf
-Thoughtseize
-Time Warp
-Troll Ascetic
-Tundra
-Umezawa's Jitte
-Underground Sea
-Vampiric Tutor
-Vendilion Clique
-Visara the Dreadful
-Wall of Reverence
-Wort, Boggart Auntie
-Wrath of God
diff --git a/res/draft/uncommon.txt b/res/draft/uncommon.txt
deleted file mode 100644
index cf12eb1fc1a..00000000000
--- a/res/draft/uncommon.txt
+++ /dev/null
@@ -1,60 +0,0 @@
-Air Elemental
-Animate Dead
-Behemoth Sledge
-Bituminous Blast
-Blade Sliver
-Blaze
-Blood Knight
-Briarhorn
-Calciderm
-Centaur Glade
-Chainer's Edict
-Cloud Djinn
-Control Magic
-Council of Advisors
-Counterspell
-Demonic Tutor
-Dimir Guildmage
-Elite Vanguard
-Enlightened Tutor
-Eternal Witness
-Flame Javelin
-Flametongue Kavu
-Force of Will
-Ghitu Encampment
-Harmonize
-Honden of Cleansing Fire
-Honden of Infinite Rage
-Honden of Life's Web
-Honden of Night's Reach
-Honden of Seeing Winds
-Infest
-Isochron Scepter
-Ivory Tower
-Jackal Pup
-Keening Banshee
-Knight of Meadowgrain
-Knight of Stromgald
-Magma Jet
-Might Sliver
-Path to Exile
-Pillage
-Regrowth
-Sejiri Merfolk
-Shriekmaw
-Skullclamp
-Smother
-Sol Ring
-Soltari Monk
-Soltari Priest
-Spectral Procession
-Spell Snare
-Swords to Plowshares
-Thieving Magpie
-Treetop Village
-Twinblade Slasher
-Vampire Nighthawk
-Viridian Shaman
-Volcanic Fallout
-Wall of Blossoms
-Wall of Denial
diff --git a/res/howto.txt b/res/howto.txt
new file mode 100644
index 00000000000..d317ff3e843
--- /dev/null
+++ b/res/howto.txt
@@ -0,0 +1,122 @@
+How to Play
+
+
+
+Introduction
+
+1. This game is similar to many other trading card games. You start out with 20 life and your goal is to reduce your opponents life to zero by attacking with your creatures. The game will end when your life or the computer's life is reduced to zero. You play "matches" against the computer as a set of "best two out of three" games.
+
+2. You use land to pay for spells. You can play one land a turn.
+
+3. Each land produces a different magical energy. This magical energy is shortened to one letter on cards.
+
+ Forests make G
+ Swamps make B
+ Plains make W
+ Islands make U
+ Mountains make R
+
+4. Each non-land card has a name and a cost. The cost looks like this "2GG" A cost like that would require two Forest lands and two other lands. The number 2 can be paid for by any land. A cost like "R", would require a Mountain land.
+
+5. Creature cards stay in play and can attack on the turn AFTER they are played. A creature's attack and defense is shown like 2/4 meaning that the creature has an attack power of 2 and a defense of 4. If this creature receives 4 damage it is put into the graveyard.
+
+6. When you attack with your creatures the computer has a chance to block with his creatures. When you attack you "tap" your creatures by turning them sideways. Your creatures will untap during your next turn. When you block, only untapped creatures can block. Usually a creature cannot attack and block during the same turn.
+
+7. Sorcery and Instant cards have an effect on the game. After you play any card it goes on the stack to the left, click OK and the stack will clear. Sorcery cards can only be played during your turn and when the stack is empty. Instant cards can be played at any time and are more versatile.
+
+8. If a card has a target, you get to choose that target. If the target is a player, click on that player's picture (next to their life points).
+
+9. When you mulligan, the cards in your hand are shuffled into you deck and you are given 1 less card.
+
+
+Legendary Cards
+
+Legendary cards are powerful cards that can be either creatures, enchantments, lands, artifacts, or planeswalkers. These cards can only exist once in the battlefield, and if another copy of the legendary card is played, all copies of the card are destroyed and sent to the graveyard.
+
+
+Planeswalkers
+
+There are relatively few planeswalkers available in the game and they have specific rules for their special abilities.
+
+You can only use one ability a turn. A planeswalker can be attacked, but you can also block with your creatures. For each 1 damage a planeswalker receives, you remove 1 counter. When a planeswalker doesn't have any counters, it goes to the graveyard.
+
+
+Hybrid Mana and Multicolored Cards
+
+1. Hybrid Mana Cards are unique in their casting cost as seen in the card. Instead of seeing a single color per mana symbol, these cards have 2 colors per mana symbol indicating that the player has the choice of playing either of the two. There are also cases where numbers and colors are combined together in one mana symbol, which indicates that either colorless or colored mana can be paid for each symbol. Hybrid cards are treated as two colors and as such can be said to be multicolored.
+
+2. Multicolored Cards are slightly different than hybrid mana cards, as they require two or more different colors of mana, which may or not be in a single mana symbol. An example would be a card like Lightning Helix which requires one red and one white mana to be played.
+
+
+Game Types
+
+1. In Constructed Deck mode you can use any of the cards to make your deck. To make a constructed deck, select the "Deck Editor" button on the main screen.
+
+2. In Sealed Deck mode you are given 75 cards and you have to make your deck from just those cards.
+
+3. In Booster Draft mode you select 1 card at a time and then make your deck from just those cards. You can then play against the other 7 computer opponents that were drafting with you.
+
+4. In Quest Mode you start out with just a few cards. As you complete matches in your quest you will win more cards. In easy mode you get more cards after every game, whether you win or lose. Your goal is to become world champion. Once you reach the end of your quest you can continue to play additional matches and win even more cards or you can start a new quest at anytime.
+
+At the Quest Options screen you will be given a choice of four different difficulty levels. These difficulty levels control:
+
+1) the length of the quest in matches
+2) the hardness of the AI deck that you will face as an opponent
+3) the number of wins or losses needed to get more cards
+4) the number of wins needed to advance a player to the next rank
+
+
+Quick Games
+
+There may be occasions where you only have a few minutes to play a quick game or two. At the top of the list of submenus on the left, choose "Sanctioned Formats" and then "Constructed". For the least amount of setup, just accept the default settings for random decks, and click Start at the bottom of the page.
+
+
+Abilities
+
+There are three kinds of abilities: Activated, Triggered, and Static.
+
+1. Activated abilities contain a colon that separates cost and effect, these can be played any time you could play an instant. An example is Elvish Piper's ability. That cost also contains the tap symbol. For creatures only, abilities containing the tap- or untap symbol can be played starting the turn after the creature came into play. Another common cost for an activated ability is sacrificing the card. You do that by putting it into your graveyard. Such abilities can only be played once.
+
+2. Triggered abilities aren't played, they simply trigger when their condition occurs. An example is Angel of Mercy: You don't play the ability, but gain 3 life when it comes into play.
+
+3. Static abilities are neither played, nor do they trigger. They still have an effect for as long as they are in play. An example is Glorious Anthem. There is no condition or cost, your creatures are just stronger.
+
+
+Keyword Abilities
+
+1. Flying: Creatures with flying are harder to block. Only creatures with flying or reach can block other flyers.
+
+2. Haste: Haste lets a creature attack or use any abilities immediately during this turn.
+
+3. Fear: Creatures with fear can only be blocked by artifact or black creatures. Creatures with fear are harder to block.
+
+4. Cycling: When you cycle a card you pay some small cost (usually 2 or so) and then you discard that card and draw a new card. Cycling helps make your deck more versatile.
+
+5. Vigilance: This means that the creature will not tap when attacking. This creature can both attack and block during the same turn.
+
+6. Trample: If you use 2/1 creature to block an attacking 3/4 creature with trample, you will still receive 2 damage because the 3/4 trampled over your 2/1 creature. Trample damage is calculated by (attack - blocker's defense), in this case 3-1 which is 2.
+
+7. Deathtouch: When a creatures with deathtouch deals damage to a creature, that creature is destroyed.
+
+8. Defender: Creatures with defender can not attack, they can only block another attacker.
+
+9. First Strike and Double Strike: Creatures with first strike deals their combat damage first. Creatures with double strike deals their combat damage first, and then deals their combat damage a second time during the combat damage step.
+
+10. Flash: You can play a creature with flash anytime that you can play an Instant.
+
+11. Landwalk: Allows your creature to attack without being blocked if your opponent controls the appropriate land type.
+
+12. Lifelink: With lifeline you gain life equal to the amount of damage dealt.
+
+13. Protection: Can not be damaged, blocked or targeted by sources that match the protection type.
+
+14. Reach: Creatures with reach can block flying creatures.
+
+15. Shroud: Permanents with shroud can not be targeted by abilities or spells.
+
+16. Regenerate: Regenerate is an ability that some creatures have which prevents them from being destroyed and put into the graveyard. When you regenerate a creature, it acts like a shield until end of turn.
+
+17. Morph: A creature with morph can be played by usually paying 3 mana of any color and be treated as a 2/2 creature with no abilities rather than playing the creature's actual cost. This creature is placed face down in the battlefield and can be flipped face up anytime as long as you pay its morph cost which is indicated on the card. Once flipped face up the card is treated as the original card, the one that you would normally play with its original-full casting cost.
+
+
+Have fun!
diff --git a/res/lang/howTo/en.properties b/res/lang/howTo/en.properties
deleted file mode 100644
index ca12037e84f..00000000000
--- a/res/lang/howTo/en.properties
+++ /dev/null
@@ -1,68 +0,0 @@
-title=How to Play
-message=How to Play - (Revised: September 2009.)\n\n\n\
-Introduction\n\n\
-1. This game is similar to many other trading card games. You start out with 20 life and your goal is to reduce your opponents life to zero by attacking with your creatures. The game will end when your life or the computer's life is reduced to zero. You play \"matches\" against the computer as a set of \"best two out of three\" games."\n\n\
-2. You use land to pay for spells. You can play one land a turn.\n\n\
-3. Each land produces a different magical energy. This magical energy is shortened to one letter on cards.\n\n\
-\ Forests make G\n\
-\ Swamps make B\n\
-\ Plains make W\n\
-\ Islands make U\n\
-\ Mountains make R\n\n\
-4. Each non-land card has a name and a cost. The cost looks like this \"2GG\" A cost like that would require two Forest lands and two other lands. The number 2 can be paid for by any land. A cost like \"R\", would require a Mountain land.\n\n\
-5. Creature cards stay in play and can attack on the turn AFTER they are played. A creature's attack and defense is shown like 2/4 meaning that the creature has an attack power of 2 and a defense of 4. If this creature receives 4 damage it is put into the graveyard.\n\n\
-6. When you attack with your creatures the computer has a chance to block with his creatures. When you attack you \"tap\" your creatures by turning them sideways. Your creatures will untap during your next turn. When you block, only untapped creatures can block. Usually a creature cannot attack and block during the same turn.\n\n\
-7. Sorcery and Instant cards have an effect on the game. After you play any card it goes on the stack to the left, click OK and the stack will clear. Sorcery cards can only be played during your turn and when the stack is empty. Instant cards can be played at any time and are more versatile.\n\n\
-8. If a card has a target, you get to choose that target. If the target is a player, click on that player's life points.\n\n\
-9. When you mulligan, the cards in your hand are shuffled into you deck and you are given 1 less card.\n\n\n\
-Legendary Cards\n\n\
-Legendary cards are powerful cards that can be either creatures, enchantments, lands, artifacts or planeswalkers. These cards can only exist once in the battlefield, and if another copy of the legendary card is played, all copies of the card are destroyed and sent to the graveyard.\n\n\n\
-Planeswalkers\n\n\
-There are 7 planeswalkers (Ajani Goldmane; Liliana Vess; Garruk Wildspeaker; Chandra Nalaar; Nicol Bolas; Elspeth, Knight-Errant; Nissa Revane) and they have specific rules for their special abilities.\n\n\
-You can only use one ability a turn. A planeswalker can be attacked, but you can also block with your creatures. For each 1 damage a planeswalker receives, you remove 1 counter. When a planeswalker doesn't have any counters, it goes to the graveyard.\n\n\n\
-Hybrid Mana and Multicolored Cards\n\n\
-1. Hybrid Mana Cards are unique in their casting cost as seen in the card. Instead of seeing a single color per mana symbol, these cards have 2 colors per mana symbol indicating that the player has the choice of playing either of the two. There are also cases where numbers and colors are combined together in one mana symbol, which indicates that either colorless or colored mana can be paid for each symbol. Hybrid cards are treated as two colors and as such can be said to be multicolored.\n\n\
-2. Multicolored Cards are slightly different than hybrid mana cards, as they require two or more different colors of mana, which may or not be in a single mana symbol. An example would be a card like Lightning Helix which requires one red and one white mana to be played.\n\n\n\
-Game Types\n\n\
-1. In Constructed Deck mode you can use any of the cards to make your deck. To make a constructed deck, from the Deck Editor select \"New Deck \u2013 Constructed\". A list of all the cards will be displayed.\n\n\
-2. In Sealed Deck mode you are given 75 cards and you have to make your deck from just those cards.\n\n\
-3. In Booster Draft mode you select 1 card at a time and then make your deck from just those cards. After you are done drafting you have to type in a filename, then go to the Deck Editor and from the menu select \"Open Deck - Draft\" and find the filename. This will allow you to construct your deck. You can then play against the other 7 computer opponents that were drafting with you.\n\n\
-4. In Quest Mode you start out with 275 cards, 200 are Basic Lands. As you complete matches in your quest you will win more cards. In easy mode you get more cards after every game, whether you win or lose. Your goal is to become world champion. Once you reach the end of your quest you can continue to play additional matches and win even more cards or you can start a new quest at anytime.\n\n\
-At the Quest Options screen you will be given a choice of four different difficulty levels. These difficulty levels control:\n\n\
-1) the length of the quest in matches,\n\
-2) the hardness of the AI deck that you will face as an opponent,\n\
-3) the number of wins or loses needed to get more cards,\n\
-4) the number of wins needed to advance a player to the next rank.\n\n\n\
-Quick Games\n\n\
-There may be occasions where you only have a few minutes to play a quick game or two. At the top of the New Game window you will see the three different game types with radio buttons. Click on the Constructed (Easy) button and it will become highlighted.\n\n\
-In the middle area of the New Game window you will see two menus, one labeled \"Your Deck\" and the other \"Opponent\". For a quick game you should select the \"Generate Deck\" or the \"Random\" option for both you and the computer.\n\n\
-1. The \"Generate Deck\" option creates a 2 color deck. This option randomly picks cards and sometimes your mana curve may be too high.\n\n\
-2. The \"Random\" option will randomly select one of the constructed decks that appear in the two deck menus. You either construct these decks in the Deck Editor or you imported a .deck file from the Deck Editor.\n\n\
-If you select the \"Random\" option and click on the \"Start Game\" button and the match fails to begin \u2026 well, this happens if you fail to have any constructed decks saved to your all-decks2 file. You should choose the \"Generate Deck\" option instead.\n\n\n\
-Resizable Game Area & Stack AI Land\n\n\
-1. The \"Resizable Game Area\" check box should be set to on if your monitor will display more than 1024 x 768 pixels. The window containing the Battlefield and the informational displays will fill the entire screen.\n\n\
-2. The \"Stack AI Land\" option will make the computer a more difficult opponent to beat. The computer will draw non-land cards from it's library after it has drawn enough lands to cover the cost of it's spells. Set the check box to on for a stronger opponent and set the check box to off for a weaker opponent.\n\n\
-At times, you may notice that when you click the \"Start Game\" button that the match fails to begin. In this case you should turn the \"Stack AI Land\" option to off.\n\n\n\
-Abilities\n\n\
-There are three kinds of abilities: Activated, Triggered, and Static.\n\n\
-1. Activated abilities contain a colon that separates cost and effect, these can be played any time you could play an instant. An example is Elvish Piper's ability. That cost also contains the tap symbol. For creatures only, abilities containing the tap- or untap symbol can be played starting the turn after the creature came into play. Another common cost for an activated ability is sacrificing the card. You do that by putting it into your graveyard. Such abilities can only be played once.\n\n\n\
-2. Triggered abilities aren't played, they simply trigger when their condition occurs. An example is Angel of Mercy: You don't play the ability, but gain 3 life when it comes into play.\n\n\
-3. Static abilities are neither played, nor do they trigger. They still have an effect for as long as they are in play. An example is Glorious Anthem. There is no condition or cost, your creatures are just stronger.\n\n\n\
-Keyword Abilities\n\n\
-1. Flying: Creatures with flying are harder to block. Only creatures with flying or reach can block other flyers.\n\n\
-2. Haste: Haste lets a creature attack or use any abilities immediately during this turn.\n\n\
-3. Fear: Creatures with fear can only be blocked by artifact or black creatures. Creatures with fear are harder to block.\n\n\
-4. Cycling: When you cycle a card you pay some cost like 2 and then you discard that card, and then draw a new card. Cycling helps make your deck more versatile.\n\n\
-5. Vigilance: This means that the creature will not tap when attacking. This creature can both attack and block during the same turn.\n\n\
-6. Trample: If you use 2/1 creature to block an attacking 3/4 creature with trample, you will still receive 2 damage because the 3/4 trampled over your 2/1 creature. Trample damage is calculated by (attack - blocker's defense), in this case 3-1 which is 2.\n\n\
-7. Deathtouch: When a creatures with deathtouch deals damage to a creature, that creature is destroyed.\n\n\
-8. Defender: Creatures with defender can not attack, they can only block another attacker.\n\n\
-9. First Strike and Double Strike: Creatures with first strike deals their combat damage first. Creatures with double strike deals their combat damage first, and then deals their combat damage a second time during the combat damage step.\n\n\
-10. Flash: You can play a creature with flash anytime that you can play an Instant.\n\n\
-11. Landwalk: Allows your creature to attack without being blocked if your opponent controls the appropriate land type.\n\n\
-12. Lifelink: With lifeline you gain life equal to the amount of damage dealt.\n\n\
-13. Protection: Can not be damaged, blocked or targeted by sources that match the protection type.\n\n\
-14. Reach: Creatures with reach can block flying creatures.\n\n\
-15. Shroud: Permanents with shroud can not be targeted by abilities or spells.\n\n\
-16. Regenerate: Regenerate is an ability that some creatures have which prevents them from being destroyed and put into the graveyard. When you regenerate a creature, it acts like a shield until end of turn.\n\n\
-17. Morph: A creature with morph can be played by usually paying 3 mana of any color and be treated as a 2/2 creature with no abilities rather than playing the creature's actual cost. This creature is placed face down in the battlefield and can be flipped face up anytime as long as you pay its morph cost which is indicated on the card. Once flipped face up the card is treated as the original card, the one that you would normally play with its original-full casting cost.
diff --git a/res/preferences/.project b/res/preferences/.project
deleted file mode 100644
index 0dd752fd79a..00000000000
--- a/res/preferences/.project
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
- preferences
-
-
-
-
-
-
-
-
diff --git a/res/preferences/main.properties b/res/preferences/main.properties
deleted file mode 100644
index 2ae0ba5554a..00000000000
--- a/res/preferences/main.properties
+++ /dev/null
@@ -1,71 +0,0 @@
-program/howToReportBugsURL=http://tinyurl.com/3zzrnyb
-program/cardforgeURL=http://cardforge.org
-
-showdeck/2color=false
-showdeck/3color=false
-showdeck/4color=false
-showdeck/5color=false
-
-tokens--file=AllTokens.txt
-mtg-data--file=mtg-data.txt
-
-decks--file=all-decks2
-booster-decks--file=booster-deck
-decks-dir--file=../decks
-
-card-pictures--file=card-pictures.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
-card-pictures_c--file=../pics_link/card-pictures_c.txt
-card-pictures_d--file=../pics_link/card-pictures_d.txt
-card-pictures_e--file=../pics_link/card-pictures_e.txt
-card-pictures_f--file=../pics_link/card-pictures_f.txt
-card-pictures_g--file=../pics_link/card-pictures_g.txt
-card-pictures_h--file=../pics_link/card-pictures_h.txt
-card-pictures_i--file=../pics_link/card-pictures_i.txt
-card-pictures_j--file=../pics_link/card-pictures_j.txt
-card-pictures_k--file=../pics_link/card-pictures_k.txt
-card-pictures_l--file=../pics_link/card-pictures_l.txt
-card-pictures_m--file=../pics_link/card-pictures_m.txt
-card-pictures_n--file=../pics_link/card-pictures_n.txt
-card-pictures_o--file=../pics_link/card-pictures_o.txt
-card-pictures_p--file=../pics_link/card-pictures_p.txt
-card-pictures_q--file=../pics_link/card-pictures_q.txt
-card-pictures_r--file=../pics_link/card-pictures_r.txt
-card-pictures_s--file=../pics_link/card-pictures_s.txt
-card-pictures_t--file=../pics_link/card-pictures_t.txt
-card-pictures_u--file=../pics_link/card-pictures_u.txt
-card-pictures_v--file=../pics_link/card-pictures_v.txt
-card-pictures_w--file=../pics_link/card-pictures_w.txt
-card-pictures_x--file=../pics_link/card-pictures_x.txt
-card-pictures_y--file=../pics_link/card-pictures_y.txt
-card-pictures_z--file=../pics_link/card-pictures_z.txt
-card-pictures_other--file=../pics_link/card-pictures_other.txt
-card-pictures_token_hq--file=../pics_link/card-pictures_token.txt
-cards--file=cards.txt
-cardsfolder--file=../cardsfolder
-removed-cards--file=removedCards.txt
-
-regular/common--file=common.txt
-regular/uncommon--file=uncommon.txt
-regular/rare--file=rare.txt
-
-draft/rankings--file=../draft/rankings.txt
-
-name-mutator--file=name-mutator.txt
-
-quest--properties=../quest/quest.properties
-draft--properties=../draft/draft.properties
-
-lang--transparent-properties=../lang/lang.properties
-
-image/base--file=../pics
-image/token--file=../pics/tokens
-image/icon--file=../pics/icons
-image/product--file=../pics_product
-pics/booster/images--file=../quest/booster-images.txt
-
-quest/opponent/icons--file=../quest/quest-opponent-icons.txt
-quest/pet/icons--file=../quest/quest-pet-shop-icons.txt
-quest/pet/tokens--file=../quest/quest-pet-token-images.txt
diff --git a/res/product-images.txt b/res/product-images.txt
deleted file mode 100644
index a37fe6ff83b..00000000000
--- a/res/product-images.txt
+++ /dev/null
@@ -1,106 +0,0 @@
-# Fat Packs
-http://www.cardforge.org/fpics/products/fatpacks/5DN.jpg
-http://www.cardforge.org/fpics/products/fatpacks/9ED.jpg
-http://www.cardforge.org/fpics/products/fatpacks/10E.jpg
-http://www.cardforge.org/fpics/products/fatpacks/ALA.jpg
-http://www.cardforge.org/fpics/products/fatpacks/APC.jpg
-http://www.cardforge.org/fpics/products/fatpacks/ARB.jpg
-http://www.cardforge.org/fpics/products/fatpacks/BOK.jpg
-http://www.cardforge.org/fpics/products/fatpacks/CFX.jpg
-http://www.cardforge.org/fpics/products/fatpacks/CHK.jpg
-http://www.cardforge.org/fpics/products/fatpacks/CSP.jpg
-http://www.cardforge.org/fpics/products/fatpacks/DIS.jpg
-http://www.cardforge.org/fpics/products/fatpacks/DKA.jpg
-http://www.cardforge.org/fpics/products/fatpacks/DST.jpg
-http://www.cardforge.org/fpics/products/fatpacks/EVE.jpg
-http://www.cardforge.org/fpics/products/fatpacks/FUT.jpg
-http://www.cardforge.org/fpics/products/fatpacks/GPT.jpg
-http://www.cardforge.org/fpics/products/fatpacks/INV.jpg
-http://www.cardforge.org/fpics/products/fatpacks/ISD.jpg
-http://www.cardforge.org/fpics/products/fatpacks/JUD.jpg
-http://www.cardforge.org/fpics/products/fatpacks/LGN.jpg
-http://www.cardforge.org/fpics/products/fatpacks/LRW.jpg
-http://www.cardforge.org/fpics/products/fatpacks/M10.jpg
-http://www.cardforge.org/fpics/products/fatpacks/M10.png
-http://www.cardforge.org/fpics/products/fatpacks/M11.jpg
-http://www.cardforge.org/fpics/products/fatpacks/M11.png
-http://www.cardforge.org/fpics/products/fatpacks/M12.jpg
-http://www.cardforge.org/fpics/products/fatpacks/M12.png
-http://www.cardforge.org/fpics/products/fatpacks/MBS.jpg
-http://www.cardforge.org/fpics/products/fatpacks/MMQ.jpg
-http://www.cardforge.org/fpics/products/fatpacks/MOR.jpg
-http://www.cardforge.org/fpics/products/fatpacks/MRD.jpg
-http://www.cardforge.org/fpics/products/fatpacks/NMS.jpg
-http://www.cardforge.org/fpics/products/fatpacks/NPH.jpg
-http://www.cardforge.org/fpics/products/fatpacks/ODY.jpg
-http://www.cardforge.org/fpics/products/fatpacks/ONS.jpg
-http://www.cardforge.org/fpics/products/fatpacks/PCY.jpg
-http://www.cardforge.org/fpics/products/fatpacks/PLC.jpg
-http://www.cardforge.org/fpics/products/fatpacks/PLS.JPG
-http://www.cardforge.org/fpics/products/fatpacks/RAV.jpg
-http://www.cardforge.org/fpics/products/fatpacks/ROE.jpg
-http://www.cardforge.org/fpics/products/fatpacks/SCG.jpg
-http://www.cardforge.org/fpics/products/fatpacks/SHM.jpg
-http://www.cardforge.org/fpics/products/fatpacks/SOK.jpg
-http://www.cardforge.org/fpics/products/fatpacks/SOM.jpg
-http://www.cardforge.org/fpics/products/fatpacks/TOR.jpg
-http://www.cardforge.org/fpics/products/fatpacks/TSP.jpg
-http://www.cardforge.org/fpics/products/fatpacks/WWK.jpg
-http://www.cardforge.org/fpics/products/fatpacks/ZEN.jpg
-
-# Precons
-http://www.cardforge.org/fpics/products/precons/bant_on_the_march.jpg
-http://www.cardforge.org/fpics/products/precons/battle_cries.jpg
-http://www.cardforge.org/fpics/products/precons/blood-and-fire.jpg
-http://www.cardforge.org/fpics/products/precons/breath_of_fire.jpg
-http://www.cardforge.org/fpics/products/precons/carnival_of_blood.jpg
-http://www.cardforge.org/fpics/products/precons/dead_ahead.jpg
-http://www.cardforge.org/fpics/products/precons/deadspread.jpg
-http://www.cardforge.org/fpics/products/precons/deathfed.jpg
-http://www.cardforge.org/fpics/products/precons/devouring_skies.jpg
-http://www.cardforge.org/fpics/products/precons/doom_inevitable.jpg
-http://www.cardforge.org/fpics/products/precons/eldritch_onslaught.jpg
-http://www.cardforge.org/fpics/products/precons/esper_air_assault.jpg
-http://www.cardforge.org/fpics/products/precons/feast_of_flesh.jpg
-http://www.cardforge.org/fpics/products/precons/grab-for-power.jpg
-http://www.cardforge.org/fpics/products/precons/grave_power.jpg
-http://www.cardforge.org/fpics/products/precons/grixis_shambling_army.jpg
-http://www.cardforge.org/fpics/products/precons/invading_spawn.jpg
-http://www.cardforge.org/fpics/products/precons/jund_appetite_for_war.jpg
-http://www.cardforge.org/fpics/products/precons/levelers_glory.jpg
-http://www.cardforge.org/fpics/products/precons/myr_of_mirrodin.jpg
-http://www.cardforge.org/fpics/products/precons/naya_domain.jpg
-http://www.cardforge.org/fpics/products/precons/path_of_blight.jpg
-http://www.cardforge.org/fpics/products/precons/phyrexian_poison.jpg
-http://www.cardforge.org/fpics/products/precons/reign_of_vampirism.jpg
-http://www.cardforge.org/fpics/products/precons/relentless_dead.jpg
-http://www.cardforge.org/fpics/products/precons/relic_breaker.jpg
-http://www.cardforge.org/fpics/products/precons/repel_the_dark.jpg
-http://www.cardforge.org/fpics/products/precons/spectral_legions.jpg
-http://www.cardforge.org/fpics/products/precons/swift_justice.jpg
-http://www.cardforge.org/fpics/products/precons/totem_power.jpg
-http://www.cardforge.org/fpics/products/precons/unnatural_schemes.jpg
-
-# Tournament Packs
-http://www.cardforge.org/fpics/products/tournamentpacks/2ED.jpg
-http://www.cardforge.org/fpics/products/tournamentpacks/3ED.jpg
-http://www.cardforge.org/fpics/products/tournamentpacks/4ED.jpg
-http://www.cardforge.org/fpics/products/tournamentpacks/5ED.jpg
-http://www.cardforge.org/fpics/products/tournamentpacks/6ED.jpg
-http://www.cardforge.org/fpics/products/tournamentpacks/ALA.jpg
-http://www.cardforge.org/fpics/products/tournamentpacks/CHK.jpg
-http://www.cardforge.org/fpics/products/tournamentpacks/ICE.jpg
-http://www.cardforge.org/fpics/products/tournamentpacks/INV.jpg
-http://www.cardforge.org/fpics/products/tournamentpacks/LEA.jpg
-http://www.cardforge.org/fpics/products/tournamentpacks/LEB.jpg
-http://www.cardforge.org/fpics/products/tournamentpacks/LRW.jpg
-http://www.cardforge.org/fpics/products/tournamentpacks/MIR.jpg
-http://www.cardforge.org/fpics/products/tournamentpacks/MMQ.jpg
-http://www.cardforge.org/fpics/products/tournamentpacks/MRD.jpg
-http://www.cardforge.org/fpics/products/tournamentpacks/ODY.jpg
-http://www.cardforge.org/fpics/products/tournamentpacks/ONS.jpg
-http://www.cardforge.org/fpics/products/tournamentpacks/RAV.jpg
-http://www.cardforge.org/fpics/products/tournamentpacks/SHM.jpg
-http://www.cardforge.org/fpics/products/tournamentpacks/TMP.jpg
-http://www.cardforge.org/fpics/products/tournamentpacks/TSP.jpg
-http://www.cardforge.org/fpics/products/tournamentpacks/USG.jpg
diff --git a/res/quest/fatpack-images.txt b/res/quest/fatpack-images.txt
new file mode 100644
index 00000000000..3ecbd849b89
--- /dev/null
+++ b/res/quest/fatpack-images.txt
@@ -0,0 +1,52 @@
+http://www.cardforge.org/fpics/products/fatpacks/10E.jpg
+http://www.cardforge.org/fpics/products/fatpacks/5DN.jpg
+http://www.cardforge.org/fpics/products/fatpacks/9ED.jpg
+http://www.cardforge.org/fpics/products/fatpacks/ALA.jpg
+http://www.cardforge.org/fpics/products/fatpacks/APC.jpg
+http://www.cardforge.org/fpics/products/fatpacks/ARB.jpg
+http://www.cardforge.org/fpics/products/fatpacks/AVR.png
+http://www.cardforge.org/fpics/products/fatpacks/BOK.jpg
+http://www.cardforge.org/fpics/products/fatpacks/CFX.jpg
+http://www.cardforge.org/fpics/products/fatpacks/CHK.jpg
+http://www.cardforge.org/fpics/products/fatpacks/CSP.jpg
+http://www.cardforge.org/fpics/products/fatpacks/DIS.jpg
+http://www.cardforge.org/fpics/products/fatpacks/DKA.jpg
+http://www.cardforge.org/fpics/products/fatpacks/DST.jpg
+http://www.cardforge.org/fpics/products/fatpacks/EVE.jpg
+http://www.cardforge.org/fpics/products/fatpacks/FUT.jpg
+http://www.cardforge.org/fpics/products/fatpacks/GPT.jpg
+http://www.cardforge.org/fpics/products/fatpacks/GTC.jpg
+http://www.cardforge.org/fpics/products/fatpacks/INV.jpg
+http://www.cardforge.org/fpics/products/fatpacks/ISD.jpg
+http://www.cardforge.org/fpics/products/fatpacks/JUD.jpg
+http://www.cardforge.org/fpics/products/fatpacks/LGN.jpg
+http://www.cardforge.org/fpics/products/fatpacks/LRW.jpg
+http://www.cardforge.org/fpics/products/fatpacks/M10.jpg
+http://www.cardforge.org/fpics/products/fatpacks/M10.png
+http://www.cardforge.org/fpics/products/fatpacks/M11.jpg
+http://www.cardforge.org/fpics/products/fatpacks/M11.png
+http://www.cardforge.org/fpics/products/fatpacks/M12.jpg
+http://www.cardforge.org/fpics/products/fatpacks/M12.png
+http://www.cardforge.org/fpics/products/fatpacks/M13.jpg
+http://www.cardforge.org/fpics/products/fatpacks/MBS.jpg
+http://www.cardforge.org/fpics/products/fatpacks/MMQ.jpg
+http://www.cardforge.org/fpics/products/fatpacks/MOR.jpg
+http://www.cardforge.org/fpics/products/fatpacks/MRD.jpg
+http://www.cardforge.org/fpics/products/fatpacks/NMS.jpg
+http://www.cardforge.org/fpics/products/fatpacks/NPH.jpg
+http://www.cardforge.org/fpics/products/fatpacks/ODY.jpg
+http://www.cardforge.org/fpics/products/fatpacks/ONS.jpg
+http://www.cardforge.org/fpics/products/fatpacks/PCY.jpg
+http://www.cardforge.org/fpics/products/fatpacks/PLC.jpg
+http://www.cardforge.org/fpics/products/fatpacks/PLS.jpg
+http://www.cardforge.org/fpics/products/fatpacks/RAV.jpg
+http://www.cardforge.org/fpics/products/fatpacks/ROE.jpg
+http://www.cardforge.org/fpics/products/fatpacks/RTR.jpg
+http://www.cardforge.org/fpics/products/fatpacks/SCG.jpg
+http://www.cardforge.org/fpics/products/fatpacks/SHM.jpg
+http://www.cardforge.org/fpics/products/fatpacks/SOK.jpg
+http://www.cardforge.org/fpics/products/fatpacks/SOM.jpg
+http://www.cardforge.org/fpics/products/fatpacks/TOR.jpg
+http://www.cardforge.org/fpics/products/fatpacks/TSP.jpg
+http://www.cardforge.org/fpics/products/fatpacks/WWK.jpg
+http://www.cardforge.org/fpics/products/fatpacks/ZEN.jpg
diff --git a/res/quest/precon-images.txt b/res/quest/precon-images.txt
new file mode 100644
index 00000000000..2454588eb26
--- /dev/null
+++ b/res/quest/precon-images.txt
@@ -0,0 +1,152 @@
+http://www.cardforge.org/fpics/products/precons/Bait_Bludgeon.jpg
+http://www.cardforge.org/fpics/products/precons/Battle_Surge.jpg
+http://www.cardforge.org/fpics/products/precons/Boggart_Feast.jpg
+http://www.cardforge.org/fpics/products/precons/Bomber.jpg
+http://www.cardforge.org/fpics/products/precons/Cho_Mannos_Resolve.jpg
+http://www.cardforge.org/fpics/products/precons/Code_of_the_Orzhov.jpg
+http://www.cardforge.org/fpics/products/precons/Critical_Mass.jpg
+http://www.cardforge.org/fpics/products/precons/Crusher.jpg
+http://www.cardforge.org/fpics/products/precons/Custom_Creatures.jpg
+http://www.cardforge.org/fpics/products/precons/Dead_Again.jpg
+http://www.cardforge.org/fpics/products/precons/Deaths_Minions.jpg
+http://www.cardforge.org/fpics/products/precons/Decay.jpg
+http://www.cardforge.org/fpics/products/precons/Deep_Freeze.jpg
+http://www.cardforge.org/fpics/products/precons/Disrupter.jpg
+http://www.cardforge.org/fpics/products/precons/Domain.jpg
+http://www.cardforge.org/fpics/products/precons/Elvish_Rage.jpg
+http://www.cardforge.org/fpics/products/precons/Evincars_Tyranny.jpg
+http://www.cardforge.org/fpics/products/precons/Expulsion.jpg
+http://www.cardforge.org/fpics/products/precons/Fangs_of_the_Bloodchief.jpg
+http://www.cardforge.org/fpics/products/precons/Fate_Blaster.jpg
+http://www.cardforge.org/fpics/products/precons/Fiendish_Nature.jpg
+http://www.cardforge.org/fpics/products/precons/Golgari_Deathcreep.jpg
+http://www.cardforge.org/fpics/products/precons/Golgari_Growth.jpg
+http://www.cardforge.org/fpics/products/precons/Grave_Danger.jpg
+http://www.cardforge.org/fpics/products/precons/Groundbreaker.jpg
+http://www.cardforge.org/fpics/products/precons/Heavy_Hitters.jpg
+http://www.cardforge.org/fpics/products/precons/Infestation.jpg
+http://www.cardforge.org/fpics/products/precons/Izzet_Ingenuity.jpg
+http://www.cardforge.org/fpics/products/precons/Kamahls_Temper.jpg
+http://www.cardforge.org/fpics/products/precons/Kami_Reborn.jpg
+http://www.cardforge.org/fpics/products/precons/Kithkin_Militia.jpg
+http://www.cardforge.org/fpics/products/precons/Legion_Aloft.jpg
+http://www.cardforge.org/fpics/products/precons/Life_Boost.jpg
+http://www.cardforge.org/fpics/products/precons/Little_Bashers.jpg
+http://www.cardforge.org/fpics/products/precons/Lofty_Heights.jpg
+http://www.cardforge.org/fpics/products/precons/Master_Blaster.jpg
+http://www.cardforge.org/fpics/products/precons/Mercenaries.jpg
+http://www.cardforge.org/fpics/products/precons/Merrow_Riverways.jpg
+http://www.cardforge.org/fpics/products/precons/Migraine.jpg
+http://www.cardforge.org/fpics/products/precons/Molimos_Might.jpg
+http://www.cardforge.org/fpics/products/precons/Phyrexian_Assault.jpg
+http://www.cardforge.org/fpics/products/precons/Pummel.jpg
+http://www.cardforge.org/fpics/products/precons/Radiants_Revenge.jpg
+http://www.cardforge.org/fpics/products/precons/Rakdos_Bloodsport.jpg
+http://www.cardforge.org/fpics/products/precons/Rakdos_Raid.jpg
+http://www.cardforge.org/fpics/products/precons/Replicator.jpg
+http://www.cardforge.org/fpics/products/precons/Rituals_of_Rebirth.jpg
+http://www.cardforge.org/fpics/products/precons/Sacrificial_Bam.jpg
+http://www.cardforge.org/fpics/products/precons/Selesnya_Surge.jpg
+http://www.cardforge.org/fpics/products/precons/Selesnya_United.jpg
+http://www.cardforge.org/fpics/products/precons/Shamanism.jpg
+http://www.cardforge.org/fpics/products/precons/Sky_Slam.jpg
+http://www.cardforge.org/fpics/products/precons/Sleeper.jpg
+http://www.cardforge.org/fpics/products/precons/Sliver_Shivers.jpg
+http://www.cardforge.org/fpics/products/precons/Snowscape.jpg
+http://www.cardforge.org/fpics/products/precons/Spectral_Slam.jpg
+http://www.cardforge.org/fpics/products/precons/Speed_Scorch.jpg
+http://www.cardforge.org/fpics/products/precons/Spirit_Flames.jpg
+http://www.cardforge.org/fpics/products/precons/Spiritcraft.jpg
+http://www.cardforge.org/fpics/products/precons/Stampede.jpg
+http://www.cardforge.org/fpics/products/precons/Sunburst.jpg
+http://www.cardforge.org/fpics/products/precons/The_Spikes.jpg
+http://www.cardforge.org/fpics/products/precons/The_Swarm.jpg
+http://www.cardforge.org/fpics/products/precons/Time_Drain.jpg
+http://www.cardforge.org/fpics/products/precons/Tombstone.jpg
+http://www.cardforge.org/fpics/products/precons/Trounce-O-Matic.jpg
+http://www.cardforge.org/fpics/products/precons/Truth_Seekers.jpg
+http://www.cardforge.org/fpics/products/precons/Turnabout.jpg
+http://www.cardforge.org/fpics/products/precons/Warriors_Code.jpg
+http://www.cardforge.org/fpics/products/precons/Way_Wild.jpg
+http://www.cardforge.org/fpics/products/precons/Wicked_Big.jpg
+http://www.cardforge.org/fpics/products/precons/World_Aflame.jpg
+http://www.cardforge.org/fpics/products/precons/Zombies_Unleashed.jpg
+http://www.cardforge.org/fpics/products/precons/angelic_might.jpg
+http://www.cardforge.org/fpics/products/precons/bant_exalted.jpg
+http://www.cardforge.org/fpics/products/precons/bant_on_the_march.jpg
+http://www.cardforge.org/fpics/products/precons/battle_blitz.jpg
+http://www.cardforge.org/fpics/products/precons/battle_cries.jpg
+http://www.cardforge.org/fpics/products/precons/blood_and_fire.jpg
+http://www.cardforge.org/fpics/products/precons/bound_by_strength.jpg
+http://www.cardforge.org/fpics/products/precons/breath_of_fire.jpg
+http://www.cardforge.org/fpics/products/precons/carnival_of_blood.jpg
+http://www.cardforge.org/fpics/products/precons/dark_sacrifice.jpg
+http://www.cardforge.org/fpics/products/precons/dead_ahead.jpg
+http://www.cardforge.org/fpics/products/precons/deadspread.jpg
+http://www.cardforge.org/fpics/products/precons/deathfed.jpg
+http://www.cardforge.org/fpics/products/precons/deathly_dominion.jpg
+http://www.cardforge.org/fpics/products/precons/deaths_encroach.jpg
+http://www.cardforge.org/fpics/products/precons/depths_of_power.jpg
+http://www.cardforge.org/fpics/products/precons/devouring_skies.jpg
+http://www.cardforge.org/fpics/products/precons/doom_inevitable.jpg
+http://www.cardforge.org/fpics/products/precons/eldritch_onslaught.jpg
+http://www.cardforge.org/fpics/products/precons/entangling_webs.jpg
+http://www.cardforge.org/fpics/products/precons/esper_air_assault.jpg
+http://www.cardforge.org/fpics/products/precons/esper_artifice.jpg
+http://www.cardforge.org/fpics/products/precons/eternal_siege.jpg
+http://www.cardforge.org/fpics/products/precons/feast_of_flesh.jpg
+http://www.cardforge.org/fpics/products/precons/fiery_dawn.jpg
+http://www.cardforge.org/fpics/products/precons/firebomber.jpg
+http://www.cardforge.org/fpics/products/precons/flyover.jpg
+http://www.cardforge.org/fpics/products/precons/gleeful_flames.jpg
+http://www.cardforge.org/fpics/products/precons/grab-for-power.jpg
+http://www.cardforge.org/fpics/products/precons/grave_power.jpg
+http://www.cardforge.org/fpics/products/precons/grixis_shambling_army.jpg
+http://www.cardforge.org/fpics/products/precons/grixis_undead.jpg
+http://www.cardforge.org/fpics/products/precons/hold_the_line.jpg
+http://www.cardforge.org/fpics/products/precons/infect_and_defile.jpg
+http://www.cardforge.org/fpics/products/precons/into_the_breach.jpg
+http://www.cardforge.org/fpics/products/precons/invading_spawn.jpg
+http://www.cardforge.org/fpics/products/precons/jund_appetite_for_war.jpg
+http://www.cardforge.org/fpics/products/precons/kor_armory.jpg
+http://www.cardforge.org/fpics/products/precons/levelers_glory.jpg
+http://www.cardforge.org/fpics/products/precons/levelers_scorn.jpg
+http://www.cardforge.org/fpics/products/precons/metalcraft.jpg
+http://www.cardforge.org/fpics/products/precons/mirromancy.jpg
+http://www.cardforge.org/fpics/products/precons/mob_rule.jpg
+http://www.cardforge.org/fpics/products/precons/monstrous_surprise.jpg
+http://www.cardforge.org/fpics/products/precons/myr_of_mirrodin.jpg
+http://www.cardforge.org/fpics/products/precons/mysterious_realms.jpg
+http://www.cardforge.org/fpics/products/precons/mystical_might.jpg
+http://www.cardforge.org/fpics/products/precons/naya_behemoths.jpg
+http://www.cardforge.org/fpics/products/precons/naya_domain.jpg
+http://www.cardforge.org/fpics/products/precons/path_of_blight.jpg
+http://www.cardforge.org/fpics/products/precons/phyrexian_poison.jpg
+http://www.cardforge.org/fpics/products/precons/presence_of_mind.jpg
+http://www.cardforge.org/fpics/products/precons/primordial_jund.jpg
+http://www.cardforge.org/fpics/products/precons/rapid_fire.jpg
+http://www.cardforge.org/fpics/products/precons/ravaging_swarm.jpg
+http://www.cardforge.org/fpics/products/precons/reign_of_vampirism.jpg
+http://www.cardforge.org/fpics/products/precons/relentless_dead.jpg
+http://www.cardforge.org/fpics/products/precons/relic_breaker.jpg
+http://www.cardforge.org/fpics/products/precons/repeat_performance.jpg
+http://www.cardforge.org/fpics/products/precons/repel_the_dark.jpg
+http://www.cardforge.org/fpics/products/precons/rise_of_the_vampires.jpg
+http://www.cardforge.org/fpics/products/precons/rot_from_within.jpg
+http://www.cardforge.org/fpics/products/precons/rumbler.jpg
+http://www.cardforge.org/fpics/products/precons/sacred_assault.jpg
+http://www.cardforge.org/fpics/products/precons/slaughterhouse.jpg
+http://www.cardforge.org/fpics/products/precons/sole_domination.jpg
+http://www.cardforge.org/fpics/products/precons/solitary_fiends.jpg
+http://www.cardforge.org/fpics/products/precons/spectral_legions.jpg
+http://www.cardforge.org/fpics/products/precons/spiraling_doom.jpg
+http://www.cardforge.org/fpics/products/precons/superabundance.jpg
+http://www.cardforge.org/fpics/products/precons/sweet_revenge.jpg
+http://www.cardforge.org/fpics/products/precons/swift_justice.jpg
+http://www.cardforge.org/fpics/products/precons/the_adventurers.jpg
+http://www.cardforge.org/fpics/products/precons/totem_power.jpg
+http://www.cardforge.org/fpics/products/precons/unnatural_schemes.jpg
+http://www.cardforge.org/fpics/products/precons/unstable_terrain.jpg
+http://www.cardforge.org/fpics/products/precons/vampire_onslaught.jpg
+http://www.cardforge.org/fpics/products/precons/war_of_attrition.jpg
+http://www.cardforge.org/fpics/products/precons/wild_rush.jpg
diff --git a/res/quest/quest.properties b/res/quest/quest.properties
deleted file mode 100644
index 69e16353ae9..00000000000
--- a/res/quest/quest.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-common--file=common.txt
-uncommon--file=uncommon.txt
-rare--file=rare.txt
-
-price--file=all-prices.txt
-boosterprice--file=booster-prices.txt
-
-data-xml--file=questData.dat
-data--file=questData
-prefs--file=quest.preferences
-
-duels-dir--file=duels
-challenges-dir--file=challenges
-world-dir--file=world
-data-dir--file=data
-precons-dir--file=precons
-
-bazaar-dir--file=bazaar
-bazaar--file=bazaar/index.xml
diff --git a/res/quest/tournamentpack-images.txt b/res/quest/tournamentpack-images.txt
new file mode 100644
index 00000000000..abbaddededa
--- /dev/null
+++ b/res/quest/tournamentpack-images.txt
@@ -0,0 +1,22 @@
+http://www.cardforge.org/fpics/products/tournamentpacks/2ED.jpg
+http://www.cardforge.org/fpics/products/tournamentpacks/3ED.jpg
+http://www.cardforge.org/fpics/products/tournamentpacks/4ED.jpg
+http://www.cardforge.org/fpics/products/tournamentpacks/5ED.jpg
+http://www.cardforge.org/fpics/products/tournamentpacks/6ED.jpg
+http://www.cardforge.org/fpics/products/tournamentpacks/ALA.jpg
+http://www.cardforge.org/fpics/products/tournamentpacks/CHK.jpg
+http://www.cardforge.org/fpics/products/tournamentpacks/ICE.jpg
+http://www.cardforge.org/fpics/products/tournamentpacks/INV.jpg
+http://www.cardforge.org/fpics/products/tournamentpacks/LEA.jpg
+http://www.cardforge.org/fpics/products/tournamentpacks/LEB.jpg
+http://www.cardforge.org/fpics/products/tournamentpacks/LRW.jpg
+http://www.cardforge.org/fpics/products/tournamentpacks/MIR.jpg
+http://www.cardforge.org/fpics/products/tournamentpacks/MMQ.jpg
+http://www.cardforge.org/fpics/products/tournamentpacks/MRD.jpg
+http://www.cardforge.org/fpics/products/tournamentpacks/ODY.jpg
+http://www.cardforge.org/fpics/products/tournamentpacks/ONS.jpg
+http://www.cardforge.org/fpics/products/tournamentpacks/RAV.jpg
+http://www.cardforge.org/fpics/products/tournamentpacks/SHM.jpg
+http://www.cardforge.org/fpics/products/tournamentpacks/TMP.jpg
+http://www.cardforge.org/fpics/products/tournamentpacks/TSP.jpg
+http://www.cardforge.org/fpics/products/tournamentpacks/USG.jpg
diff --git a/src/main/java/forge/Card.java b/src/main/java/forge/Card.java
index acb185935a5..bcac589e379 100644
--- a/src/main/java/forge/Card.java
+++ b/src/main/java/forge/Card.java
@@ -42,8 +42,8 @@ import forge.card.ability.AbilityUtils;
import forge.card.ability.ApiType;
import forge.card.cardfactory.CardFactoryUtil;
import forge.card.cost.Cost;
-import forge.card.mana.ManaCostBeingPaid;
import forge.card.mana.ManaCost;
+import forge.card.mana.ManaCostBeingPaid;
import forge.card.replacement.ReplaceMoved;
import forge.card.replacement.ReplacementEffect;
import forge.card.replacement.ReplacementResult;
@@ -58,8 +58,8 @@ import forge.card.trigger.TriggerType;
import forge.card.trigger.ZCTrigger;
import forge.game.GameActionUtil;
import forge.game.GlobalRuleChange;
-import forge.game.event.CounterAddedEvent;
import forge.game.event.CardEquippedEvent;
+import forge.game.event.CounterAddedEvent;
import forge.game.event.CounterRemovedEvent;
import forge.game.event.SetTappedEvent;
import forge.game.phase.Combat;
diff --git a/src/main/java/forge/CardUtil.java b/src/main/java/forge/CardUtil.java
index a5a46807d69..8b44b584570 100644
--- a/src/main/java/forge/CardUtil.java
+++ b/src/main/java/forge/CardUtil.java
@@ -17,7 +17,6 @@
*/
package forge;
-import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -39,7 +38,6 @@ import forge.game.player.Player;
import forge.game.zone.ZoneType;
import forge.gui.GuiDisplayUtil;
import forge.item.IPaperCard;
-import forge.properties.ForgeProps;
import forge.properties.NewConstants;
@@ -131,7 +129,7 @@ public final class CardUtil {
final String set = card.getCurSetCode();
CardInSet neededSet = card.getRules().getEditionInfo(set);
final int cntPictures = neededSet == null ? 1 : neededSet.getCopiesCount();
- return CardUtil.buildFilename(card.getName(), card.getCurSetCode(), card.getRandomPicture(), cntPictures, token);
+ return CardUtil.buildFilename(GuiDisplayUtil.cleanString(card.getName()), card.getCurSetCode(), card.getRandomPicture(), cntPictures, token);
}
/**
@@ -146,7 +144,7 @@ public final class CardUtil {
final int maxIndex = cr.getEditionInfo(card.getEdition()).getCopiesCount();
// picture is named AssaultBattery.full.jpg
String imageName = cr.getSplitType() != CardSplitType.Split ? card.getName() : buildSplitCardFilename(cr);
- return CardUtil.buildFilename(imageName, card.getEdition(), card.getArtIndex(), maxIndex, false);
+ return CardUtil.buildFilename(GuiDisplayUtil.cleanString(imageName), card.getEdition(), card.getArtIndex(), maxIndex, false);
}
public static String buildSplitCardFilename(CardRules cr) {
@@ -164,68 +162,18 @@ public final class CardUtil {
*/
public static String buildFilename(final IPaperCard card, final String nameToUse) {
final int maxIndex = card.getRules().getEditionInfo(card.getEdition()).getCopiesCount();
- return CardUtil.buildFilename(nameToUse, card.getEdition(), card.getArtIndex(), maxIndex, false);
+ return CardUtil.buildFilename(GuiDisplayUtil.cleanString(nameToUse), card.getEdition(), card.getArtIndex(), maxIndex, false);
}
- private static String buildFilename(final String cardName, final String setName, final int artIndex,
+ public static String buildFilename(final String cleanCardName, final String setName, final int artIndex,
final int artIndexMax, final boolean isToken) {
- final File path = ForgeProps.getFile(isToken ? NewConstants.IMAGE_TOKEN : NewConstants.IMAGE_BASE);
- final String nn = artIndexMax > 1 ? Integer.toString(artIndex + 1) : "";
- final String cleanCardName = GuiDisplayUtil.cleanString(cardName);
-
- File f = null;
- if (StringUtils.isNotBlank(setName)) {
- final String mwsCardName = GuiDisplayUtil.cleanStringMWS(cardName);
-
- // First, try 3 letter set code with MWS filename format
- final String mwsSet3 = String.format("%s/%s%s.full", setName, mwsCardName, nn);
- f = new File(path, mwsSet3 + ".jpg");
- if (f.exists()) {
- return mwsSet3;
- }
-
- // Second, try 2 letter set code with MWS filename format
- final String mwsSet2 = String.format("%s/%s%s.full", Singletons.getModel().getEditions().getCode2ByCode(setName), mwsCardName, nn);
- f = new File(path, mwsSet2 + ".jpg");
- if (f.exists()) {
- return mwsSet2;
- }
-
- // Third, try 3 letter set code with Forge filename format
- final String forgeSet3 = String.format("%s/%s%s", setName, cleanCardName, nn);
- f = new File(path, forgeSet3 + ".jpg");
- if (f.exists()) {
- return forgeSet3;
- }
- }
-
- // Last, give up with set images, go with the old picture type
- final String forgePlain = String.format("%s%s", cleanCardName, nn);
-
- f = new File(path, forgePlain + ".jpg");
- if (f.exists()) {
- return forgePlain;
- }
-
- // give up with art index
- f = new File(path, cleanCardName + ".jpg");
- if (f.exists()) {
- return cleanCardName;
- }
-
- // if still no file, download if option enabled?
- return "none";
+ return String.format("%s%s%s%s.full",
+ isToken ? ImageCache.TOKEN_PREFIX : "",
+ StringUtils.isBlank(setName) ? "" : setName + "/",
+ cleanCardName,
+ artIndexMax <= 1 ? "" : String.valueOf(artIndex + 1));
}
- /**
- *
- * getShortColorsString.
- *
- *
- * @param colors
- * a {@link java.util.ArrayList} object.
- * @return a {@link java.lang.String} object.
- */
public static String getShortColorsString(final ArrayList colors) {
String colorDesc = "";
for (final String col : colors) {
@@ -412,7 +360,7 @@ public final class CardUtil {
ret.setName("");
ret.setType(types);
- ret.setImageFilename(NewConstants.MORPH_IMAGE_FILE_NAME);
+ ret.setImageFilename(NewConstants.CACHE_MORPH_IMAGE_FILE);
return ret;
}
diff --git a/src/main/java/forge/Constant.java b/src/main/java/forge/Constant.java
index dedcda1983a..b672b8d65c7 100644
--- a/src/main/java/forge/Constant.java
+++ b/src/main/java/forge/Constant.java
@@ -22,9 +22,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-import forge.properties.ForgeProps;
-import forge.properties.NewConstants;
-
/**
*
* Constant interface.
@@ -34,9 +31,6 @@ import forge.properties.NewConstants;
* @version $Id$
*/
public final class Constant {
- /** Constant ProgramName="Forge - http://cardforge.org". */
- public static final String PROGRAM_NAME = "Forge - " + ForgeProps.getProperty(NewConstants.CARDFORGE_URL);
-
// used to pass information between the GUI screens
/**
* The Class Runtime.
diff --git a/src/main/java/forge/ImageCache.java b/src/main/java/forge/ImageCache.java
index d0bfd66222b..75d629e7921 100644
--- a/src/main/java/forge/ImageCache.java
+++ b/src/main/java/forge/ImageCache.java
@@ -19,6 +19,7 @@ package forge;
import java.awt.image.BufferedImage;
import java.util.concurrent.ExecutionException;
+
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader.InvalidCacheLoadException;
import com.google.common.cache.LoadingCache;
@@ -27,6 +28,7 @@ import com.mortennobel.imagescaling.ResampleOp;
import forge.gui.GuiDisplayUtil;
import forge.item.InventoryItem;
import forge.properties.ForgePreferences.FPref;
+import forge.properties.NewConstants;
/**
* This class stores ALL card images in a cache with soft values. this means
@@ -43,18 +45,17 @@ import forge.properties.ForgePreferences.FPref;
* @version $Id$
*/
public class ImageCache {
- /** Constant imageCache. */
- static final LoadingCache CACHE = CacheBuilder.newBuilder().softValues().build(new ImageLoader());
- /** Constant FULL_SIZE. */
-
- public static final String SEALED_PRODUCT = "sealed://";
- public static final String TOKEN = "token://";
+ // short prefixes to save memory
+ public static final String TOKEN_PREFIX = "t:";
+ public static final String BOOSTER_PREFIX = "b:";
+ public static final String FATPACK_PREFIX = "f:";
+ public static final String PRECON_PREFIX = "p:";
+ public static final String TOURNAMENTPACK_PREFIX = "o:";
+
+ static private final LoadingCache CACHE = CacheBuilder.newBuilder().softValues().build(new ImageLoader());
public static BufferedImage getImage(final Card card, final int width, final int height) {
- //SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss.SSS");
- //System.out.printf("%s - load '%s' (%d x %d)\n", sdf.format(new Date()), card.getImageFilename(), width, height );
-
- final String key = card.canBeShownTo(Singletons.getControl().getPlayer()) ? ImageCache.getKey(card) : "Morph";
+ final String key = card.canBeShownTo(Singletons.getControl().getPlayer()) ? ImageCache.getKey(card) : NewConstants.CACHE_MORPH_IMAGE_FILE;
return scaleImage(key, width, height);
}
@@ -70,12 +71,6 @@ public class ImageCache {
return scaleImage(key, width, height);
}
- /**
- * TODO: Write javadoc for this method.
- * @param original
- * @param scale
- * @return
- */
private static BufferedImage scaleImage(String key, final int width, final int height) {
if (3 > width || 3 > height) {
// picture too small; return a blank
@@ -118,10 +113,6 @@ public class ImageCache {
/**
* Returns the Image corresponding to the key.
- *
- * @param key
- * a {@link java.lang.String} object.
- * @return a {@link java.awt.image.BufferedImage} object.
*/
private static BufferedImage getImage(final String key) {
try {
@@ -140,14 +131,10 @@ public class ImageCache {
/**
* Returns the map key for a card, without any suffixes for the image size.
- *
- * @param card
- * a {@link forge.Card} object.
- * @return a {@link java.lang.String} object.
*/
public static String getKey(final Card card) {
if ((card.isToken() && !card.isCopiedToken()) || card.isFaceDown()) {
- return ImageCache.TOKEN + GuiDisplayUtil.cleanString(card.getImageFilename());
+ return ImageCache.TOKEN_PREFIX + GuiDisplayUtil.cleanString(card.getImageFilename());
}
return card.getImageFilename(); // key;
}
@@ -155,5 +142,4 @@ public class ImageCache {
public static String getKey(final InventoryItem ii) {
return ii.getImageFilename();
}
-
}
diff --git a/src/main/java/forge/ImageLoader.java b/src/main/java/forge/ImageLoader.java
index 62a5d975e03..2053a2def90 100644
--- a/src/main/java/forge/ImageLoader.java
+++ b/src/main/java/forge/ImageLoader.java
@@ -3,70 +3,76 @@ package forge;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
+
import javax.imageio.ImageIO;
import com.google.common.cache.CacheLoader;
import forge.error.BugReporter;
-import forge.properties.ForgeProps;
import forge.properties.NewConstants;
-/**
- * TODO: Write javadoc for this type.
- *
- */
final class ImageLoader extends CacheLoader {
+ // image file extensions for various formats in order of likelihood
+ private static final String[] _FILE_EXTENSIONS = { ".jpg", ".png" };
+
@Override
public BufferedImage load(String key) {
- // original
- File path;
- String filename;
- if (key.startsWith(ImageCache.TOKEN)) {
- filename = key.substring(ImageCache.TOKEN.length());
- path = ForgeProps.getFile(NewConstants.IMAGE_TOKEN);
- } else if (key.startsWith(ImageCache.SEALED_PRODUCT)) {
- filename = key.substring(ImageCache.SEALED_PRODUCT.length());
- path = ForgeProps.getFile(NewConstants.IMAGE_SEALED_PRODUCT);
+ final String path;
+ final String filename;
+ if (key.startsWith(ImageCache.TOKEN_PREFIX)) {
+ filename = key.substring(ImageCache.TOKEN_PREFIX.length());
+ path = NewConstants.CACHE_TOKEN_PICS_DIR;
+ } else if (key.startsWith(ImageCache.BOOSTER_PREFIX)) {
+ filename = key.substring(ImageCache.BOOSTER_PREFIX.length());
+ path = NewConstants.CACHE_BOOSTER_PICS_DIR;
+ } else if (key.startsWith(ImageCache.FATPACK_PREFIX)) {
+ filename = key.substring(ImageCache.FATPACK_PREFIX.length());
+ path = NewConstants.CACHE_FATPACK_PICS_DIR;
+ } else if (key.startsWith(ImageCache.PRECON_PREFIX)) {
+ filename = key.substring(ImageCache.PRECON_PREFIX.length());
+ path = NewConstants.CACHE_PRECON_PICS_DIR;
+ } else if (key.startsWith(ImageCache.TOURNAMENTPACK_PREFIX)) {
+ filename = key.substring(ImageCache.TOURNAMENTPACK_PREFIX.length());
+ path = NewConstants.CACHE_TOURNAMENTPACK_PICS_DIR;
} else {
filename = key;
- path = ForgeProps.getFile(NewConstants.IMAGE_BASE);
+ path = NewConstants.CACHE_CARD_PICS_DIR;
}
- File file = null;
- boolean isPng = filename.endsWith(".png");
- final String fName = isPng || filename.endsWith(".jpg") ? filename : filename + ".jpg";
- file = new File(path, fName);
- if (!file.exists()) {
- // DEBUG
- //System.out.println("File not found, no image created: "
- //+ file);
- return null;
+ BufferedImage ret = _findFile(key, path, filename);
+
+ // try without set prefix (if any)
+ if (null == ret && filename.contains("/")) {
+ ret = _findFile(key, path, filename.substring(filename.indexOf('/') + 1));
}
- final BufferedImage image = getImage(file);
- //ImageCache.IMAGE_CACHE.put(key, image);
- return image;
+
+ if (null == ret) {
+ System.out.println("File not found, no image created: " + key);
+ }
+
+ return ret;
}
- /**
- *
- * getImage.
- *
- *
- * @param file a {@link java.io.File} object.
- * @return a {@link java.awt.image.BufferedImage} object.
- * @throws IOException Signals that an I/O exception has occurred.
- */
public static BufferedImage getImage(final File file) {
- //System.out.printf("Loading from disk: %s\n", file.toString());
-
- BufferedImage image;
- //int format = useAlpha ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB;
+ BufferedImage image = null;;
try {
image = ImageIO.read(file);
} catch (IOException ex) {
BugReporter.reportException(ex, "Could not read image file " + file.getAbsolutePath() + " ");
- return null;
}
return image;
}
+
+ private static BufferedImage _findFile(String key, String path, String filename) {
+ for (String ext : _FILE_EXTENSIONS) {
+ File file = new File(path, filename + ext);
+ if (file.exists()) {
+ System.out.println(String.format("Found %s at: %s", key, file.getAbsolutePath()));
+ return getImage(file);
+ }
+ }
+
+ return null;
+
+ }
}
\ No newline at end of file
diff --git a/src/main/java/forge/Singletons.java b/src/main/java/forge/Singletons.java
index e6376b3f204..96f3ce81dec 100644
--- a/src/main/java/forge/Singletons.java
+++ b/src/main/java/forge/Singletons.java
@@ -25,50 +25,22 @@ import forge.view.FView;
* Provides global/static access to singleton instances.
*/
public final class Singletons {
-
- private static FModel model = null;
-
- private static FView view = null;
-
+ private static FModel model = null;
+ private static FView view = null;
private static FControl control = null;
- /**
- * Do not instantiate.
- */
- private Singletons() {
- // This line intentionally left blank.
- }
-
- /** @return {@link forge.model.FModel} */
- public static FModel getModel() {
- return Singletons.model;
- }
-
- /** @param model0 {@link forge.model.FModel} */
- public static void setModel(final FModel model0) {
- Singletons.model = model0;
- }
-
/**
* IMPORTANT - does not return view frame! Must call
* getFrame() from FView for that.
- * @return {@link forge.model.JFrame} */
- public static FView getView() {
- return Singletons.view;
- }
+ */
+ public static FView getView() { return view; }
+ public static FControl getControl() { return control; }
+ public static FModel getModel() { return model; }
- /** @param view0 {@link forge.model.FView} */
- public static void setView(final FView view0) {
- Singletons.view = view0;
- }
+ public static void setModel (FModel model0) { model = model0; }
+ public static void setView (FView view0) { view = view0; }
+ public static void setControl(FControl control0) { control = control0; }
- /** @return {@link forge.control.FControl} */
- public static FControl getControl() {
- return Singletons.control;
- }
-
- /** @param control0 {@link forge.control.FControl} */
- public static void setControl(final FControl control0) {
- Singletons.control = control0;
- }
+ // disallow instantiation
+ private Singletons() { }
}
diff --git a/src/main/java/forge/StaticEffects.java b/src/main/java/forge/StaticEffects.java
index 0ddbb669f96..65f1880ffcd 100644
--- a/src/main/java/forge/StaticEffects.java
+++ b/src/main/java/forge/StaticEffects.java
@@ -28,9 +28,9 @@ import com.esotericsoftware.minlog.Log;
import forge.card.replacement.ReplacementEffect;
import forge.card.spellability.SpellAbility;
import forge.card.staticability.StaticAbility;
+import forge.game.GlobalRuleChange;
import forge.game.player.Player;
import forge.game.zone.ZoneType;
-import forge.game.GlobalRuleChange;
/**
*
- *
- * @param
- * a T object.
- * @param button
- * a T object.
- * @return a T object.
- */
public T setupButton(final T button) {
button.setAction(this);
button.setText((String) this.getValue(button instanceof JMenuItem ? "menuText" : "buttonText"));
diff --git a/src/main/java/forge/gui/GuiDisplayUtil.java b/src/main/java/forge/gui/GuiDisplayUtil.java
index cd601122daa..ad24bb63a2c 100644
--- a/src/main/java/forge/gui/GuiDisplayUtil.java
+++ b/src/main/java/forge/gui/GuiDisplayUtil.java
@@ -41,7 +41,6 @@ import com.google.common.collect.Lists;
import forge.Card;
import forge.CardCharacteristicName;
-
import forge.CardLists;
import forge.CardPredicates;
import forge.CardUtil;
@@ -61,29 +60,11 @@ import forge.item.CardDb;
import forge.item.CardPrinted;
import forge.item.IPaperCard;
-/**
- *
- * GuiDisplayUtil class.
- *
- *
- * @author Forge
- * @version $Id$
- */
public final class GuiDisplayUtil {
-
private GuiDisplayUtil() {
throw new AssertionError();
}
- /**
- *
- * getBorder.
- *
- *
- * @param card
- * a {@link forge.Card} object.
- * @return a {@link javax.swing.border.Border} object.
- */
public static Border getBorder(final Card card) {
// color info
if (card == null) {
@@ -137,11 +118,6 @@ public final class GuiDisplayUtil {
}
}
- /**
- *
- * devModeGenerateMana.
- *
- */
public static void devModeGenerateMana() {
final Card dummy = new Card();
final Player human = Singletons.getControl().getPlayer();
@@ -153,15 +129,6 @@ public final class GuiDisplayUtil {
abMana.produceMana(null);
}
- /**
- *
- * formatCardType.
- *
- *
- * @param card
- * a {@link forge.Card} object.
- * @return a {@link java.lang.String} object.
- */
public static String formatCardType(final Card card) {
final ArrayList list = card.getType();
final StringBuilder sb = new StringBuilder();
@@ -205,58 +172,20 @@ public final class GuiDisplayUtil {
return sb.toString();
}
- /**
- *
- * cleanString.
- *
- *
- * @param in
- * a {@link java.lang.String} object.
- * @return a {@link java.lang.String} object.
- */
public static String cleanString(final String in) {
final StringBuffer out = new StringBuffer();
char c;
for (int i = 0; i < in.length(); i++) {
c = in.charAt(i);
- if ((c == ' ') || (c == '-')) {
+ if ((c == ' ') || (c == '-') || (c == '_')) {
out.append('_');
- } else if (Character.isLetterOrDigit(c) || (c == '_')) {
+ } else if (Character.isLetterOrDigit(c)) {
out.append(c);
}
}
return out.toString().toLowerCase();
}
- /**
- *
- * cleanStringMWS.
- *
- *
- * @param in
- * a {@link java.lang.String} object.
- * @return a {@link java.lang.String} object.
- */
- public static String cleanStringMWS(final String in) {
- final StringBuffer out = new StringBuffer();
- char c;
- for (int i = 0; i < in.length(); i++) {
- c = in.charAt(i);
- if ((c == '"') || (c == '/') || (c == ':') || (c == '?')) {
- out.append("");
- } else {
- out.append(c);
- }
- }
- return out.toString();
- }
-
-
- /**
- *
- * updateGUI.
- *
- */
public static void updateGUI() {
for (Player p : Singletons.getModel().getGame().getRegisteredPlayers()) {
@@ -265,11 +194,6 @@ public final class GuiDisplayUtil {
}
}
- /**
- *
- * devSetupGameState.
- *
- */
public static void devSetupGameState() {
String tHumanLife = "-1";
String tComputerLife = "-1";
diff --git a/src/main/java/forge/gui/GuiImportPicture.java b/src/main/java/forge/gui/GuiImportPicture.java
index 98991f53059..08c7a59e260 100644
--- a/src/main/java/forge/gui/GuiImportPicture.java
+++ b/src/main/java/forge/gui/GuiImportPicture.java
@@ -41,7 +41,6 @@ import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.event.MouseInputAdapter;
-import forge.properties.ForgeProps;
import forge.properties.NewConstants;
import forge.util.CopyFiles;
import forge.util.FileFinder;
@@ -129,7 +128,7 @@ public class GuiImportPicture extends JDialog {
this.jLabelHDDFree = new JLabel();
this.jLabelHDDFree.setBounds(new Rectangle(15, 119, 177, 16));
- final File file = ForgeProps.getFile(NewConstants.IMAGE_BASE);
+ final File file = new File(NewConstants.CACHE_CARD_PICS_DIR);
final long freeSpace = file.getFreeSpace();
this.freeSpaceM = freeSpace / 1024 / 1024;
@@ -223,7 +222,7 @@ public class GuiImportPicture extends JDialog {
start = fName.indexOf("full");
fName = fName.substring(0, start - 1) + fName.substring(start + 4, fName.length() - 4);
fName = GuiDisplayUtil.cleanString(fName) + ".jpg";
- final File file = new File(ForgeProps.getFile(NewConstants.IMAGE_BASE), fName);
+ final File file = new File(NewConstants.CACHE_CARD_PICS_DIR, fName);
if (!file.exists()) {
GuiImportPicture.this.filesForCopy = GuiImportPicture.this.filesForCopy + 1;
filesToCopySize = filesToCopySize + GuiImportPicture.this.listFiles.get(i).length();
@@ -324,7 +323,7 @@ public class GuiImportPicture extends JDialog {
start = fName.indexOf("full");
fName = fName.substring(0, start - 1) + fName.substring(start + 4, fName.length() - 4);
fName = GuiDisplayUtil.cleanString(fName) + ".jpg";
- final File file = new File(ForgeProps.getFile(NewConstants.IMAGE_BASE), fName);
+ final File file = new File(NewConstants.CACHE_CARD_PICS_DIR, fName);
if (!file.exists()) {
GuiImportPicture.this.filesForCopy = GuiImportPicture.this.filesForCopy + 1;
filesToCopySize = filesToCopySize + GuiImportPicture.this.listFiles.get(i).length();
diff --git a/src/main/java/forge/gui/deckeditor/DeckImport.java b/src/main/java/forge/gui/deckeditor/DeckImport.java
index 69d02986828..d637217b51a 100644
--- a/src/main/java/forge/gui/deckeditor/DeckImport.java
+++ b/src/main/java/forge/gui/deckeditor/DeckImport.java
@@ -26,13 +26,13 @@ import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.JButton;
+import javax.swing.JCheckBox;
import javax.swing.JDialog;
import javax.swing.JEditorPane;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
-import javax.swing.JCheckBox;
import javax.swing.border.TitledBorder;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
@@ -44,8 +44,8 @@ import net.miginfocom.swing.MigLayout;
import forge.deck.Deck;
import forge.deck.DeckBase;
import forge.deck.DeckRecognizer;
-import forge.deck.DeckSection;
import forge.deck.DeckRecognizer.TokenType;
+import forge.deck.DeckSection;
import forge.gui.GuiUtils;
import forge.gui.deckeditor.controllers.ACEditorBase;
import forge.item.CardPrinted;
diff --git a/src/main/java/forge/gui/deckeditor/SEditorIO.java b/src/main/java/forge/gui/deckeditor/SEditorIO.java
index 6c95d1f14ec..47208545ae3 100644
--- a/src/main/java/forge/gui/deckeditor/SEditorIO.java
+++ b/src/main/java/forge/gui/deckeditor/SEditorIO.java
@@ -1,11 +1,8 @@
package forge.gui.deckeditor;
-import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -201,7 +198,7 @@ public class SEditorIO {
*/
private static void save() throws Exception {
final XMLOutputFactory out = XMLOutputFactory.newInstance();
- final XMLEventWriter writer = out.createXMLEventWriter(new FileOutputStream(NewConstants.PREFS_EDITOR_FILE));
+ final XMLEventWriter writer = out.createXMLEventWriter(new FileOutputStream(NewConstants.EDITOR_PREFERENCES_FILE.userPrefLoc));
writer.add(EVENT_FACTORY.createStartDocument());
writer.add(NEWLINE);
@@ -252,37 +249,17 @@ public class SEditorIO {
}
private static void load() throws Exception {
- // Preferences files have been consolidated into res/preferences/.
- // This code is here temporarily to facilitate this transfer.
- // After a while, this can be deleted. Doublestrike 21-5-12
- final File oldFile = new File("editor.preferences");
- if (oldFile.exists()) {
- final File newFile = new File(NewConstants.PREFS_EDITOR_FILE);
- final InputStream in = new FileInputStream(oldFile);
- final OutputStream out = new FileOutputStream(newFile);
-
- byte[] buf = new byte[1024];
- int len;
- while ((len = in.read(buf)) > 0) {
- out.write(buf, 0, len);
- }
- in.close();
- out.close();
-
- oldFile.delete();
- } // END TEMPORARY CONSOLIDATION FACILITATION
-
final XMLInputFactory inputFactory = XMLInputFactory.newInstance();
PREFS.clear();
COLS.clear();
// read in defaults
- loadPrefs(inputFactory.createXMLEventReader(new FileInputStream(NewConstants.PREFS_DEFAULT_EDITOR_FILE)));
+ loadPrefs(inputFactory.createXMLEventReader(new FileInputStream(NewConstants.EDITOR_PREFERENCES_FILE.defaultLoc)));
try {
// overwrite defaults with user preferences, if they exist
- loadPrefs(inputFactory.createXMLEventReader(new FileInputStream(NewConstants.PREFS_EDITOR_FILE)));
+ loadPrefs(inputFactory.createXMLEventReader(new FileInputStream(NewConstants.EDITOR_PREFERENCES_FILE.userPrefLoc)));
} catch (FileNotFoundException e) {
/* ignore; it's ok if this file doesn't exist */
} finally {
diff --git a/src/main/java/forge/gui/deckeditor/controllers/CCurrentDeck.java b/src/main/java/forge/gui/deckeditor/controllers/CCurrentDeck.java
index c074f39f145..d1b097fda6a 100644
--- a/src/main/java/forge/gui/deckeditor/controllers/CCurrentDeck.java
+++ b/src/main/java/forge/gui/deckeditor/controllers/CCurrentDeck.java
@@ -20,8 +20,6 @@ import forge.gui.deckeditor.tables.DeckController;
import forge.gui.deckeditor.views.VCurrentDeck;
import forge.gui.framework.ICDoc;
import forge.gui.toolbox.FLabel;
-import forge.properties.ForgeProps;
-import forge.properties.NewConstants;
/**
* Controls the "current deck" panel in the deck editor UI.
@@ -35,9 +33,7 @@ public enum CCurrentDeck implements ICDoc {
private static File previousDirectory = null;
- private File openStartDir = ForgeProps.getFile(NewConstants.NEW_DECKS);
-
- private JFileChooser fileChooser = new JFileChooser("");
+ private JFileChooser fileChooser = new JFileChooser();
//========== Overridden methods
@@ -166,8 +162,6 @@ public enum CCurrentDeck implements ICDoc {
private File getImportFilename() {
fileChooser.setDialogTitle("Import Deck");
- fileChooser.setCurrentDirectory(openStartDir);
-
final int returnVal = fileChooser.showOpenDialog(null);
if (returnVal == JFileChooser.APPROVE_OPTION) {
diff --git a/src/main/java/forge/gui/deckeditor/controllers/CEditorConstructed.java b/src/main/java/forge/gui/deckeditor/controllers/CEditorConstructed.java
index 0275b377a99..a2683e15652 100644
--- a/src/main/java/forge/gui/deckeditor/controllers/CEditorConstructed.java
+++ b/src/main/java/forge/gui/deckeditor/controllers/CEditorConstructed.java
@@ -23,6 +23,7 @@ import java.util.Map;
import com.google.common.base.Predicates;
import com.google.common.base.Supplier;
+
import forge.Command;
import forge.Singletons;
import forge.card.CardRulesPredicates;
diff --git a/src/main/java/forge/gui/deckeditor/controllers/CStatistics.java b/src/main/java/forge/gui/deckeditor/controllers/CStatistics.java
index 5fd06fca47b..07c675c25bd 100644
--- a/src/main/java/forge/gui/deckeditor/controllers/CStatistics.java
+++ b/src/main/java/forge/gui/deckeditor/controllers/CStatistics.java
@@ -6,10 +6,11 @@ import javax.swing.JLabel;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
+
import forge.Command;
-import forge.card.MagicColor;
-import forge.card.CardRulesPredicates;
import forge.card.CardRules;
+import forge.card.CardRulesPredicates;
+import forge.card.MagicColor;
import forge.deck.DeckBase;
import forge.gui.deckeditor.CDeckEditorUI;
import forge.gui.deckeditor.SEditorUtil;
diff --git a/src/main/java/forge/gui/deckeditor/tables/ManaCostRenderer.java b/src/main/java/forge/gui/deckeditor/tables/ManaCostRenderer.java
index f818a466aef..97260b48fb3 100644
--- a/src/main/java/forge/gui/deckeditor/tables/ManaCostRenderer.java
+++ b/src/main/java/forge/gui/deckeditor/tables/ManaCostRenderer.java
@@ -24,8 +24,8 @@ import java.util.List;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
-import forge.card.mana.ManaCostShard;
import forge.card.mana.ManaCost;
+import forge.card.mana.ManaCostShard;
import forge.gui.toolbox.CardFaceSymbols;
/**
diff --git a/src/main/java/forge/gui/deckeditor/tables/SColumnUtil.java b/src/main/java/forge/gui/deckeditor/tables/SColumnUtil.java
index a30c993a678..1d6c2c531ba 100644
--- a/src/main/java/forge/gui/deckeditor/tables/SColumnUtil.java
+++ b/src/main/java/forge/gui/deckeditor/tables/SColumnUtil.java
@@ -31,9 +31,9 @@ import com.google.common.base.Function;
import forge.Singletons;
import forge.card.CardAiHints;
-import forge.card.ColorSet;
import forge.card.CardEdition;
import forge.card.CardRarity;
+import forge.card.ColorSet;
import forge.card.mana.ManaCost;
import forge.deck.DeckBase;
import forge.game.limited.DraftRankCache;
diff --git a/src/main/java/forge/gui/download/GuiDownloadPicturesLQ.java b/src/main/java/forge/gui/download/GuiDownloadPicturesLQ.java
index f4ad0762fc2..a824fdbb5a0 100644
--- a/src/main/java/forge/gui/download/GuiDownloadPicturesLQ.java
+++ b/src/main/java/forge/gui/download/GuiDownloadPicturesLQ.java
@@ -26,7 +26,6 @@ import forge.card.ICardCharacteristics;
import forge.gui.GuiDisplayUtil;
import forge.item.CardDb;
import forge.item.IPaperCard;
-import forge.properties.ForgeProps;
import forge.properties.NewConstants;
/**
@@ -37,10 +36,8 @@ import forge.properties.NewConstants;
* @author Forge
* @version $Id$
*/
+@SuppressWarnings("serial")
public class GuiDownloadPicturesLQ extends GuiDownloader {
-
- private static final long serialVersionUID = -2839597792999139007L;
- private String baseFolder;
private ArrayList downloads;
/**
@@ -59,13 +56,10 @@ public class GuiDownloadPicturesLQ extends GuiDownloader {
* @return an array of {@link forge.gui.download.GuiDownloader.DownloadObject} objects.
*/
@Override
- protected final DownloadObject[] getNeededImages() {
- // This is called as a virtual method from constructor.
- baseFolder = ForgeProps.getFile(NewConstants.IMAGE_BASE).getPath();
+ protected final ArrayList getNeededImages() {
downloads = new ArrayList();
for (final IPaperCard c : CardDb.instance().getUniqueCards()) {
- //System.out.println(c.getName());
CardRules cardRules = c.getRules();
this.createDLObjects(cardRules.getPictureUrl(), cardRules.getMainPart().getName());
@@ -76,15 +70,13 @@ public class GuiDownloadPicturesLQ extends GuiDownloader {
}
// Add missing tokens to the list of things to download.
- for (final DownloadObject element : GuiDownloader.readFileWithNames(NewConstants.TOKEN_IMAGES,
- ForgeProps.getFile(NewConstants.IMAGE_TOKEN))) {
+ for (final DownloadObject element : GuiDownloader.readFileWithNames(NewConstants.IMAGE_LIST_TOKENS_FILE, NewConstants.CACHE_TOKEN_PICS_DIR)) {
if (!element.getDestination().exists()) {
downloads.add(element);
}
}
- // Return all card names and URLs that are needed.
- return downloads.toArray(new DownloadObject[downloads.size()]);
+ return downloads;
} // getNeededImages()
private void createDLObjects(final String url, final String cardName) {
@@ -93,10 +85,10 @@ public class GuiDownloadPicturesLQ extends GuiDownloader {
final String[] urls = url.split("\\\\");
final String sName = GuiDisplayUtil.cleanString(cardName);
- addDownloadObject(urls[0], new File(baseFolder, sName + ".jpg"));
+ addDownloadObject(urls[0], new File(NewConstants.CACHE_CARD_PICS_DIR, sName + ".jpg"));
for (int j = 1; j < urls.length; j++) {
- addDownloadObject(urls[j], new File(baseFolder, sName + j + ".jpg"));
+ addDownloadObject(urls[j], new File(NewConstants.CACHE_CARD_PICS_DIR, sName + j + ".jpg"));
}
}
}
@@ -106,23 +98,4 @@ public class GuiDownloadPicturesLQ extends GuiDownloader {
downloads.add(new DownloadObject(url, destFile));
}
}
-
- /**
- * Builds the ideal filename.
- *
- * @param cardName
- * the card name
- * @param artIndex
- * the art index
- * @param artIndexMax
- * the art index max
- * @return the string
- */
- public static String buildIdealFilename(final String cardName, final int artIndex, final int artIndexMax) {
- final String nn = artIndexMax > 1 ? Integer.toString(artIndex + 1) : "";
- final String mwsCardName = GuiDisplayUtil.cleanStringMWS(cardName);
- // 3 letter set code with MWS filename format
- return String.format("%s%s.full.jpg", mwsCardName, nn);
- }
-
}
diff --git a/src/main/java/forge/gui/download/GuiDownloadPrices.java b/src/main/java/forge/gui/download/GuiDownloadPrices.java
index 157dac80942..8e99ae9bd07 100644
--- a/src/main/java/forge/gui/download/GuiDownloadPrices.java
+++ b/src/main/java/forge/gui/download/GuiDownloadPrices.java
@@ -18,30 +18,21 @@
package forge.gui.download;
import java.io.File;
+import java.util.ArrayList;
+
+import com.google.common.collect.Lists;
-import forge.properties.ForgeProps;
import forge.properties.NewConstants;
-/** */
@SuppressWarnings("serial")
public class GuiDownloadPrices extends GuiDownloader {
-
- /**
- * Constructor.
- */
public GuiDownloadPrices() {
super();
}
- /* (non-Javadoc)
- * @see forge.gui.download.GuiDownloader#getNeededImages()
- */
@Override
- protected DownloadObject[] getNeededImages() {
- final File f = ForgeProps.getFile(NewConstants.Quest.PRICE);
- final String url = "http://www.cardforge.org/MagicInfo/pricegen.php";
- final DownloadObject[] objects = {new DownloadObject(url, f)};
- return objects;
+ protected ArrayList getNeededImages() {
+ final File f = new File(NewConstants.QUEST_CARD_PRICE_FILE.userPrefLoc);
+ return Lists.newArrayList(new DownloadObject(NewConstants.URL_PRICE_DOWNLOAD, f));
}
-
-} // @jve:decl-index=0:visual-constraint="10,10"
+}
diff --git a/src/main/java/forge/gui/download/GuiDownloadQuestImages.java b/src/main/java/forge/gui/download/GuiDownloadQuestImages.java
index 25ccf870a6b..7833ee49aae 100644
--- a/src/main/java/forge/gui/download/GuiDownloadQuestImages.java
+++ b/src/main/java/forge/gui/download/GuiDownloadQuestImages.java
@@ -18,9 +18,7 @@
package forge.gui.download;
import java.util.ArrayList;
-import java.util.List;
-import forge.properties.ForgeProps;
import forge.properties.NewConstants;
/** */
@@ -43,39 +41,52 @@ public class GuiDownloadQuestImages extends GuiDownloader {
* @return an array of {@link forge.gui.download.GuiDownloadSetPicturesLQ} objects.
*/
@Override
- protected final DownloadObject[] getNeededImages() {
+ protected final ArrayList getNeededImages() {
// read all card names and urls
- final List urls = new ArrayList();
+ final ArrayList urls = new ArrayList();
- for (final DownloadObject questOpponent : GuiDownloader.readFile(NewConstants.Quest.OPPONENT_ICONS, ForgeProps.getFile(NewConstants.Quest.OPPONENT_DIR))) {
+ for (final DownloadObject questOpponent : GuiDownloader.readFile(NewConstants.IMAGE_LIST_QUEST_OPPONENT_ICONS_FILE, NewConstants.CACHE_ICON_PICS_DIR)) {
if (!questOpponent.getDestination().exists()) {
urls.add(questOpponent);
}
}
- for (final DownloadObject boosterImage : GuiDownloader.readFile(NewConstants.PICS_BOOSTER_IMAGES, ForgeProps.getFile(NewConstants.IMAGE_SEALED_PRODUCT))) {
- if (!boosterImage.getDestination().exists()) {
- urls.add(boosterImage);
+ for (final DownloadObject packImage : GuiDownloader.readFile(NewConstants.IMAGE_LIST_QUEST_BOOSTERS_FILE, NewConstants.CACHE_BOOSTER_PICS_DIR)) {
+ if (!packImage.getDestination().exists()) {
+ urls.add(packImage);
}
}
- for (final DownloadObject petIcon : GuiDownloader.readFileWithNames(NewConstants.Quest.PET_SHOP_ICONS, ForgeProps.getFile(NewConstants.IMAGE_ICON))) {
+ for (final DownloadObject packImage : GuiDownloader.readFile(NewConstants.IMAGE_LIST_QUEST_FATPACKS_FILE, NewConstants.CACHE_FATPACK_PICS_DIR)) {
+ if (!packImage.getDestination().exists()) {
+ urls.add(packImage);
+ }
+ }
+
+ for (final DownloadObject packImage : GuiDownloader.readFile(NewConstants.IMAGE_LIST_QUEST_PRECONS_FILE, NewConstants.CACHE_PRECON_PICS_DIR)) {
+ if (!packImage.getDestination().exists()) {
+ urls.add(packImage);
+ }
+ }
+
+ for (final DownloadObject packImage : GuiDownloader.readFile(NewConstants.IMAGE_LIST_QUEST_TOURNAMENTPACKS_FILE, NewConstants.CACHE_TOURNAMENTPACK_PICS_DIR)) {
+ if (!packImage.getDestination().exists()) {
+ urls.add(packImage);
+ }
+ }
+
+ for (final DownloadObject petIcon : GuiDownloader.readFileWithNames(NewConstants.IMAGE_LIST_QUEST_PET_SHOP_ICONS_FILE, NewConstants.CACHE_ICON_PICS_DIR)) {
if (!petIcon.getDestination().exists()) {
urls.add(petIcon);
}
}
- for (final DownloadObject questPet : GuiDownloader.readFileWithNames(NewConstants.Quest.PET_TOKEN_IMAGES, ForgeProps.getFile(NewConstants.IMAGE_TOKEN))) {
+ for (final DownloadObject questPet : GuiDownloader.readFileWithNames(NewConstants.IMAGE_LIST_QUEST_TOKENS_FILE, NewConstants.CACHE_TOKEN_PICS_DIR)) {
if (!questPet.getDestination().exists()) {
urls.add(questPet);
}
}
- // return all card names and urls that are needed
- final DownloadObject[] out = new DownloadObject[urls.size()];
- urls.toArray(out);
-
- return out;
- } // getNeededCards()
-
-} // end class GuiDownloadQuestImages
+ return urls;
+ }
+}
diff --git a/src/main/java/forge/gui/download/GuiDownloadSetPicturesLQ.java b/src/main/java/forge/gui/download/GuiDownloadSetPicturesLQ.java
index 44b73ff4523..760c7d2b746 100644
--- a/src/main/java/forge/gui/download/GuiDownloadSetPicturesLQ.java
+++ b/src/main/java/forge/gui/download/GuiDownloadSetPicturesLQ.java
@@ -31,78 +31,51 @@ import forge.card.CardRules;
import forge.card.CardSplitType;
import forge.item.CardDb;
import forge.item.CardPrinted;
-import forge.properties.ForgeProps;
import forge.properties.NewConstants;
import forge.util.Base64Coder;
-/** */
@SuppressWarnings("serial")
public class GuiDownloadSetPicturesLQ extends GuiDownloader {
- private String picturesPath;
-
- /**
- *
- * Constructor for Gui_DownloadSetPictures_LQ.
- *
- */
public GuiDownloadSetPicturesLQ() {
super();
}
- /**
- * Adds the card to list.
- *
- * @param cList
- * the c list
- * @param c
- * the c
- * @param cardName
- * the card name
- */
- protected final void addCardToList(final ArrayList cList, final CardPrinted c, final String cardName) {
+ private final void addCardToList(ArrayList cList, CardPrinted c, String nameToUse) {
+ File file = new File(NewConstants.CACHE_CARD_PICS_DIR, CardUtil.buildFilename(c, nameToUse) + ".jpg");
+ if (!file.exists()) {
+ cList.add(new DownloadObject(getCardPictureUrl(c, nameToUse), file));
+ }
+
final String setCode3 = c.getEdition();
final CardEdition thisSet = Singletons.getModel().getEditions().get(setCode3);
- final String setCode2 = thisSet.getCode2();
- final int artsCnt = c.getRules().getEditionInfo(setCode3).getCopiesCount();
-
- final String imgFN = CardUtil.buildFilename(c, cardName);
- final boolean foundSetImage = imgFN.contains(setCode3) || imgFN.contains(setCode2);
+ System.out.println(String.format("%s [%s - %s]", nameToUse, setCode3, thisSet.getName()));
+ }
- if (!foundSetImage) {
- String url = getCardPictureUrl(c, cardName);
-
- final String filename = GuiDownloadPicturesLQ.buildIdealFilename(cardName, c.getArtIndex(), artsCnt);
- cList.add(new DownloadObject(url, new File(this.picturesPath + File.separator + setCode3, filename)));
-
- System.out.println(String.format("%s [%s - %s]", cardName, setCode3, thisSet.getName()));
+ private static String cleanMWS(String in) {
+ final StringBuffer out = new StringBuffer();
+ char c;
+ for (int i = 0; i < in.length(); i++) {
+ c = in.charAt(i);
+ if ((c == '"') || (c == '/') || (c == ':') || (c == '?')) {
+ out.append("");
+ } else {
+ out.append(c);
+ }
}
+ return out.toString();
}
public static String getCardPictureUrl(final CardPrinted c, final String cardName) {
- final String urlBase = ForgeProps.getProperty(NewConstants.CARDFORGE_URL) + "/fpics/";
+ String setCode3 = c.getEdition();
+ String setCode2 = Singletons.getModel().getEditions().get(setCode3).getCode2();
+ int artsCnt = c.getRules().getEditionInfo(setCode3).getCopiesCount();
+ String filename = CardUtil.buildFilename(cleanMWS(cardName), null, c.getArtIndex(), artsCnt, false) + ".jpg";
- final String setCode3 = c.getEdition();
- final CardEdition thisSet = Singletons.getModel().getEditions().get(setCode3);
- final String setCode2 = thisSet.getCode2();
-
- final int artsCnt = c.getRules().getEditionInfo(setCode3).getCopiesCount();
- final String filename = GuiDownloadPicturesLQ.buildIdealFilename(cardName, c.getArtIndex(), artsCnt);
- return urlBase + setCode2 + "/" + Base64Coder.encodeString(filename, true);
+ return NewConstants.URL_PIC_DOWNLOAD + setCode2 + "/" + Base64Coder.encodeString(filename, true);
}
- /**
- *
- * getNeededCards.
- *
- *
- * @return an array of {@link forge.gui.download.GuiDownloader.DownloadObject} objects.
- */
@Override
- protected final DownloadObject[] getNeededImages() {
- if (this.picturesPath == null) {
- this.picturesPath = ForgeProps.getFile(NewConstants.IMAGE_BASE).getPath();
- }
- // read token names and urls
+ protected final ArrayList getNeededImages() {
final ArrayList cList = new ArrayList();
Iterable allPrinted = Iterables.concat(CardDb.instance().getAllCards(), CardDb.variants().getAllCards());
@@ -112,26 +85,23 @@ public class GuiDownloadSetPicturesLQ extends GuiDownloader {
if (StringUtils.isBlank(setCode3) || "???".equals(setCode3)) {
continue; // we don't want cards from unknown sets
}
+
CardRules cr = c.getRules();
String firstPartName = cr.getSplitType() == CardSplitType.Split ? CardUtil.buildSplitCardFilename(cr) : c.getName();
- this.addCardToList(cList, c, firstPartName);
+ addCardToList(cList, c, firstPartName);
+
if (cr.getSplitType() == CardSplitType.Transform) {
- this.addCardToList(cList, c, cr.getOtherPart().getName());
+ addCardToList(cList, c, cr.getOtherPart().getName());
}
}
// add missing tokens to the list of things to download
- for (final DownloadObject element : GuiDownloader.readFileWithNames(NewConstants.TOKEN_IMAGES, ForgeProps.getFile(NewConstants.IMAGE_TOKEN))) {
+ for (final DownloadObject element : GuiDownloader.readFileWithNames(NewConstants.IMAGE_LIST_TOKENS_FILE, NewConstants.CACHE_TOKEN_PICS_DIR)) {
if (!element.getDestination().exists()) {
cList.add(element);
}
}
- // return all card names and urls that are needed
- final DownloadObject[] out = new DownloadObject[cList.size()];
- cList.toArray(out);
-
- return out;
- } // getNeededImages()
-
-} // end class Gui_DownloadSetPictures_LQ
+ return cList;
+ }
+}
diff --git a/src/main/java/forge/gui/download/GuiDownloader.java b/src/main/java/forge/gui/download/GuiDownloader.java
index 11c73adb0cd..9daf89a7c6e 100644
--- a/src/main/java/forge/gui/download/GuiDownloader.java
+++ b/src/main/java/forge/gui/download/GuiDownloader.java
@@ -65,8 +65,6 @@ import forge.gui.toolbox.FProgressBar;
import forge.gui.toolbox.FRadioButton;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.JXButtonPanel;
-import forge.properties.ForgeProps;
-import forge.properties.NewConstants;
import forge.util.FileUtil;
import forge.util.MyRandom;
@@ -100,21 +98,21 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
private final FPanel pnlDialog = new FPanel(new MigLayout("insets 0, gap 0, wrap, ax center, ay center"));
private final FProgressBar barProgress = new FProgressBar();
private final FButton btnStart = new FButton("Start");
- private final JTextField txfAddr = new JTextField(ForgeProps.getLocalized(NewConstants.Lang.GuiDownloadPictures.PROXY_ADDRESS));
- private final JTextField txfPort = new JTextField(ForgeProps.getLocalized(NewConstants.Lang.GuiDownloadPictures.PROXY_PORT));
+ private final JTextField txfAddr = new JTextField("Proxy Address");
+ private final JTextField txfPort = new JTextField("Proxy Port");
private final FLabel btnClose = new FLabel.Builder().text("X")
.hoverable(true).fontAlign(SwingConstants.CENTER).cmdClick(cmdClose).build();
- private final JRadioButton radProxyNone = new FRadioButton(ForgeProps.getLocalized(NewConstants.Lang.GuiDownloadPictures.NO_PROXY));
- private final JRadioButton radProxySocks = new FRadioButton(ForgeProps.getLocalized(NewConstants.Lang.GuiDownloadPictures.SOCKS_PROXY));
- private final JRadioButton radProxyHTTP = new FRadioButton(ForgeProps.getLocalized(NewConstants.Lang.GuiDownloadPictures.HTTP_PROXY));
+ private final JRadioButton radProxyNone = new FRadioButton("No Proxy");
+ private final JRadioButton radProxySocks = new FRadioButton("SOCKS Proxy");
+ private final JRadioButton radProxyHTTP = new FRadioButton("HTTP Proxy");
// Proxy info
private int type; /** */
// Progress variables
- private DownloadObject[] cards; /** */
+ private ArrayList cards; /** */
private int card; /** */
private boolean cancel; /** */
private final long[] times = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /** */
@@ -174,18 +172,18 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
}
private void readyToStart() {
- if (this.cards.length == 0) {
+ if (this.cards.size() == 0) {
barProgress.setString("All items have been downloaded.");
btnStart.setVisible(true);
btnStart.setText("OK");
btnStart.addActionListener(actOK);
}
else {
- barProgress.setMaximum(this.cards.length);
+ barProgress.setMaximum(this.cards.size());
barProgress.setString(
- this.cards.length == 1
+ this.cards.size() == 1
? "1 item found."
- : this.cards.length + " items found.");
+ : this.cards.size() + " items found.");
btnStart.setVisible(true);
btnStart.addActionListener(actStartDownload);
@@ -268,10 +266,10 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
final int a = GuiDownloader.this.getAverageTimePerObject();
- if (this.card != GuiDownloader.this.cards.length) {
- sb.append(this.card + "/" + GuiDownloader.this.cards.length + " - ");
+ if (this.card != GuiDownloader.this.cards.size()) {
+ sb.append(this.card + "/" + GuiDownloader.this.cards.size() + " - ");
- long t2Go = (GuiDownloader.this.cards.length - this.card) * a;
+ long t2Go = (GuiDownloader.this.cards.size() - this.card) * a;
boolean secOnly = true;
if (t2Go > 3600000) {
@@ -290,12 +288,12 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
sb.append(String.format("0:%02d remaining.", t2Go / 1000));
}
} else {
- sb.append(String.format(ForgeProps.getLocalized(NewConstants.Lang.GuiDownloadPictures.BAR_CLOSE),
- this.card, GuiDownloader.this.cards.length));
+ sb.append(String.format("%d of %d items finished! Please close!",
+ this.card, GuiDownloader.this.cards.size()));
}
GuiDownloader.this.barProgress.setString(sb.toString());
- System.out.println(this.card + "/" + GuiDownloader.this.cards.length + " - " + a);
+ System.out.println(this.card + "/" + GuiDownloader.this.cards.size() + " - " + a);
}
}
EventQueue.invokeLater(new Worker(card));
@@ -322,7 +320,7 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
Integer.parseInt(this.txfPort.getText())));
} catch (final Exception ex) {
BugReporter.reportException(ex,
- ForgeProps.getLocalized(NewConstants.Lang.GuiDownloadPictures.Errors.PROXY_CONNECT),
+ "Proxy connection could not be established!\nProxy address: %s\nProxy port: %s",
this.txfAddr.getText(), this.txfPort.getText());
return;
}
@@ -331,10 +329,9 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
if (p != null) {
final byte[] buf = new byte[1024];
int len;
- for (this.update(0); (this.card < this.cards.length) && !this.cancel; this.update(this.card + 1)) {
-
- final String url = this.cards[this.card].getSource();
- final File fileDest = this.cards[this.card].getDestination();
+ for (this.update(0); (this.card < this.cards.size()) && !this.cancel; this.update(this.card + 1)) {
+ final String url = this.cards.get(this.card).getSource();
+ final File fileDest = this.cards.get(this.card).getDestination();
final File base = fileDest.getParentFile();
try {
@@ -406,7 +403,7 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
*
* @return an array of {@link forge.gui.download.GuiDownloader.DownloadObject} objects.
*/
- protected abstract DownloadObject[] getNeededImages();
+ protected abstract ArrayList getNeededImages();
/**
*
@@ -419,8 +416,8 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
* a {@link java.util.File} object.
* @return an array of {@link forge.gui.download.GuiDownloader.DownloadObject} objects.
*/
- protected static List readFile(final String urlsFile, final File dir) {
- List fileLines = FileUtil.readFile(ForgeProps.getFile(urlsFile));
+ protected static List readFile(final String urlsFile, String dir) {
+ List fileLines = FileUtil.readFile(urlsFile);
final ArrayList list = new ArrayList();
final Pattern splitter = Pattern.compile(Pattern.quote("/"));
final Pattern replacer = Pattern.compile(Pattern.quote("%20"));
@@ -452,8 +449,8 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
* a {@link java.util.File} object.
* @return an array of {@link forge.gui.download.GuiDownloader.DownloadObject} objects.
*/
- protected static ArrayList readFileWithNames(final String urlNamesFile, final File dir) {
- List fileLines = FileUtil.readFile(ForgeProps.getFile(urlNamesFile));
+ protected static ArrayList readFileWithNames(final String urlNamesFile, final String dir) {
+ List fileLines = FileUtil.readFile(urlNamesFile);
final ArrayList list = new ArrayList();
final Pattern splitter = Pattern.compile(Pattern.quote(" "));
final Pattern replacer = Pattern.compile(Pattern.quote("%20"));
diff --git a/src/main/java/forge/gui/framework/DragCell.java b/src/main/java/forge/gui/framework/DragCell.java
index e2fafac1005..6697de1d12e 100644
--- a/src/main/java/forge/gui/framework/DragCell.java
+++ b/src/main/java/forge/gui/framework/DragCell.java
@@ -14,9 +14,10 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
+import net.miginfocom.swing.MigLayout;
+
import com.google.common.collect.Lists;
-import net.miginfocom.swing.MigLayout;
import forge.gui.toolbox.FPanel;
import forge.gui.toolbox.FSkin;
import forge.view.FView;
diff --git a/src/main/java/forge/gui/framework/SLayoutIO.java b/src/main/java/forge/gui/framework/SLayoutIO.java
index d46d4d0b686..ec42327b962 100644
--- a/src/main/java/forge/gui/framework/SLayoutIO.java
+++ b/src/main/java/forge/gui/framework/SLayoutIO.java
@@ -21,6 +21,7 @@ import javax.xml.stream.events.StartElement;
import javax.xml.stream.events.XMLEvent;
import forge.control.FControl;
+import forge.properties.FileLocation;
import forge.properties.NewConstants;
import forge.view.FView;
@@ -40,8 +41,7 @@ public final class SLayoutIO {
doc
}
- private static String fileDefault = null;
- private static String filePreferred = null;
+ private static FileLocation file = null;
private static final XMLEventFactory EF = XMLEventFactory.newInstance();
private static final XMLEvent NEWLINE = EF.createDTD("\n");
private static final XMLEvent TAB = EF.createDTD("\t");
@@ -51,7 +51,7 @@ public final class SLayoutIO {
* @return {@link java.lang.String}
*/
public static String getFilePreferred() {
- return filePreferred;
+ return null == file ? null : file.userPrefLoc;
}
/** Publicly-accessible save method, to neatly handle exception handling.
@@ -83,7 +83,10 @@ public final class SLayoutIO {
SLayoutIO.setFilesForState();
if (f0 == null) {
- fWriteTo = filePreferred;
+ if (null == file) {
+ return;
+ }
+ fWriteTo = file.userPrefLoc;
}
else {
fWriteTo = f0.getPath();
@@ -144,12 +147,12 @@ public final class SLayoutIO {
final XMLEventReader reader;
if (f != null && f.exists()) {
reader = inputFactory.createXMLEventReader(new FileInputStream(f));
- }
- else if (new File(filePreferred).exists()) {
- reader = inputFactory.createXMLEventReader(new FileInputStream(filePreferred));
- }
- else {
- reader = inputFactory.createXMLEventReader(new FileInputStream(fileDefault));
+ } else if (null == file) {
+ reader = null;
+ } else if (new File(file.userPrefLoc).exists()) {
+ reader = inputFactory.createXMLEventReader(new FileInputStream(file.userPrefLoc));
+ } else {
+ reader = inputFactory.createXMLEventReader(new FileInputStream(file.defaultLoc));
}
view.removeAllDragCells();
@@ -160,7 +163,7 @@ public final class SLayoutIO {
DragCell cell = null;
double x0 = 0, y0 = 0, w0 = 0, h0 = 0;
- while (reader.hasNext()) {
+ while (null != reader && reader.hasNext()) {
event = reader.nextEvent();
if (event.isStartElement()) {
@@ -217,28 +220,22 @@ public final class SLayoutIO {
* Always called before a load or a save, to ensure file addresses are correct.
*/
private static void setFilesForState() {
- final String dir = NewConstants.LAYOUT_DIR;
-
switch(FControl.SINGLETON_INSTANCE.getState()) {
case HOME_SCREEN:
- fileDefault = dir + "home_default.xml";
- filePreferred = dir + "home_preferred.xml";
+ file = NewConstants.HOME_LAYOUT_FILE;
break;
case MATCH_SCREEN:
- fileDefault = dir + "match_default.xml";
- filePreferred = dir + "match_preferred.xml";
+ file = NewConstants.MATCH_LAYOUT_FILE;
break;
case DECK_EDITOR_CONSTRUCTED:
case DECK_EDITOR_LIMITED:
case DECK_EDITOR_QUEST:
case DRAFTING_PROCESS:
case QUEST_CARD_SHOP:
- fileDefault = dir + "editor_default.xml";
- filePreferred = dir + "editor_preferred.xml";
+ file = NewConstants.EDITOR_LAYOUT_FILE;
break;
case QUEST_BAZAAR:
- fileDefault = dir + "bazaar_default.xml";
- filePreferred = dir + "bazaar_preferred.xml";
+ file = null;
break;
default:
throw new IllegalStateException("Layout load failed; UI state unknown.");
diff --git a/src/main/java/forge/gui/home/quest/CSubmenuQuestData.java b/src/main/java/forge/gui/home/quest/CSubmenuQuestData.java
index 4fe69dbf67d..8e4fb696072 100644
--- a/src/main/java/forge/gui/home/quest/CSubmenuQuestData.java
+++ b/src/main/java/forge/gui/home/quest/CSubmenuQuestData.java
@@ -14,13 +14,12 @@ import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import forge.Command;
+import forge.Singletons;
import forge.deck.Deck;
import forge.deck.DeckSection;
-import forge.Singletons;
import forge.game.GameFormat;
import forge.gui.framework.ICDoc;
import forge.item.CardPrinted;
-import forge.properties.ForgeProps;
import forge.properties.NewConstants;
import forge.quest.QuestController;
import forge.quest.QuestMode;
@@ -100,7 +99,7 @@ public enum CSubmenuQuestData implements ICDoc {
@Override
public void update() {
final VSubmenuQuestData view = VSubmenuQuestData.SINGLETON_INSTANCE;
- final File dirQuests = ForgeProps.getFile(NewConstants.Quest.DATA_DIR);
+ final File dirQuests = new File(NewConstants.QUEST_SAVE_DIR);
final QuestController qc = Singletons.getModel().getQuest();
// Temporary transition code between v1.2.2 and v1.2.3.
diff --git a/src/main/java/forge/gui/home/quest/PnlEvent.java b/src/main/java/forge/gui/home/quest/PnlEvent.java
index 780eb3f17be..e7222732ea0 100644
--- a/src/main/java/forge/gui/home/quest/PnlEvent.java
+++ b/src/main/java/forge/gui/home/quest/PnlEvent.java
@@ -19,7 +19,6 @@ import net.miginfocom.swing.MigLayout;
import forge.gui.toolbox.FRadioButton;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FTextArea;
-import forge.properties.ForgeProps;
import forge.properties.NewConstants;
import forge.quest.QuestEvent;
@@ -55,8 +54,7 @@ class PnlEvent extends JPanel {
this.event = e0;
// Icon
- final File base = ForgeProps.getFile(NewConstants.IMAGE_ICON);
- final File file = new File(base, event.getIconFilename());
+ final File file = new File(NewConstants.CACHE_ICON_PICS_DIR, event.getIconFilename());
if (!file.exists()) {
img = FSkin.getIcon(FSkin.InterfaceIcons.ICO_UNKNOWN).getImage();
diff --git a/src/main/java/forge/gui/home/quest/QuestFileLister.java b/src/main/java/forge/gui/home/quest/QuestFileLister.java
index f6817303740..4964eac2439 100644
--- a/src/main/java/forge/gui/home/quest/QuestFileLister.java
+++ b/src/main/java/forge/gui/home/quest/QuestFileLister.java
@@ -20,7 +20,6 @@ import net.miginfocom.swing.MigLayout;
import forge.Command;
import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FSkin;
-import forge.properties.ForgeProps;
import forge.properties.NewConstants;
import forge.quest.data.QuestData;
@@ -315,8 +314,8 @@ public class QuestFileLister extends JPanel {
return;
}
else {
- File newpath = new File(ForgeProps.getFile(NewConstants.Quest.DATA_DIR) + File.separator + questName + ".dat");
- File oldpath = new File(ForgeProps.getFile(NewConstants.Quest.DATA_DIR) + File.separator + s0 + ".dat");
+ File newpath = new File(NewConstants.QUEST_SAVE_DIR, questName + ".dat");
+ File oldpath = new File(NewConstants.QUEST_SAVE_DIR, s0 + ".dat");
oldpath.renameTo(newpath);
}
@@ -335,7 +334,7 @@ public class QuestFileLister extends JPanel {
return;
}
- new File(ForgeProps.getFile(NewConstants.Quest.DATA_DIR) + File.separator + r0.getQuestData().getName() + ".dat").delete();
+ new File(NewConstants.QUEST_SAVE_DIR, r0.getQuestData().getName() + ".dat").delete();
if (cmdRowDelete != null) { cmdRowDelete.execute(); }
diff --git a/src/main/java/forge/gui/home/sanctioned/VSubmenuConstructed.java b/src/main/java/forge/gui/home/sanctioned/VSubmenuConstructed.java
index c29ec99a05a..85529443409 100644
--- a/src/main/java/forge/gui/home/sanctioned/VSubmenuConstructed.java
+++ b/src/main/java/forge/gui/home/sanctioned/VSubmenuConstructed.java
@@ -3,6 +3,7 @@ package forge.gui.home.sanctioned;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JPanel;
+
import net.miginfocom.swing.MigLayout;
import forge.game.player.PlayerType;
import forge.gui.framework.DragCell;
diff --git a/src/main/java/forge/gui/home/settings/VSubmenuDownloaders.java b/src/main/java/forge/gui/home/settings/VSubmenuDownloaders.java
index 97fb6dcec49..4bc82a813fd 100644
--- a/src/main/java/forge/gui/home/settings/VSubmenuDownloaders.java
+++ b/src/main/java/forge/gui/home/settings/VSubmenuDownloaders.java
@@ -27,8 +27,8 @@ import forge.gui.toolbox.FPanel;
import forge.gui.toolbox.FScrollPane;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FTextArea;
-import forge.properties.ForgeProps;
-import forge.properties.NewConstants.Lang;
+import forge.properties.NewConstants;
+import forge.util.FileUtil;
/**
* Assembles Swing components of utilities submenu singleton.
@@ -175,7 +175,7 @@ public enum VSubmenuDownloaders implements IVSubmenu {
}
public void showHowToPlay() {
- FTextArea directions = new FTextArea(ForgeProps.getLocalized(Lang.HowTo.MESSAGE));
+ FTextArea directions = new FTextArea(FileUtil.readFileToString(NewConstants.TEXT_HOWTO_FILE));
final FScrollPane scr = new FScrollPane(directions, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
scr.setBorder(null);
diff --git a/src/main/java/forge/gui/home/settings/VSubmenuPreferences.java b/src/main/java/forge/gui/home/settings/VSubmenuPreferences.java
index 084902e503f..fb0a074ec9b 100644
--- a/src/main/java/forge/gui/home/settings/VSubmenuPreferences.java
+++ b/src/main/java/forge/gui/home/settings/VSubmenuPreferences.java
@@ -42,8 +42,6 @@ import forge.gui.toolbox.FList;
import forge.gui.toolbox.FScrollPane;
import forge.gui.toolbox.FSkin;
import forge.properties.ForgePreferences.FPref;
-import forge.properties.ForgeProps;
-import forge.properties.NewConstants.Lang.OldGuiNewGame.NewGameText;
/**
* Assembles Swing components of preferences submenu singleton.
@@ -82,7 +80,7 @@ public enum VSubmenuPreferences implements IVSubmenu {
private final JCheckBox cbUploadDraft = new OptionsCheckBox("Upload Draft Picks");
private final JCheckBox cbStackLand = new OptionsCheckBox("Stack AI Land");
private final JCheckBox cbManaBurn = new OptionsCheckBox("Mana Burn");
- private final JCheckBox cbDevMode = new OptionsCheckBox(ForgeProps.getLocalized(NewGameText.DEV_MODE));
+ private final JCheckBox cbDevMode = new OptionsCheckBox("Developer Mode");
private final JCheckBox cbEnforceDeckLegality = new OptionsCheckBox("Deck Conformance");
private final JCheckBox cbTextMana = new OptionsCheckBox("Text / Mana Overlay");
private final JCheckBox cbScaleLarger = new OptionsCheckBox("Scale Image Larger");
diff --git a/src/main/java/forge/gui/match/CMatchUI.java b/src/main/java/forge/gui/match/CMatchUI.java
index 5d18f17ed69..930689a4825 100644
--- a/src/main/java/forge/gui/match/CMatchUI.java
+++ b/src/main/java/forge/gui/match/CMatchUI.java
@@ -42,7 +42,6 @@ import forge.gui.match.nonsingleton.VHand;
import forge.gui.toolbox.FSkin;
import forge.item.InventoryItem;
import forge.properties.ForgePreferences.FPref;
-import forge.properties.ForgeProps;
import forge.properties.NewConstants;
/**
@@ -60,7 +59,7 @@ public enum CMatchUI {
private Image getPlayerAvatar(final Player p, final int defaultIndex) {
String strAvatarIcon = p.getLobbyPlayer().getPicture();
if (strAvatarIcon != null) {
- final File f = new File(ForgeProps.getFile(NewConstants.IMAGE_ICON), strAvatarIcon);
+ final File f = new File(NewConstants.CACHE_ICON_PICS_DIR, strAvatarIcon);
if (f.exists()) {
return new ImageIcon(f.getPath()).getImage();
}
diff --git a/src/main/java/forge/gui/match/ControlWinLose.java b/src/main/java/forge/gui/match/ControlWinLose.java
index 8594496e076..3fb23292af5 100644
--- a/src/main/java/forge/gui/match/ControlWinLose.java
+++ b/src/main/java/forge/gui/match/ControlWinLose.java
@@ -11,8 +11,8 @@ import forge.Card;
import forge.Singletons;
import forge.control.FControl;
import forge.deck.Deck;
-import forge.game.GameType;
import forge.game.GameOutcome;
+import forge.game.GameType;
import forge.game.MatchController;
import forge.game.player.Player;
import forge.game.zone.ZoneType;
diff --git a/src/main/java/forge/gui/match/QuestWinLose.java b/src/main/java/forge/gui/match/QuestWinLose.java
index 0c6c59ec5ee..c067a562465 100644
--- a/src/main/java/forge/gui/match/QuestWinLose.java
+++ b/src/main/java/forge/gui/match/QuestWinLose.java
@@ -17,22 +17,34 @@
package forge.gui.match;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Image;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map.Entry;
+
+import javax.swing.BorderFactory;
+import javax.swing.ImageIcon;
+import javax.swing.JLabel;
+import javax.swing.SwingConstants;
+
import forge.Card;
import forge.Singletons;
-import forge.control.FControl;
-
import forge.card.BoosterData;
import forge.card.CardEdition;
import forge.card.UnOpenedProduct;
+import forge.control.FControl;
import forge.game.GameEndReason;
import forge.game.GameFormat;
import forge.game.GameLossReason;
import forge.game.GameOutcome;
import forge.game.MatchController;
import forge.game.player.LobbyPlayer;
+import forge.game.player.Player;
import forge.game.player.PlayerOutcome;
import forge.game.player.PlayerStatistics;
-import forge.game.player.Player;
import forge.game.zone.ZoneType;
import forge.gui.GuiChoose;
import forge.gui.ListChooser;
@@ -47,28 +59,15 @@ import forge.item.InventoryItem;
import forge.item.OpenablePack;
import forge.item.TournamentPack;
import forge.properties.ForgePreferences.FPref;
-import forge.quest.QuestEventChallenge;
+import forge.quest.IQuestRewardCard;
import forge.quest.QuestController;
import forge.quest.QuestEvent;
-import forge.quest.IQuestRewardCard;
+import forge.quest.QuestEventChallenge;
import forge.quest.bazaar.QuestItemType;
import forge.quest.data.QuestPreferences;
import forge.quest.data.QuestPreferences.QPref;
import forge.util.MyRandom;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Image;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map.Entry;
-
-import javax.swing.BorderFactory;
-import javax.swing.ImageIcon;
-import javax.swing.JLabel;
-import javax.swing.SwingConstants;
-
/**
*
* QuestWinLose.
diff --git a/src/main/java/forge/gui/match/VAssignDamage.java b/src/main/java/forge/gui/match/VAssignDamage.java
index 4fc26a3dbbc..e7180dae5d3 100644
--- a/src/main/java/forge/gui/match/VAssignDamage.java
+++ b/src/main/java/forge/gui/match/VAssignDamage.java
@@ -27,6 +27,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
diff --git a/src/main/java/forge/gui/match/ViewWinLose.java b/src/main/java/forge/gui/match/ViewWinLose.java
index 81ff07f4922..be07ea41e60 100644
--- a/src/main/java/forge/gui/match/ViewWinLose.java
+++ b/src/main/java/forge/gui/match/ViewWinLose.java
@@ -24,8 +24,6 @@ import forge.gui.toolbox.FOverlay;
import forge.gui.toolbox.FScrollPane;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FTextArea;
-import forge.properties.ForgeProps;
-import forge.properties.NewConstants.Lang.GuiWinLose.WinLoseText;
/**
* TODO: Write javadoc for this type.
@@ -95,11 +93,11 @@ public class ViewWinLose {
lblStats.setHorizontalAlignment(SwingConstants.CENTER);
lblStats.setFont(FSkin.getFont().deriveFont(Font.PLAIN, 26));
- btnContinue.setText(ForgeProps.getLocalized(WinLoseText.CONTINUE));
+ btnContinue.setText("Continue");
btnContinue.setFont(FSkin.getFont(22));
- btnRestart.setText(ForgeProps.getLocalized(WinLoseText.RESTART));
+ btnRestart.setText("Restart");
btnRestart.setFont(FSkin.getFont(22));
- btnQuit.setText(ForgeProps.getLocalized(WinLoseText.QUIT));
+ btnQuit.setText("Quit");
btnQuit.setFont(FSkin.getFont(22));
btnContinue.setEnabled(!match.isMatchOver());
diff --git a/src/main/java/forge/gui/match/nonsingleton/CCommand.java b/src/main/java/forge/gui/match/nonsingleton/CCommand.java
index 0e19f4339c2..28fc6ed8aeb 100644
--- a/src/main/java/forge/gui/match/nonsingleton/CCommand.java
+++ b/src/main/java/forge/gui/match/nonsingleton/CCommand.java
@@ -26,7 +26,6 @@ import java.util.Observable;
import java.util.Observer;
import forge.Card;
-
import forge.Command;
import forge.game.player.Player;
import forge.game.zone.ZoneType;
diff --git a/src/main/java/forge/gui/match/nonsingleton/CField.java b/src/main/java/forge/gui/match/nonsingleton/CField.java
index 2e14f5e8dae..fb6c7bcf443 100644
--- a/src/main/java/forge/gui/match/nonsingleton/CField.java
+++ b/src/main/java/forge/gui/match/nonsingleton/CField.java
@@ -49,15 +49,12 @@ import forge.game.player.Player;
import forge.game.zone.PlayerZone;
import forge.game.zone.ZoneType;
import forge.gui.ForgeAction;
+import forge.gui.ForgeAction.MatchConstants;
import forge.gui.GuiChoose;
import forge.gui.framework.ICDoc;
import forge.gui.match.CMatchUI;
import forge.gui.match.controllers.CMessage;
import forge.gui.toolbox.FLabel;
-import forge.properties.ForgeProps;
-import forge.properties.NewConstants;
-import forge.properties.NewConstants.Lang.GuiDisplay.HumanHand;
-import forge.properties.NewConstants.Lang.GuiDisplay.HumanLibrary;
/**
* Controls Swing components of a player's field instance.
@@ -273,9 +270,9 @@ public class CField implements ICDoc {
* @param property
* String obj
*/
- public ZoneAction(final PlayerZone zone, final String property) {
+ public ZoneAction(final PlayerZone zone, MatchConstants property) {
super(property);
- this.title = ForgeProps.getLocalized(property + "/title");
+ this.title = property.title;
this.zone = zone;
}
@@ -327,17 +324,15 @@ public class CField implements ICDoc {
/** */
private void handAction() {
if ( CField.this.player == playerViewer || Preferences.DEV_MODE || CField.this.player.hasKeyword("Play with your hand revealed.")) {
- new ZoneAction(CField.this.player.getZone(ZoneType.Hand), HumanHand.BASE)
+ new ZoneAction(CField.this.player.getZone(ZoneType.Hand), MatchConstants.HUMANHAND)
.actionPerformed(null);
}
}
/** */
+ @SuppressWarnings("serial")
private void flashbackAction() {
- new ZoneAction(CField.this.player.getZone(ZoneType.Graveyard), NewConstants.Lang.GuiDisplay.HUMAN_FLASHBACK) {
-
- private static final long serialVersionUID = 8120331222693706164L;
-
+ new ZoneAction(CField.this.player.getZone(ZoneType.Graveyard), MatchConstants.HUMANFLASHBACK) {
@Override
protected List getCardsAsIterable() {
return CardFactoryUtil.getExternalZoneActivationCards(player);
@@ -356,23 +351,22 @@ public class CField implements ICDoc {
}
}
}.actionPerformed(null);
-
}
/** */
private void libraryAction() {
if (!Preferences.DEV_MODE) { return; }
- new ZoneAction(CField.this.player.getZone(ZoneType.Library), HumanLibrary.BASE).actionPerformed(null);
+ new ZoneAction(CField.this.player.getZone(ZoneType.Library), MatchConstants.HUMANLIBRARY).actionPerformed(null);
}
/** */
private void exiledAction() {
- new ZoneAction(CField.this.player.getZone(ZoneType.Exile), NewConstants.Lang.GuiDisplay.HUMAN_EXILED).actionPerformed(null);
+ new ZoneAction(CField.this.player.getZone(ZoneType.Exile), MatchConstants.HUMANEXILED).actionPerformed(null);
}
private void graveyardAction() {
- new ZoneAction(CField.this.player.getZone(ZoneType.Graveyard), NewConstants.Lang.GuiDisplay.HUMAN_GRAVEYARD).actionPerformed(null);
+ new ZoneAction(CField.this.player.getZone(ZoneType.Graveyard), MatchConstants.HUMANGRAVEYARD).actionPerformed(null);
}
private void avatarAction() {
diff --git a/src/main/java/forge/gui/match/views/VPlayers.java b/src/main/java/forge/gui/match/views/VPlayers.java
index c00103bb479..fa14bc82a4e 100644
--- a/src/main/java/forge/gui/match/views/VPlayers.java
+++ b/src/main/java/forge/gui/match/views/VPlayers.java
@@ -27,7 +27,6 @@ import javax.swing.border.MatteBorder;
import net.miginfocom.swing.MigLayout;
import forge.Card;
-
import forge.Singletons;
import forge.game.player.Player;
import forge.game.zone.ZoneType;
diff --git a/src/main/java/forge/gui/match/views/VStack.java b/src/main/java/forge/gui/match/views/VStack.java
index f652a9f3e9a..45364e7f5b9 100644
--- a/src/main/java/forge/gui/match/views/VStack.java
+++ b/src/main/java/forge/gui/match/views/VStack.java
@@ -36,6 +36,7 @@ import forge.Singletons;
import forge.card.spellability.SpellAbilityStackInstance;
import forge.game.zone.MagicStack;
import forge.gui.ForgeAction;
+import forge.gui.ForgeAction.MatchConstants;
import forge.gui.framework.DragCell;
import forge.gui.framework.DragTab;
import forge.gui.framework.EDocID;
@@ -43,7 +44,6 @@ import forge.gui.framework.IVDoc;
import forge.gui.match.CMatchUI;
import forge.gui.match.controllers.CStack;
import forge.gui.toolbox.FSkin;
-import forge.properties.NewConstants;
/**
* Assembles Swing components of stack report.
@@ -230,34 +230,28 @@ public enum VStack implements IVDoc {
//========= Custom class handling
+ @SuppressWarnings("serial")
private class TriggerReactionMenu extends JPopupMenu {
- private static final long serialVersionUID = 6665085414634139984L;
private int workTrigID;
public TriggerReactionMenu() {
super();
- final ForgeAction actAccept = new ForgeAction(NewConstants.Lang.GuiDisplay.Trigger.ALWAYSACCEPT) {
- private static final long serialVersionUID = -3734674058185367612L;
-
+ final ForgeAction actAccept = new ForgeAction(MatchConstants.ALWAYSACCEPT) {
@Override
public final void actionPerformed(final ActionEvent e) {
Singletons.getModel().getGame().getTriggerHandler().setAlwaysAcceptTrigger(TriggerReactionMenu.this.workTrigID);
}
};
- final ForgeAction actDecline = new ForgeAction(NewConstants.Lang.GuiDisplay.Trigger.ALWAYSDECLINE) {
- private static final long serialVersionUID = -1983295769159971502L;
-
+ final ForgeAction actDecline = new ForgeAction(MatchConstants.ALWAYSDECLINE) {
@Override
public final void actionPerformed(final ActionEvent e) {
Singletons.getModel().getGame().getTriggerHandler().setAlwaysDeclineTrigger(TriggerReactionMenu.this.workTrigID);
}
};
- final ForgeAction actAsk = new ForgeAction(NewConstants.Lang.GuiDisplay.Trigger.ALWAYSASK) {
- private static final long serialVersionUID = 5045255351332940821L;
-
+ final ForgeAction actAsk = new ForgeAction(MatchConstants.ALWAYSASK) {
@Override
public final void actionPerformed(final ActionEvent e) {
Singletons.getModel().getGame().getTriggerHandler().setAlwaysAskTrigger(TriggerReactionMenu.this.workTrigID);
diff --git a/src/main/java/forge/gui/toolbox/CardFaceSymbols.java b/src/main/java/forge/gui/toolbox/CardFaceSymbols.java
index a2e05e06e9f..7734d2d0906 100644
--- a/src/main/java/forge/gui/toolbox/CardFaceSymbols.java
+++ b/src/main/java/forge/gui/toolbox/CardFaceSymbols.java
@@ -24,11 +24,10 @@ import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
-
import com.esotericsoftware.minlog.Log;
-import forge.card.mana.ManaCostShard;
import forge.card.mana.ManaCost;
+import forge.card.mana.ManaCostShard;
/**
*
diff --git a/src/main/java/forge/gui/toolbox/SaveOpenDialog.java b/src/main/java/forge/gui/toolbox/SaveOpenDialog.java
index d70726f0637..e0624a87152 100644
--- a/src/main/java/forge/gui/toolbox/SaveOpenDialog.java
+++ b/src/main/java/forge/gui/toolbox/SaveOpenDialog.java
@@ -19,8 +19,9 @@
package forge.gui.toolbox;
import java.io.File;
-import javax.swing.JPanel;
+
import javax.swing.JFileChooser;
+import javax.swing.JPanel;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileNameExtensionFilter;
diff --git a/src/main/java/forge/item/BoosterPack.java b/src/main/java/forge/item/BoosterPack.java
index c79592316ad..be3c86d43dc 100644
--- a/src/main/java/forge/item/BoosterPack.java
+++ b/src/main/java/forge/item/BoosterPack.java
@@ -40,7 +40,7 @@ public class BoosterPack extends OpenablePack {
@Override
public final String getImageFilename() {
- return ImageCache.SEALED_PRODUCT + "booster/" + this.contents.getEdition() + ".png";
+ return ImageCache.BOOSTER_PREFIX + this.contents.getEdition();
}
@Override
diff --git a/src/main/java/forge/item/CardDb.java b/src/main/java/forge/item/CardDb.java
index 825c4433dd0..b3e058d4cc8 100644
--- a/src/main/java/forge/item/CardDb.java
+++ b/src/main/java/forge/item/CardDb.java
@@ -26,7 +26,6 @@ import java.util.Map;
import java.util.NoSuchElementException;
import java.util.TreeMap;
-
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
diff --git a/src/main/java/forge/item/FatPack.java b/src/main/java/forge/item/FatPack.java
index 8ae69aa3722..ff258c28f8d 100644
--- a/src/main/java/forge/item/FatPack.java
+++ b/src/main/java/forge/item/FatPack.java
@@ -53,7 +53,7 @@ public class FatPack extends OpenablePack {
@Override
public final String getImageFilename() {
- return ImageCache.SEALED_PRODUCT + "fatpacks/" + this.contents.getEdition();
+ return ImageCache.FATPACK_PREFIX + this.contents.getEdition();
}
diff --git a/src/main/java/forge/item/IPaperCard.java b/src/main/java/forge/item/IPaperCard.java
index e84345dba4e..3f6946aa329 100644
--- a/src/main/java/forge/item/IPaperCard.java
+++ b/src/main/java/forge/item/IPaperCard.java
@@ -6,6 +6,7 @@ import java.util.List;
import java.util.Set;
import com.google.common.base.Predicate;
+
import forge.Card;
import forge.card.CardRarity;
import forge.card.CardRules;
diff --git a/src/main/java/forge/item/PreconDeck.java b/src/main/java/forge/item/PreconDeck.java
index 3057a8072c4..108a430e19c 100644
--- a/src/main/java/forge/item/PreconDeck.java
+++ b/src/main/java/forge/item/PreconDeck.java
@@ -23,7 +23,6 @@ import java.util.Map;
import com.google.common.base.Function;
-
import forge.ImageCache;
import forge.Singletons;
import forge.deck.Deck;
@@ -61,7 +60,7 @@ public class PreconDeck implements InventoryItemFromSet {
*/
@Override
public String getImageFilename() {
- return ImageCache.SEALED_PRODUCT + "precons/" + this.imageFilename;
+ return ImageCache.PRECON_PREFIX + imageFilename;
}
/*
diff --git a/src/main/java/forge/item/TournamentPack.java b/src/main/java/forge/item/TournamentPack.java
index e842da23273..76c40616466 100644
--- a/src/main/java/forge/item/TournamentPack.java
+++ b/src/main/java/forge/item/TournamentPack.java
@@ -42,12 +42,6 @@ public class TournamentPack extends OpenablePack {
}
};
- /**
- * Instantiates a new booster pack.
- *
- * @param set
- * the set
- */
public TournamentPack(final String name0, final BoosterData boosterData) {
super(name0, boosterData);
}
@@ -55,7 +49,7 @@ public class TournamentPack extends OpenablePack {
@Override
public final String getImageFilename() {
- return ImageCache.SEALED_PRODUCT + "tournamentpacks/" + this.contents.getEdition();
+ return ImageCache.TOURNAMENTPACK_PREFIX + contents.getEdition();
}
public final boolean isStarterDeck() {
diff --git a/src/main/java/forge/model/FModel.java b/src/main/java/forge/model/FModel.java
index 6e7df7681c8..f2de6f9a6ff 100644
--- a/src/main/java/forge/model/FModel.java
+++ b/src/main/java/forge/model/FModel.java
@@ -43,13 +43,10 @@ import forge.game.player.LobbyPlayer;
import forge.gauntlet.GauntletData;
import forge.properties.ForgePreferences;
import forge.properties.ForgePreferences.FPref;
-import forge.properties.ForgeProps;
-import forge.properties.NewConstants;
import forge.quest.QuestController;
import forge.quest.QuestWorld;
import forge.quest.data.QuestPreferences;
import forge.util.FileUtil;
-import forge.util.HttpUtil;
import forge.util.MultiplexOutputStream;
import forge.util.storage.IStorageView;
import forge.util.storage.StorageView;
@@ -64,16 +61,12 @@ import forge.util.storage.StorageView;
* this class must be either private or public static final.
*/
public enum FModel {
-
- /** The SINGLETO n_ instance. */
SINGLETON_INSTANCE;
- // private static final int NUM_INIT_PHASES = 1;
private final PrintStream oldSystemOut;
private final PrintStream oldSystemErr;
private OutputStream logFileStream;
-
private final QuestPreferences questPreferences;
private final ForgePreferences preferences;
@@ -148,14 +141,11 @@ public enum FModel {
// TODO - there's got to be a better place for this...oblivion?
Preferences.DEV_MODE = this.preferences.getPrefBoolean(FPref.DEV_MODE_ENABLED);
-
- testNetworkConnection();
-
this.loadDynamicGamedata();
// Loads all cards (using progress bar).
- this.cardFactory = new CardFactory(ForgeProps.getFile(NewConstants.CARDSFOLDER));
- this.decks = new CardCollections(ForgeProps.getFile(NewConstants.NEW_DECKS));
+ this.cardFactory = new CardFactory();
+ this.decks = new CardCollections();
this.quest = new QuestController();
}
@@ -163,24 +153,6 @@ public enum FModel {
return quest;
}
- /**
- * Tests if draft upload is technically possible.
- * Separate thread, no more hangs when network connection is limited
- */
- private void testNetworkConnection() {
-
- Runnable runNetworkTest = new Runnable() {
- @Override
- public void run() {
- final HttpUtil pinger = new HttpUtil();
- final String url = ForgeProps.getProperty(NewConstants.CARDFORGE_URL) + "/draftAI/ping.php";
- Constant.Runtime.NET_CONN = pinger.getURL(url).equals("pong");
- }
- };
- Thread testNetConnection = new Thread(runNetworkTest, "CheckRemoteDraftAI");
- testNetConnection.start();
- }
-
/**
* Load dynamic gamedata.
*/
@@ -356,14 +328,10 @@ public enum FModel {
* Finalizer, generally should be avoided, but here closes the log file
* stream and resets the system output streams.
*/
- public final void close() {
+ public final void close() throws IOException {
System.setOut(this.oldSystemOut);
System.setErr(this.oldSystemErr);
- try {
- this.logFileStream.close();
- } catch (final IOException e) {
- // ignored
- }
+ logFileStream.close();
}
/** @return {@link forge.util.storage.IStorageView}<{@link forge.card.CardBlock}> */
diff --git a/src/main/java/forge/properties/FileLocation.java b/src/main/java/forge/properties/FileLocation.java
new file mode 100644
index 00000000000..e406a7c9d7c
--- /dev/null
+++ b/src/main/java/forge/properties/FileLocation.java
@@ -0,0 +1,28 @@
+/*
+ * Forge: Play Magic: the Gathering.
+ * Copyright (C) 2011 Forge Team
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package forge.properties;
+
+public final class FileLocation {
+ public final String defaultLoc;
+ public final String userPrefLoc;
+
+ FileLocation (String defaultPrefix, String userPrefix, String commonSuffix) {
+ defaultLoc = defaultPrefix + commonSuffix;
+ userPrefLoc = userPrefix + commonSuffix;
+ }
+}
diff --git a/src/main/java/forge/properties/ForgePreferences.java b/src/main/java/forge/properties/ForgePreferences.java
index 71898429bac..a1c398d1624 100644
--- a/src/main/java/forge/properties/ForgePreferences.java
+++ b/src/main/java/forge/properties/ForgePreferences.java
@@ -18,7 +18,6 @@
package forge.properties;
import java.io.BufferedWriter;
-import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
@@ -26,8 +25,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import com.google.common.io.Files;
-
import forge.Constant;
import forge.Constant.Preferences;
import forge.gui.home.EMenuItem;
@@ -162,37 +159,20 @@ public class ForgePreferences {
/** Instantiates a ForgePreferences object. */
public ForgePreferences() {
preferenceValues = new HashMap();
- try {
- // Preferences files have been consolidated into res/prefs/.
- // This code is here temporarily to facilitate this transfer.
- // After a while, this can be deleted. Doublestrike 21-5-12
- final File oldFile = new File("forge.preferences");
+ List lines = FileUtil.readFile(NewConstants.MAIN_PREFERENCES_FILE.userPrefLoc);
+ for (String line : lines) {
- if (oldFile.exists()) {
- final File newFile = new File(NewConstants.PREFS_GLOBAL_FILE);
- Files.copy(oldFile, newFile);
- oldFile.delete();
- } // END TEMPORARY CONSOLIDATION FACILITATION
-
- List lines = FileUtil.readFile(NewConstants.PREFS_GLOBAL_FILE);
- for (String line : lines) {
-
- if (line.startsWith("#") || (line.length() == 0)) {
- continue;
- }
-
- final String[] split = line.split("=");
-
- if (split.length == 2) {
- this.setPref(split[0], split[1]);
- } else if (split.length == 1 && line.endsWith("=")) {
- this.setPref(split[0], "");
- }
+ if (line.startsWith("#") || (line.length() == 0)) {
+ continue;
+ }
+
+ final String[] split = line.split("=");
+
+ if (split.length == 2) {
+ this.setPref(split[0], split[1]);
+ } else if (split.length == 1 && line.endsWith("=")) {
+ this.setPref(split[0], "");
}
- } catch (FileNotFoundException ex) {
- //ex.printStackTrace();
- } catch (IOException ex) {
- //ex.printStackTrace();
}
}
@@ -287,7 +267,7 @@ public class ForgePreferences {
BufferedWriter writer = null;
try {
- writer = new BufferedWriter(new FileWriter(NewConstants.PREFS_GLOBAL_FILE));
+ writer = new BufferedWriter(new FileWriter(NewConstants.MAIN_PREFERENCES_FILE.userPrefLoc));
for (FPref key : FPref.values()) {
writer.write(key + "=" + getPref(key));
writer.newLine();
diff --git a/src/main/java/forge/properties/ForgeProfileProperties.java b/src/main/java/forge/properties/ForgeProfileProperties.java
new file mode 100644
index 00000000000..4a9e0d1e1e7
--- /dev/null
+++ b/src/main/java/forge/properties/ForgeProfileProperties.java
@@ -0,0 +1,100 @@
+/*
+ * Forge: Play Magic: the Gathering.
+ * Copyright (C) 2011 Forge Team
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package forge.properties;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Properties;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
+
+/**
+ * Determines the user data and cache dirs, first looking at the specified file for overrides
+ * then falling back to platform-specific defaults. Resulting dir strings are guaranteed to end in a slash
+ * so they can be easily appended with further path elements.
+ */
+public class ForgeProfileProperties {
+ public final String userDir;
+ public final String cacheDir;
+
+ private final String _USER_DIR_KEY = "userDir";
+ private final String _CACHE_DIR_KEY = "cacheDir";
+
+ public ForgeProfileProperties(String filename) {
+ Properties props = new Properties();
+ File propFile = new File(filename);
+ try {
+ if (propFile.canRead()) {
+ props.load(new FileInputStream(propFile));
+ }
+ } catch (IOException e) {
+ // ignore
+ }
+
+ Pair defaults = _getDefaultDirs();
+
+ String propUserDir = props.getProperty(_USER_DIR_KEY, defaults.getLeft());
+ String propCacheDir = props.getProperty(_CACHE_DIR_KEY, defaults.getRight());
+
+ // use defaults if the dirs are "defined" as empty strings in the properties file
+ propUserDir = StringUtils.isEmpty(propUserDir) ? defaults.getLeft() : propUserDir.trim();
+ propCacheDir = StringUtils.isEmpty(propCacheDir) ? defaults.getRight() : propCacheDir.trim();
+
+ propUserDir += propUserDir.endsWith("/") || propUserDir.endsWith(File.pathSeparator) ? "" : "/";
+ propCacheDir += propCacheDir.endsWith("/") || propCacheDir.endsWith(File.pathSeparator) ? "" : "/";
+
+ userDir = propUserDir;
+ cacheDir = propCacheDir;
+ }
+
+ // returns a pair
+ private Pair _getDefaultDirs() {
+ String osName = System.getProperty("os.name");
+ String homeDir = System.getProperty("user.home");
+
+ if (StringUtils.isEmpty(osName) || StringUtils.isEmpty(homeDir)) {
+ throw new RuntimeException("cannot determine OS and user home directory");
+ }
+
+ String fallbackDataDir = String.format("%s/.forge", homeDir);
+
+ if (StringUtils.containsIgnoreCase("windows", osName)) {
+ // the split between appdata and localappdata on windows is relatively recent. If
+ // localappdata is not defined, use appdata for both.
+ String appRoot = System.getenv().get("APPDATA");
+ if (StringUtils.isEmpty(appRoot)) {
+ appRoot = fallbackDataDir;
+ }
+ String cacheRoot = System.getenv().get("LOCALAPPDATA");
+ if (StringUtils.isEmpty(cacheRoot)) {
+ cacheRoot = appRoot;
+ }
+ // just use '/' everywhere instead of file.separator. it always works
+ return Pair.of(String.format("%s/Forge", appRoot),
+ String.format("%s/Forge/Cache", cacheRoot));
+ } else if (StringUtils.containsIgnoreCase("mac os x", osName)) {
+ return Pair.of(String.format("%s/Library/Application Support/Forge", homeDir),
+ String.format("%s/Library/Caches/Forge", homeDir));
+ }
+
+ // Linux and everything else
+ return Pair.of(fallbackDataDir, String.format("%s/.cache/forge", homeDir));
+ }
+}
diff --git a/src/main/java/forge/properties/ForgeProps.java b/src/main/java/forge/properties/ForgeProps.java
deleted file mode 100644
index 502e6c76813..00000000000
--- a/src/main/java/forge/properties/ForgeProps.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Forge: Play Magic: the Gathering.
- * Copyright (C) 2011 Forge Team
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package forge.properties;
-
-/**
- * ForgeProps.java
- *
- * Created on 30.08.2009
- */
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Locale;
-
-import forge.error.BugReporter;
-import forge.util.TreeProperties;
-
-/**
- * The class ForgeProps. Wrapper around TreeProperties to support the uses in
- * forge.
- *
- * @author Forge
- * @version $Id$
- */
-public class ForgeProps {
- /** Constant properties. */
- private static final TreeProperties PROPERTIES;
-
- static {
- TreeProperties p;
- try {
- p = new TreeProperties(NewConstants.PREFS_MAIN_PROPERTIES_FILE);
- p.rethrow();
- } catch (final IOException ex) {
- BugReporter.reportException(ex);
- p = null;
- }
- PROPERTIES = p;
- }
-
- /**
- * Returns the tree properties of forge.
- *
- * @return a {@link forge.util.TreeProperties} object.
- */
- public static TreeProperties getProperties() {
- return ForgeProps.PROPERTIES;
- }
-
- /**
- * Returns the string property value, or null if there's no such property.
- *
- * @param key
- * a {@link java.lang.String} object.
- * @return a {@link java.lang.String} object.
- */
- public static String getProperty(final String key) {
- return ForgeProps.getProperty(key, null);
- }
-
- /**
- * Returns the string property value, or def if there's no such property.
- *
- * @param key
- * a {@link java.lang.String} object.
- * @param def
- * a {@link java.lang.String} object.
- * @return a {@link java.lang.String} object.
- */
- public static String getProperty(final String key, final String def) {
- String result;
- try {
- result = ForgeProps.getProperties().getProperty(key);
- if (result == null) {
- result = def;
- }
- } catch (final Exception ex) {
- result = def;
- }
- return result;
- }
-
- /**
- * Returns the File property value, or null if there's no such property.
- *
- * @param key
- * a {@link java.lang.String} object.
- * @return a {@link java.io.File} object.
- */
- public static File getFile(final String key) {
- return ForgeProps.getFile(key, null);
- }
-
- /**
- * Returns the File property value, or def if there's no such property.
- *
- * @param key
- * a {@link java.lang.String} object.
- * @param def
- * a {@link java.io.File} object.
- * @return a {@link java.io.File} object.
- */
- public static File getFile(final String key, final File def) {
- File result;
- try {
- result = ForgeProps.getProperties().getFile(key);
- if (result == null) {
- result = def;
- }
- } catch (final Exception ex) {
- result = def;
- }
- return result;
- }
-
- /**
- * Returns the localized version of the specified property. The key is a
- * format string containing "%s", which is replaced with a language code
- * (ISO 639-1, see {@link Locale#getLanguage()}). First, the configured
- * language is used. Second, the locale's code is used. If none of them
- * contains the requested key, "en" is used as the language code.
- *
- * @param key
- * a {@link java.lang.String} object.
- * @return a {@link java.lang.String} object.
- */
- public static String getLocalized(final String key) {
- return ForgeProps.getLocalized(key, null);
- }
-
- /**
- * Returns the localized version of the specified property. The key is a
- * format string containing "%s", which is replaced with a language code
- * (ISO 639-1, see {@link Locale#getLanguage()}). First, the configured
- * language is used. Second, the locale's code is used. If none of them
- * contains the requested key, "en" is used as the language code. If even
- * that has no value, the def parameter is returned.
- *
- * @param key
- * a {@link java.lang.String} object.
- * @param def
- * a {@link java.lang.String} object.
- * @return a {@link java.lang.String} object.
- */
- public static String getLocalized(final String key, final String def) {
- // the list of languages to look for, in the order to be used
- // the first is the configured language
- // the second is the default locale's language code
- final String[] languages = { ForgeProps.getProperty(NewConstants.Lang.LANGUAGE),
- Locale.getDefault().getLanguage(), "en" };
- try {
- for (final String lang : languages) {
- // could be if a property does not exist
- // just skip it, and try the next
- if (lang == null) {
- continue;
- }
- final String result = ForgeProps.getProperty(String.format(key, lang));
- if (result != null) {
- return result;
- }
- }
- // exceptions are skipped here; also the error viewer uses this, and
- // reporting exceptions may result
- // in a more fatal error (stack overflow)
- } catch (final Exception ex) {
- }
- // if no property was found, or an error occurred, return the default
- // value
- return def;
- }
-}
diff --git a/src/main/java/forge/properties/NewConstants.java b/src/main/java/forge/properties/NewConstants.java
index 6e6f51fce10..f77eb5f049e 100644
--- a/src/main/java/forge/properties/NewConstants.java
+++ b/src/main/java/forge/properties/NewConstants.java
@@ -17,1122 +17,107 @@
*/
package forge.properties;
-import org.apache.commons.lang.StringUtils;
+import java.util.List;
+
+import com.google.common.collect.Lists;
-/**
- * NewConstants.java
- *
- * Created on 22.08.2009
- */
-/**
- * These are mostly property keys.
- *
- * @author Clemens Koza
- * @version V0.0 22.08.2009
- */
public final class NewConstants {
- // General properties
- /**
- * Constant
- * HOW_TO_REPORT_BUGS_URL = "program/howToReportBugsURL".
- */
- public static final String HOW_TO_REPORT_BUGS_URL = "program/howToReportBugsURL";
+ public static final String PROFILE_FILE = "forge.profile.properties";
+ public static final String PROFILE_TEMPLATE_FILE = PROFILE_FILE + ".example";
- /** Constant SHOW2CDECK="showdeck/2color". */
- public static final String SHOW2CDECK = "showdeck/2color";
-
- /** Constant CARDFORGE_URL = "program/cardforgeURL". */
- public static final String CARDFORGE_URL = "program/cardforgeURL";
-
- /** Default base path for user data (settings, decks, quest save files, custom worlds, etc.) */
- public static final String DEFAULT_USER_DATA_ROOT;
-
- /** Default base path for cached program data (downloaded pictures) */
- public static final String DEFAULT_CACHE_DATA_ROOT;
-
+ // data tree roots
+ private static final String _USER_DIR;
+ private static final String _CACHE_DIR;
static {
- String osName = System.getProperty("os.name");
- String homeDir = System.getProperty("user.home");
-
- if (StringUtils.isEmpty(osName) || StringUtils.isEmpty(homeDir)) {
- throw new RuntimeException("cannot determine OS and user home directory");
- }
-
- String fallbackDataDir = String.format("%s/.forge", homeDir);
-
- if (StringUtils.containsIgnoreCase("windows", osName)) {
- // the split between appdata and localappdata on windows is relatively recent. If
- // localappdata is not defined, use appdata for both.
- String appRoot = System.getenv().get("APPDATA");
- if (StringUtils.isEmpty(appRoot)) {
- appRoot = fallbackDataDir;
- }
- String cacheRoot = System.getenv().get("LOCALAPPDATA");
- if (StringUtils.isEmpty(cacheRoot)) {
- cacheRoot = appRoot;
- }
- // just use '/' everywhere instead of file.separator. it always works
- DEFAULT_USER_DATA_ROOT = String.format("%s/Forge", appRoot);
- DEFAULT_CACHE_DATA_ROOT = String.format("%s/Forge/Cache", cacheRoot);
- } else if (StringUtils.containsIgnoreCase("mac os x", osName)) {
- DEFAULT_USER_DATA_ROOT = String.format("%s/Library/Application Support/Forge", homeDir);
- DEFAULT_CACHE_DATA_ROOT = String.format("%s/Library/Caches/Forge", homeDir);
- } else {
- // Linux or anything else
- DEFAULT_USER_DATA_ROOT = fallbackDataDir;
- DEFAULT_CACHE_DATA_ROOT = String.format("%s/.cache/forge", homeDir);
- }
+ ForgeProfileProperties profileProps = new ForgeProfileProperties(PROFILE_FILE);
+ _USER_DIR = profileProps.userDir;
+ _CACHE_DIR = profileProps.cacheDir;
}
+ private static final String _RES_ROOT = "res/";
+ private static final String _DEFAULTS_DIR = _RES_ROOT + "defaults/";
+ private static final String _QUEST_DIR = _RES_ROOT + "quest/";
+ private static final String _USER_PREFS_DIR = _USER_DIR + "preferences/";
+ private static final String _USER_QUEST_DIR = _USER_DIR + "quest/";
+ private static final String _DB_DIR = _CACHE_DIR + "db/";
+
+ // data that is only in the program dir
+ public static final String IMAGE_LIST_TOKENS_FILE = _RES_ROOT + "token-images.txt";
+ public static final String IMAGE_LIST_QUEST_OPPONENT_ICONS_FILE = _QUEST_DIR + "quest-opponent-icons.txt";
+ public static final String IMAGE_LIST_QUEST_PET_SHOP_ICONS_FILE = _QUEST_DIR + "quest-pet-shop-icons.txt";
+ public static final String IMAGE_LIST_QUEST_TOKENS_FILE = _QUEST_DIR + "quest-pet-token-images.txt";
+ public static final String IMAGE_LIST_QUEST_BOOSTERS_FILE = _QUEST_DIR + "booster-images.txt";
+ public static final String IMAGE_LIST_QUEST_FATPACKS_FILE = _QUEST_DIR + "fatpack-images.txt";
+ public static final String IMAGE_LIST_QUEST_PRECONS_FILE = _QUEST_DIR + "precon-images.txt";
+ public static final String IMAGE_LIST_QUEST_TOURNAMENTPACKS_FILE = _QUEST_DIR + "tournamentpack-images.txt";
- /** Constant PREFS_GLOBAL_FILE = "forge.preferences". */
- public static final String PREFS_GLOBAL_FILE = "res/preferences/forge.preferences";
- /** Constant PREFS_GLOBAL_FILE = "editor.preferences". */
- public static final String PREFS_EDITOR_FILE = "res/preferences/editor.preferences";
- public static final String PREFS_DEFAULT_EDITOR_FILE = "res/preferences/editor.default.preferences";
- /** */
- public static final String PREFS_MAIN_PROPERTIES_FILE = "res/preferences/main.properties";
-
- /** Constant LAYOUT_DIR = "res/layouts/". */
- public static final String LAYOUT_DIR = "res/layouts/";
-
- /** Constant DECKS="decks". */
- public static final String DECKS = "decks";
- /** Constant BOOSTER_DECKS="booster-decks". */
- public static final String BOOSTER_DECKS = "booster-decks";
- /** Constant NEW_DECKS="decks-dir". */
- public static final String NEW_DECKS = "decks-dir";
-
- /** Constant TOKENS="tokens". */
- public static final String TOKENS = "tokens";
- /** Constant CARD_PICTURES="card-pictures". */
- public static final String CARD_PICTURES = "card-pictures";
- /** Constant CARD_PICTURES_A="card-pictures_a". */
-
- public static final class CardPicturesByLetter {
- /** */
- public static final String CARD_PICTURES_A = "card-pictures_a";
- /** Constant CARD_PICTURES_B="card-pictures_b". */
- public static final String CARD_PICTURES_B = "card-pictures_b";
- /** Constant CARD_PICTURES_C="card-pictures_c". */
- public static final String CARD_PICTURES_C = "card-pictures_c";
- /** Constant CARD_PICTURES_D="card-pictures_d". */
- public static final String CARD_PICTURES_D = "card-pictures_d";
- /** Constant CARD_PICTURES_E="card-pictures_e". */
- public static final String CARD_PICTURES_E = "card-pictures_e";
- /** Constant CARD_PICTURES_F="card-pictures_f". */
- public static final String CARD_PICTURES_F = "card-pictures_f";
- /** Constant CARD_PICTURES_G="card-pictures_g". */
- public static final String CARD_PICTURES_G = "card-pictures_g";
- /** Constant CARD_PICTURES_H="card-pictures_h". */
- public static final String CARD_PICTURES_H = "card-pictures_h";
- /** Constant CARD_PICTURES_I="card-pictures_i". */
- public static final String CARD_PICTURES_I = "card-pictures_i";
- /** Constant CARD_PICTURES_J="card-pictures_j". */
- public static final String CARD_PICTURES_J = "card-pictures_j";
- /** Constant CARD_PICTURES_K="card-pictures_k". */
- public static final String CARD_PICTURES_K = "card-pictures_k";
- /** Constant CARD_PICTURES_L="card-pictures_l". */
- public static final String CARD_PICTURES_L = "card-pictures_l";
- /** Constant CARD_PICTURES_M="card-pictures_m". */
- public static final String CARD_PICTURES_M = "card-pictures_m";
- /** Constant CARD_PICTURES_N="card-pictures_n". */
- public static final String CARD_PICTURES_N = "card-pictures_n";
- /** Constant CARD_PICTURES_O="card-pictures_o". */
- public static final String CARD_PICTURES_O = "card-pictures_o";
- /** Constant CARD_PICTURES_P="card-pictures_p". */
- public static final String CARD_PICTURES_P = "card-pictures_p";
- /** Constant CARD_PICTURES_Q="card-pictures_q". */
- public static final String CARD_PICTURES_Q = "card-pictures_q";
- /** Constant CARD_PICTURES_R="card-pictures_r". */
- public static final String CARD_PICTURES_R = "card-pictures_r";
- /** Constant CARD_PICTURES_S="card-pictures_s". */
- public static final String CARD_PICTURES_S = "card-pictures_s";
- /** Constant CARD_PICTURES_T="card-pictures_t". */
- public static final String CARD_PICTURES_T = "card-pictures_t";
- /** Constant CARD_PICTURES_U="card-pictures_u". */
- public static final String CARD_PICTURES_U = "card-pictures_u";
- /** Constant CARD_PICTURES_V="card-pictures_v". */
- public static final String CARD_PICTURES_V = "card-pictures_v";
- /** Constant CARD_PICTURES_W="card-pictures_w". */
- public static final String CARD_PICTURES_W = "card-pictures_w";
- /** Constant CARD_PICTURES_X="card-pictures_x". */
- public static final String CARD_PICTURES_X = "card-pictures_x";
- /** Constant CARD_PICTURES_Y="card-pictures_y". */
- public static final String CARD_PICTURES_Y = "card-pictures_y";
- /** Constant CARD_PICTURES_Z="card-pictures_z". */
- public static final String CARD_PICTURES_Z = "card-pictures_z";
- }
-
- /** Constant TOKEN_IMAGES="token-images". */
- public static final String TOKEN_IMAGES = "token-images";
- /** Constant CARDSFOLDER="cardsfolder". */
- public static final String CARDSFOLDER = "cardsfolder";
- /** Constant REMOVED="removed-cards". */
- public static final String REMOVED = "removed-cards";
- /** Constant NAME_MUTATOR="name-mutator". */
- public static final String NAME_MUTATOR = "name-mutator";
- /** The file name of the image for face down cards on the battlefield. */
- public static final String MORPH_IMAGE_FILE_NAME = "morph";
-
- /** The MTG_DATA. */
- public static final String MTG_DATA = "mtg-data";
-
- /** The SYMBOLS_SMALL. */
- public static final String SYMBOLS_SMALL = "symbols/small";
-
- /** Constant IMAGE_BASE="image/base". */
- public static final String IMAGE_BASE = "image/base";
- /** Constant IMAGE_TOKEN="image/token". */
- public static final String IMAGE_TOKEN = "image/token";
- /** Constant IMAGE_ICON="image/icon". */
- public static final String IMAGE_ICON = "image/icon";
- /** Constant IMAGE_SEALED_PRODUCT="image/product". */
- public static final String IMAGE_SEALED_PRODUCT = "image/product";
- /** Constant PICS_BOOSTER_IMAGES="pics/booster/images". */
- public static final String PICS_BOOSTER_IMAGES = "pics/booster/images";
-
- /**
- * These properties are for a regular game.
- */
- public static class Regular {
- /** Property path for a common card. */
- public static final String COMMON = "regular/common";
- /** Property path for an uncommon card. */
- public static final String UNCOMMON = "regular/uncommon";
- /** Property path for a rare card. */
- public static final String RARE = "regular/rare";
- }
-
- /**
- * These properties are for a booster draft.
- */
- public static class Draft {
- /** Property path for a common card. */
- public static final String COMMON = "draft/common";
- /** Property path for an uncommon card. */
- public static final String UNCOMMON = "draft/uncommon";
- /** Property path for a rare card. */
- public static final String RARE = "draft/rare";
- /** Path for draft rankings. */
- public static final String RANKINGS = "draft/rankings";
- }
-
- /**
- * These properties are for a quest game.
- */
- public static class Quest {
- /** Property path for a common card. */
- public static final String COMMON = "quest/common";
- /** Property path for an uncommon card. */
- public static final String UNCOMMON = "quest/uncommon";
- /** Property path for a rare card. */
- public static final String RARE = "quest/rare";
-
- /** The PRICE. */
- public static final String PRICE = "quest/price";
-
- /** The BOOSTER_PRICE. */
- public static final String BOOSTER_PRICE = "quest/boosterprice";
-
- /** The DATA. */
- public static final String DATA = "quest/data";
-
- /** The PREFS. */
- public static final String PREFS = "quest/prefs";
-
- /** The DECKS. */
- public static final String DUELS = "quest/duels-dir";
- /** */
- public static final String CHALLENGES = "quest/challenges-dir";
- /** */
- public static final String WORLD = "quest/world-dir";
-
- /** The XMLDATA. */
- public static final String XMLDATA = "quest/data-xml";
-
- /** The XMLDATA. */
- public static final String DATA_DIR = "quest/data-dir";
-
- /** The OPPONENT_ICONS. */
- public static final String OPPONENT_ICONS = "quest/opponent/icons";
-
- /** The OPPONENT_DIR. */
- public static final String OPPONENT_DIR = "image/icon";
-
- /** The PET_SHOP_ICONS. */
- public static final String PET_SHOP_ICONS = "quest/pet/icons";
-
- /** The PET_TOKEN_IMAGES. */
- public static final String PET_TOKEN_IMAGES = "quest/pet/tokens";
-
- /** */
- public static final String PRECONS = "quest/precons-dir";
-
- /** */
- public static final String BAZAAR = "quest/bazaar";
- /** */
- public static final String BAZAAR_DIR = "quest/bazaar-dir";
- }
-
- /**
- * These are localization properties.
- */
- public static class Lang {
-
- /** The PROGRAM_NAME. */
- public static final String PROGRAM_NAME = "%s/program/name";
-
- /** The LANGUAGE. */
- public static final String LANGUAGE = "lang";
-
- /**
- * The Interface HowTo.
- */
- public static class HowTo {
-
- /** The TITLE. */
- public static final String TITLE = "%s/HowTo/title";
-
- /** The MESSAGE. */
- public static final String MESSAGE = "%s/HowTo/message";
- }
-
- /**
- * The Interface ErrorViewer.
- */
- public static class ErrorViewer {
-
- /** The SHOW_ERROR. */
- public static final String SHOW_ERROR = "%s/ErrorViewer/show";
-
- /** The TITLE. */
- public static final String TITLE = "%s/ErrorViewer/title";
-
- /** The MESSAGE. */
- public static final String MESSAGE = "%s/ErrorViewer/message";
-
- /** The BUTTON_SAVE. */
- public static final String BUTTON_SAVE = "%s/ErrorViewer/button/save";
-
- /** The BUTTON_CLOSE. */
- public static final String BUTTON_CLOSE = "%s/ErrorViewer/button/close";
-
- /** The BUTTON_EXIT. */
- public static final String BUTTON_EXIT = "%s/ErrorViewer/button/exit";
-
- /**
- * The Interface ERRORS.
- */
- public static class ERRORS {
-
- /** The SAVE_MESSAGE. */
- public static final String SAVE_MESSAGE = "%s/ErrorViewer/errors/save/message";
-
- /** The SHOW_MESSAGE. */
- public static final String SHOW_MESSAGE = "%s/ErrorViewer/errors/show/message";
- }
- }
-
- /**
- * The Interface GuiBoosterDraft.
- */
- public static class GuiBoosterDraft {
-
- /** The CLOSE_MESSAGE. */
- public static final String CLOSE_MESSAGE = "%s/BoosterDraft/close/message";
-
- /** The SAVE_MESSAGE. */
- public static final String SAVE_MESSAGE = "%s/BoosterDraft/save/message";
-
- /** The SAVE_TITLE. */
- public static final String SAVE_TITLE = "%s/BoosterDraft/save/title";
-
- /** The RENAME_MESSAGE. */
- public static final String RENAME_MESSAGE = "%s/BoosterDraft/rename/message";
-
- /** The RENAME_TITLE. */
- public static final String RENAME_TITLE = "%s/BoosterDraft/rename/title";
-
- /** The SAVE_DRAFT_MESSAGE. */
- public static final String SAVE_DRAFT_MESSAGE = "%s/BoosterDraft/saveDraft/message";
-
- /** The SAVE_DRAFT_TITLE. */
- public static final String SAVE_DRAFT_TITLE = "%s/BoosterDraft/saveDraft/title";
- }
-
- /**
- * The Interface GuiDisplay.
- */
- public static class GuiDisplay {
-
- /**
- * The Interface MenuBar.
- */
- public static class MenuBar {
-
- /**
- * The Interface Menu.
- */
- public static class Menu {
-
- /** The TITLE. */
- public static final String TITLE = "%s/Display/menu/title";
- }
-
- /**
- * The Interface Phase.
- */
- public static class PHASE {
-
- /** The TITLE. */
- public static final String TITLE = "%s/Display/phase/title";
- }
-
- /**
- * The Interface DEV.
- */
- public static class DEV {
-
- /** The TITLE. */
- public static final String TITLE = "%s/Display/dev/title";
- }
- }
-
- /** The HUMAN_TITLE. */
- public static final String HUMAN_TITLE = "%s/Display/human/title";
-
- /** The HUMAN_DECKLIST. */
- public static final String HUMAN_DECKLIST = "%s/Display/human/decklist";
-
- /**
- * The Interface HumanHand.
- */
- public static class HumanHand {
-
- /** The BASE. */
- public static final String BASE = "%s/Display/human/hand";
-
- /** The TITLE. */
- public static final String TITLE = "%s/Display/human/hand/title";
-
- /** The BUTTON. */
- public static final String BUTTON = "%s/Display/human/hand/button";
-
- /** The MENU. */
- public static final String MENU = "%s/Display/human/hand/menu";
- }
-
- /**
- * The Interface HumanLibrary.
- */
- public static class HumanLibrary {
-
- /** The BASE. */
- public static final String BASE = "%s/Display/human/library";
-
- /** The TITLE. */
- public static final String TITLE = "%s/Display/human/library/title";
-
- /** The MENU. */
- public static final String MENU = "%s/Display/human/library/menu";
-
- /** The BUTTON. */
- public static final String BUTTON = "%s/Display/human/library/button";
- }
-
- /** The HUMAN_GRAVEYARD. */
- public static final String HUMAN_GRAVEYARD = "%s/Display/human/graveyard";
-
- /**
- * The Interface HumanGraveyard.
- */
- public static class HumanGraveyard {
-
- /** The TITLE. */
- public static final String TITLE = "%s/Display/human/graveyard/title";
-
- /** The BUTTON. */
- public static final String BUTTON = "%s/Display/human/graveyard/button";
-
- /** The MENU. */
- public static final String MENU = "%s/Display/human/graveyard/menu";
- }
-
- /** The HUMAN_EXILED. */
- public static final String HUMAN_EXILED = "%s/Display/human/exiled";
-
- /**
- * The Interface HumanRemoved.
- */
- public static class HumanRemoved {
-
- /** The TITLE. */
- public static final String TITLE = "%s/Display/human/exiled/title";
-
- /** The BUTTON. */
- public static final String BUTTON = "%s/Display/human/exiled/button";
-
- /** The MENU. */
- public static final String MENU = "%s/Display/human/exiled/menu";
- }
-
- /** The COMBAT. */
- public static final String COMBAT = "%s/Display/combat/title";
-
- /** The HUMAN_FLASHABCK. */
- public static final String HUMAN_FLASHBACK = "%s/Display/human/flashback";
-
- /** The COMPUTER_FLASHBACK. */
- public static final String COMPUTER_FLASHBACK = "%s/Display/computer/flashback";
-
- /**
- * The Interface HumanFlashback.
- */
- public static class HumanFlashback {
-
- /** The TITLE. */
- public static final String TITLE = "%s/Display/human/flashback/title";
-
- /** The BUTTON. */
- public static final String BUTTON = "%s/Display/human/flashback/button";
-
- /** The MENU. */
- public static final String MENU = "%s/Display/human/flashback/menu";
- }
-
- /**
- * The Interface ComputerFlashback.
- */
- public static class ComputerFlashback {
-
- /** The TITLE. */
- public static final String TITLE = "%s/Display/computer/flashback/title";
-
- /** The BUTTON. */
- public static final String BUTTON = "%s/Display/computer/flashback/button";
-
- /** The MENU. */
- public static final String MENU = "%s/Display/computer/flashback/menu";
- }
-
- /** The COMPUTER_TITLE. */
- public static final String COMPUTER_TITLE = "%s/Display/computer/title";
-
- /**
- * The Interface ComputerHand.
- */
- public static class ComputerHand {
-
- /** The BASE. */
- public static final String BASE = "%s/Display/computer/hand";
-
- /** The TITLE. */
- public static final String TITLE = "%s/Display/computer/hand/title";
-
- /** The BUTTON. */
- public static final String BUTTON = "%s/Display/computer/hand/button";
-
- /** The MENU. */
- public static final String MENU = "%s/Display/computer/hand/menu";
- }
-
- /**
- * The Interface CopmuterLibrary.
- */
- public static class ComputerLibrary {
-
- /** The BASE. */
- public static final String BASE = "%s/Display/computer/library";
-
- /** The TITLE. */
- public static final String TITLE = "%s/Display/computer/library/title";
-
- /** The BUTTON. */
- public static final String BUTTON = "%s/Display/computer/library/button";
-
- /** The MENU. */
- public static final String MENU = "%s/Display/computer/library/menu";
- }
-
- /** The COMPUTER_GRAVEYARD. */
- public static final String COMPUTER_GRAVEYARD = "%s/Display/computer/graveyard";
-
- /**
- * The Interface ComputerGraveyard.
- */
- public static class ComputerGraveyard {
-
- /** The TITLE. */
- public static final String TITLE = "%s/Display/computer/graveyard/title";
-
- /** The BUTTON. */
- public static final String BUTTON = "%s/Display/computer/graveyard/button";
-
- /** The MENU. */
- public static final String MENU = "%s/Display/computer/graveyard/menu";
- }
-
- /** The COMPUTER_EXILED. */
- public static final String COMPUTER_EXILED = "%s/Display/computer/exiled";
-
- /**
- * The Interface CopmuterRemoved.
- */
- public static class ComputerRemoved {
-
- /** The TITLE. */
- public static final String TITLE = "%s/Display/computer/exiled/title";
-
- /** The BUTTON. */
- public static final String BUTTON = "%s/Display/computer/exiled/button";
-
- /** The MENU. */
- public static final String MENU = "%s/Display/computer/exiled/menu";
- }
-
- /** The CONCEDE. */
- public static final String CONCEDE = "%s/Display/concede";
-
- /**
- * The Interface Concede.
- */
- public static class Concede {
-
- /** The BUTTON. */
- public static final String BUTTON = "%s/Display/concede/button";
-
- /** The MENU. */
- public static final String MENU = "%s/Display/concede/menu";
- }
-
- /** The MANAGEN. */
- public static final String MANAGEN = "%s/Display/managen";
-
- /**
- * The Interface Managen.
- */
- public static class Managen {
-
- /** The BUTTON. */
- public static final String BUTTON = "%s/Display/managen/button";
-
- /** The MENU. */
- public static final String MENU = "%s/Display/managen/menu";
- }
-
- /** The SETUPBATTLEFIELD. */
- public static final String SETUPBATTLEFIELD = "%s/Display/setupbattlefield";
-
- /**
- * The Interface SetupBattlefield.
- */
- public static class SetupBattlefield {
-
- /** The BUTTON. */
- public static final String BUTTON = "%s/Display/setupbattlefield/button";
-
- /** The MENU. */
- public static final String MENU = "%s/Display/setupbattlefield/menu";
- }
-
- /** The TUTOR. */
- public static final String TUTOR = "%s/Display/tutor";
-
- /**
- * The Interface Tutor.
- */
- public static class Tutor {
-
- /** The BUTTON. */
- public static final String BUTTON = "%s/Display/tutor/button";
-
- /** The MENU. */
- public static final String MENU = "%s/Display/tutor/menu";
- }
-
- /** The ADDCOUNTER. */
- public static final String ADDCOUNTER = "%s/Display/addcounter";
-
- /**
- * The Interface AddCounter.
- */
- public static class AddCounter {
-
- /** The BUTTON. */
- public static final String BUTTON = "%s/Display/addcounter/button";
-
- /** The MENU. */
- public static final String MENU = "%s/Display/addcounter/menu";
- }
-
- /** The TAPPERM. */
- public static final String TAPPERM = "%s/Display/tapperm";
-
- /**
- * The Interface Tapperm.
- */
- public static class Tapperm {
-
- /** The BUTTON. */
- public static final String BUTTON = "%s/Display/tapperm/button";
-
- /** The MENU. */
- public static final String MENU = "%s/Display/tapperm/menu";
- }
-
- /** The UNTAPPERM. */
- public static final String UNTAPPERM = "%s/Display/untapperm";
-
- /**
- * The Interface Untapperm.
- */
- public static class Untapperm {
-
- /** The BUTTON. */
- public static final String BUTTON = "%s/Display/untapperm/button";
-
- /** The MENU. */
- public static final String MENU = "%s/Display/untapperm/menu";
- }
-
- /** The NOLANDLIMIT. */
- public static final String NOLANDLIMIT = "%s/Display/nolandlimit";
-
- /**
- * The Interface NoLandLimit.
- */
- public static class NoLandLimit {
-
- /** The BUTTON. */
- public static final String BUTTON = "%s/Display/nolandlimit/button";
-
- /** The MENU. */
- public static final String MENU = "%s/Display/nolandlimit/menu";
- }
-
- /** The SETLIFE. */
- public static final String SETLIFE = "%s/Display/setlife";
-
- /**
- * The Interface SetLife.
- */
- public static class SetLife {
-
- /** The BUTTON. */
- public static final String BUTTON = "%s/Display/setlife/button";
-
- /** The MENU. */
- public static final String MENU = "%s/Display/setlife/menu";
- }
-
- /**
- * The Interface Trigger.
- */
- public static class Trigger {
-
- /** The ALWAYSACCEPT. */
- public static final String ALWAYSACCEPT = "%s/Display/alwaysaccept";
-
- /** The ALWAYSDECLINE. */
- public static final String ALWAYSDECLINE = "%s/Display/alwaysdecline";
-
- /** The ALWAYSASK. */
- public static final String ALWAYSASK = "%s/Display/alwaysask";
- }
- }
-
- /**
- * The Interface GuiDownloadPictures.
- */
- public static class GuiDownloadPictures {
-
- /** The TITLE. */
- public static final String TITLE = "%s/DownloadPictures/title";
-
- /** The PROXY_ADDRESS. */
- public static final String PROXY_ADDRESS = "%s/DownloadPictures/proxy/address";
-
- /** The PROXY_PORT. */
- public static final String PROXY_PORT = "%s/DownloadPictures/proxy/port";
-
- /** The NO_PROXY. */
- public static final String NO_PROXY = "%s/DownloadPictures/proxy/type/none";
-
- /** The HTTP_PROXY. */
- public static final String HTTP_PROXY = "%s/DownloadPictures/proxy/type/http";
-
- /** The SOCKS_PROXY. */
- public static final String SOCKS_PROXY = "%s/DownloadPictures/proxy/type/socks";
-
- /** The NO_MORE. */
- public static final String NO_MORE = "%s/DownloadPictures/no-more";
-
- /** The BAR_BEFORE_START. */
- public static final String BAR_BEFORE_START = "%s/DownloadPictures/bar/before-start";
-
- /** The BAR_WAIT. */
- public static final String BAR_WAIT = "%s/DownloadPictures/bar/wait";
-
- /** The BAR_CLOSE. */
- public static final String BAR_CLOSE = "%s/DownloadPictures/bar/close";
-
- /**
- * The Interface Buttons.
- */
- public static class Buttons {
-
- /** The START. */
- public static final String START = "%s/DownloadPictures/button/start";
-
- /** The CANCEL. */
- public static final String CANCEL = "%s/DownloadPictures/button/cancel";
-
- /** The CLOSE. */
- public static final String CLOSE = "%s/DownloadPictures/button/close";
- }
-
- /**
- * The Interface Errors.
- */
- public static class Errors {
-
- /** The PROXY_CONNECT. */
- public static final String PROXY_CONNECT = "%s/DownloadPictures/errors/proxy/connect";
-
- /** The OTHER. */
- public static final String OTHER = "%s/DownloadPictures/errors/other";
- }
- }
-
- /**
- * The Interface OldGuiNewGame.
- */
- public static class OldGuiNewGame {
-
- /**
- * The Interface NewGameText.
- */
- public static class NewGameText {
-
- /** The GAMETYPE. */
- public static final String GAMETYPE = "%s/NewGame/gametype";
-
- /** The LIBRARY. */
- public static final String LIBRARY = "%s/NewGame/library";
-
- /** The SETTINGS. */
- public static final String SETTINGS = "%s/NewGame/settings";
-
- /** The NEW_GAME. */
- public static final String NEW_GAME = "%s/NewGame/new_game";
-
- /** The CONSTRUCTED_TEXT. */
- public static final String CONSTRUCTED_TEXT = "%s/NewGame/constructed_text";
-
- /** The SEALED_TEXT. */
- public static final String SEALED_TEXT = "%s/NewGame/sealed_text";
-
- /** The BOOSTER_TEXT. */
- public static final String BOOSTER_TEXT = "%s/NewGame/booster_text";
-
- /** The YOURDECK. */
- public static final String YOURDECK = "%s/NewGame/yourdeck";
-
- /** The OPPONENT. */
- public static final String OPPONENT = "%s/NewGame/opponent";
-
- /** The DECK_EDITOR. */
- public static final String DECK_EDITOR = "%s/NewGame/deckeditor";
-
- /** The AI_LAND. */
- public static final String AI_LAND = "%s/NewGame/ailand";
-
- /** The DEV_MODE. */
- public static final String DEV_MODE = "%s/NewGame/devmode";
-
- /** The QUEST_MODE. */
- public static final String QUEST_MODE = "%s/NewGame/questmode";
-
- /** The START_GAME. */
- public static final String START_GAME = "%s/NewGame/startgame";
-
- /** The SAVE_SEALED_MSG. */
- public static final String SAVE_SEALED_MSG = "%s/NewGame/savesealed_msg";
-
- /** The SAVE_SEALED_TTL. */
- public static final String SAVE_SEALED_TTL = "%s/NewGame/savesealed_ttl";
-
- }
-
- /**
- * The Interface MenuBar.
- */
- public static class MenuBar {
-
- /**
- * The Interface Menu.
- */
- public static class Menu {
-
- /** The TITLE. */
- public static final String TITLE = "%s/NewGame/menu/title";
-
- /** The DOWNLOADPRICE. */
- public static final String DOWNLOADPRICE = "%s/NewGame/menu/downloadPrice";
-
- /** The DOWNLOAD. */
- public static final String DOWNLOAD = "%s/NewGame/menu/download";
-
- /** The DOWNLOADLQ. */
- public static final String DOWNLOADLQ = "%s/NewGame/menu/downloadlq";
-
- /** The DOWNLOADSETLQ. */
- public static final String DOWNLOADSETLQ = "%s/NewGame/menu/downloadsetlq";
-
- /** The DOWNLOADQUESTIMG. */
- public static final String DOWNLOADQUESTIMG = "%s/NewGame/menu/downloadquest";
-
- /** The IMPORTPICTURE. */
- public static final String IMPORTPICTURE = "%s/NewGame/menu/importPicture";
-
- /** The CARD_SIZES. */
- public static final String CARD_SIZES = "%s/NewGame/menu/cardSizes";
-
- /** The CARD_STACK. */
- public static final String CARD_STACK = "%s/NewGame/menu/cardStack";
-
- /** The CARD_STACK_OFFSET. */
- public static final String CARD_STACK_OFFSET = "%s/NewGame/menu/cardStackOffset";
-
- /** The ABOUT. */
- public static final String ABOUT = "%s/NewGame/menu/about";
-
- /** The EXIT. */
- public static final String EXIT = "%s/NewGame/menu/exit";
- }
-
- /**
- * The Interface Options.
- */
- public static class Options {
-
- /** The TITLE. */
- public static final String TITLE = "%s/NewGame/options/title";
-
- /** The FONT. */
- public static final String FONT = "%s/NewGame/options/font";
-
- /** The CARD_OVERLAY. */
- public static final String CARD_OVERLAY = "%s/NewGame/options/cardOverlay";
-
- /** The CARD_SCALE. */
- public static final String CARD_SCALE = "%s/NewGame/options/cardScale";
-
- /**
- * The Interface Generate.
- */
- public static class Generate {
-
- /** The TITLE. */
- public static final String TITLE = "%s/NewGame/options/generate/title";
-
- /** The Constant SINGLETONS. */
- public static final String SINGLETONS = "%s/NewGame/options/generate/singletons";
-
- /** The REMOVE_SMALL. */
- public static final String REMOVE_SMALL = "%s/NewGame/options/generate/removeSmall";
-
- /** The REMOVE_ARTIFACTS. */
- public static final String REMOVE_ARTIFACTS = "%s/NewGame/options/generate/removeArtifacts";
- }
- }
-
- /**
- * The Interface Help.
- */
- public static class Help {
-
- /** The TITLE. */
- public static final String TITLE = "%s/NewGame/help/title";
- }
-
- }
-
- /**
- * The Interface Errors.
- */
- public static class Errors {
- }
- }
-
- /**
- * The Interface WinLoseFrame.
- */
- public static class WinLoseFrame {
-
- /**
- * The Interface WinLoseText.
- */
- public static class WinLoseText {
-
- /** The WON. */
- public static final String WON = "%s/WinLose/won";
-
- /** The LOST. */
- public static final String LOST = "%s/WinLose/lost";
-
- /** The WIN. */
- public static final String WIN = "%s/WinLose/win";
-
- /** The LOSE. */
- public static final String LOSE = "%s/WinLose/lose";
-
- /** The CONTINUE. */
- public static final String CONTINUE = "%s/WinLose/continue";
-
- /** The RESTART. */
- public static final String RESTART = "%s/WinLose/restart";
-
- /** The QUIT. */
- public static final String QUIT = "%s/WinLose/quit";
- }
- }
-
- // end
-
- // Doublestrike 02-10-11 - this is soon to be deprecated.
- /**
- * The Interface GuiWinLose.
- */
- public static class GuiWinLose {
-
- /**
- * The Interface WinLoseText.
- */
- public static class WinLoseText {
-
- /** The WON. */
- public static final String WON = "%s/WinLose/won";
-
- /** The LOST. */
- public static final String LOST = "%s/WinLose/lost";
-
- /** The WIN. */
- public static final String WIN = "%s/WinLose/win";
-
- /** The LOSE. */
- public static final String LOSE = "%s/WinLose/lose";
-
- /** The CONTINUE. */
- public static final String CONTINUE = "%s/WinLose/continue";
-
- /** The RESTART. */
- public static final String RESTART = "%s/WinLose/restart";
-
- /** The QUIT. */
- public static final String QUIT = "%s/WinLose/quit";
- }
- }
-
- /**
- * The Interface GuiDownloadPrices.
- */
- public static class GuiDownloadPrices {
-
- /**
- * The Interface DownloadPrices.
- */
- public static class DownloadPrices {
-
- /** The TITLE. */
- public static final String TITLE = "%s/DownloadPrices/title";
-
- /** The START_UPDATE. */
- public static final String START_UPDATE = "%s/DownloadPrices/startupdate";
-
- /** The DOWNLOADING. */
- public static final String DOWNLOADING = "%s/DownloadPrices/downloading";
-
- /** The COMPILING. */
- public static final String COMPILING = "%s/DownloadPrices/compiling";
- }
- }
-
- /**
- * The Interface GameAction.
- */
- public static class GameAction {
-
- /**
- * The Interface GameActionText.
- */
- public static class GameActionText {
-
- /** The HEADS. */
- public static final String HEADS = "%s/GameAction/heads";
-
- /** The TAILS. */
- public static final String TAILS = "%s/GameAction/tails";
-
- /** The HEADS_OR_TAILS. */
- public static final String HEADS_OR_TAILS = "%s/GameAction/heads_or_tails";
-
- /** The COIN_TOSS. */
- public static final String COIN_TOSS = "%s/GameAction/coin_toss";
-
- /** The HUMAN_WIN. */
- public static final String HUMAN_WIN = "%s/GameAction/human_win";
-
- /** The COMPUTER_WIN. */
- public static final String COMPUTER_WIN = "%s/GameAction/computer_win";
-
- /** The COMPUTER_STARTS. */
- public static final String COMPUTER_STARTS = "%s/GameAction/computer_starts";
-
- /** The HUMAN_STARTS. */
- public static final String HUMAN_STARTS = "%s/GameAction/human_starts";
-
- /** The HUMAN_MANA_COST. */
- public static final String HUMAN_MANA_COST = "%s/GameAction/human_mana_cost";
-
- /** The COMPUTER_MANA_COST. */
- public static final String COMPUTER_MANA_COST = "%s/GameAction/computer_mana_cost";
-
- /** The COMPUTER_CUT. */
- public static final String COMPUTER_CUT = "%s/GameAction/computer_cut";
-
- /** The HUMAN_CUT. */
- public static final String HUMAN_CUT = "%s/GameAction/human_cut";
-
- /** The CUT_NUMBER. */
- public static final String CUT_NUMBER = "%s/GameAction/cut_number";
-
- /** The RESOLVE_STARTER. */
- public static final String RESOLVE_STARTER = "%s/GameAction/resolve_starter";
-
- /** The EQUAL_CONVERTED_MANA. */
- public static final String EQUAL_CONVERTED_MANA = "%s/GameAction/equal_converted_mana";
-
- /** The CUTTING_AGAIN. */
- public static final String CUTTING_AGAIN = "%s/GameAction/cutting_again";
-
- /** The YES. */
- public static final String YES = "%s/GameAction/yes";
-
- /** The NO. */
- public static final String NO = "%s/GameAction/no";
-
- /** The WANT_DREDGE. */
- public static final String WANT_DREDGE = "%s/GameAction/want_dredge";
-
- /** The SELECT_DREDGE. */
- public static final String SELECT_DREDGE = "%s/GameAction/select_dredge";
-
- /** The CHOOSE_2ND_LAND. */
- public static final String CHOOSE_2ND_LAND = "%s/GameAction/choose_2nd_land";
-
- }
- }
- }
+ public static final String TEXT_HOWTO_FILE = _RES_ROOT + "howto.txt";
+ public static final String DRAFT_RANKINGS_FILE = _RES_ROOT + "draft/rankings.txt";
+ public static final String PRICES_BOOSTER_FILE = _QUEST_DIR + "booster-prices.txt";
+ public static final String BAZAAR_FILE = _QUEST_DIR + "bazaar/index.xml";
+
+ public static final String CARD_DATA_PETS_DIR = _QUEST_DIR + "bazaar/";
+ public static final String DEFAULT_DUELS_DIR = _QUEST_DIR + "duels";
+ public static final String DEFAULT_CHALLENGES_DIR = _QUEST_DIR + "challenges";
+
+ // data that has defaults in the program dir but overrides/additions in the user dir
+ public static final FileLocation MAIN_PREFERENCES_FILE = new FileLocation(_DEFAULTS_DIR, _USER_PREFS_DIR, "forge.preferences");
+ public static final FileLocation EDITOR_PREFERENCES_FILE = new FileLocation(_DEFAULTS_DIR, _USER_PREFS_DIR, "editor.preferences");
+ public static final FileLocation QUEST_PREFERENCES_FILE = new FileLocation(_DEFAULTS_DIR, _USER_PREFS_DIR, "quest.preferences");
+
+ public static final FileLocation HOME_LAYOUT_FILE = new FileLocation(_DEFAULTS_DIR, _USER_PREFS_DIR, "home.xml");
+ public static final FileLocation MATCH_LAYOUT_FILE = new FileLocation(_DEFAULTS_DIR, _USER_PREFS_DIR, "match.xml");
+ public static final FileLocation EDITOR_LAYOUT_FILE = new FileLocation(_DEFAULTS_DIR, _USER_PREFS_DIR, "editor.xml");
+
+ public static final FileLocation QUEST_CARD_PRICE_FILE = new FileLocation(_DEFAULTS_DIR, _DB_DIR, "all-prices.txt");
+
+ public static final FileLocation CARD_DATA_DIR = new FileLocation(_RES_ROOT, _USER_DIR, "cardsfolder/");
+ public static final FileLocation DECK_CUBE_DIR = new FileLocation(_DEFAULTS_DIR, _USER_DIR, "cube");
+ public static final FileLocation QUEST_WORLD_DIR = new FileLocation(_QUEST_DIR, _USER_QUEST_DIR, "worlds/");
+ public static final FileLocation QUEST_PRECON_DIR = new FileLocation(_QUEST_DIR, _USER_QUEST_DIR, "precons/");
+
+ // data that is only in the user dir
+ public static final String DECK_CONSTRUCTED_DIR = _USER_DIR + "constructed/";
+ public static final String DECK_DRAFT_DIR = _USER_DIR + "draft/";
+ public static final String DECK_SEALED_DIR = _USER_DIR + "sealed/";
+ public static final String DECK_SCHEME_DIR = _USER_DIR + "scheme/";
+ public static final String DECK_PLANE_DIR = _USER_DIR + "plane/";
+ public static final String QUEST_SAVE_DIR = _USER_DIR + "quest/saves";
+
+ // data that is only in the cached dir
+ public static final String CACHE_CARD_PICS_DIR = _CACHE_DIR + "pics/cards/";
+ public static final String CACHE_TOKEN_PICS_DIR = _CACHE_DIR + "pics/tokens/";
+ public static final String CACHE_ICON_PICS_DIR = _CACHE_DIR + "pics/icons/";
+ public static final String CACHE_BOOSTER_PICS_DIR = _CACHE_DIR + "pics/boosters/";
+ public static final String CACHE_FATPACK_PICS_DIR = _CACHE_DIR + "pics/fatpacks/";
+ public static final String CACHE_PRECON_PICS_DIR = _CACHE_DIR + "pics/precons/";
+ public static final String CACHE_TOURNAMENTPACK_PICS_DIR = _CACHE_DIR + "pics/tournamentpacks/";
+ public static final String CACHE_MORPH_IMAGE_FILE = CACHE_TOKEN_PICS_DIR + "morph.jpg";
+
+ public static final List PROFILE_DIRS = Lists.newArrayList(
+ _USER_PREFS_DIR,
+ _DB_DIR,
+ CARD_DATA_DIR.userPrefLoc,
+ DECK_CUBE_DIR.userPrefLoc,
+ QUEST_WORLD_DIR.userPrefLoc,
+ QUEST_PRECON_DIR.userPrefLoc,
+ DECK_CONSTRUCTED_DIR,
+ DECK_DRAFT_DIR,
+ DECK_SEALED_DIR,
+ DECK_SCHEME_DIR,
+ DECK_PLANE_DIR,
+ QUEST_SAVE_DIR,
+ CACHE_CARD_PICS_DIR,
+ CACHE_TOKEN_PICS_DIR,
+ CACHE_ICON_PICS_DIR,
+ CACHE_BOOSTER_PICS_DIR,
+ CACHE_FATPACK_PICS_DIR,
+ CACHE_PRECON_PICS_DIR,
+ CACHE_TOURNAMENTPACK_PICS_DIR);
+
+ // URLs
+ private static final String _URL_CARDFORGE = "http://cardforge.org";
+ public static final String URL_DRAFT_UPLOAD = _URL_CARDFORGE + "/draftAI/submitDraftData.php";
+ public static final String URL_PIC_DOWNLOAD = _URL_CARDFORGE + "/fpics/";
+ public static final String URL_PRICE_DOWNLOAD = _URL_CARDFORGE + "/MagicInfo/pricegen.php";
}
diff --git a/src/main/java/forge/quest/BoosterUtils.java b/src/main/java/forge/quest/BoosterUtils.java
index d613ac373fd..9f5c2687f2d 100644
--- a/src/main/java/forge/quest/BoosterUtils.java
+++ b/src/main/java/forge/quest/BoosterUtils.java
@@ -18,7 +18,6 @@
package forge.quest;
import java.util.ArrayList;
-
import java.util.Collections;
import java.util.List;
@@ -32,8 +31,8 @@ import com.google.common.collect.Lists;
import forge.Singletons;
import forge.card.BoosterGenerator;
-import forge.card.CardRulesPredicates;
import forge.card.CardRules;
+import forge.card.CardRulesPredicates;
import forge.card.UnOpenedProduct;
import forge.item.BoosterPack;
import forge.item.CardDb;
diff --git a/src/main/java/forge/quest/QuestController.java b/src/main/java/forge/quest/QuestController.java
index eba2527010d..555cf86b339 100644
--- a/src/main/java/forge/quest/QuestController.java
+++ b/src/main/java/forge/quest/QuestController.java
@@ -24,14 +24,13 @@ import com.google.common.base.Predicates;
import forge.Singletons;
import forge.deck.Deck;
-import forge.quest.data.GameFormatQuest;
import forge.game.GameFormat;
import forge.item.CardPrinted;
import forge.item.PreconDeck;
-import forge.properties.ForgeProps;
import forge.properties.NewConstants;
import forge.quest.bazaar.QuestBazaarManager;
import forge.quest.bazaar.QuestPetStorage;
+import forge.quest.data.GameFormatQuest;
import forge.quest.data.QuestAchievements;
import forge.quest.data.QuestAssets;
import forge.quest.data.QuestData;
@@ -169,7 +168,7 @@ public class QuestController {
*/
public static IStorageView getPrecons() {
if (null == preconManager) {
- preconManager = new StorageView(new PreconReader(ForgeProps.getFile(NewConstants.Quest.PRECONS)));
+ preconManager = new StorageView(new PreconReader(new File(NewConstants.QUEST_PRECON_DIR.defaultLoc)));
}
return QuestController.preconManager;
@@ -339,7 +338,7 @@ public class QuestController {
*/
public final QuestBazaarManager getBazaar() {
if (null == this.bazaar) {
- this.bazaar = new QuestBazaarManager(ForgeProps.getFile(NewConstants.Quest.BAZAAR));
+ this.bazaar = new QuestBazaarManager(new File(NewConstants.BAZAAR_FILE));
}
return this.bazaar;
}
@@ -374,12 +373,12 @@ public class QuestController {
*/
public void resetDuelsManager() {
if (this.model == null || this.model.getWorldId() == null) {
- this.duelManager = new QuestEventManager(ForgeProps.getFile(NewConstants.Quest.DUELS));
+ this.duelManager = new QuestEventManager(new File(NewConstants.DEFAULT_DUELS_DIR));
} else {
QuestWorld world = Singletons.getModel().getWorlds().get(this.model.getWorldId());
if (world == null || world.getDuelsDir() == null) {
- this.duelManager = new QuestEventManager(ForgeProps.getFile(NewConstants.Quest.DUELS));
+ this.duelManager = new QuestEventManager(new File(NewConstants.DEFAULT_DUELS_DIR));
} else {
this.duelManager = new QuestEventManager(new File("res/quest/world/" + world.getDuelsDir()));
}
@@ -392,13 +391,13 @@ public class QuestController {
*/
public void resetChallengesManager() {
if (this.model == null || this.model.getWorldId() == null) {
- this.challengesManager = new QuestEventManager(ForgeProps.getFile(NewConstants.Quest.CHALLENGES));
+ this.challengesManager = new QuestEventManager(new File(NewConstants.DEFAULT_CHALLENGES_DIR));
}
else {
QuestWorld world = Singletons.getModel().getWorlds().get(this.model.getWorldId());
if (world == null || world.getChallengesDir() == null) {
- this.challengesManager = new QuestEventManager(ForgeProps.getFile(NewConstants.Quest.CHALLENGES));
+ this.challengesManager = new QuestEventManager(new File(NewConstants.DEFAULT_CHALLENGES_DIR));
} else {
this.challengesManager = new QuestEventManager(new File("res/quest/world/" + world.getChallengesDir()));
}
@@ -412,7 +411,7 @@ public class QuestController {
*/
public QuestPetStorage getPetsStorage() {
if (this.pets == null) {
- this.pets = new QuestPetStorage(ForgeProps.getFile(NewConstants.Quest.BAZAAR));
+ this.pets = new QuestPetStorage(new File(NewConstants.CARD_DATA_PETS_DIR));
}
return this.pets;
@@ -435,5 +434,4 @@ public class QuestController {
return unlocksAvaliable > unlocksSpent ? Math.min(unlocksAvaliable - unlocksSpent, cntLocked) : 0;
}
-
}
diff --git a/src/main/java/forge/quest/QuestRewardCardChooser.java b/src/main/java/forge/quest/QuestRewardCardChooser.java
index 2f31e4cf0ba..2a17e9f75b9 100644
--- a/src/main/java/forge/quest/QuestRewardCardChooser.java
+++ b/src/main/java/forge/quest/QuestRewardCardChooser.java
@@ -1,19 +1,19 @@
package forge.quest;
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-import com.google.common.collect.Iterables;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
+import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
+import com.google.common.collect.Iterables;
+
import forge.Singletons;
+import forge.card.CardRules;
import forge.item.CardDb;
import forge.item.CardPrinted;
import forge.item.IPaperCard;
-import forge.card.CardRules;
import forge.item.InventoryItem;
import forge.item.ItemPool;
diff --git a/src/main/java/forge/quest/QuestUtil.java b/src/main/java/forge/quest/QuestUtil.java
index d787962e38f..e3795614a94 100644
--- a/src/main/java/forge/quest/QuestUtil.java
+++ b/src/main/java/forge/quest/QuestUtil.java
@@ -17,8 +17,10 @@
*/
package forge.quest;
-import forge.Card;
+import java.util.ArrayList;
+import java.util.List;
+import forge.Card;
import forge.card.CardEdition;
import forge.card.CardRulesReader;
import forge.item.CardDb;
@@ -26,9 +28,6 @@ import forge.item.CardToken;
import forge.item.IPaperCard;
import forge.quest.bazaar.QuestPetController;
-import java.util.ArrayList;
-import java.util.List;
-
/**
*
- *
- * @param sURL
- * a {@link java.lang.String} object.
- * @param file
- * a {@link java.lang.String} object.
- */
- public final void upload(final String sURL, final String file) {
+ public static void upload(String sURL, String file) {
+ upload(sURL, new File(file));
+ }
+
+ public static void upload(String url, Collection> data) {
+ File tempFile = null;
+ try {
+ tempFile = File.createTempFile("forge.upload", null);
+ FileUtil.writeFile(tempFile, data);
+ HttpUtil.upload(url, tempFile);
+ } catch (IOException e) {
+ System.err.println("unable to write to temp file for upload");
+ } finally {
+ if (null != tempFile) {
+ tempFile.delete();
+ }
+ }
+ }
+
+ public static void upload(String sURL, File f) {
URL url = null;
try {
url = new URL(sURL);
@@ -80,7 +81,6 @@ public class HttpUtil {
return;
}
- final File f = new File(file);
final String str = "--" + HttpUtil.BOUNDARY + "\r\n"
+ "Content-Disposition: form-data;name=\"data\"; filename=\"" + f.getName() + "\"\r\n"
+ "Content-Type: text/plain\r\n\r\n";
@@ -155,16 +155,7 @@ public class HttpUtil {
}
}
- /**
- *
- * getURL.
- *
- *
- * @param sURL
- * a {@link java.lang.String} object.
- * @return a {@link java.lang.String} object.
- */
- public final String getURL(final String sURL) {
+ public static String getURL(final String sURL) {
URL url = null;
try {
url = new URL(sURL);
@@ -189,4 +180,7 @@ public class HttpUtil {
return buffer.toString();
}
+
+ // disable instantiation
+ private HttpUtil () { }
}
diff --git a/src/main/java/forge/util/ThreadUtil.java b/src/main/java/forge/util/ThreadUtil.java
index 8260fd98851..4abc7967ae9 100644
--- a/src/main/java/forge/util/ThreadUtil.java
+++ b/src/main/java/forge/util/ThreadUtil.java
@@ -21,6 +21,7 @@
package forge.util;
import java.lang.reflect.InvocationTargetException;
+
import javax.swing.SwingUtilities;
/**
diff --git a/src/main/java/forge/util/TreeProperties.java b/src/main/java/forge/util/TreeProperties.java
deleted file mode 100644
index 598775ede4f..00000000000
--- a/src/main/java/forge/util/TreeProperties.java
+++ /dev/null
@@ -1,531 +0,0 @@
-/*
- * Forge: Play Magic: the Gathering.
- * Copyright (C) 2009 Clemens Koza
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package forge.util;
-
-/**
- * TreeProperties.java
- *
- * Created on 19.08.2009
- */
-
-import static java.lang.String.format;
-import static java.util.Collections.unmodifiableList;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.Properties;
-import java.util.Set;
-
-
-/**
- * The class TreeProperties. This class allows for a tree-like structure of
- * properties-files. This class lays some restrictions on the keys used in
- * properties-files:
- *
- *
The use of "--" is forbidden
- *
The suffixes "--properties" and "--transparent-properties" are reserved
- * for specifying additional properties-files in the tree (relative paths are
- * relative to the properties-file where they are referenced)
- *
Other suffixes are used by {@link PropertyType}s. PropertyTypes are
- * registered or unregistered using {@link #addType(PropertyType)} or
- * {@link #removeType(PropertyType)}.
- *
- * As you can see, a properties file included with "--transparent-properties"
- * hides its existence from the user. A file included with "--properties" is not
- * hidden. The child properties are accessible as if their keys were prepended
- * with the parent key, separated by a slash.
- *
- * Note that --file, --properties and --transparent-properties entries will be
- * relative to the included file, even if the properties file is transparent.
- *
- * Also, the TreeProperties can be retrieved:
- *
- *
- *
- *
- * @param type
- * a {@link tree.properties.PropertyType} object.
- */
- public static void removeType(final PropertyType> type) {
- TYPES.remove(type.getType());
- SUFFIXES.remove(type.getSuffix());
- }
-
- /**
- * Delegate to {@link #TreeProperties(File)} with a new.
- *
- * @param f a {@link java.lang.String} object.
- * @throws IOException Signals that an I/O exception has occurred.
- * {@link File#File(String)}.
- */
- public TreeProperties(final String f) throws IOException {
- this(new File(f));
- }
-
- /**
- * Delegate to {@link #TreeProperties(File)} with a new.
- *
- * @param parent a {@link java.io.File} object.
- * @param f a {@link java.lang.String} object.
- * @throws IOException Signals that an I/O exception has occurred.
- * {@link File#File(File, String)}.
- */
- public TreeProperties(final File parent, final String f) throws IOException {
- this(new File(parent, f));
- }
-
- /**
- * The constructor is forgiving in the way that Exceptions are not directly
- * forwarded. The only fatal exception is if the parameter is null or not
- * found. Instead, the rest of the properties are processed, so that the
- * erroneous properties are the only ones not present in this
- * TreeProperties. Afterwards, the exceptions can be accessed.
- *
- * @param f a {@link java.io.File} object.
- * @throws IOException Signals that an I/O exception has occurred.
- */
- public TreeProperties(final File f) throws IOException {
- if (f == null) {
- throw new FileNotFoundException("null");
- }
- this.path = f.getParentFile();
- instanceTypes = new HashMap, PropertyType>>(TYPES);
- instanceSuffixes = new HashMap>(SUFFIXES);
- Properties p = new Properties();
-
- // BufferedReader r = new BufferedReader(new FileReader(f));
- // p.load(r);
- // r.close();
- BufferedInputStream is = new BufferedInputStream(new FileInputStream(f));
- p.load(is);
- is.close();
-
- Set> entries = p.entrySet();
- properties = new HashMap();
- List exceptions = new ArrayList();
- this.exceptions = unmodifiableList(exceptions);
- for (Entry