Beispiel #1
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);
        }
Beispiel #2
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);
        }