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);
 }
Example #2
0
        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");
        }
Example #3
0
        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);
        }