internal string ToFeedbackString() { var info = $@"{ApplicationFullVersion} {ApplicationDescription} "; var repoDefaults = new Repository(); var colInfo = new int[] { 0, 30, 65, 75 }; var table = new List <string[]>() { new string[] { "Configuration entry", "Description", "Value", "Default" }, new string[] { "===================", "===========", "=====", "=======" }, Array.Empty <string>(), new string[] { nameof(UploadFolder), "Upload Folder", UploadFolder, repoDefaults.UploadFolder }, new string[] { nameof(ArchiveFolder), "Archive Folder", ArchiveFolder, repoDefaults.ArchiveFolder }, new string[] { nameof(TransferCheckpointFilename), "Transfer Checkpoint Filename", TransferCheckpointFilename, repoDefaults.TransferCheckpointFilename }, new string[] { nameof(BlockSize), "Tx Block Size", BlockSize.ToSizeSuffix(), repoDefaults.BlockSize.ToSizeSuffix() }, new string[] { nameof(ParallelOperations), "Parallel Operations", ParallelOperations.ToString(), repoDefaults.ParallelOperations.ToString() }, new string[] { nameof(DefaultConnectionLimit), "Default Connection Limit", DefaultConnectionLimit.ToString(), repoDefaults.DefaultConnectionLimit.ToString() }, new string[] { nameof(Expect100Continue), "Wait for '100' response?", Expect100Continue.ToString(), repoDefaults.Expect100Continue.ToString() }, new string[] { nameof(Recursive), "Recurse the upload folder", Recursive.ToString(), repoDefaults.Recursive.ToString() }, Array.Empty <string>(), new string[] { nameof(BlobContainerUri), "Azure Blob Container", BlobDirectory?.Uri.ToString(), repoDefaults.BlobDirectory?.Uri.ToString() }, new string[] { nameof(FileContainerUri), "Azure File Directory", FileDirectory?.Uri.ToString(), repoDefaults.FileDirectory?.Uri.ToString() }, Array.Empty <string>(), new string[] { "For details of the configuration options see: https://github.com/Azure/azure-storage-net-data-movement/" }, }; table.ForEach(row => { var line = ""; for (int i = 0; i < row.Length; i++) { if (line.Length > colInfo[i]) { info = info.TrimEnd(' ') + $"\n{line}"; line = string.Empty; } line = $"{line.PadRight(colInfo[i])}{row[i]} "; } info = info.TrimEnd(' ') + $"\n{line}"; }); return(info); }
/// <summary> /// Prepopulates the SftpConnectionPool with servers defined in config file. /// </summary> /// <param name="section"></param> public static void Load(XmlNode section) { try { DefaultConnectionLimit = int.Parse(section.SelectSingleNode("SftpConnectionPool").Attributes["defaultConnectionLimit"].Value); Trace.WriteLine("[SftpConnectionPool] DefaultConnectionLimit set to " + DefaultConnectionLimit.ToString()); foreach (XmlNode node in section.SelectNodes("SftpConnectionPool/Host")) { string name = node.Attributes["hostName"].Value; int connLimit = int.Parse(node.Attributes["connectionLimit"].Value); Hosts.Add(new SftpHost(name, connLimit, true)); Trace.WriteLine("[SftpConnectionPool] A limited connections(" + connLimit.ToString() + ") given to " + name + "."); } Trace.WriteLine("[SftpConnectionPool] SftpConnectionPool was loaded with " + Hosts.Count.ToString() + " hosts."); } catch (Exception e) { throw ExceptionHandling.HandleComponentException(System.Reflection.MethodBase.GetCurrentMethod(), new Exception("SftpConnectionPool Load Configuration failed", e)); } }