From 508ff62703bb441cdb8e9fc28da92d18165b7685 Mon Sep 17 00:00:00 2001 From: JirkaPok Date: Mon, 25 Feb 2019 16:01:02 +0000 Subject: [PATCH] Allowed port in new connection dialog server text box --- Src/SwqlStudio/InfoServiceBase.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Src/SwqlStudio/InfoServiceBase.cs b/Src/SwqlStudio/InfoServiceBase.cs index dafad3ced..770a2e380 100644 --- a/Src/SwqlStudio/InfoServiceBase.cs +++ b/Src/SwqlStudio/InfoServiceBase.cs @@ -1,4 +1,5 @@ using System; +using System.Globalization; using System.ServiceModel.Channels; using SolarWinds.InformationService.Contract2; using SolarWinds.InformationService.Contract2.PubSub; @@ -44,8 +45,18 @@ protected virtual int Port public virtual Uri Uri(string serverAddress) { - Uri uri = new Uri(String.Format("{0}://{1}:{2}/" + _endpoint, _protocolName, serverAddress, Port)); - return uri; + if (serverAddress.Contains(":")) + { + var parts = serverAddress.Split(':'); + return Uri(parts[0], parts[1]); + } + + return Uri(serverAddress, Port.ToString(CultureInfo.InvariantCulture)); + } + + private Uri Uri(string serverAddress, string port) + { + return new Uri(String.Format("{0}://{1}:{2}/" + _endpoint, _protocolName, serverAddress, port)); } public virtual InfoServiceProxy CreateProxy(string server)