public static bool CopyBlob(WindowsAzureStorageHelper storageHelper, string accountName, string sourceContainerName, string blobName, string destinationContainerName, string destinationBlobName, NameValueCollection metadata) { BlobProperties sourceBlobProperties = storageHelper.GetBlobProperties(sourceContainerName, blobName); if (metadata != null) { sourceBlobProperties.Metadata = metadata; } blobName = String.Format("/{0}/{1}/{2}", accountName, sourceContainerName, blobName); return(storageHelper.CopyBlob(destinationContainerName, sourceBlobProperties, blobName, destinationBlobName, "2009-04-14")); }
public static bool PutBlob(WindowsAzureStorageHelper storageHelper, string containerName, string blobName, string fileName, byte[] fileContents, bool overwrite, NameValueCollection metadata) { BlobProperties blobProperties = new BlobProperties(blobName); blobProperties.ContentType = WindowsAzureStorageHelper.GetContentTypeFromExtension(Path.GetExtension(fileName)); blobProperties.Metadata = metadata; BlobContents blobContents = null; bool ret = false; blobContents = new BlobContents(fileContents); ret = storageHelper.CreateBlob(containerName, blobProperties, blobContents, overwrite); return(ret); }
public static void GetAssemblyDependencies(string inputContainerName, string assemblyDependencies, string localStoragePath, WindowsAzureStorageHelper storageHelper, bool loadAssemblies) { string[] assemblies = assemblyDependencies.Split(';'); if (assemblies != null && assemblies.Length > 0) { foreach (string a in assemblies) { string fileName = Path.GetFileName(a); string localFile = localStoragePath + fileName; WindowsAzureStorageHelper.GetBlob(inputContainerName, a, localFile, storageHelper); if (loadAssemblies) { if (Path.GetExtension(a).IndexOf("dll") > -1) { Assembly asm = Assembly.LoadFrom(localFile); } } }//foreach } }
public static BlobProperties GetBlob(string containerName, string blobName, bool transferAsChunks, out BlobContents blobContents, WindowsAzureStorageHelper storageHelper) { blobContents = new BlobContents(new MemoryStream()); return(storageHelper.GetBlob(containerName, blobName, blobContents, transferAsChunks)); }
public static NameValueCollection GetBlob(string containerName, string blobName, string destinationFilePath, WindowsAzureStorageHelper storageHelper) { if (File.Exists(destinationFilePath)) { try { File.Delete(destinationFilePath); } catch (Exception ex) { Trace.WriteLine("Exception deleting old file " + ex.Message, "Error"); } } if (!File.Exists(destinationFilePath)) { BlobContents blobContents; BlobProperties props = GetBlob(containerName, blobName, true, out blobContents, storageHelper); SaveBlobLocally(destinationFilePath, props, blobContents); if (props != null) { return(props.Metadata); } } //else //{ // LogInfo("Assembly already exists and is loaded. Develop an Unload Assembly function to unload the assembly when done so that it is not locked."); // LogInfo("Loading and Unloading Assemblies: http://people.oregonstate.edu/~reeset/blog/archives/466"); //} return(null); }