예제 #1
0
        private string GetDirectory(string directory)
        {
            string URI;

            if (directory == "")
            {
                //build from current
                URI            = Hostname + this.CurrentDirectory;
                _lastDirectory = this.CurrentDirectory;
            }
            else
            {
                if (!directory.StartsWith("/"))
                {
                    throw (new ApplicationException("Directory should start with /"));
                }
                URI            = this.Hostname + directory;
                _lastDirectory = directory;
            }

            if (!URI.EndsWith("/"))
            {
                URI = URI + "/";
            }
            return(URI);
        }
예제 #2
0
 /// <summary>Get this node or one of its children that has a given URI.</summary>
 /// <param name="uri">Node unique identifier to search for</param>
 /// <returns>Node n for which n.URI == uri, or null if no such Node was found</returns>
 public Node Get(string uri) {
     if (URI != null && URI.EndsWith(uri)) return this;
     foreach (var child in Children) {
         var found = child.Get(uri);
         if (found != null) return found;
     }
     return null;
 }