Skip to content

Commit

Permalink
Merge pull request #169 from jirkapok/feature/Allow_CustomPort_InConn…
Browse files Browse the repository at this point in the history
…ectionDialog

Allowed port in new connection dialog server text box
  • Loading branch information
nothrow committed Feb 25, 2019
2 parents c1be4ea + 508ff62 commit 3cd0caa
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions 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;
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 3cd0caa

Please sign in to comment.