Esempio n. 1
0
        public override bool SaveChunkData(string filePath, long position, byte[] buffer, int contentLength, out int savedBytes)
        {
            if (this.IsNewFileRequest())
            {
                this.InitializeBlob();
            }

            blockId++;
            using (var blockStream = new MemoryStream(buffer))
            {
                var blockGuid = GenerateBlockId(blockId, this.GetFileName());
                blocksList.Add(blockGuid);
                blob.PutBlock(blockGuid, blockStream, null, null, new BlobRequestOptions {
                    UseTransactionalMD5 = true
                }, null);
                savedBytes = buffer.Length;
            }

            if (this.IsFinalFileRequest())
            {
                blob.PutBlockList(blocksList);
                AzureHandler.ClearBlob();
            }

            return(true);
        }
Esempio n. 2
0
 static AzureHandler()
 {
     account = CloudStorageAccount.Parse("DefaultEndpointsProtocol=http;AccountName=" + AzureHandler.AccountName + ";AccountKey=" + AzureHandler.AccountKey);
     AzureHandler.InitializeContainer();
 }