forked from External/mage
Refactoring
See github line by line comments in 'File changed'
This commit is contained in:
parent
6577e641e6
commit
c526306c5b
11 changed files with 21 additions and 25 deletions
|
|
@ -65,6 +65,7 @@ public class Sets extends HashMap<String, ExpansionSet> {
|
|||
try {
|
||||
addSet((ExpansionSet) c.getMethod("getInstance").invoke(null));
|
||||
} catch (Exception ex) {
|
||||
logger.error(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -142,10 +143,9 @@ public class Sets extends HashMap<String, ExpansionSet> {
|
|||
}
|
||||
|
||||
public static void saveDeck(String file, DeckCardLists deck) throws FileNotFoundException {
|
||||
PrintWriter out = new PrintWriter(file);
|
||||
Map<String, DeckCardInfo> deckCards = new HashMap<>();
|
||||
Map<String, DeckCardInfo> sideboard = new HashMap<>();
|
||||
try {
|
||||
try (PrintWriter out = new PrintWriter(file)) {
|
||||
if (deck.getName() != null && deck.getName().length() > 0) {
|
||||
out.println("NAME:" + deck.getName());
|
||||
}
|
||||
|
|
@ -169,10 +169,10 @@ public class Sets extends HashMap<String, ExpansionSet> {
|
|||
}
|
||||
|
||||
// Write out all of the cards
|
||||
for (Map.Entry<String, DeckCardInfo> entry : deckCards.entrySet()) {
|
||||
for (Entry<String, DeckCardInfo> entry : deckCards.entrySet()) {
|
||||
out.printf("%d [%s:%s] %s%n", entry.getValue().getQuantity(), entry.getValue().getSetCode(), entry.getValue().getCardNum(), entry.getValue().getCardName());
|
||||
}
|
||||
for (Map.Entry<String, DeckCardInfo> entry : sideboard.entrySet()) {
|
||||
for (Entry<String, DeckCardInfo> entry : sideboard.entrySet()) {
|
||||
out.printf("SB: %d [%s:%s] %s%n", entry.getValue().getQuantity(), entry.getValue().getSetCode(), entry.getValue().getCardNum(), entry.getValue().getCardName());
|
||||
}
|
||||
|
||||
|
|
@ -183,8 +183,6 @@ public class Sets extends HashMap<String, ExpansionSet> {
|
|||
out.print("LAYOUT SIDEBOARD:");
|
||||
writeCardLayout(out, deck.getSideboardLayout());
|
||||
out.print("\n");
|
||||
} finally {
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue