Beispiel #1
0
		public static IADOPathNode ToSearchAccountExpirationDate(string extendedAttribute, string[] directoryAttributes, IADOPathNode filterClause, CmdletSessionInfo cmdletSessionInfo)
		{
			bool flag;
			BinaryADOPathNode binaryADOPathNode = filterClause as BinaryADOPathNode;
			if (binaryADOPathNode == null)
			{
				throw new ArgumentException(StringResources.SearchConverterNotBinaryNode);
			}
			else
			{
				PropertyADOPathNode propertyADOPathNode = new PropertyADOPathNode(directoryAttributes[0]);
				IDataNode rightNode = binaryADOPathNode.RightNode as IDataNode;
				if (rightNode == null)
				{
					throw new ArgumentException(StringResources.SearchConverterRHSNotDataNode);
				}
				else
				{
					ObjectADOPathNode objectADOPathNode = new ObjectADOPathNode(rightNode.DataObject);
					objectADOPathNode.EncodeAsteriskChar = rightNode.EncodeAsteriskChar;
					IADOPathNode searchDateTimeUsingSchemaInfo = new BinaryADOPathNode(binaryADOPathNode.Operator, propertyADOPathNode, objectADOPathNode);
					searchDateTimeUsingSchemaInfo = SearchConverters.ToSearchDateTimeUsingSchemaInfo(extendedAttribute, directoryAttributes, searchDateTimeUsingSchemaInfo, cmdletSessionInfo);
					bool flag1 = true;
					if (binaryADOPathNode.Operator != ADOperator.Eq)
					{
						if (binaryADOPathNode.Operator == ADOperator.Like)
						{
							if (rightNode.DataObject as string == null)
							{
								flag = false;
							}
							else
							{
								flag = ADOPathUtil.IsValueAllAsterisk((string)rightNode.DataObject);
							}
							flag1 = flag;
						}
					}
					else
					{
						flag1 = false;
					}
					if (!flag1)
					{
						return searchDateTimeUsingSchemaInfo;
					}
					else
					{
						IADOPathNode[] aDOPathNodeArray = new IADOPathNode[2];
						aDOPathNodeArray[0] = ADOPathUtil.CreateFilterClause(ADOperator.Eq, directoryAttributes[0], 0);
						aDOPathNodeArray[1] = ADOPathUtil.CreateFilterClause(ADOperator.Eq, directoryAttributes[0], 0x7fffffffffffffffL);
						IADOPathNode aDOPathNode = ADOPathUtil.CreateNotClause(ADOPathUtil.CreateOrClause(aDOPathNodeArray));
						IADOPathNode[] aDOPathNodeArray1 = new IADOPathNode[2];
						aDOPathNodeArray1[0] = searchDateTimeUsingSchemaInfo;
						aDOPathNodeArray1[1] = aDOPathNode;
						return ADOPathUtil.CreateAndClause(aDOPathNodeArray1);
					}
				}
			}
		}
Beispiel #2
0
        public static IADOPathNode CreateFilterClause(ADOperator op, string attributeName, object value)
        {
            IADOPathNode objectADOPathNode;
            IADOPathNode propertyADOPathNode = new PropertyADOPathNode(attributeName);
            string       str = value as string;

            if (str == null)
            {
                objectADOPathNode = new ObjectADOPathNode(value);
            }
            else
            {
                objectADOPathNode = new TextDataADOPathNode(str);
            }
            return(ADOPathUtil.CreateRelationalExpressionNode(op, propertyADOPathNode, objectADOPathNode, null));
        }
Beispiel #3
0
		public static IADOPathNode ToSearchGroupScope(string extendedAttributeName, string[] directoryAttributes, IADOPathNode filterClause, CmdletSessionInfo cmdletSessionInfo)
		{
			ADGroupScope aDGroupScope = ADGroupScope.DomainLocal;
			BinaryADOPathNode binaryADOPathNode = filterClause as BinaryADOPathNode;
			if (binaryADOPathNode == null)
			{
				throw new ArgumentException(StringResources.SearchConverterNotBinaryNode);
			}
			else
			{
				if (binaryADOPathNode.Operator == ADOperator.Eq || binaryADOPathNode.Operator == ADOperator.Ne)
				{
					IDataNode rightNode = binaryADOPathNode.RightNode as IDataNode;
					if (rightNode == null)
					{
						throw new ArgumentException(StringResources.SearchConverterRHSNotDataNode);
					}
					else
					{
						if (!Utils.TryParseEnum<ADGroupScope>(rightNode.DataObject.ToString(), out aDGroupScope))
						{
							object[] str = new object[2];
							str[0] = rightNode.DataObject.ToString();
							str[1] = extendedAttributeName;
							throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.SearchConverterInvalidValue, str));
						}
						else
						{
							PropertyADOPathNode propertyADOPathNode = new PropertyADOPathNode(directoryAttributes[0]);
							ObjectADOPathNode objectADOPathNode = new ObjectADOPathNode((object)GroupTypeUtils.GetDirectoryGroupTypeValue(aDGroupScope));
							IADOPathNode aDOPathNode = new BinaryADOPathNode(ADOperator.Band, propertyADOPathNode, objectADOPathNode);
							if (binaryADOPathNode.Operator != ADOperator.Eq)
							{
								return ADOPathUtil.CreateNotClause(aDOPathNode);
							}
							else
							{
								return aDOPathNode;
							}
						}
					}
				}
				else
				{
					object[] objArray = new object[2];
					ADOperator[] aDOperatorArray = new ADOperator[2];
					aDOperatorArray[1] = ADOperator.Ne;
					objArray[0] = SearchConverters.ConvertOperatorListToString(aDOperatorArray);
					objArray[1] = extendedAttributeName;
					throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, StringResources.SearchConverterSupportedOperatorListErrorMessage, objArray));
				}
			}
		}
Beispiel #4
0
		public static IADOPathNode CreateFilterClause(ADOperator op, string attributeName, object value)
		{
			IADOPathNode objectADOPathNode;
			IADOPathNode propertyADOPathNode = new PropertyADOPathNode(attributeName);
			string str = value as string;
			if (str == null)
			{
				objectADOPathNode = new ObjectADOPathNode(value);
			}
			else
			{
				objectADOPathNode = new TextDataADOPathNode(str);
			}
			return ADOPathUtil.CreateRelationalExpressionNode(op, propertyADOPathNode, objectADOPathNode, null);
		}