//************************************************************************
        // Creates a MagicCard Object out of an html Code from MagicCards.Info
        //************************************************************************
        public static MagicCard HTMLToMagicCard(String html)
        {
            if (html == "")
            {
                throw new Exception("Empty HTML string");
            }

            String mainBody = GetMainBody(html);
            String imageUrl = GetCardImageURL(mainBody);
            String cardName = GetCardName(mainBody);
            // Meta-Information contains:
            //    Card-Type
            //    Sub-Type
            //    Power / Toughness
            //    Mana-Cost
            //    Color Indicator
            String        metaInformation = GetCardRawMetaInformation(mainBody);
            List <String> cardTypes       = GetCardTypes(metaInformation);
            List <String> subTypes        = GetCardSubTypes(metaInformation);
            String        power           = GetCardPower(metaInformation);
            String        toughness       = GetCardToughness(metaInformation);
            String        manaCost        = GetCardManaCost(metaInformation);
            String        color           = GetCardColor(metaInformation, manaCost);

            // Cuts the Meta-Information away, since it's no longer needed
            mainBody = CutOutString(mainBody, metaInformation);

            String ruleText   = GetCardRuleText(mainBody);
            String flavorText = GetCardFlavorText(mainBody);

            // Extra-Information about other Version
            //    Other Part of a 2 Faced card
            //    Editions (Rarity)
            //    Names in other Languages
            String extraInformation = GetCardRawExtraInformation(mainBody);
            // Get the Link to the Other Part
            //MagicCard otherPart = GetCardOtherPart(extraInformation); // Not-Used jet
            //String editionsRawData = GetCardEditionsRawData(extraInformation);
            //List<String> editionsWithRarity = GetCardEditionsWithRarity(editionsRawData);
            //String newestRarity = GetCardNewestRarity(editionsWithRarity);
            //String linkToNewestEdition = GetCardNewestEditionLink(editionsWithRarity);

            // Filling the Information into a MagicCard object
            MagicCard resultCard = new MagicCard();

            resultCard.name       = cardName;
            resultCard.types      = cardTypes;
            resultCard.subTypes   = subTypes;
            resultCard.power      = power;
            resultCard.toughness  = toughness;
            resultCard.manaCost   = manaCost;
            resultCard.color      = color;
            resultCard.ruleText   = ruleText;
            resultCard.flavorText = flavorText;
            resultCard.image      = WebImageAsBitmap(imageUrl);
            return(resultCard);
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            MagicCard Card = MagicCardsInfo_WebReader.URLToMagicCard(textBox1.Text);

            pictureBox1.Image = Card.image;
            pictureBox1.Width = pictureBox1.Image.Width;

            lbl_Name.Text         = "Name:\n" + Card.name;
            lbl_ruleText.Text     = "RuleText:\n" + Card.ruleText;
            lbl_FlavorText.Text   = "FlavorText:\n" + Card.flavorText;
            lbl_Types.Text        = "Types:\n" + ListToText(Card.types);
            lbl_Color.Text        = "Color:\n" + Card.color;
            lbl_ManaCost.Text     = "ManaCost:\n" + Card.manaCost;
            lbl_Power.Text        = "Power:\n" + Card.power;
            lbl_toughness.Text    = "Toughness:\n" + Card.toughness;
            lbl_convmanacost.Text = "ConvManaCost:\n" + Card.convertedManaCost.ToString();
            lbl_subtypes.Text     = "SubTypes:\n" + ListToText(Card.subTypes);
            lbl_Rarity.Text       = "Editions:\n" + Card.rarity;
        }