Ejemplo n.º 1
0
 private static void Upload(string path, string filepath, AssetStoreAPI.DoneCallback callback, AssetStoreClient.ProgressCallback progress = null)
 {
     AssetStoreClient.Pending pending = AssetStoreClient.CreatePendingUpload(path, path, filepath, delegate(AssetStoreResponse resp)
     {
         string errorMessage = null;
         JSONValue jSONValue;
         AssetStoreAPI.Parse(resp, out errorMessage, out jSONValue);
         callback(errorMessage);
     });
     pending.progressCallback = progress;
 }
Ejemplo n.º 2
0
 private static void Upload(string path, string filepath, AssetStoreAPI.DoneCallback callback, AssetStoreClient.ProgressCallback progress = null)
 {
     AssetStoreClient.Pending pending = AssetStoreClient.CreatePendingUpload(path, path, filepath, (AssetStoreResponse resp) =>
     {
         JSONValue jSONValue;
         string str = null;
         AssetStoreAPI.Parse(resp, out str, out jSONValue);
         callback(str);
     });
     pending.progressCallback = progress;
 }
Ejemplo n.º 3
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);
     });
 }
Ejemplo n.º 4
0
    public static void UploadAssets(Package package, string newGUID, string newRootPath, string newProjectpath, string filepath, AssetStoreAPI.DoneCallback callback, AssetStoreClient.ProgressCallback progress)
    {
        string path = string.Format("/package/{0}/unitypackage", package.versionId);

        AssetStoreClient.UploadLargeFile(path, filepath, new Dictionary <string, string>
        {
            {
                "root_guid",
                newGUID
            },
            {
                "root_path",
                newRootPath
            },
            {
                "project_path",
                newProjectpath
            }
        }, delegate(AssetStoreResponse resp)
        {
            if (resp.HttpStatusCode == -2)
            {
                callback("aborted");
                return;
            }
            string errorMessage = null;
            JSONValue jSONValue;
            AssetStoreAPI.Parse(resp, out errorMessage, out jSONValue);
            callback(errorMessage);
        }, progress);
    }
Ejemplo n.º 5
0
    public static void UploadAssets(Package package, string newGUID, string newRootPath, string newProjectpath, string filepath, AssetStoreAPI.DoneCallback callback, AssetStoreClient.ProgressCallback progress)
    {
        string str1 = string.Format("/package/{0}/unitypackage", package.versionId);
        Dictionary <string, string> strs = new Dictionary <string, string>()
        {
            { "root_guid", newGUID },
            { "root_path", newRootPath },
            { "project_path", newProjectpath }
        };

        AssetStoreClient.UploadLargeFile(str1, filepath, strs, (AssetStoreResponse resp) =>
        {
            JSONValue jSONValue;
            if (resp.HttpStatusCode == -2)
            {
                callback("aborted");
                return;
            }

            string str = null;
            AssetStoreAPI.Parse(resp, out str, out jSONValue);
            callback(str);
        }, progress);
    }
Ejemplo n.º 6
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);
        });
    }