mRemoteNG.Config.Serializers.PortScanDeserializer.ImportScannedHost C# (CSharp) Method

ImportScannedHost() private method

private ImportScannedHost ( ScanHost host, ContainerInfo parentContainer ) : void
host mRemoteNG.Tools.ScanHost
parentContainer ContainerInfo
return void
        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);
        }