Ejemplo n.º 1
0
        protected override void Parse(Dictionary <string, JSONValue> dict)
        {
            JSONValue value5 = dict["groups"];

            foreach (JSONValue value2 in value5.AsList(true))
            {
                Group group = Group.Create();
                this.ParseList(value2, ref group);
                this.groups.Add(group);
            }
            JSONValue        value6 = dict["query"];
            JSONValue        value3 = value6["offsets"];
            JSONValue        value7 = dict["query"];
            List <JSONValue> list   = value7["limits"].AsList(true);
            int num = 0;

            foreach (JSONValue value4 in value3.AsList(true))
            {
                Group group2 = this.groups[num];
                group2.offset = (int)value4.AsFloat(true);
                JSONValue value9 = list[num];
                group2.limit     = (int)value9.AsFloat(true);
                this.groups[num] = group2;
                num++;
            }
        }
Ejemplo n.º 2
0
        protected override void Parse(Dictionary <string, JSONValue> dict)
        {
            using (List <JSONValue> .Enumerator enumerator = dict["groups"].AsList(true).GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    JSONValue current = enumerator.Current;
                    AssetStoreSearchResults.Group group = AssetStoreSearchResults.Group.Create();
                    this.ParseList(current, ref group);
                    this.groups.Add(group);
                }
            }
            JSONValue        jsonValue     = dict["query"]["offsets"];
            List <JSONValue> jsonValueList = dict["query"]["limits"].AsList(true);
            int index = 0;

            using (List <JSONValue> .Enumerator enumerator = jsonValue.AsList(true).GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    JSONValue current = enumerator.Current;
                    AssetStoreSearchResults.Group group = this.groups[index];
                    group.offset       = (int)current.AsFloat(true);
                    group.limit        = (int)jsonValueList[index].AsFloat(true);
                    this.groups[index] = group;
                    ++index;
                }
            }
        }
Ejemplo n.º 3
0
    public bool Copy(string key, ref int dest)
    {
        bool      flag;
        JSONValue jSONValue = this.Get(key, out flag);

        if (flag && !jSONValue.IsNull())
        {
            dest = (int)jSONValue.AsFloat(false);
        }
        return(flag);
    }
Ejemplo n.º 4
0
        private void ParseList(JSONValue matches, ref Group group)
        {
            List <AssetStoreAsset> assets = group.assets;

            if (matches.ContainsKey("error"))
            {
                base.error = matches["error"].AsString(true);
            }
            if (matches.ContainsKey("warnings"))
            {
                base.warnings = matches["warnings"].AsString(true);
            }
            if (matches.ContainsKey("name"))
            {
                group.name = matches["name"].AsString(true);
            }
            if (matches.ContainsKey("label"))
            {
                group.label = matches["label"].AsString(true);
            }
            if (group.label == null)
            {
            }
            group.label = group.name;
            if (matches.ContainsKey("total_found"))
            {
                JSONValue value7 = matches["total_found"];
                group.totalFound = (int)value7.AsFloat(true);
            }
            if (matches.ContainsKey("matches"))
            {
                JSONValue value8 = matches["matches"];
                foreach (JSONValue value2 in value8.AsList(true))
                {
                    AssetStoreAsset item = new AssetStoreAsset();
                    if ((value2.ContainsKey("id") && value2.ContainsKey("name")) && value2.ContainsKey("package_id"))
                    {
                        JSONValue value9 = value2["id"];
                        item.id          = (int)value9.AsFloat();
                        item.name        = value2["name"].AsString();
                        item.displayName = StripExtension(item.name);
                        JSONValue value11 = value2["package_id"];
                        item.packageID = (int)value11.AsFloat();
                        if (value2.ContainsKey("static_preview_url"))
                        {
                            item.staticPreviewURL = value2["static_preview_url"].AsString();
                        }
                        if (value2.ContainsKey("dynamic_preview_url"))
                        {
                            item.dynamicPreviewURL = value2["dynamic_preview_url"].AsString();
                        }
                        item.className = !value2.ContainsKey("class_name") ? string.Empty : value2["class_name"].AsString();
                        if (value2.ContainsKey("price"))
                        {
                            item.price = value2["price"].AsString();
                        }
                        assets.Add(item);
                    }
                }
            }
        }
