Clipboard .mtga deck importing & fixes to .mtga and .dck importers (#9321)

This commit is contained in:
sprangg 2022-08-01 05:42:32 +03:00 committed by GitHub
parent 4728bac28e
commit 17deba2df3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 22 deletions

View file

@ -68,7 +68,14 @@ public class DeckImportClipboardDialog extends MageDialog {
}
private void onOK() {
tmpPath = DeckUtil.writeTextToTempFile(editData.getText());
String decklist = editData.getText();
decklist = decklist.replace(FORMAT_TEXT, "");
// This dialog also accepts a paste in .mtga format
if (decklist.startsWith("Deck\n")) { // An .mtga list always starts with the first line being "Deck". This kind of paste is processed as .mtga
tmpPath = DeckUtil.writeTextToTempFile("cbimportdeck", ".mtga", decklist);
} else { // If the paste is not .mtga format, it's processed as plaintext
tmpPath = DeckUtil.writeTextToTempFile(decklist);
}
this.removeDialog();
}