CheckDownload() private method

private CheckDownload ( string id, string url, string destination, string key ) : string
id string
url string
destination string
key string
return string
        public static void Download(string package_id, string url, string key, string package_name,
                                    string publisher_name, string category_name, AssetStoreUtils.DownloadDoneCallback doneCallback)
        {
            string[] dest = PackageStorePath(publisher_name, category_name,
                                             package_name, package_id, url);

            JSONValue existing = JSONParser.SimpleParse(AssetStoreUtils.CheckDownload(package_id, url, dest, key));

            // If the package is actively being downloaded right now just return
            if (existing.Get("in_progress").AsBool(true))
            {
                Debug.Log("Will not download " + package_name + ". Download is already in progress.");
                return;
            }

            // The package is not being downloaded.
            // If the package has previously been partially downloaded then
            // resume that download.
            string existingUrl = existing.Get("download.url").AsString(true);
            string existingKey = existing.Get("download.key").AsString(true);
            bool   resumeOK    = (existingUrl == url && existingKey == key);

            JSONValue download = new JSONValue();

            download["url"] = url;
            download["key"] = key;
            JSONValue parameters = new JSONValue();

            parameters["download"] = download;

            AssetStoreUtils.Download(package_id, url, dest, key, parameters.ToString(), resumeOK, doneCallback);
        }
        public static void Download(string package_id, string url, string key, string package_name, string publisher_name, string category_name, AssetStoreUtils.DownloadDoneCallback doneCallback)
        {
            string[]  destination = AssetStoreContext.PackageStorePath(publisher_name, category_name, package_name, package_id, url);
            JSONValue jSONValue   = JSONParser.SimpleParse(AssetStoreUtils.CheckDownload(package_id, url, destination, key));

            if (jSONValue.Get("in_progress").AsBool(true))
            {
                Debug.Log("Will not download " + package_name + ". Download is already in progress.");
                return;
            }
            string    a        = jSONValue.Get("download.url").AsString(true);
            string    a2       = jSONValue.Get("download.key").AsString(true);
            bool      resumeOK = a == url && a2 == key;
            JSONValue value    = default(JSONValue);

            value["url"] = url;
            value["key"] = key;
            JSONValue jSONValue2 = default(JSONValue);

            jSONValue2["download"] = value;
            AssetStoreUtils.Download(package_id, url, destination, key, jSONValue2.ToString(), resumeOK, doneCallback);
        }
        public static void Download(string package_id, string url, string key, string package_name, string publisher_name, string category_name, AssetStoreUtils.DownloadDoneCallback doneCallback)
        {
            string[]  destination = AssetStoreContext.PackageStorePath(publisher_name, category_name, package_name, package_id, url);
            JSONValue jsonValue1  = JSONParser.SimpleParse(AssetStoreUtils.CheckDownload(package_id, url, destination, key));

            if (jsonValue1.Get("in_progress").AsBool(true))
            {
                Debug.Log((object)("Will not download " + package_name + ". Download is already in progress."));
            }
            else
            {
                string    str1       = jsonValue1.Get("download.url").AsString(true);
                string    str2       = jsonValue1.Get("download.key").AsString(true);
                bool      resumeOK   = str1 == url && str2 == key;
                JSONValue jsonValue2 = new JSONValue();
                jsonValue2["url"] = (JSONValue)url;
                jsonValue2["key"] = (JSONValue)key;
                JSONValue jsonValue3 = new JSONValue();
                jsonValue3["download"] = jsonValue2;
                AssetStoreUtils.Download(package_id, url, destination, key, jsonValue3.ToString(), resumeOK, doneCallback);
            }
        }
        public static void Download(string package_id, string url, string key, string package_name, string publisher_name, string category_name, AssetStoreUtils.DownloadDoneCallback doneCallback)
        {
            string[]  destination = PackageStorePath(publisher_name, category_name, package_name, package_id, url);
            JSONValue value2      = JSONParser.SimpleParse(AssetStoreUtils.CheckDownload(package_id, url, destination, key));

            if (value2.Get("in_progress").AsBool(true))
            {
                Debug.Log("Will not download " + package_name + ". Download is already in progress.");
            }
            else
            {
                string    str      = value2.Get("download.url").AsString(true);
                string    str2     = value2.Get("download.key").AsString(true);
                bool      resumeOK = (str == url) && (str2 == key);
                JSONValue value3   = new JSONValue();
                value3["url"] = url;
                value3["key"] = key;
                JSONValue value4 = new JSONValue();
                value4["download"] = value3;
                AssetStoreUtils.Download(package_id, url, destination, key, value4.ToString(), resumeOK, doneCallback);
            }
        }