Exemplo n.º 1
0
        internal static IADOPathNode ToSearchComputerSamAccountName(string extendedAttribute, string[] directoryAttributes, IADOPathNode filterClause, CmdletSessionInfo cmdletSessionInfo)
        {
            BinaryADOPathNode binaryADOPathNode = filterClause as BinaryADOPathNode;

            if (binaryADOPathNode != null)
            {
                IDataNode rightNode = binaryADOPathNode.RightNode as IDataNode;
                if (rightNode != null)
                {
                    string dataObject = rightNode.DataObject as string;
                    if (dataObject != null)
                    {
                        bool       flag      = dataObject.EndsWith("$", StringComparison.OrdinalIgnoreCase);
                        bool       flag1     = dataObject.EndsWith("*", StringComparison.OrdinalIgnoreCase);
                        ADOperator @operator = binaryADOPathNode.Operator;
                        if ((@operator == ADOperator.Eq || @operator == ADOperator.Ne) && !flag)
                        {
                            object[] objArray = new object[3];
                            objArray[0] = extendedAttribute;
                            objArray[1] = "$";
                            objArray[2] = filterClause;
                            cmdletSessionInfo.CmdletMessageWriter.WriteWarningBuffered(string.Format(CultureInfo.CurrentCulture, StringResources.WarningSamAccountNameClauseLacksDollarSign, objArray));
                        }
                        else
                        {
                            if ((@operator == ADOperator.Like || @operator == ADOperator.NotLike) && !flag && !flag1)
                            {
                                object[] objArray1 = new object[3];
                                objArray1[0] = extendedAttribute;
                                objArray1[1] = "$";
                                objArray1[2] = filterClause;
                                cmdletSessionInfo.CmdletMessageWriter.WriteWarningBuffered(string.Format(CultureInfo.CurrentCulture, StringResources.WarningSamAccountNameClauseLacksDollarSign, objArray1));
                            }
                        }
                        return(SearchConverters.ToSearchObject(extendedAttribute, directoryAttributes, filterClause, cmdletSessionInfo));
                    }
                    else
                    {
                        object[] type = new object[2];
                        type[0] = rightNode.DataObject.GetType();
                        type[1] = extendedAttribute;
                        throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.SearchConverterRHSInvalidType, type));
                    }
                }
                else
                {
                    throw new ArgumentException(StringResources.SearchConverterRHSNotDataNode);
                }
            }
            else
            {
                throw new ArgumentException(StringResources.SearchConverterNotBinaryNode);
            }
        }
Exemplo n.º 2
0
        internal static IADOPathNode ToSearchInvertBool(string extendedAttributeName, string[] directoryAttributes, IADOPathNode filterClause, CmdletSessionInfo cmdletSessionInfo)
        {
            BinaryADOPathNode binaryADOPathNode = filterClause as BinaryADOPathNode;

            if (binaryADOPathNode != null)
            {
                IDataNode rightNode = binaryADOPathNode.RightNode as IDataNode;
                if (rightNode != null)
                {
                    if (rightNode.DataObject is bool)
                    {
                        ADOperator @operator = binaryADOPathNode.Operator;
                        if (@operator == ADOperator.Eq || @operator == ADOperator.Ne)
                        {
                            IADOPathNode aDOPathNode = new BinaryADOPathNode(binaryADOPathNode.Operator, new PropertyADOPathNode(directoryAttributes[0]), new ObjectADOPathNode((object)(!(bool)rightNode.DataObject)));
                            return(SearchConverters.ToSearchObject(extendedAttributeName, directoryAttributes, aDOPathNode, cmdletSessionInfo));
                        }
                        else
                        {
                            object[]     str             = new object[2];
                            ADOperator[] aDOperatorArray = new ADOperator[2];
                            aDOperatorArray[1] = ADOperator.Ne;
                            str[0]             = SearchConverters.ConvertOperatorListToString(aDOperatorArray);
                            str[1]             = extendedAttributeName;
                            throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.SearchConverterSupportedOperatorListErrorMessage, str));
                        }
                    }
                    else
                    {
                        object[] type = new object[2];
                        type[0] = rightNode.DataObject.GetType();
                        type[1] = extendedAttributeName;
                        throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.SearchConverterRHSInvalidType, type));
                    }
                }
                else
                {
                    throw new ArgumentException(StringResources.SearchConverterRHSNotDataNode);
                }
            }
            else
            {
                throw new ArgumentException(StringResources.SearchConverterNotBinaryNode);
            }
        }
Exemplo n.º 3
0
 internal static IADOPathNode ToSearchMultivalueObject(string extendedAttributeName, string[] directoryAttributes, IADOPathNode filterClause, CmdletSessionInfo cmdletSessionInfo)
 {
     return(SearchConverters.ToSearchObject(extendedAttributeName, directoryAttributes, filterClause, cmdletSessionInfo));
 }