mirror of
https://github.com/correl/mage.git
synced 2024-12-26 19:16:54 +00:00
* UI: fixed wrong deck import from cubes and other sources without cards amount;
This commit is contained in:
parent
7f9e2595f7
commit
e3f5071738
1 changed files with 23 additions and 19 deletions
|
@ -55,8 +55,13 @@ public class TxtDeckImporter extends PlainTextDeckImporter {
|
||||||
line = line.substring(0, commentDelim).trim();
|
line = line.substring(0, commentDelim).trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ignore all empty lines until real cards starts
|
||||||
|
if (line.isEmpty() && !wasCardLines) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// switch sideboard by empty line
|
// switch sideboard by empty line
|
||||||
if (switchSideboardByEmptyLine && line.isEmpty() && wasCardLines) {
|
if (switchSideboardByEmptyLine && line.isEmpty()) {
|
||||||
if (!sideboard) {
|
if (!sideboard) {
|
||||||
sideboard = true;
|
sideboard = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -77,29 +82,28 @@ public class TxtDeckImporter extends PlainTextDeckImporter {
|
||||||
|
|
||||||
line = line.replace("\t", " "); // changing tabs to blanks as delimiter
|
line = line.replace("\t", " "); // changing tabs to blanks as delimiter
|
||||||
int delim = line.indexOf(' ');
|
int delim = line.indexOf(' ');
|
||||||
if (delim < 0) {
|
String lineNum = "";
|
||||||
return;
|
if (delim > 0) {
|
||||||
}
|
lineNum = line.substring(0, delim).trim();
|
||||||
|
if (IGNORE_NAMES.contains(lineNum)) {
|
||||||
String lineNum = line.substring(0, delim).trim();
|
return;
|
||||||
if (IGNORE_NAMES.contains(lineNum)) {
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// amount
|
// amount
|
||||||
int cardAmount = 0;
|
int cardAmount = 0;
|
||||||
boolean haveCardAmout;
|
boolean haveCardAmout = false;
|
||||||
try {
|
if (!lineNum.isEmpty()) {
|
||||||
cardAmount = Integer.parseInt(lineNum.replaceAll("\\D+", ""));
|
try {
|
||||||
if ((cardAmount <= 0) || (cardAmount >= 100)) {
|
cardAmount = Integer.parseInt(lineNum.replaceAll("\\D+", ""));
|
||||||
sbMessage.append("Invalid number (too small or too big): ").append(lineNum).append(" at line ").append(lineCount).append('\n');
|
if ((cardAmount <= 0) || (cardAmount >= 100)) {
|
||||||
return;
|
sbMessage.append("Invalid number (too small or too big): ").append(lineNum).append(" at line ").append(lineCount).append('\n');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
haveCardAmout = true;
|
||||||
|
} catch (NumberFormatException nfe) {
|
||||||
|
// card without amount
|
||||||
}
|
}
|
||||||
haveCardAmout = true;
|
|
||||||
} catch (NumberFormatException nfe) {
|
|
||||||
haveCardAmout = false;
|
|
||||||
//sbMessage.append("Invalid number: ").append(lineNum).append(" at line ").append(lineCount).append('\n');
|
|
||||||
//return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String lineName;
|
String lineName;
|
||||||
|
|
Loading…
Reference in a new issue