Exemplo n.º 1
0
        public static void ValidatePartitionDN(ADRootDSE rootDSE, string partitionDN)
        {
            IEnumerable <string> partitionList;

            if (ADForestPartitionInfo.IsValidPartitionDN(rootDSE, partitionDN, false) || ADForestPartitionInfo.IsValidPartitionDN(rootDSE, partitionDN, true))
            {
                return;
            }
            else
            {
                CultureInfo currentCulture = CultureInfo.CurrentCulture;
                string      invalidPartitionMustBelongToValidSet = StringResources.InvalidPartitionMustBelongToValidSet;
                object[]    objArray  = new object[1];
                object[]    objArray1 = objArray;
                int         num       = 0;
                if (rootDSE.SessionInfo.ConnectedToGC)
                {
                    partitionList = ADForestPartitionInfo.GetForestPartitionInfo(rootDSE).PartitionList;
                }
                else
                {
                    partitionList = rootDSE.NamingContexts;
                }
                objArray1[num] = ADForestPartitionInfo.ConcatList(partitionList, " , ");
                throw new ArgumentException(string.Format(currentCulture, invalidPartitionMustBelongToValidSet, objArray));
            }
        }
Exemplo n.º 2
0
        public static string ExtractAndValidatePartitionInfo(ADRootDSE rootDSE, string objectDN)
        {
            IEnumerable <string> partitionList;
            string str = ADForestPartitionInfo.ExtractPartitionInfo(rootDSE, objectDN, false);

            if (str == null)
            {
                str = ADForestPartitionInfo.ExtractPartitionInfo(rootDSE, objectDN, true);
                if (str == null)
                {
                    CultureInfo currentCulture = CultureInfo.CurrentCulture;
                    string      invalidDNMustBelongToValidPartitionSet = StringResources.InvalidDNMustBelongToValidPartitionSet;
                    object[]    objArray  = new object[1];
                    object[]    objArray1 = objArray;
                    int         num       = 0;
                    if (rootDSE.SessionInfo.ConnectedToGC)
                    {
                        partitionList = ADForestPartitionInfo.GetForestPartitionInfo(rootDSE).PartitionList;
                    }
                    else
                    {
                        partitionList = rootDSE.NamingContexts;
                    }
                    objArray1[num] = ADForestPartitionInfo.ConcatList(partitionList, " , ");
                    throw new ArgumentException(string.Format(currentCulture, invalidDNMustBelongToValidPartitionSet, objArray));
                }
            }
            return(str);
        }