Example #1
0
 public static string GetParentPath(string path, string root)
 {
     if (ADPathHelper.EndsWithDelimiter(path, CanonicalPath.delimiterChar, CanonicalPath.escapeChar))
     {
         path = path.Substring(0, path.Length - 1);
     }
     if (ADPathHelper.EndsWithDelimiter(root, CanonicalPath.delimiterChar, CanonicalPath.escapeChar))
     {
         root = root.Substring(0, root.Length - 1);
     }
     if (!string.Equals(path, root, StringComparison.InvariantCultureIgnoreCase))
     {
         int num = ADPathHelper.IndexOfLastDelimiter(path, CanonicalPath.delimiterChar, CanonicalPath.escapeChar);
         if (num < 0 || num >= path.Length - 1)
         {
             return("");
         }
         else
         {
             return(path.Substring(0, num));
         }
     }
     else
     {
         return("");
     }
 }
Example #2
0
        public static string GetChildName(string path)
        {
            if (ADPathHelper.EndsWithDelimiter(path, CanonicalPath.delimiterChar, CanonicalPath.escapeChar))
            {
                path = path.Substring(0, path.Length - 1);
            }
            int num = ADPathHelper.IndexOfLastDelimiter(path, CanonicalPath.delimiterChar, CanonicalPath.escapeChar);

            if (num < 0 || num >= path.Length - 1)
            {
                return(path);
            }
            else
            {
                return(path.Substring(num + 1));
            }
        }