GetCloudBlobClient() public static method

public static GetCloudBlobClient ( ) : Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient
return Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient
Ejemplo n.º 1
0
        // sets MD5 for entire blob.
        public static void SetBlobMD5(string containerName, string blobName, string md5)
        {
            var client    = AzureHelper.GetCloudBlobClient();
            var container = client.GetContainerReference(containerName);
            var blob      = container.GetBlockBlobReference(blobName);

            blob.FetchAttributes();
            blob.Properties.ContentMD5 = md5;
            blob.SetProperties();
        }
Ejemplo n.º 2
0
        internal static long GetBlobSize(string containerName, string blobName)
        {
            var client    = AzureHelper.GetCloudBlobClient();
            var container = client.GetContainerReference(containerName);
            var blob      = container.GetBlockBlobReference(blobName);

            blob.FetchAttributes();
            var length = blob.Properties.Length;

            return(length);
        }
Ejemplo n.º 3
0
        public static string GetSignatureBlobName(string containerName, string blobName)
        {
            var client    = AzureHelper.GetCloudBlobClient();
            var container = client.GetContainerReference(containerName);
            var blob      = container.GetBlockBlobReference(blobName);

            blob.FetchAttributes();

            var sig = "";

            if (blob.Metadata.ContainsKey(SIGURL))
            {
                sig = blob.Metadata[SIGURL];
            }

            return(sig);
        }
Ejemplo n.º 4
0
        // sets signature name as metadata in blob
        // returns the signature name that will be uploaded.
        public static string SetSignatureName(string containerName, string blobName)
        {
            var client    = AzureHelper.GetCloudBlobClient();
            var container = client.GetContainerReference(containerName);
            var blob      = container.GetBlockBlobReference(blobName);

            blob.FetchAttributes();

            int sigCount = 0;

            if (blob.Metadata.ContainsKey(SIGCOUNT))
            {
                sigCount = Convert.ToInt32(blob.Metadata[SIGCOUNT]);
                sigCount++;
            }

            var sig = string.Format("{0}.{1}.sig", blobName, sigCount);

            blob.Metadata[SIGURL]   = sig;
            blob.Metadata[SIGCOUNT] = sigCount.ToString();
            blob.SetMetadata();

            return(sig);
        }