Ejemplo n.º 1
0
    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);
    }
Ejemplo n.º 2
0
    private static string OnAssetStorePublisher(JSONValue jval, AssetStorePublisher account, PackageDataSource packageDataSource)
    {
        string str;
        string str1 = "unknown field";

        try
        {
            str1 = "publisher";
            Dictionary <string, JSONValue> strs = jval["publisher"].AsDict(false);
            account.mStatus = AssetStorePublisher.Status.New;
            if (strs.ContainsKey("name"))
            {
                account.mStatus = AssetStorePublisher.Status.Existing;
                str1            = "publisher -> id";
                JSONValue item = strs["id"];
                account.publisherId = int.Parse(item.AsString(false));
                str1 = "publisher -> name";
                account.publisherName = strs["name"].AsString(false);
            }

            str1 = "publisher";
            if (AssetStoreManager.sDbg)
            {
                JSONValue jSONValue = jval["publisher"];
                DebugUtils.Log(string.Concat("publisher ", jSONValue.ToString(string.Empty, "    ")));
                JSONValue item1 = jval["packages"];
                DebugUtils.Log(string.Concat("packs ", item1.ToString(string.Empty, "    ")));
            }

            str1 = "packages";
            if (!jval.Get("packages").IsNull())
            {
                AssetStoreAPI.OnPackages(jval["packages"], packageDataSource);
            }

            return(null);
        }
        catch (JSONTypeException jSONTypeException1)
        {
            JSONTypeException jSONTypeException = jSONTypeException1;
            str = string.Concat("Malformed response from server: ", str1, " - ", jSONTypeException.Message);
        }
        catch (KeyNotFoundException keyNotFoundException1)
        {
            KeyNotFoundException keyNotFoundException = keyNotFoundException1;
            str = string.Concat("Malformed response from server. ", str1, " - ", keyNotFoundException.Message);
        }

        return(str);
    }
Ejemplo n.º 3
0
    private static string OnPackageReceived(JSONValue jval, Package package)
    {
        string str;
        string str1 = "unknown";

        try
        {
            if (jval.ContainsKey("id"))
            {
                string empty  = string.Empty;
                string empty1 = string.Empty;
                string empty2 = string.Empty;
                string str2   = string.Empty;
                string empty3 = string.Empty;
                bool   flag   = false;
                string str3   = string.Empty;
                string empty4 = string.Empty;
                string str4   = string.Empty;
                str1 = "id";
                if (!jval[str1].IsNull())
                {
                    JSONValue item = jval[str1];
                    package.versionId = int.Parse(item.AsString(false));
                }

                str1 = "name";
                jval.Copy(str1, ref empty, false);
                str1 = "version_name";
                jval.Copy(str1, ref empty1, false);
                str1 = "root_guid";
                jval.Copy(str1, ref empty2, false);
                str1 = "root_path";
                jval.Copy(str1, ref str2, false);
                str1 = "project_path";
                jval.Copy(str1, ref empty3, false);
                str1 = "is_complete_project";
                jval.Copy(str1, ref flag);
                str1 = "preview_url";
                jval.Copy(str1, ref str3);
                str1 = "icon_url";
                jval.Copy(str1, ref empty4);
                str1 = "status";
                jval.Copy(str1, ref str4);
                package.Name               = empty;
                package.VersionName        = empty1;
                package.RootGUID           = empty2;
                package.RootPath           = str2;
                package.ProjectPath        = empty3;
                package.IsCompleteProjects = flag;
                package.PreviewURL         = str3;
                package.SetStatus(str4);
                if (!string.IsNullOrEmpty(empty4))
                {
                    package.SetIconURL(empty4);
                }

                return(null);
            }
            else
            {
                str = null;
            }
        }
        catch (JSONTypeException jSONTypeException1)
        {
            JSONTypeException jSONTypeException = jSONTypeException1;
            str = string.Concat(new string[] { "Malformed metadata response for package '", 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);
    }