public static LargeDownloadToFile Start(LargeDownloadToFileSettings parallelDownloadSettings, AccessCondition accessConditions, OperationContext operationContext, CancellationToken cancellationToken)
        {
            LargeDownloadToFile parallelDownload = new LargeDownloadToFile(parallelDownloadSettings);

            parallelDownload.Task = parallelDownload.StartAsync(accessConditions, operationContext, cancellationToken);

            return(parallelDownload);
        }
        private LargeDownloadToFile(LargeDownloadToFileSettings largeDownloadToFileSettings)
        {
            this.LargeDownloadToFileSettings = largeDownloadToFileSettings;
            this.downloadTaskList            = new List <Task>();

            this.Offset = largeDownloadToFileSettings.Offset;
            this.Length = largeDownloadToFileSettings.Length;
        }
Пример #3
0
        //private static async Task DoParallelUploadTask()
        //{
        //    string connectionString = "DefaultEndpointsProtocol=http;AccountName=xclientdev3;AccountKey=/3Hxt63L5GIDMxhTVtWEEWGgbhegrr1fDjglOQcCrbEcyUa28sKIIkA5c4x0jDuyhUWZ9f4DstQISHZiTD4LOg==";
        //    CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);

        //    CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
        //    CloudBlobContainer blobContainer = blobClient.GetContainerReference("donotdelete");
        //    //await blobContainer.CreateIfNotExistsAsync();
        //    string blobName = "onehundredgig"; //"threehundredgig";
        //    CloudBlockBlob blob = blobContainer.GetBlockBlobReference(blobName);
        //    BlobRequestOptions options = new BlobRequestOptions();
        //    options.ParallelOperationThreadCount = 20;
        //    //blob.UploadFromFile("D:\\onehundredgig.rng", null, /*null*/ options, null);
        //    //await blob.UploadFromFileAsync("D:\\onehundredgig.rng", null, /*null*/ options, null);
        //}

        private static async Task DoDownloadFileTask(CloudBlob blob, int parallelCount, long chunkSize)
        {
            string outputFileName = "D:\\onehundredgb.rng";     //"D:\\threehundredgb.rng";//"D:\\onegb.rng"; //"D:\\threehundredgb.rng";//Path.GetTempFileName();

            long?offset = null;
            long?length = null;
            LargeDownloadToFileSettings largeDownloadToFileSettings = new LargeDownloadToFileSettings(blob, outputFileName, FileMode.Create, offset, length, parallelCount, chunkSize);
            BlobRequestOptions          options             = new BlobRequestOptions();
            LargeDownloadToFile         largeDownloadToFile = LargeDownloadToFile.Start(largeDownloadToFileSettings, null, null, CancellationToken.None);

            largeDownloadToFileObject = largeDownloadToFile;
            await largeDownloadToFile.Task;
        }
 public static LargeDownloadToFile Start(LargeDownloadToFileSettings largeDownloadToFileSettings)
 {
     return(Start(largeDownloadToFileSettings, null, null, CancellationToken.None));
 }