Beispiel #1
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);
    }
    private static string OnAssetStorePublisher(JSONValue jval, AssetStorePublisher account, PackageDataSource packageDataSource)
    {
        string str = "unknown field";

        try
        {
            str = "publisher";
            Dictionary <string, JSONValue> dictionary = jval["publisher"].AsDict(false);
            account.mStatus = AssetStorePublisher.Status.New;
            if (dictionary.ContainsKey("name"))
            {
                account.mStatus       = AssetStorePublisher.Status.Existing;
                str                   = "publisher -> id";
                account.publisherId   = int.Parse(dictionary["id"].AsString(false));
                str                   = "publisher -> name";
                account.publisherName = dictionary["name"].AsString(false);
            }
            str = "publisher";
            if (AssetStoreManager.sDbg)
            {
                DebugUtils.Log("publisher " + jval["publisher"].ToString(string.Empty, "    "));
                DebugUtils.Log("packs " + jval["packages"].ToString(string.Empty, "    "));
            }
            str = "packages";
            if (!jval.Get("packages").IsNull())
            {
                AssetStoreAPI.OnPackages(jval["packages"], packageDataSource);
            }
        }
        catch (JSONTypeException ex)
        {
            string result = "Malformed response from server: " + str + " - " + ex.Message;
            return(result);
        }
        catch (KeyNotFoundException ex2)
        {
            string result = "Malformed response from server. " + str + " - " + ex2.Message;
            return(result);
        }
        return(null);
    }