Exemplo n.º 1
0
        private void ImportForDeck(Deck deck)
        {
            string path = Path.Combine("decks", deck.Name + ".txt");

            // We need skip first line of arena deck file because it contains an arena rank.
            if (deck.Type != DeckType.Constructed)
            {
                string correct_path = Path.Combine(game_path, path);
                var    lines        = File.ReadAllLines(correct_path);
                File.WriteAllLines(correct_path, lines.Skip(1).ToArray());
            }

            DeckImporter deckImporter = new DeckImporter();

            deckImporter.Cards = new List <CardInstance>();
            deckImporter.ImportFromFileProcess(path);
            deck.SelectedVersion.Cards = new PropertiesObservableCollection <CardInstance>(deckImporter.Cards);
        }