public bool Copy(string key, ref string dest, bool allowCopyNull) { bool flag; JSONValue jSONValue = this.Get(key, out flag); if (flag && (!jSONValue.IsNull() || allowCopyNull)) { dest = ((!jSONValue.IsNull()) ? jSONValue.AsString(false) : null); } return(flag); }
private static string RefreshMainAssets(JSONValue jval, Package package) { string str; string str1 = "unknown"; try { str1 = "assetbundles"; JSONValue jSONValue = jval.Get(str1); if (!jSONValue.IsNull()) { List <string> strs = new List <string>(); foreach (JSONValue jSONValue1 in jSONValue.AsList(false)) { strs.Add(jSONValue1.AsString(false)); } package.MainAssets = strs; } return(null); } catch (JSONTypeException jSONTypeException1) { JSONTypeException jSONTypeException = jSONTypeException1; str = string.Concat(new string[] { "Malformed metadata response for mainAssets '", package.Name, "' field '", str1, "': ", jSONTypeException.Message }); } catch (KeyNotFoundException keyNotFoundException1) { KeyNotFoundException keyNotFoundException = keyNotFoundException1; str = string.Concat(new string[] { "Malformed metadata response for package. '", package.Name, "' field '", str1, "': ", keyNotFoundException.Message }); } return(str); }
public PackageList GetPackageList() { Dictionary <string, Package> dictionary = new Dictionary <string, Package>(); PackageInfo[] packageList = PackageInfo.GetPackageList(); foreach (PackageInfo info in packageList) { Package package = new Package(); if (info.jsonInfo == "") { package.title = Path.GetFileNameWithoutExtension(info.packagePath); package.id = info.packagePath; if (this.IsBuiltinStandardAsset(info.packagePath)) { LabelAndId id = new LabelAndId { label = "Unity Technologies", id = "1" }; package.publisher = id; id = new LabelAndId { label = "Prefab Packages", id = "4" }; package.category = id; package.version = "3.5.0.0"; } } else { JSONValue json = JSONParser.SimpleParse(info.jsonInfo); if (json.IsNull()) { continue; } package.Initialize(json); if (package.id == null) { JSONValue value3 = json.Get("link.id"); if (!value3.IsNull()) { package.id = value3.AsString(); } else { package.id = info.packagePath; } } } package.local_icon = info.iconURL; package.local_path = info.packagePath; if (((!dictionary.ContainsKey(package.id) || (dictionary[package.id].version_id == null)) || (dictionary[package.id].version_id == "-1")) || (((package.version_id != null) && (package.version_id != "-1")) && (int.Parse(dictionary[package.id].version_id) <= int.Parse(package.version_id)))) { dictionary[package.id] = package; } } Package[] packageArray = dictionary.Values.ToArray <Package>(); return(new PackageList { results = packageArray }); }
public AssetStoreContext.PackageList GetPackageList() { Dictionary <string, AssetStoreContext.Package> dictionary = new Dictionary <string, AssetStoreContext.Package>(); foreach (PackageInfo package1 in PackageInfo.GetPackageList()) { AssetStoreContext.Package package2 = new AssetStoreContext.Package(); if (package1.jsonInfo == string.Empty) { package2.title = Path.GetFileNameWithoutExtension(package1.packagePath); package2.id = package1.packagePath; if (this.IsBuiltinStandardAsset(package1.packagePath)) { package2.publisher = new AssetStoreContext.LabelAndId() { label = "Unity Technologies", id = "1" }; package2.category = new AssetStoreContext.LabelAndId() { label = "Prefab Packages", id = "4" }; package2.version = "3.5.0.0"; } } else { JSONValue json = JSONParser.SimpleParse(package1.jsonInfo); if (!json.IsNull()) { package2.Initialize(json); if (package2.id == null) { JSONValue jsonValue = json.Get("link.id"); package2.id = jsonValue.IsNull() ? package1.packagePath : jsonValue.AsString(); } } else { continue; } } package2.local_icon = package1.iconURL; package2.local_path = package1.packagePath; if (!dictionary.ContainsKey(package2.id) || dictionary[package2.id].version_id == null || dictionary[package2.id].version_id == "-1" || package2.version_id != null && package2.version_id != "-1" && int.Parse(dictionary[package2.id].version_id) <= int.Parse(package2.version_id)) { dictionary[package2.id] = package2; } } AssetStoreContext.Package[] array = dictionary.Values.ToArray <AssetStoreContext.Package>(); return(new AssetStoreContext.PackageList() { results = array }); }
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); }
public bool Copy(string key, ref bool dest) { bool flag; JSONValue jSONValue = this.Get(key, out flag); if (flag && !jSONValue.IsNull()) { dest = jSONValue.AsBool(false); } return(flag); }
public bool Copy(string key, ref string dest, bool allowCopyNull) { bool flag; string str; JSONValue jSONValue = this.Get(key, out flag); if (flag && (!jSONValue.IsNull() || allowCopyNull)) { if (!jSONValue.IsNull()) { str = jSONValue.AsString(false); } else { str = null; } dest = str; } return(flag); }
private static string RefreshMainAssets(JSONValue jval, Package package) { string text = "unknown"; try { text = "assetbundles"; JSONValue jSONValue = jval.Get(text); if (!jSONValue.IsNull()) { List <string> list = new List <string>(); List <JSONValue> list2 = jSONValue.AsList(false); foreach (JSONValue current in list2) { list.Add(current.AsString(false)); } package.MainAssets = list; } } catch (JSONTypeException ex) { string result = string.Concat(new string[] { "Malformed metadata response for mainAssets '", package.Name, "' field '", text, "': ", ex.Message }); return(result); } catch (KeyNotFoundException ex2) { string result = string.Concat(new string[] { "Malformed metadata response for package. '", package.Name, "' field '", text, "': ", ex2.Message }); return(result); } return(null); }
public AssetStoreContext.PackageList GetPackageList() { Dictionary <string, AssetStoreContext.Package> dictionary = new Dictionary <string, AssetStoreContext.Package>(); PackageInfo[] packageList = PackageInfo.GetPackageList(); PackageInfo[] array = packageList; int i = 0; while (i < array.Length) { PackageInfo packageInfo = array[i]; AssetStoreContext.Package package = new AssetStoreContext.Package(); if (packageInfo.jsonInfo == string.Empty) { package.title = Path.GetFileNameWithoutExtension(packageInfo.packagePath); package.id = packageInfo.packagePath; if (this.IsBuiltinStandardAsset(packageInfo.packagePath)) { package.publisher = new AssetStoreContext.LabelAndId { label = "Unity Technologies", id = "1" }; package.category = new AssetStoreContext.LabelAndId { label = "Prefab Packages", id = "4" }; package.version = "3.5.0.0"; } goto IL_144; } JSONValue json = JSONParser.SimpleParse(packageInfo.jsonInfo); if (!json.IsNull()) { package.Initialize(json); if (package.id != null) { goto IL_144; } JSONValue jSONValue = json.Get("link.id"); if (!jSONValue.IsNull()) { package.id = jSONValue.AsString(); goto IL_144; } package.id = packageInfo.packagePath; goto IL_144; } IL_203: i++; continue; IL_144: package.local_icon = packageInfo.iconURL; package.local_path = packageInfo.packagePath; if (!dictionary.ContainsKey(package.id) || dictionary[package.id].version_id == null || dictionary[package.id].version_id == "-1" || (package.version_id != null && package.version_id != "-1" && int.Parse(dictionary[package.id].version_id) <= int.Parse(package.version_id))) { dictionary[package.id] = package; goto IL_203; } goto IL_203; } AssetStoreContext.Package[] results = dictionary.Values.ToArray <AssetStoreContext.Package>(); return(new AssetStoreContext.PackageList { results = results }); }
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; } } }