public override string CopyAndExtractToTempFolder(string versionId, PackageInfo packageInfo, string tempFolder, string downloadFolder) { var objectFileName = Path.GetFileName(versionId); if (objectFileName == null) { throw new InvalidOperationException($"Could not extract file name from object {versionId}"); } var localFileName = Path.Combine(downloadFolder, packageInfo.Source + "_" + objectFileName); var metadata = StorageClient.GetObject(Bucket, versionId); if (DirectoryUtil.Exists(localFileName) && metadata.Md5Hash == DirectoryUtil.Md5(localFileName)) { _log.Info("Using cached file: " + localFileName); } else { DownloadPackage(versionId, localFileName); } Extract(localFileName, tempFolder, packageInfo.InternalPath); return(Path.Combine(tempFolder, packageInfo.InternalPath)); }
private void Download(IEnumerable items, string folder) { foreach (BrowseComponent browse in items) { if (browse.File) { Download(browse); } else if (browse.Folder) { ClientComponent client = MenuController.SelectedItem; string subfolder = Path.Combine(folder, browse.Name); string path = Path.Combine(client.Download, subfolder); if (!DirectoryUtil.Exists(path)) { DirectoryUtil.Create(path); } IEnumerable children = browse.GetChildren(browse); if (children != null && !folder.Equals(subfolder)) { Download(children, subfolder); } } } }
private void CleanPhysicalPath(DeployContext context) { if (DirectoryUtil.Exists(_installableConfig.TargetPath)) { context.Log.InfoFormat("Cleaning folder {0}", _installableConfig.TargetPath); DirectoryUtil.Clean(_installableConfig.TargetPath); } }
public override string CopyAndExtractToTempFolder(string versionId, PackageInfo packageInfo, string tempFolder, string downloadFolder) { var fileInfo = GetFilePathForVersion(versionId); var localZipFileName = Path.Combine(downloadFolder, fileInfo.Name); if (!DirectoryUtil.Exists(localZipFileName)) { File.Copy(fileInfo.FullName, localZipFileName, true); } Extract(localZipFileName, tempFolder, packageInfo.InternalPath); return(Path.Combine(tempFolder, packageInfo.InternalPath)); }
public override string CopyAndExtractToTempFolder(string versionId, PackageInfo packageInfo, string tempFolder, string downloadFolder) { string fileName = versionId + ".zip"; string localZipFileName = Path.Combine(downloadFolder, fileName); if (!DirectoryUtil.Exists(localZipFileName)) { webClient.DownloadFile(Uri + "/" + versionId + ".zip", localZipFileName); } Extract(localZipFileName, tempFolder, packageInfo.InternalPath); return(Path.Combine(tempFolder, packageInfo.InternalPath)); }
public override string CopyAndExtractToTempFolder(string versionId, PackageInfo packageInfo, string tempFolder, string downloadFolder) { var @object = S3Client.GetObject(Bucket, versionId); var objectFileName = Path.GetFileName(@object.Key); if (objectFileName == null) { throw new InvalidOperationException($"Could not extract file name from object key {@object.Key}"); } var localFileName = Path.Combine(downloadFolder, objectFileName); if (!DirectoryUtil.Exists(localFileName)) { @object.WriteResponseStreamToFile(localFileName); } Extract(localFileName, tempFolder, packageInfo.InternalPath); return(Path.Combine(tempFolder, packageInfo.InternalPath)); }