private void ImportScannedHost(ScanHost host, ContainerInfo parentContainer)
{
var finalProtocol = default(ProtocolType);
var protocolValid = true;
switch (_targetProtocolType)
{
case ProtocolType.SSH2:
if (host.SSH)
finalProtocol = ProtocolType.SSH2;
break;
case ProtocolType.Telnet:
if (host.Telnet)
finalProtocol = ProtocolType.Telnet;
break;
case ProtocolType.HTTP:
if (host.HTTP)
finalProtocol = ProtocolType.HTTP;
break;
case ProtocolType.HTTPS:
if (host.HTTPS)
finalProtocol = ProtocolType.HTTPS;
break;
case ProtocolType.Rlogin:
if (host.Rlogin)
finalProtocol = ProtocolType.Rlogin;
break;
case ProtocolType.RDP:
if (host.RDP)
finalProtocol = ProtocolType.RDP;
break;
case ProtocolType.VNC:
if (host.VNC)
finalProtocol = ProtocolType.VNC;
break;
default:
protocolValid = false;
break;
}
if (!protocolValid) return;
var newConnectionInfo = new ConnectionInfo
{
Name = host.HostNameWithoutDomain,
Hostname = host.HostName,
Protocol = finalProtocol
};
newConnectionInfo.SetDefaultPort();
parentContainer.AddChild(newConnectionInfo);
}