Ejemplo n.º 1
0
 public static string GetParentPath(string path, string root)
 {
     if (ADPathHelper.StartsWithDelimiter(path, X500Path.delimiterChar))
     {
         path = path.Substring(1);
     }
     if (ADPathHelper.StartsWithDelimiter(root, X500Path.delimiterChar))
     {
         root = root.Substring(1);
     }
     root = X500Path.StripX500Whitespace(root);
     if (!string.Equals(X500Path.StripX500Whitespace(path), root, StringComparison.InvariantCultureIgnoreCase))
     {
         int num = ADPathHelper.IndexOfFirstDelimiter(path, X500Path.delimiterChar, X500Path.escapeChar);
         if (num < 0 || num >= path.Length - 1)
         {
             return("");
         }
         else
         {
             return(path.Substring(num + 1));
         }
     }
     else
     {
         return("");
     }
 }
Ejemplo n.º 2
0
        public static string GetChildName(string path)
        {
            if (ADPathHelper.StartsWithDelimiter(path, X500Path.delimiterChar))
            {
                path = path.Substring(1);
            }
            int num = ADPathHelper.IndexOfFirstDelimiter(path, X500Path.delimiterChar, X500Path.escapeChar);

            if (num < 0)
            {
                return(path);
            }
            else
            {
                return(path.Substring(0, num));
            }
        }
Ejemplo n.º 3
0
 public static string MakePath(string parent, string child)
 {
     if (!ADPathHelper.StartsWithDelimiter(parent, X500Path.delimiterChar) || !ADPathHelper.EndsWithDelimiter(child, X500Path.delimiterChar, X500Path.escapeChar))
     {
         if (ADPathHelper.StartsWithDelimiter(parent, X500Path.delimiterChar) || ADPathHelper.EndsWithDelimiter(child, X500Path.delimiterChar, X500Path.escapeChar))
         {
             return(string.Concat(child, parent));
         }
         else
         {
             return(string.Concat(child, X500Path.delimiterChar, parent));
         }
     }
     else
     {
         return(string.Concat(child, parent.Substring(1)));
     }
 }
Ejemplo n.º 4
0
 public static bool ComparePath(string path1, string path2)
 {
     if (ADPathHelper.StartsWithDelimiter(path1, CanonicalPath.delimiterChar))
     {
         path1 = path1.Substring(1);
     }
     if (ADPathHelper.StartsWithDelimiter(path2, CanonicalPath.delimiterChar))
     {
         path2 = path2.Substring(1);
     }
     if (ADPathHelper.EndsWithDelimiter(path1, CanonicalPath.delimiterChar, CanonicalPath.escapeChar))
     {
         path1 = path1.Substring(0, path1.Length - 1);
     }
     if (ADPathHelper.EndsWithDelimiter(path2, CanonicalPath.delimiterChar, CanonicalPath.escapeChar))
     {
         path2 = path2.Substring(0, path2.Length - 1);
     }
     return(path1.Equals(path2, StringComparison.OrdinalIgnoreCase));
 }