示例#1
0
        /// <summary>
        /// Get SKU information from Google Play
        /// </summary>
        /// <returns>Dictionary key:productId / value:SKU detail</returns>
        public Dictionary <string, SkuDetails> GetSKUs()
        {
            Dictionary <string, string>     SKUs       = googlePlay.GetProductJSONDictionary();
            Dictionary <string, SkuDetails> SKUDetails = new Dictionary <string, SkuDetails>();

            foreach (var pair in SKUs)
            {
                SkuDetails detail = new SkuDetails();
                SkuDetails.FromJson(pair.Value, out detail);
                SKUDetails.Add(pair.Key, detail);
                DebugLog($"------- \n pair.Key={pair.Key}\ndetail.JsonSkuDetails={detail.JsonSkuDetails}");
            }

            return(SKUDetails);
        }
示例#2
0
        /// <summary>
        /// Get SKU information from Google Play
        /// </summary>
        /// <param name="productId">target product id</param>
        /// <returns></returns>
        public SkuDetails GetSKU(string productId)
        {
            Dictionary <string, string> SKUs = GetSKUsJson();

            if (!SKUs.ContainsKey(productId))
            {
                DebugLog($"{productId} doesn't exist in SKU dictionary.");
                return(null);
            }

            SkuDetails detail = new SkuDetails();

            SkuDetails.FromJson(SKUs[productId], out detail);
            DebugLog(detail.JsonSkuDetails);

            return(detail);
        }