protected DoExecuteCoroutine ( TaskExecutionContext context ) : IEnumerator | ||
context | TaskExecutionContext | |
return | IEnumerator |
protected override IEnumerator DoExecuteCoroutine(TaskExecutionContext context)
{
var url = (string)context[UrlKey];
PSDebug.Log("Start Download: {0}", url);
using (var www = new WWW(url))
{
var progressReporter = ProgressCallback(_progressKey, context.OnProgress);
yield return WwwHelper.GetResponse(www, context.CancellationToken, (string)context[HashKey], progressReporter);
var target = (string)context[TargetPathKey];
FileHelper.WriteFileAtomic(target, www.bytes, deleteOnError: true);
}
}