public string UploadAlbumComposition(string albumCode)
        {
            Logger.Instance.Info("Uploading album composition {0}", albumCode);
            var albumFolders = System.IO.Directory.GetDirectories(Settings.CompositionFolder, albumCode + "*");

            if (albumFolders.Any())
            {
                using (var sshService = new SshService(Settings.SshUrl, Settings.SshPort, Settings.SshUsernameComposition, Settings.SshPasswordComposition, Settings.SshKeyComposition))
                {
                    var compositionFolder = albumFolders[0];
                    sshService.UploadFolder(compositionFolder);

                    //upload delivery.complete
                    using (var stream = new MemoryStream())
                    {
                        stream.WriteByte(0);
                        stream.Position = 0;
                        sshService.UploadFile(stream, "delivery.complete", Path.GetFileName(compositionFolder));
                    }

                    return(compositionFolder);
                }
            }
            return(null);
        }
 public void GetUploadAlbumReportCSV(string[] csvFolderList)
 {
     try
     {
         using (var sshService = new SshService(Settings.SshUrl, Settings.SshPort, Settings.SshUsernameCSV, Settings.SshPasswordCSV, Settings.SshKeyCSV))
         {
             foreach (var csvFolder in csvFolderList)
             {
                 var remoteFolder = Path.GetFileName(csvFolder);
                 if (!sshService.Exists(remoteFolder))
                 {
                     continue;
                 }
                 var files      = sshService.ListDirectory(remoteFolder);
                 var reportFile = files.Where(p => p.StartsWith("report-")).FirstOrDefault();
                 if (reportFile != null)
                 {
                     using (var stream = sshService.DownloadFile(reportFile, remoteFolder))
                     {
                         stream.Position = 0;
                         using (var fileStream = File.Create(Path.Combine(csvFolder, reportFile)))
                         {
                             stream.CopyTo(fileStream);
                             fileStream.Flush();
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Logger.Instance.Error(ex);
     }
 }
        public string UploadAlbum(string albumCode)
        {
            Logger.Instance.Info("Uploading album {0}", albumCode);
            var albumFolders = System.IO.Directory.GetDirectories(Settings.DDEXFolder, albumCode + "*");

            if (albumFolders.Any())
            {
                using (var sshService = new SshService(Settings.SshUrl, Settings.SshPort, Settings.SshUsername, Settings.SshPassword, Settings.SshKey))
                {
                    var ddexFolder = albumFolders[0];
                    sshService.UploadFolder(ddexFolder);

                    //upload BatchComplete_.xml
                    using (var stream = new MemoryStream())
                    {
                        stream.WriteByte(0);
                        stream.Position = 0;
                        sshService.UploadFile(stream, "BatchComplete_.xml", Path.GetFileName(ddexFolder));
                    }

                    return(ddexFolder);
                }
            }
            return(null);
        }