Esempio n. 1
0
        public string ExportDeck(string name, Deck current, bool exact = false)
        {
            if (!Repo.IsLoadingComplete.Signaled)
            {
                throw new InvalidOperationException();
            }

            Deck deckToExport = exact
                                ? current
                                : DeckConverter.ConvertDeck(current, cardId => Repo.CardsById[cardId].Faces.Main?.Id);

            return(ExportDeckImplementation(name, deckToExport, exact));
        }
Esempio n. 2
0
        public Deck ConvertV2Deck(Deck deck) =>
        DeckConverter.ConvertDeck(deck, v2Id =>
        {
            var card = _repo.CardsByScryfallId.TryGet(v2Id) ??
                       _repo.CardsById.TryGet(v2Id);

            if (card == null)
            {
                _log.Error($"No v2 card found by id {v2Id}");
                return(null);
            }

            return(card.Id);
        });
Esempio n. 3
0
        public Deck ConvertLegacyDeck(Deck deck) =>
        DeckConverter.ConvertDeck(deck, legacyId =>
        {
            var cardLegacy = _repoLegacy.CardsById.TryGet(legacyId);
            if (cardLegacy == null)
            {
                _log.Error($"No legacy card found by id {legacyId}");
                return(null);
            }

            var card = MatchLegacyCard(cardLegacy);
            if (card == null)
            {
                _log.Warn($"No matching card found for legacy card {cardLegacy.SetCode} {cardLegacy.NameEn} {cardLegacy.Number} {cardLegacy.MultiverseId} {cardLegacy.Id}");
                return(null);
            }

            return(card.Id);
        });
Esempio n. 4
0
 public Deck ConvertV3Deck(Deck deck) =>
 DeckConverter.ConvertDeck(deck, MatchIdV3);