Beispiel #1
0
        private void Publish(IS3Client client,
                             IEnumerable <ITaskItem> sourceFiles,
                             string bucket,
                             string destinationFolder,
                             bool publicRead,
                             int timeoutMilliseconds, String uploadIfNotExists = null)
        {
            if (uploadIfNotExists != null)
            {
                uploadIfNotExists = uploadIfNotExists.Replace(".", "\\.").Replace("*", ".*");
            }
            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));
                if (uploadIfNotExists != null && Regex.IsMatch(info.Name, uploadIfNotExists))
                {
                    if (!client.FileExists(bucket, CreateRelativePath(destinationFolder, info.Name)))
                    {
                        client.PutFile(bucket, CreateRelativePath(destinationFolder, info.Name), info.FullName, headers, publicRead, timeoutMilliseconds);
                    }
                }
                else
                {
                    client.PutFile(bucket, CreateRelativePath(destinationFolder, info.Name), info.FullName, headers, publicRead, timeoutMilliseconds);
                }
            }
        }
Beispiel #2
0
        private void Publish(IS3Client client,
                            IEnumerable<string> sourceFiles,
                            string bucket,
                            string destinationFolder,
                            bool publicRead,
                            int timeoutMilliseconds)
        {
            foreach (var f in sourceFiles)
            {
                if (string.IsNullOrEmpty(f))
                    continue;

                var info = new FileInfo(f);
                Logger.LogMessage(MessageImportance.Normal, string.Format("Copying file {0}", info.FullName));
                client.PutFile(bucket, CreateRelativePath(destinationFolder, info.Name), info.FullName, publicRead, timeoutMilliseconds);
            }
        }
Beispiel #3
0
        private void Publish(IS3Client client,
                             IEnumerable <string> sourceFiles,
                             string bucket,
                             string destinationFolder,
                             bool publicRead,
                             int timeoutMilliseconds)
        {
            foreach (var f in sourceFiles)
            {
                if (string.IsNullOrEmpty(f))
                {
                    continue;
                }

                var info = new FileInfo(f);
                Logger.LogMessage(MessageImportance.Normal, string.Format("Copying file {0}", info.FullName));
                client.PutFile(bucket, CreateRelativePath(destinationFolder, info.Name), info.FullName, publicRead, timeoutMilliseconds);
            }
        }
Beispiel #4
0
        private void Publish(IS3Client client,
            string sourceFolder,
            string bucket,
            string destinationFolder,
            bool publicRead,
            int timeoutMilliseconds)
        {
            var dirInfo = new DirectoryInfo(sourceFolder);
            var files = dirInfo.GetFiles();
            foreach (var f in files)
            {
                Logger.LogMessage(MessageImportance.Normal, string.Format("Copying file {0}", f.FullName));
                client.PutFile(bucket, CreateRelativePath(destinationFolder, f.Name), f.FullName, publicRead, timeoutMilliseconds);
            }

            var dirs = dirInfo.GetDirectories();
            foreach (var d in dirs)
            {
                Publish(client, d.FullName, bucket, CreateRelativePath(destinationFolder, d.Name), publicRead, timeoutMilliseconds);
            }
        }
Beispiel #5
0
        private void Publish(IS3Client client,
                             string sourceFolder,
                             string bucket,
                             string destinationFolder,
                             bool publicRead,
                             int timeoutMilliseconds)
        {
            var dirInfo = new DirectoryInfo(sourceFolder);
            var files   = dirInfo.GetFiles();

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

            var dirs = dirInfo.GetDirectories();

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