コード例 #1
0
        protected override void PerformUpload()
        {
            if (!Directory.Exists(Options.TemporaryDirectory))
            {
                Directory.CreateDirectory(Options.TemporaryDirectory);
            }

            var tempFile = Path.Combine(Options.TemporaryDirectory, Guid.NewGuid().ToString());

            try
            {
                ReliableCloudOperations.RetryRead(() => DownloadSource(tempFile));

                ReliableCloudOperations.RetryWrite(() =>
                {
                    if (Blob.Exists())
                    {
                        return;
                    }
                    Blob.UploadFromFile(
                        tempFile,
                        FileMode.Open,
                        options: Options.BlobRequestOptions,
                        accessCondition: AccessConditions.CreateIfNotExists());
                });
            }
            finally
            {
                File.Delete(tempFile);
            }
        }
コード例 #2
0
 protected override void PerformUpload()
 {
     _stream.EnsureAtStart();
     _stream = Store.Cache.Add(FileKey, _stream, Length);
     ReliableCloudOperations.RetryWrite(() =>
     {
         if (Blob.Exists())
         {
             return;
         }
         _stream.EnsureAtStart();
         Blob.UploadFromStream(
             _stream,
             options: Options.BlobRequestOptions,
             accessCondition: AccessConditions.CreateIfNotExists());
     });
 }