private void CopyAsync(CloudBlobContainer container, string blobName, int copy) { var source = container.GetBlobReference(GetSource(blobName, copy)); var target = container.GetBlobReference(GetTarget(blobName, copy)); CopyAsyncState state = new CopyAsyncState() { Container = container, BlobName = blobName, Target = target, Copy = copy - 1 }; target.BeginCopyFromBlob(source, CopyAsyncCompletedCallback, state); }
private void CopyAsyncCompletedCallback(IAsyncResult result) { CopyAsyncState state = (CopyAsyncState)result.AsyncState; try { state.Target.EndCopyFromBlob(result); } catch { } if (state.Copy > 0) { CopyAsync(state.Container, state.BlobName, state.Copy); } }