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);
}