GitSharp.Core.Transport.OpenSshConfig.lookup C# (CSharp) Method

lookup() public method

public lookup ( string hostName ) : Host
hostName string
return Host
        public Host lookup(string hostName)
        {
            Dictionary<string, Host> cache = refresh();
            Host h = null;
            if (cache.ContainsKey(hostName))
            {
                h = cache[hostName];
            }
            if (h == null)
                h = new Host();
            if (h.patternsApplied)
                return h;

            foreach (string k in cache.Keys)
            {
                if (!isHostPattern(k))
                    continue;
                if (!isHostMatch(k, hostName))
                    continue;
                h.copyFrom(cache[k]);
            }

            if (h.getHostName() == null)
                h.hostName = hostName;
            if (h.user == null)
                h.user = userName();
            if (h.port == 0)
                h.port = SSH_PORT;
            h.patternsApplied = true;
            return h;
        }