public static ConfigurationItems GetSettings(IConfigurationRoot configurationRoot) { var configurationItems = new ConfigurationItems { IconName = configurationRoot.GetSection("Application")["IconName"] ?? string.Empty, UseLogging = bool.Parse(configurationRoot.GetSection("Application")["Logging"] ?? "false"), Messaging = new MessagingSettings { UseLocalPipeline = bool.Parse(configurationRoot.GetSection("Messaging")["UseLocalPipeline"] ?? "true") } }; var uniqueEndPoints = new List <string>(); var apiEndPoints = configurationRoot.GetSection("RestApi").Get <string[]>(); if (apiEndPoints != null) { foreach (var apiEndPoint in apiEndPoints) { var ipEndPoint = AddressParser.ParseEndPointConfiguration(apiEndPoint, 5000); var uniqueEndPoint = ipEndPoint.ToString(); if (uniqueEndPoints.Contains(uniqueEndPoint)) { continue; } uniqueEndPoints.Add(uniqueEndPoint); configurationItems.ApiEndPoints.Add(ipEndPoint); } } var telnetEndPoints = configurationRoot.GetSection("Telnet").Get <string[]>(); if (telnetEndPoints != null) { foreach (var telnetEndPoint in telnetEndPoints) { var ipEndPoint = AddressParser.ParseEndPointConfiguration(telnetEndPoint, 4000); var uniqueEndPoint = ipEndPoint.ToString(); if (uniqueEndPoints.Contains(uniqueEndPoint)) { continue; } uniqueEndPoints.Add(uniqueEndPoint); configurationItems.TelnetEndPoints.Add(ipEndPoint); } } configurationRoot.GetSection("Messaging:EndPoints") .GetChildren() .ToList() .ForEach(item => { _ = configurationItems.Messaging.EndPoints.TryAdd(item.Key, item.Value); }); return(configurationItems); }