private byte[] GetFileFromStorage(AppManifestBase manifest, FileCreator fileCreator) { byte[] file; if (manifest.StorageType == StorageTypes.FileSystem) { file = Utility.GetFile(fileCreator.RelativeFilePath, fileCreator.IsBinary, manifest.BaseFilePath); } else { var pfc = fileCreator as ProvisioningFileCreator; if (pfc == null) { var storageInfo = manifest.GetAzureStorageInfo(); var blobStorage = new BlobStorage(storageInfo.Account, storageInfo.AccountKey, storageInfo.Container); file = blobStorage.DownloadToByteArray(fileCreator.Url); } else { var storageInfo = pfc.GetAzureStorageInfo(); var blobStorage = new BlobStorage(storageInfo.Account, storageInfo.AccountKey, storageInfo.Container); file = blobStorage.DownloadToByteArray(fileCreator.Url); } } return(file); }
public static void SaveManifestToAzureStorage(AppManifestBase appManifest) { var azureStorageInfo = appManifest.GetAzureStorageInfo(); if (azureStorageInfo == null) { return; } var blobStorage = new BlobStorage(azureStorageInfo.Account, azureStorageInfo.AccountKey, azureStorageInfo.Container); var js = new JavaScriptSerializer(); var json = js.Serialize(appManifest); blobStorage.UploadText(json, "manifest.json"); }
public static void SaveManifestToAzureStorage(AppManifestBase appManifest, string fileName = "manifest.json") { var azureStorageInfo = appManifest.GetAzureStorageInfo(); if (azureStorageInfo == null) { return; } if (string.IsNullOrEmpty(fileName)) { fileName = "manifest.json"; } var blobStorage = new BlobStorage(azureStorageInfo.Account, azureStorageInfo.AccountKey, azureStorageInfo.Container); var js = new JavaScriptSerializer(); var json = js.Serialize(appManifest); blobStorage.UploadText(json, fileName); }