示例#1
0
 public SiteMapBuilderNode AddNode(SiteMapBuilderNode entry)
 {
     // go up
     if (entry.Depth <= Depth)
     {
         return(Parent.AddNode(entry));
     }
     else
     {
         // current child
         foreach (SiteMapBuilderNode child in Children)
         {
             if (child.Title == entry.Title)
             {
                 if (!(String.IsNullOrWhiteSpace(entry.Text.Replace(entry.Title, String.Empty).Replace("+", String.Empty))))
                 {
                     child.Text = entry.Text;
                 }
                 return(child);
             }
         }
         Children.Add(entry);
         entry.Parent = this;
         return(entry);
     }
 }
示例#2
0
        public void Insert(string title, int depth, string text)
        {
            if (_last == null)
            {
                _last = _root;
            }
            SiteMapBuilderNode entry = new SiteMapBuilderNode(title, depth, text);

            _last = _last.AddNode(entry);
        }