/// <summary> /// create folder/subfolder in azure storage containner /// </summary> /// <param name="folder"></param> public static void CreateFolder(string folder) { folder = folder.Replace("\\", "/"); string[] allFolders = folder.Split('/'); CloudBlobDirectory rootFolderBlob = null; //create the root folder if (container.GetDirectoryReference(allFolders[0]).ListBlobs().Count() == 0) { CloudBlockBlob blockBlob = container.GetBlockBlobReference(allFolders[0]); blockBlob.UploadFromByteArray(new byte[0], 0, 0); } rootFolderBlob = container.GetDirectoryReference(allFolders[0]); //create all sub folder if it is required for (int i = 1; i < allFolders.Length; i++) { string folderName = allFolders[i]; if (rootFolderBlob.GetDirectoryReference(folderName).ListBlobs().Count() == 0) { CloudBlockBlob blockBlob = rootFolderBlob.GetBlockBlobReference(folderName); blockBlob.UploadFromByteArray(new byte[0], 0, 0); } rootFolderBlob = rootFolderBlob.GetDirectoryReference(folderName); } }
/// <summary> /// Get the object for Azure storage folder/Subfolder /// </summary> /// <param name="folderPath"></param> /// <returns>if folder/subfolder existing, return the the object for Azure storage folder/Subfolder, else return null</returns> private static CloudBlobDirectory GetFolderBlobObject(string folderPath) { folderPath = folderPath.Replace("\\", "/"); string[] allFolders = folderPath.Split('/'); CloudBlobDirectory rootFolderObject = null; if (container.GetDirectoryReference(allFolders[0]).ListBlobs().Count() > 0) { rootFolderObject = container.GetDirectoryReference(allFolders[0]); } if (rootFolderObject != null && allFolders.Length > 1) { for (int i = 1; i < allFolders.Length; i++) { string folderName = allFolders[i]; if (rootFolderObject.GetDirectoryReference(folderName).ListBlobs().Count() > 0) { rootFolderObject = rootFolderObject.GetDirectoryReference(folderName); } else { rootFolderObject = null; break; } } } return(rootFolderObject); }
public async Task <String> SaveToStorage(AzureCloudImageDirectoryStorageEnum type, byte[] buffer, string fileName) { CloudBlockBlob blob = null; blob = imagesDirectory.GetDirectoryReference(type.ToString().ToLower()).GetBlockBlobReference(fileName); using (Stream stream = new MemoryStream(buffer)) { await blob.UploadFromStreamAsync(stream); } return($"{this.containerUrl}/images/{type.ToString().ToLower()}/{fileName}"); }
private async Task <HandlerResponse <DownloadFile> > PageFiles(Guid applicationId, string pageId, CancellationToken cancellationToken, Page page, CloudBlobDirectory pageDirectory) { // Get All answers on the page./ // Loop them. // for each question... // get the blobdirectory for that question // download any files from that directory // add to the zip using (var zipStream = new MemoryStream()) { using (var zipArchive = new ZipArchive(zipStream, ZipArchiveMode.Create, true)) { foreach (var answer in page.PageOfAnswers.SelectMany(poa => poa.Answers)) { var questionDirectory = pageDirectory.GetDirectoryReference(answer.QuestionId.ToLower()); var blobStream = await GetFileStream(cancellationToken, questionDirectory, answer.Value); var zipEntry = zipArchive.CreateEntry(answer.Value); using (var entryStream = zipEntry.Open()) { blobStream.Item1.CopyTo(entryStream); } } } zipStream.Position = 0; var newStream = new MemoryStream(); zipStream.CopyTo(newStream); newStream.Position = 0; return(new HandlerResponse <DownloadFile>(new DownloadFile() { ContentType = "application/zip", FileName = $"{applicationId}_{pageId}_uploads.zip", Stream = newStream })); } }
private void uploadFilesToAzureBlob(CloudBlobContainer container, string testSavedLogsFolderPath, string buildName) { string searchPattern = buildName + "*"; var testResultDirs = System.IO.Directory.EnumerateDirectories(testSavedLogsFolderPath, searchPattern); CloudBlobDirectory buildFolder = container.GetDirectoryReference(buildName); foreach (var testResultDir in testResultDirs) { string topFolderName = testResultDir.Substring(testResultDir.LastIndexOf("\\") + 1); CloudBlobDirectory topBlobDirectory = buildFolder.GetDirectoryReference(topFolderName); logger.WriteToConsole("create a top test directory " + topFolderName); var testResultFolders = System.IO.Directory.EnumerateDirectories(testResultDir); foreach (var testResultFolder in testResultFolders) { string testFolderName = testResultFolder.Substring(testResultFolder.LastIndexOf("\\") + 1); CloudBlobDirectory testResultBlobDirectory = topBlobDirectory.GetDirectoryReference(testFolderName); logger.WriteToConsole("create a test run folder " + testFolderName); foreach (var filePath in System.IO.Directory.EnumerateFiles(testResultFolder)) { string fileName = filePath.Substring(filePath.LastIndexOf("\\") + 1); CloudBlockBlob fileBlob = testResultBlobDirectory.GetBlockBlobReference(fileName); logger.WriteToConsole("Create a file blob " + fileName); fileBlob.UploadFromFile(filePath); } } } }
public Task <IRemoteDirectory> GetDirectory(string name) { return(Task.Run(() => { IRemoteDirectory directory = new AzureBlobDirectory(_cloudBlobDirectory.GetDirectoryReference(name)); return directory; })); }
private static void CreateDirectoryAndUpload(CloudBlobContainer container) { CloudBlobDirectory cloudBlobDirectory = container.GetDirectoryReference("parent-folder"); CloudBlobDirectory subCloudBlobDirectory = cloudBlobDirectory.GetDirectoryReference("child-folder"); CloudBlockBlob blob = subCloudBlobDirectory.GetBlockBlobReference("newBlob"); UploadFile(blob).Wait(); }
public async Task <string> UploadItem(string jobId, string taskId, Item item) { CloudBlobDirectory jobDirectory = container.GetDirectoryReference(jobId); CloudBlobDirectory taskDirectory = jobDirectory.GetDirectoryReference(taskId); string fileName = "" + DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() + ".json"; CloudBlockBlob blockBlob = taskDirectory.GetBlockBlobReference(fileName); await blockBlob.UploadTextAsync(JsonConvert.SerializeObject(item, Formatting.Indented, new VersionConverter())); return(fileName); }
static void UploadBlobSubdirectory(CloudBlobContainer container) { CloudBlobDirectory directory = container.GetDirectoryReference("parent-directory"); CloudBlobDirectory subdirectory = directory.GetDirectoryReference("child-directory"); CloudBlockBlob blockBlob = subdirectory.GetBlockBlobReference("newexamobjectives"); using (var fileStream = System.IO.File.OpenRead(@"C:\Users\scott\Downloads\70-532_OD (1).pdf")) { blockBlob.UploadFromStream(fileStream); } }
private static void UploadBlobSubdirectory(CloudBlobContainer container) { CloudBlobDirectory directory = container.GetDirectoryReference("parent-directory"); CloudBlobDirectory childDirectory = directory.GetDirectoryReference("child-directory"); CloudBlockBlob blockBlob = childDirectory.GetBlockBlobReference("newexamobjectives"); using (var fileStream = System.IO.File.OpenRead(@"m:\AzureCloudExam\Blobs\files\gcg.pdf")) { blockBlob.UploadFromStream(fileStream); } }
static void UploadBlobSubdirectory(CloudBlobContainer container) { CloudBlobDirectory directory = container.GetDirectoryReference("allfiles"); CloudBlobDirectory subdirectory = directory.GetDirectoryReference("text-files"); CloudBlockBlob blockBlob = subdirectory.GetBlockBlobReference("mytestfile.txt"); using (var fileStream = System.IO.File.OpenRead(@"c:\mytestfile.txt")) { blockBlob.UploadFromStream(fileStream); } }
private static void UploadProfilesinSubDirectories(CloudBlobContainer container) { CloudBlobDirectory mainDirectory = container.GetDirectoryReference("Info"); CloudBlobDirectory subDirectory = mainDirectory.GetDirectoryReference("Resumes"); CloudBlockBlob cloudBlockBlob = subDirectory.GetBlockBlobReference("praveen"); using (var fileStream = System.IO.File.OpenRead(@"")) //put the file you need to upload. { cloudBlockBlob.UploadFromStream(fileStream); } }
static void UploadSubdirectories(CloudBlobContainer container) { CloudBlobDirectory directory = container.GetDirectoryReference("parent-directory"); CloudBlobDirectory subdirectory = directory.GetDirectoryReference("child-directory"); CloudBlockBlob blockBlob = subdirectory.GetBlockBlobReference("532_OD_Changes.pdf"); using (var fileStream = File.OpenRead(@"D:\temp\532_OD_Changes.pdf")) { blockBlob.UploadFromStream(fileStream); } }
protected virtual async Task uploadReferenceData(CloudBlobDirectory refDataBlobDir, List <IoTEnsembleEnterpriseReferenceData> refData) { var now = DateTime.UtcNow; var dateBlobDir = refDataBlobDir.GetDirectoryReference($"{now.ToString("yyyy-MM-dd")}"); var timeBlobDir = dateBlobDir.GetDirectoryReference($"{now.AddMinutes(1).ToString("HH-mm")}"); var refDataBlob = timeBlobDir.GetBlockBlobReference("enterprise.ref-data.json"); await refDataBlob.UploadTextAsync(refData.ToJSON()); }
/// <inheritdoc /> public void Delete(FileDescriptor fileInfo) { if (fileInfo.fileName != null) { var dir = fileInfo.directoryName == "" ? baseRef : baseRef.GetDirectoryReference(fileInfo.directoryName); // We only delete shard 0 dir.GetBlobReference(fileInfo.fileName + ".0").DeleteIfExists(); } else { var dir = fileInfo.directoryName == "" ? baseRef : baseRef.GetDirectoryReference(fileInfo.directoryName); foreach (IListBlobItem blob in dir.ListBlobs(true)) { if (blob.GetType() == typeof(CloudBlob) || blob.GetType().BaseType == typeof(CloudBlob)) { ((CloudBlob)blob).DeleteIfExists(); } } } }
public void UploadBlobSubdirectory(string path) { FileInfo info = new FileInfo(path); CloudBlobDirectory directory = _container.GetDirectoryReference("parent-directory"); CloudBlobDirectory subdirectory = directory.GetDirectoryReference("child-directory"); CloudBlockBlob blockBlob = subdirectory.GetBlockBlobReference(info.Name); using (var fileStream = File.OpenRead(path)) { blockBlob.UploadFromStreamAsync(fileStream); } }
public async Task MoveAsync(string blobName, string destinationContainerName, CancellationToken token) { if (string.IsNullOrEmpty(blobName)) { throw new ArgumentException("message", nameof(blobName)); } var destinationDirectory = _blobDirectory.GetDirectoryReference(destinationContainerName); var sourceBlob = GetBlob(blobName); var destinationBlob = destinationDirectory.GetBlockBlobReference(blobName); await destinationBlob.StartCopyAsync(sourceBlob, AccessCondition.GenerateIfExistsCondition(), AccessCondition.GenerateEmptyCondition(), new BlobRequestOptions() { StoreBlobContentMD5 = true }, null, token); while (destinationBlob.CopyState.Status != CopyStatus.Success) { await Task.Delay(TimeSpan.FromSeconds(0.2), token); await destinationBlob.ExistsAsync(); } await sourceBlob.DeleteAsync(); }
protected virtual AzureBlobFolder GetChildFolder(string name) { if (_folder == null) { throw new InvalidOperationException(); } CheckValidFileName(name); var blobDirectory = _folder.GetDirectoryReference(name); return(new AzureBlobFolder(this, name, blobDirectory)); }
private Uri UploadBlob(byte[] fileContent, string containerName, string blobName, string contentType, string subdirectory) { CloudStorageAccount storageAccount = CloudStorageAccount.Parse(_configuration.ConnexionString); CloudBlobClient blobclient = storageAccount.CreateCloudBlobClient(); CloudBlobContainer container = blobclient.GetContainerReference(containerName); //Get blob reference CloudBlockBlob blob = null; if (!string.IsNullOrEmpty(subdirectory)) { subdirectory = subdirectory.Replace('\\', '/'); string[] tokenizedDir = subdirectory.Split('/'); CloudBlobDirectory dir = container.GetDirectoryReference(tokenizedDir[0]); for (int i = 1; i < tokenizedDir.Length; i++) { dir = dir.GetDirectoryReference(tokenizedDir[i]); } blob = dir.GetBlockBlobReference(blobName); } else { blob = container.GetBlockBlobReference(blobName); } HashSet <string> blocklist = new HashSet <string>(); foreach (FileBlock block in GetFileBlocks(fileContent)) { blob.PutBlock( block.Id, new MemoryStream(block.Content, true), null ); blocklist.Add(block.Id); } blob.PutBlockList(blocklist); if (contentType != null) { blob.FetchAttributes(); blob.Properties.ContentType = contentType; blob.SetProperties(); } return(blob.Uri); }
/// <summary> /// Search blob content in specified folder /// </summary> /// <param name="path">folder path in which the search will be processed</param> /// <param name="searchPattern">search blob name pattern can be used mask (*, ? symbols)</param> /// <param name="recursive"> recursive search</param> /// <returns>Returns relative path for all found blobs example: /folder/blob.md </returns> public virtual IEnumerable <string> Search(string path, string searchPattern, bool recursive) { var retVal = new List <string>(); path = NormalizePath(path); //Search pattern may contains part of path /path/*.jpg then nedd add this part to base path searchPattern = searchPattern.Replace('\\', '/').TrimStart('/'); var subDir = Path.GetDirectoryName(searchPattern); if (!string.IsNullOrEmpty(subDir)) { path = path.TrimEnd('/') + "/" + subDir; searchPattern = Path.GetFileName(searchPattern); } IEnumerable <IListBlobItem> blobItems; if (_directory != null) { var directoryBlob = _directory; if (!string.IsNullOrEmpty(path)) { directoryBlob = _directory.GetDirectoryReference(path); } blobItems = directoryBlob.ListBlobs(useFlatBlobListing: recursive); } else { blobItems = _container.ListBlobs(useFlatBlobListing: recursive); } // Loop over items within the container and output the length and URI. foreach (IListBlobItem item in blobItems) { var block = item as CloudBlockBlob; if (block != null) { var blobRelativePath = GetRelativeUrl(block.Uri.ToString()); var fileName = Path.GetFileName(Uri.UnescapeDataString(block.Uri.ToString())); if (fileName.FitsMask(searchPattern)) { retVal.Add(blobRelativePath); } } } return(retVal); }
public virtual CloudBlobDirectoryEx GetDirectoryReference(string itemName) { if (itemName == null) { throw new ArgumentNullException(nameof(itemName)); } CloudBlobDirectory[] cloudBlobDirectoryArray = new CloudBlobDirectory[this.failoverExecutor.AllElements.Length]; for (int i = 0; i < this.failoverExecutor.AllElements.Length; i++) { CloudBlobDirectory directory = this.failoverExecutor.AllElements[i]; CloudBlobDirectory dir = directory.GetDirectoryReference(itemName); cloudBlobDirectoryArray[i] = dir; } CloudBlobDirectoryEx cloudBlobDirectoryEx = new CloudBlobDirectoryEx(this.Container, this.failoverExecutor.FailoverToken, cloudBlobDirectoryArray); return(cloudBlobDirectoryEx); }
void UploadBlob_Click(object sender, EventArgs e) { TreeNode node = Containers.SelectedNode; if (node == null) { return; } if (node.ImageIndex == 2) { node = node.Parent; } CloudBlobContainer container; switch (node.ImageIndex) { case 0: container = Client.GetContainerReference(node.Text); new UploadBlobForm(container).ShowDialog(); break; case 1: (TreeNode containerNode, int count, string[] hier) = GetContainerNode(node); Array.Reverse(hier); container = Client.GetContainerReference(containerNode.Text); CloudBlobDirectory directory = container.GetDirectoryReference(hier[0]); for (int i = 0; i < count; i++) { directory = directory.GetDirectoryReference(hier[i + 1]); } new UploadBlobForm(directory).ShowDialog(); break; } RefreshAll(); }
public async Task <bool> DeleteFolder(string name) { var folder = directory.GetDirectoryReference(name); try { BlobContinuationToken token = null; do { var blobs = await ListFolderContent(folder); token = blobs.ContinuationToken; await DeleteList(blobs.Results); } while (null != token); return(true); } catch { return(false); } }
static void CreateDirectory() { Console.WriteLine($"Starting Create Directory Snippet"); Console.WriteLine($"Creating Directory references"); CloudBlobDirectory directory = blobContainer.GetDirectoryReference("test-directory"); CloudBlobDirectory subDirectory = directory.GetDirectoryReference("sub-directory"); Console.WriteLine($"Uploading test.txt file to sub directory"); // Blob name can contain any combination of characters as long as the reserved URL characters are properly escaped. // The length of a blob name can range from as short as 1 character to as long as 1024 characters. // Avoid blob names that end with a dot (.), a forward slash (/), or a sequence or combination of the two. CloudBlockBlob blockBlob = subDirectory.GetBlockBlobReference(TEST_BLOCK_BLOB_NAME); using (var fileStream = System.IO.File.OpenRead(@"C:\Users\jeffg\Documents\test.txt")) { blockBlob.UploadFromStream(fileStream); } Console.WriteLine($"Finished Create Directory Snippet\r\n"); }
private CloudBlockBlob StoretokenToBlob(string s) { string[] list = s.Split(_pathSeparators, StringSplitOptions.RemoveEmptyEntries); if (list.Length < 4) { return(null); } string http = list[0].ToLower(); if (!http.Contains("http")) { return(null); } string url = list[1].ToLower(); if (!url.Contains("blob.core.windows.net")) { return(null); } // list[2] is the container name // list[3] contains the directory names // list[length - 1] contains the blob name int len = list.Length; CloudBlobDirectory blobdir = AzureCloudBlobContainer.GetDirectoryReference(list[3]); for (int i = 4; i < len - 1; i++) { blobdir = blobdir.GetDirectoryReference(list[i]); } CloudBlockBlob cloudBlockBlob = blobdir.GetBlockBlobReference(list[len - 1]); return(cloudBlockBlob); }
private void GenerateDir(DirNode dirNode, CloudBlobDirectory cloudBlobDir) { DMLibDataHelper.CreateLocalDirIfNotExists(this.TempFolder); foreach (var subDir in dirNode.DirNodes) { CloudBlobDirectory subCloudBlobDir = cloudBlobDir.GetDirectoryReference(subDir.Name); this.GenerateDir(subDir, subCloudBlobDir); } List <FileNode> snapshotList = new List <FileNode>(); foreach (var file in dirNode.FileNodes) { CloudBlob cloudBlob = CloudBlobHelper.GetCloudBlobReference(cloudBlobDir, file.Name, this.BlobType); this.GenerateFile(file, cloudBlob, snapshotList); } foreach (var snapshot in snapshotList) { dirNode.AddFileNode(snapshot); } }
/// <summary> /// Search blob content in specified folder /// </summary> /// <param name="path">folder path in which the search will be processed</param> /// <param name="searchPattern">search blob name pattern can be used mask (*, ? symbols)</param> /// <param name="recursive"> recursive search</param> /// <returns>Returns relative path for all found blobs example: /folder/blob.md </returns> public virtual IEnumerable <string> Search(string path, string searchPattern, bool recursive) { var retVal = new List <string>(); path = NormalizePath(path); IEnumerable <IListBlobItem> blobItems; if (_directory != null) { var directoryBlob = _directory; if (!string.IsNullOrEmpty(path)) { directoryBlob = _directory.GetDirectoryReference(path); } blobItems = directoryBlob.ListBlobs(useFlatBlobListing: recursive); } else { blobItems = _container.ListBlobs(useFlatBlobListing: recursive); } // Loop over items within the container and output the length and URI. foreach (IListBlobItem item in blobItems) { var block = item as CloudBlockBlob; if (block != null) { var blobRelativePath = GetRelativeUrl(block.Uri.ToString()); var fileName = Path.GetFileName(Uri.UnescapeDataString(block.Uri.ToString())); if (fileName.FitsMask(searchPattern)) { retVal.Add(blobRelativePath); } } } return(retVal); }
public async Task <bool> MoveToSubFolderAsync(string id, string subFolderName) { try { CloudBlobDirectory subDirectory = serviceDirectory.GetDirectoryReference(subFolderName); try { CloudBlockBlob frontSource = serviceDirectory.GetBlockBlobReference(id + "Front.jpeg"); CloudBlockBlob frontTarget = subDirectory.GetBlockBlobReference(id + "Front.jpeg"); await frontTarget.StartCopyAsync(frontSource); await frontSource.DeleteAsync(); } catch (Exception) { } try { CloudBlockBlob backSource = serviceDirectory.GetBlockBlobReference(id + "Back.jpeg"); CloudBlockBlob backTarget = subDirectory.GetBlockBlobReference(id + "Back.jpeg"); await backTarget.StartCopyAsync(backSource); await backSource.DeleteAsync(); } catch (Exception) { } return(true); } catch (Exception) { Console.WriteLine("Error : Migrating the Images."); return(false); } }
public void BlobTypesWithStorageUri() { StorageUri endpoint = new StorageUri( new Uri("http://" + AccountName + BlobService + EndpointSuffix), new Uri("http://" + AccountName + SecondarySuffix + BlobService + EndpointSuffix)); CloudBlobClient client = new CloudBlobClient(endpoint, new StorageCredentials()); Assert.IsTrue(endpoint.Equals(client.StorageUri)); Assert.IsTrue(endpoint.PrimaryUri.Equals(client.BaseUri)); StorageUri containerUri = new StorageUri( new Uri(endpoint.PrimaryUri + "container"), new Uri(endpoint.SecondaryUri + "container")); CloudBlobContainer container = client.GetContainerReference("container"); Assert.IsTrue(containerUri.Equals(container.StorageUri)); Assert.IsTrue(containerUri.PrimaryUri.Equals(container.Uri)); Assert.IsTrue(endpoint.Equals(container.ServiceClient.StorageUri)); container = new CloudBlobContainer(containerUri, client.Credentials); Assert.IsTrue(containerUri.Equals(container.StorageUri)); Assert.IsTrue(containerUri.PrimaryUri.Equals(container.Uri)); Assert.IsTrue(endpoint.Equals(container.ServiceClient.StorageUri)); StorageUri directoryUri = new StorageUri( new Uri(containerUri.PrimaryUri + "/directory/"), new Uri(containerUri.SecondaryUri + "/directory/")); StorageUri subdirectoryUri = new StorageUri( new Uri(directoryUri.PrimaryUri + "subdirectory/"), new Uri(directoryUri.SecondaryUri + "subdirectory/")); CloudBlobDirectory directory = container.GetDirectoryReference("directory"); Assert.IsTrue(directoryUri.Equals(directory.StorageUri)); Assert.IsTrue(directoryUri.PrimaryUri.Equals(directory.Uri)); Assert.IsNotNull(directory.Parent); Assert.IsTrue(containerUri.Equals(directory.Container.StorageUri)); Assert.IsTrue(endpoint.Equals(directory.ServiceClient.StorageUri)); CloudBlobDirectory subdirectory = directory.GetDirectoryReference("subdirectory"); Assert.IsTrue(subdirectoryUri.Equals(subdirectory.StorageUri)); Assert.IsTrue(subdirectoryUri.PrimaryUri.Equals(subdirectory.Uri)); Assert.IsTrue(directoryUri.Equals(subdirectory.Parent.StorageUri)); Assert.IsTrue(containerUri.Equals(subdirectory.Container.StorageUri)); Assert.IsTrue(endpoint.Equals(subdirectory.ServiceClient.StorageUri)); StorageUri blobUri = new StorageUri( new Uri(subdirectoryUri.PrimaryUri + "blob"), new Uri(subdirectoryUri.SecondaryUri + "blob")); CloudBlockBlob blockBlob = subdirectory.GetBlockBlobReference("blob"); Assert.IsTrue(blobUri.Equals(blockBlob.StorageUri)); Assert.IsTrue(blobUri.PrimaryUri.Equals(blockBlob.Uri)); Assert.IsTrue(subdirectoryUri.Equals(blockBlob.Parent.StorageUri)); Assert.IsTrue(containerUri.Equals(blockBlob.Container.StorageUri)); Assert.IsTrue(endpoint.Equals(blockBlob.ServiceClient.StorageUri)); blockBlob = new CloudBlockBlob(blobUri, null, client.Credentials); Assert.IsTrue(blobUri.Equals(blockBlob.StorageUri)); Assert.IsTrue(blobUri.PrimaryUri.Equals(blockBlob.Uri)); Assert.IsTrue(subdirectoryUri.Equals(blockBlob.Parent.StorageUri)); Assert.IsTrue(containerUri.Equals(blockBlob.Container.StorageUri)); Assert.IsTrue(endpoint.Equals(blockBlob.ServiceClient.StorageUri)); CloudPageBlob pageBlob = subdirectory.GetPageBlobReference("blob"); Assert.IsTrue(blobUri.Equals(pageBlob.StorageUri)); Assert.IsTrue(blobUri.PrimaryUri.Equals(pageBlob.Uri)); Assert.IsTrue(subdirectoryUri.Equals(pageBlob.Parent.StorageUri)); Assert.IsTrue(containerUri.Equals(pageBlob.Container.StorageUri)); Assert.IsTrue(endpoint.Equals(pageBlob.ServiceClient.StorageUri)); pageBlob = new CloudPageBlob(blobUri, null, client.Credentials); Assert.IsTrue(blobUri.Equals(pageBlob.StorageUri)); Assert.IsTrue(blobUri.PrimaryUri.Equals(pageBlob.Uri)); Assert.IsTrue(subdirectoryUri.Equals(pageBlob.Parent.StorageUri)); Assert.IsTrue(containerUri.Equals(pageBlob.Container.StorageUri)); Assert.IsTrue(endpoint.Equals(pageBlob.ServiceClient.StorageUri)); }
public ICloudBlobDirectory GetDirectoryReference(string directoryName) { return(new AzureCloudBlobDirectory(_directory.GetDirectoryReference(directoryName))); }