support importing forge decks
This commit is contained in:
@@ -17,6 +17,7 @@ public class DeckImporter
|
|||||||
String message = "";
|
String message = "";
|
||||||
String deck = "";
|
String deck = "";
|
||||||
String deckname = "";
|
String deckname = "";
|
||||||
|
String prefix = "#SB:";
|
||||||
if(f.exists() && !f.isDirectory())
|
if(f.exists() && !f.isDirectory())
|
||||||
{
|
{
|
||||||
deckname = f.getName();
|
deckname = f.getName();
|
||||||
@@ -33,15 +34,21 @@ public class DeckImporter
|
|||||||
{
|
{
|
||||||
while (scanner.hasNext())
|
while (scanner.hasNext())
|
||||||
{
|
{
|
||||||
|
boolean foundSideboard = false;
|
||||||
String line = scanner.nextLine();
|
String line = scanner.nextLine();
|
||||||
|
if(line.toLowerCase().contains("sideboard"))
|
||||||
|
foundSideboard = true;
|
||||||
String[] slines = line.split("\\s+");
|
String[] slines = line.split("\\s+");
|
||||||
String arranged = "";
|
String arranged = "";
|
||||||
for(int idx = 1; idx < slines.length; idx++)
|
for(int idx = 1; idx < slines.length; idx++)
|
||||||
{
|
{
|
||||||
arranged += slines[idx] + " ";
|
arranged += slines[idx] + " ";
|
||||||
}
|
}
|
||||||
if (isNumeric(slines[0]) && arranged != null)
|
if ((isNumeric(slines[0])||foundSideboard) && arranged != null)
|
||||||
{
|
{
|
||||||
|
if (foundSideboard)
|
||||||
|
deck += prefix;
|
||||||
|
|
||||||
if (slines[1] != null && slines[1].startsWith("["))
|
if (slines[1] != null && slines[1].startsWith("["))
|
||||||
{
|
{
|
||||||
arranged = arranged.substring(5);
|
arranged = arranged.substring(5);
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ public class SDLActivity extends Activity implements OnKeyListener
|
|||||||
File[] files = root.listFiles();
|
File[] files = root.listFiles();
|
||||||
for( File f : files)
|
for( File f : files)
|
||||||
{
|
{
|
||||||
if( !myresult.contains(f.toString()) && (f.toString().contains(".txt")||f.toString().contains(".dec")))
|
if( !myresult.contains(f.toString()) && (f.toString().contains(".txt")||f.toString().contains(".dck")||f.toString().contains(".dec")))
|
||||||
myresult.add(f.toString());
|
myresult.add(f.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user