Example #1
0
        void IterateThroughSet(string setName)
        {
            var cards = DatabaseManager.GetAllCardsForSet(setName);

            foreach (DataRow card in cards.Rows)
            {
                var name         = card[3].ToString();
                var stringID     = card[17].ToString();
                var multiverseID = -1;
                if (!String.IsNullOrWhiteSpace(stringID))
                {
                    multiverseID = Int32.Parse(stringID);
                }

                double timeLastUpdated = double.Parse(card[23].ToString());

                GetImageForCard(0);
                if (PriceOldEnoughToUpdate(timeLastUpdated) || float.Parse(card[19].ToString()) < 0 || float.Parse(card[21].ToString()) < 0)
                {
                    UpdatePriceOfCard(name, setName);
                }
                if (multiverseID != -1)
                {
                    GetImageForCard(multiverseID);
                }
            }
        }
Example #2
0
        void UpdateCardInSet(string set, JObject setData)
        {
            DatabaseManager.LockSet(set.Replace("'", "''"));
            var cardList = DatabaseManager.GetAllCardsForSet(set.Replace("'", "''"));

            var json = setData["prints"];

            foreach (var card in json)
            {
                var id   = card["id"].ToString();
                var name = card["name"].ToString();

                var cardObject = GetMTGStocksData(id);
                var cardData   = ParseCardData(cardObject, set);
                var prices     = GetPriceFromData(cardData);

                DatabaseManager.UpdatePrice(name, set, prices["price"], false);
                DatabaseManager.UpdatePrice(name, set, prices["foilPrice"], true);
            }

            Logger.LogActivity("Updated price of cards in set:" + set);
            DatabaseManager.UnlockSet(set.Replace("'", "''"));
        }