public Tuple <string, ICloudBlob> DequeueRequest()
        {
            string filePath = Requests.Dequeue();
            string blobName = string.Empty;

            if (!string.IsNullOrEmpty(BlobName))
            {
                blobName = BlobName;
            }
            else
            {
                blobName = filePath.Substring(root.Length);
            }

            blobName = NameUtil.ResolveBlobName(blobName);

            ICloudBlob blob = default(ICloudBlob);

            switch (Type)
            {
            case BlobType.PageBlob:
                blob = Container.GetPageBlobReference(blobName);
                break;

            case BlobType.BlockBlob:
            default:
                blob = Container.GetBlockBlobReference(blobName);
                break;
            }

            return(new Tuple <string, ICloudBlob>(filePath, blob));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Check whether the container name is valid. If not throw an exception
 /// </summary>
 /// <param name="name">Container name</param>
 public static void ValidateContainerName(string name)
 {
     if (!NameUtil.IsValidContainerName(name))
     {
         throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, Resources.InvalidContainerName, name));
     }
 }
        public void SetDestinationContainer(IStorageBlobManagement channel, string containerName)
        {
            if (Container == null)
            {
                if (!NameUtil.IsValidContainerName(containerName))
                {
                    throw new ArgumentException(String.Format(Resources.InvalidContainerName, containerName));
                }

                Container = channel.GetContainerReference(containerName);
            }
        }
        public Tuple <string, CloudBlob> DequeueRequest()
        {
            string filePath = Requests.Dequeue();
            string blobName = string.Empty;

            if (!string.IsNullOrEmpty(BlobName))
            {
                blobName = BlobName;
            }
            else
            {
                blobName = filePath.Substring(root.Length);
            }

            blobName = NameUtil.ResolveBlobName(blobName);

            CloudBlob blob = Util.GetBlobReference(Container, blobName, Type);

            return(new Tuple <string, CloudBlob>(filePath, blob));
        }