示例#1
0
 private void AssignFieldFromEntry(CardDetailEntry entry)
 {
     switch (entry.FieldName)
     {
         case CardFieldName.CardName:
             CardName = (CardDetailEntryString) entry;
             break;
         case CardFieldName.ManaCost:
             ManaCost = (CardDetailEntrySequence) entry;
             break;
         case CardFieldName.ConvertedManaCost:
             if (!Int32.TryParse(((CardDetailEntryString) entry).Value, out ConvertedManaCost))
             {
                 Debug.Assert(false);
             }
             break;
         case CardFieldName.Types:
             Types = (CardDetailEntryString) entry;
             break;
         case CardFieldName.CardText:
             CardText = (CardDetailEntrySequence) entry;
             CardTextInnerHtml = entry.InnerHtmlCode;
             CardTextOuterHtml = entry.OuterHtmlCode;
             break;
         case CardFieldName.Watermark:
             Watermark = (CardDetailEntryString) entry;
             break;
         case CardFieldName.PowerToughness:
             ExtractPowerToughnessOrLoyalty(((CardDetailEntryString) entry).Value, out Power, out Toughness);
             break;
         case CardFieldName.Expansion:
             Expansion = (CardDetailEntrySequence) entry;
             break;
         case CardFieldName.Rarity:
             Rarity = (CardDetailEntryString) entry;
             break;
         case CardFieldName.CardNumber:
             CardNumber = (CardDetailEntryString) entry;
             break;
         case CardFieldName.Artist:
             Artist = (CardDetailEntryString) entry;
             break;
         case CardFieldName.CommunityRating:
             CommunityRating = (CardDetailEntryString) entry;
             break;
         case CardFieldName.Image:
             ImageUrl = (CardDetailEntryString) entry;
             break;
     }
 }
 private void DownloadImagesForDetailEntrySequence(CardDetailEntrySequence sequence)
 {
     foreach (CardFieldData element in sequence.Data)
     {
         if (element is CardFieldDataLink)
         {
             string convertedImageName = CommonHelpers.ConvertWebImageUrlToLocalFileName(element.Data);
             DownloadImageHelper.DownloadImage(element.Data,
                                               convertedImageName + ".jpg",
                                               CommonHelpers.DetailsImagesFolder);
         }
     }
 }