예제 #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("");
     }
 }
예제 #2
0
        public static bool IsValidPath(string path)
        {
            string str = null;

            path = X500Path.StripX500Whitespace(path);
            while (path != null)
            {
                int num = ADPathHelper.IndexOfFirstDelimiter(path, X500Path.delimiterChar, X500Path.escapeChar);
                if (num <= 0 || num >= path.Length - 1)
                {
                    if (num == 0 || num == path.Length - 1)
                    {
                        return(false);
                    }
                    else
                    {
                        str  = path;
                        path = null;
                    }
                }
                else
                {
                    str  = path.Substring(0, num);
                    path = path.Substring(num + 1);
                }
                int num1 = str.IndexOf(X500Path.equalsChar);
                if (num1 <= 0 || num1 >= str.Length - 1)
                {
                    if (num1 == 0 || num1 == str.Length - 1)
                    {
                        return(false);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    string str1 = str.Substring(0, num1);
                    string str2 = str.Substring(num1 + 1);
                    if (X500Path.IsProperlyFormedRDNAttID(str1) && X500Path.IsProperlyFormedValue(str2))
                    {
                        continue;
                    }
                    return(false);
                }
            }
            return(true);
        }
예제 #3
0
 public static string StandardizeX500Path(string path)
 {
     return(X500Path.StripX500Whitespace(path));
 }