Exemplo n.º 1
0
 public static void GetMetaData(AssetStorePublisher account, PackageDataSource packageDataSource, AssetStoreAPI.DoneCallback callback)
 {
     AssetStoreClient.CreatePendingGet("metadata", "/metadata/0", delegate(AssetStoreResponse res)
     {
         DebugUtils.Log(res.data);
         string errorMessage;
         JSONValue jval;
         bool flag = AssetStoreAPI.Parse(res, out errorMessage, out jval);
         if (flag && !jval.ContainsKey("error_fields"))
         {
             callback(errorMessage);
             return;
         }
         string str = "none";
         try
         {
             str         = "account";
             string text = AssetStoreAPI.OnAssetStorePublisher(jval, account, packageDataSource);
             if (text != null)
             {
                 callback(text);
                 return;
             }
         }
         catch (JSONTypeException ex)
         {
             callback("Malformed metadata response from server: " + str + " - " + ex.Message);
         }
         catch (KeyNotFoundException ex2)
         {
             callback("Malformed metadata response from server. " + str + " - " + ex2.Message);
         }
         callback(null);
     });
 }
Exemplo n.º 2
0
    public static void GetMetaData(AssetStorePublisher publisherAccount, PackageDataSource packageDataSource, DoneCallback callback)
    {
        Type doneCallbackType;
        var  doneCallback = CreateCallbackDelegate("DoneCallback", callback, out doneCallbackType);

        s_Instance.GetRuntimeType().Invoke("GetMetaData", publisherAccount.GetRuntimeObject().Param(), packageDataSource.GetRuntimeObject().Param(), new Parameter(doneCallback, doneCallbackType));
    }
Exemplo n.º 3
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);
    }
Exemplo n.º 4
0
    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);
    }
Exemplo n.º 5
0
    public static void GetMetaData(AssetStorePublisher account, PackageDataSource packageDataSource, AssetStoreAPI.DoneCallback callback)
    {
        AssetStoreClient.CreatePendingGet("metadata", "/metadata/0", (AssetStoreResponse res) =>
        {
            string str;
            JSONValue jSONValue;
            DebugUtils.Log(res.data);
            if (AssetStoreAPI.Parse(res, out str, out jSONValue) && !jSONValue.ContainsKey("error_fields"))
            {
                callback(str);
                return;
            }

            string str1 = "none";
            try
            {
                str1        = "account";
                string str2 = AssetStoreAPI.OnAssetStorePublisher(jSONValue, account, packageDataSource);
                if (str2 != null)
                {
                    callback(str2);
                    return;
                }
            }
            catch (JSONTypeException jSONTypeException)
            {
                callback(string.Concat("Malformed metadata response from server: ", str1, " - ", jSONTypeException.Message));
            }
            catch (KeyNotFoundException keyNotFoundException)
            {
                callback(string.Concat("Malformed metadata response from server. ", str1, " - ", keyNotFoundException.Message));
            }

            callback(null);
        });
    }