Ejemplo n.º 5
0
        protected override void Parse(Dictionary <string, JSONValue> dict)
        {
            Dictionary <string, JSONValue> dictionary = dict["purchase_info"].AsDict(true);
            JSONValue value4 = dictionary["status"];

            switch (value4.AsString(true))
            {
            case "basket-not-empty":
                this.status = Status.BasketNotEmpty;
                break;

            case "service-disabled":
                this.status = Status.ServiceDisabled;
                break;

            case "user-anonymous":
                this.status = Status.AnonymousUser;
                break;

            case "ok":
                this.status = Status.Ok;
                break;
            }
            this.paymentTokenAvailable = dictionary["payment_token_available"].AsBool();
            if (dictionary.ContainsKey("payment_method_card"))
            {
                this.paymentMethodCard = dictionary["payment_method_card"].AsString(true);
            }
            if (dictionary.ContainsKey("payment_method_expire"))
            {
                this.paymentMethodExpire = dictionary["payment_method_expire"].AsString(true);
            }
            this.price     = dictionary["price"].AsFloat(true);
            this.vat       = dictionary["vat"].AsFloat(true);
            this.priceText = dictionary["price_text"].AsString(true);
            this.vatText   = dictionary["vat_text"].AsString(true);
            this.currency  = dictionary["currency"].AsString(true);
            this.message   = !dictionary.ContainsKey("message") ? null : dictionary["message"].AsString(true);
            JSONValue value14 = dict["results"];

            foreach (JSONValue value2 in value14.AsList(true))
            {
                AssetStoreAsset asset;
                int             key     = 0;
                JSONValue       value15 = value2["id"];
                if (value15.IsString())
                {
                    key = int.Parse(value2["id"].AsString());
                }
                else
                {
                    JSONValue value17 = value2["id"];
                    key = (int)value17.AsFloat();
                }
                if (this.assets.TryGetValue(key, out asset))
                {
                    JSONValue value27;
                    if (asset.previewInfo == null)
                    {
                        asset.previewInfo = new AssetStoreAsset.PreviewInfo();
                    }
                    AssetStoreAsset.PreviewInfo previewInfo = asset.previewInfo;
                    JSONValue value18 = value2["class_names"];
                    asset.className = value18.AsString(true).Trim();
                    JSONValue value19 = value2["package_name"];
                    previewInfo.packageName = value19.AsString(true).Trim();
                    JSONValue value20 = value2["short_url"];
                    previewInfo.packageShortUrl = value20.AsString(true).Trim();
                    asset.price                = !value2.ContainsKey("price_text") ? null : value2["price_text"].AsString(true).Trim();
                    previewInfo.packageSize    = int.Parse(!value2.Get("package_size").IsNull() ? value2["package_size"].AsString(true) : "-1");
                    asset.packageID            = int.Parse(value2["package_id"].AsString());
                    previewInfo.packageVersion = value2["package_version"].AsString();
                    if (!value2.Get("rating").IsNull())
                    {
                        value27 = value2["rating"];
                    }
                    previewInfo.packageRating = int.Parse((value27.AsString(true).Length != 0) ? value2["rating"].AsString(true) : "-1");
                    JSONValue value29 = value2["package_asset_count"];
                    previewInfo.packageAssetCount = int.Parse(!value29.IsNull() ? value2["package_asset_count"].AsString(true) : "-1");
                    previewInfo.isPurchased       = value2.ContainsKey("purchased") && value2["purchased"].AsBool(true);
                    previewInfo.isDownloadable    = previewInfo.isPurchased || (asset.price == null);
                    JSONValue value32 = value2["publisher_name"];
                    previewInfo.publisherName    = value32.AsString(true).Trim();
                    previewInfo.packageUrl       = !value2.Get("package_url").IsNull() ? value2["package_url"].AsString(true) : string.Empty;
                    previewInfo.encryptionKey    = !value2.Get("encryption_key").IsNull() ? value2["encryption_key"].AsString(true) : string.Empty;
                    previewInfo.categoryName     = !value2.Get("category_name").IsNull() ? value2["category_name"].AsString(true) : string.Empty;
                    previewInfo.buildProgress    = -1f;
                    previewInfo.downloadProgress = -1f;
                }
            }
        }