private void Publish(IS3Client client,
                             IEnumerable <ITaskItem> sourceFiles,
                             string bucket,
                             string destinationFolder,
                             bool publicRead,
                             int timeoutMilliseconds)
        {
            foreach (var fileItem in sourceFiles.Where(taskItem => taskItem != null &&
                                                       !string.IsNullOrEmpty(taskItem.GetMetadata("Identity"))))
            {
                var info    = new FileInfo(fileItem.GetMetadata("Identity"));
                var headers = MsBuildHelpers.GetCustomItemMetadata(fileItem);

                Logger.LogMessage(MessageImportance.Normal, string.Format("Copying file {0}", info.FullName));
                client.PutFileWithHeaders(bucket, CreateRelativePath(destinationFolder, info.Name), info.FullName, headers, publicRead, timeoutMilliseconds);
            }
        }
Example #2
0
        private void Publish(IS3Client client,
                             ITaskItem sourceFolder,
                             string bucket,
                             string destinationFolder,
                             bool publicRead,
                             int timeoutMilliseconds)
        {
            var dirInfo = new DirectoryInfo(sourceFolder.GetMetadata("Identity"));
            var headers = MsBuildHelpers.GetCustomItemMetadata(sourceFolder);
            var files   = dirInfo.GetFiles();

            foreach (var f in files)
            {
                Logger.LogMessage(MessageImportance.Normal, string.Format("Copying file {0}", f.FullName));
                client.PutFileWithHeaders(bucket, CreateRelativePath(destinationFolder, f.Name), f.FullName, headers, publicRead, timeoutMilliseconds);
            }

            var dirs = dirInfo.GetDirectories();

            foreach (var d in dirs)
            {
                Publish(client, new TaskItem(d.FullName, sourceFolder.CloneCustomMetadata()), bucket, CreateRelativePath(destinationFolder, d.Name), publicRead, timeoutMilliseconds);
            }
        }