public BoundingBox[] ListBoxes() { var blobList = _container.ListBlobs(useFlatBlobListing: true); var listOfFileNames = new List <BoundingBox>(); foreach (var blob in blobList) { var blobFileName = blob.Uri.Segments.Last(); listOfFileNames.Add(BoundingBoxFilenameConverter.ParseFileName(blobFileName)); } return(listOfFileNames.ToArray()); }
public Geometry GetBox(BoundingBox box) { var filename = BoundingBoxFilenameConverter.CreateFileName(box, "json"); var blobReference = _container.GetBlobReference(filename); string text; using (var memoryStream = new MemoryStream()) { blobReference.DownloadToStream(memoryStream); text = System.Text.Encoding.UTF8.GetString(memoryStream.ToArray()); } return(JsonSerDe.GetGeometry(text)); }
public string Upload(string geometry, BoundingBox box) { var path = BoundingBoxFilenameConverter.CreateFileName(box, _suffix); // todo: move this. string storageConnectionString = Environment.GetEnvironmentVariable(""); if (CloudStorageAccount.TryParse(storageConnectionString, out var storageAccount)) { try { CloudBlobClient cloudBlobClient = storageAccount.CreateCloudBlobClient(); CloudBlobContainer cloudBlobContainer = cloudBlobClient.GetContainerReference(_path); CloudBlockBlob cloudBlockBlob = cloudBlobContainer.GetBlockBlobReference(path); cloudBlockBlob.UploadFromStream(new MemoryStream(Encoding.ASCII.GetBytes(geometry))); } catch (StorageException ex) { Console.WriteLine(ex); } } return(path); }