public void uploadMetaData(ZipDetails clientZipDetails,ZipDetails launcherZipDetails) { UpdateMetaData newEntryToInsert = new UpdateMetaData(clientZipDetails,launcherZipDetails); TableOperation newUpdateMetaDataEntryToInsert = TableOperation.Insert(newEntryToInsert); CloudTable updateMetaData = VP2CloudTableClient.GetTableReference("UpdateMetaData"); updateMetaData.Execute(newUpdateMetaDataEntryToInsert); }
public void uploadMetaData(ZipDetails clientZipDetails, ZipDetails launcherZipDetails) { if (expectException) { throw new Exception(); } }
public UpdateMetaData(ZipDetails clientZipDetails, ZipDetails launcherZipDetails) { ClientBinariesSaveFileName = clientZipDetails.ZipName; LauncherBinariesSaveFileName = launcherZipDetails.ZipName; ZipUrl = clientZipDetails.ZipLocation; LauncherBinariesUrl = launcherZipDetails.ZipLocation; LauncherVersion = launcherZipDetails.ProductVersion; RowKey = clientZipDetails.ProductVersion; PartitionKey = "TPSA"; }
public string uploadToStorage(ZipDetails zipToUpload) { if (!VP2CloudStorage.doesStorageExists() || !VP2CloudStorage.canConnect()) { throw new VP2UploaderException("STORAGE DOES NOT EXIST"); } VP2CloudStorage.uploadZip(zipToUpload); return VP2CloudStorage.getStorageLocationByName(zipToUpload.ZipName); }
public void uploadZip(ZipDetails zipToUpload) { CloudBlobContainer uploadBlobContainer = createBlobContainerFromZipName(zipToUpload.ZipName); if (uploadBlobContainer != null) { using (var fileStream = System.IO.File.OpenRead(zipToUpload.ZipLocation)) { CloudBlockBlob fileBlockBlob = uploadBlobContainer.GetBlockBlobReference(zipToUpload.ZipName); fileBlockBlob.UploadFromStream(fileStream); } } }
public void auditUploadedZipFiles(ZipDetails clientZipDetails,ZipDetails launcherZipDetails) { try { if (isProductVersionInvalidForInsert(clientZipDetails) || isProductVersionInvalidForInsert(launcherZipDetails)) { throw new VP2UploaderException("META DATA ALREADY EXISTS"); } zipFileMetaData.uploadMetaData(clientZipDetails, launcherZipDetails); } catch (Exception) { throw new VP2UploaderException("COULD NOT UPLOAD DUE TO WEIRD ERROR"); } }
public void uploadZip(ZipDetails zipToUpload) { mockBlobs.Add(new List<string>() {zipToUpload.ZipName,zipToUpload.ZipLocation}); }
private bool isProductVersionInvalidForInsert(ZipDetails zipDetailsForUpload) { return string.IsNullOrEmpty(zipDetailsForUpload.ProductVersion) || zipFileMetaData.doesMetaDataExists(zipDetailsForUpload.ProductVersion); }
static void Main(string[] args) { try { Console.Clear(); Console.WriteLine( "======================================================================================="); Console.WriteLine("WELCOME TO RICHARD'S CLIENT BINARY ZIP FILE TOOL"); Console.WriteLine(); string productVersion = ""; DirectoryZipper zipper = new DirectoryZipper(new ConcerteZipMaker(), new InstallerDirectory(ConfigurationSettings.AppSettings["PUBLICSAFETYINSTALLPATH"], new ConcreteFileManager(ConfigurationSettings.AppSettings["PUBLICSAFETYINSTALLPATH"]))); Console.WriteLine("PLEASE WRITE ENTER THE PRODUCT VERSION AND PRESS ENTER"); productVersion = Console.ReadLine(); if (productVersionIsNotMismatched(productVersion)) { Console.WriteLine(); Console.WriteLine("ZIPPING UP FILES"); string clientZipName = ConfigurationSettings.AppSettings["ClientBinariesSaveFileName"] + productVersion + ".zip"; string clientInstallerLocation = zipper.zipInstallerFile(ConfigurationSettings.AppSettings["PUBLICSAFETYCLIENT"], clientZipName); ZipDetails clientInstallerZipDetails = new ZipDetails() { ProductVersion = productVersion, ZipName = clientZipName, ZipLocation = clientInstallerLocation }; Console.WriteLine(clientInstallerZipDetails.ZipLocation); Console.WriteLine("CLIENT ZIPPED AT LOCATION : " + clientInstallerZipDetails.ZipLocation); string launcherZipName = ConfigurationSettings.AppSettings["LauncherBinariesSaveFileName"] + productVersion + ".zip"; string launcherInstallerLocation = zipper.zipInstallerFile(ConfigurationSettings.AppSettings["PUBLICSAFETYLAUNCHER"], launcherZipName); ZipDetails launcherZipDetails = new ZipDetails() { ProductVersion = productVersion, ZipLocation = launcherInstallerLocation, ZipName = launcherZipName }; Console.WriteLine("LAUNCHER ZIPPED AT LOCATION : " + launcherZipDetails.ZipLocation); Console.WriteLine(); Console.WriteLine( "DO YOU WANT TO UPLOAD THIS FILE TO THE BLOB STORAGE? PRESS Y FOR YES AND N FOR NO AND PRESS ENTER"); string uploadBlobPromptKey = Console.ReadLine(); if (uploadBlobPromptKey.ToUpper() == "Y") { ZipperUploader clientLauncherUploader = new ZipperUploader(new BlobStorageManager(ConfigurationSettings.AppSettings["DeveloperCommonAzureStorage"])); clientInstallerZipDetails.ZipLocation = clientLauncherUploader.uploadToStorage(clientInstallerZipDetails); Console.WriteLine("CLIENT ZIP UPLOADED : " + clientInstallerZipDetails.ZipLocation); launcherZipDetails.ZipLocation = clientLauncherUploader.uploadToStorage(launcherZipDetails); Console.WriteLine("LAUNCHER ZIP UPLOADED :" + launcherZipDetails.ZipLocation); clientLauncherUploader.auditUploadedZipFiles(clientInstallerZipDetails,launcherZipDetails); Console.WriteLine("SUCCESFULLY WRITTEN TO UPDATEMETADATA TABLE"); } Console.WriteLine("==================COMPLETED======================"); } else { Console.WriteLine("PRODUCT IS NOT EQUAL TO INSTALLED VERSION"); } } catch (VP2BinaryZipperException e) { Console.WriteLine("COULD NOT COMPRESS GENERATE ZIP FILES : " + e.Message); } catch (VP2UploaderException e) { Console.WriteLine("FAILED TO UPLOAD TO COMPLETE BLOB UPLOAD : " + e.Message); } catch (Exception e) { Console.WriteLine("UNKONWN EXCEPTION OCCURED, DO NOT KNOW HOW TO FIX THIS : " + e.Message); } }