private static void DeleteAllBlobs(CloudBlobDirectory cloudBlobDirectory) {
            foreach ( var blob in cloudBlobDirectory.ListBlobs() ) {
                if ( blob is CloudBlob ) {
                    ( (CloudBlob)blob ).DeleteIfExists();
                }

                if ( blob is CloudBlobDirectory ) {
                    DeleteAllBlobs((CloudBlobDirectory)blob);
                }
            }
        }
 public StatelessAzureQueueReader(
     string name,
     CloudQueue primaryQueue,
     CloudBlobDirectory container,
     Lazy<CloudQueue> poisonQueue,
     TimeSpan visibilityTimeout)
 {
     _cloudBlob = container;
     _queue = primaryQueue;
     _posionQueue = poisonQueue;
     _queueName = name;
     _visibilityTimeout = visibilityTimeout;
 }
        public static bool TryGetContainerName(
            AzureStoreConfiguration config, 
            CloudBlobDirectory dir,
            out EventStoreId container)
        {
            var topic = dir.Uri.ToString().Remove(0, dir.Container.Uri.ToString().Length).Trim('/');

            container = null;
            if (EventStoreId.IsValid(topic)!= EventStoreId.Rule.Valid)
                return false;
            container = EventStoreId.Parse(topic);
            return IsValid(config, container);
        }
            private static long GetDirectorySize(CloudBlobDirectory directoryBlob) {
                long size = 0;

                foreach ( var blobItem in directoryBlob.ListBlobs() ) {
                    if ( blobItem is CloudBlob )
                        size += ( (CloudBlob)blobItem ).Properties.Length;

                    if ( blobItem is CloudBlobDirectory )
                        size += GetDirectorySize((CloudBlobDirectory)blobItem);
                }

                return size;
            }
 public AzureBlobFolderStorage(CloudBlobDirectory blob, string rootPath) {
     _blob = blob;
     _rootPath = rootPath;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="CloudBlob"/> class based on an existing instance.
        /// </summary>
        /// <param name="cloudBlob">An existing reference to a blob.</param>
        public CloudBlob(CloudBlob cloudBlob)
        {
            this.attributes = cloudBlob.Attributes;
            this.container = cloudBlob.container;
            this.parent = cloudBlob.parent;

            this.ServiceClient = cloudBlob.ServiceClient;
        }
        private static FileItem ToFileItem(CloudBlobDirectory dir)
        {
            var uriParts = dir.Uri.LocalPath.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);

            return new FileItem
                       {
                           Name = uriParts.Last(),
                           IsDirectory = !dir.Uri.IsFile,
                           Image = "dir.png",
                           Path = string.Join("/", uriParts.Skip(2)),
                           IsPathAbsolute = false,
                           FileSize = "",
                           Modified = "",
                           Extension = ""
                       };
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="BlobStreamingContainer"/> class.
 /// </summary>
 /// <param name="directory">The directory.</param>
 public BlobStreamingContainer(CloudBlobDirectory directory)
 {
     _directory = directory;
 }
 public MsgSetBlobPack(CloudBlobContainer container, string path)
 {
     dir = container.GetDirectoryReference(path);
 }
 public PrefixTreeBlob(CloudBlobContainer container, string path)
 {
     dir = container.GetDirectoryReference(path);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AzureViewContainer"/> class.
 /// </summary>
 /// <param name="directory">The directory.</param>
 public AzureViewContainer(CloudBlobDirectory directory)
 {
     _directory = directory;
 }
 public AzureBlobFolderStorage(CloudBlobDirectory blob) {
     _blob = blob;
 }