This commit is contained in:
Anthony Calosa
2016-07-17 14:11:54 +08:00

View File

@@ -18,6 +18,7 @@ public class DeckImporter
String deck = ""; String deck = "";
String deckname = ""; String deckname = "";
String prefix = "#SB:"; String prefix = "#SB:";
int cardcount = 0;
if(f.exists() && !f.isDirectory()) if(f.exists() && !f.isDirectory())
{ {
deckname = f.getName(); deckname = f.getName();
@@ -36,7 +37,7 @@ public class DeckImporter
{ {
String line = scanner.nextLine(); String line = scanner.nextLine();
line = line.trim(); line = line.trim();
if (!line.equals("")) // don't write out blank lines if (!line.equals("") && cardcount < 61) // don't write out blank lines
{ {
String[] slines = line.split("\\s+"); String[] slines = line.split("\\s+");
String arranged = ""; String arranged = "";
@@ -56,6 +57,7 @@ public class DeckImporter
{ {
deck += arranged + "(*) * " + slines[0] + "\n"; deck += arranged + "(*) * " + slines[0] + "\n";
} }
cardcount += Integer.parseInt(slines[0]);
} }
} }
} }
@@ -90,7 +92,7 @@ public class DeckImporter
fop.write(contentInBytes); fop.write(contentInBytes);
fop.flush(); fop.flush();
fop.close(); fop.close();
message = "Import Deck Success!\n\n"+deck; message = "Import Deck Success!\n"+cardcount+" total cards in this deck\n\n"+deck;
} }
catch (IOException e) catch (IOException e)
{ {