예제 #1
0
        public SshHost Compute(string host)
        {
            var result = new SshHost();

            void SetProperty(string name, string value)
            {
                if (!result.Properties.ContainsKey(name))
                {
                    result.Properties[name] = value;
                }
            }

            foreach (var line in _nodes)
            {
                if (line.Type != NodeType.Directive)
                {
                    continue;
                }

                if (line.Param == "Host")
                {
                    if (Glob(line.Value, host))
                    {
                        SetProperty(line.Param, line.Value);

                        line.Config._nodes
                        .Where(n => n.Type == NodeType.Directive)
                        .ForEach(n => SetProperty(n.Param, n.Value));
                    }
                }
                else if (line.Param == "Match")
                {
                    // TODO
                }
                else
                {
                    SetProperty(line.Param, line.Value);
                }
            }

            return(result);
        }
예제 #2
0
 public void Add(SshHost host)
 {
     Add(host.Properties);
 }