internal static IADOPathNode ToSearchUsingSchemaInfo(string extendedAttributeName, string[] directoryAttributes, IADOPathNode filterClause, CmdletSessionInfo cmdletSessionInfo) { ADTypeConverter aDTypeConverter = new ADTypeConverter(cmdletSessionInfo.ADSessionInfo); BinaryADOPathNode binaryADOPathNode = filterClause as BinaryADOPathNode; if (binaryADOPathNode == null) { throw new ArgumentException(StringResources.SearchConverterNotBinaryNode); } else { PropertyADOPathNode propertyADOPathNode = new PropertyADOPathNode(directoryAttributes[0]); ObjectADOPathNode objectADOPathNode = new ObjectADOPathNode(null); IDataNode rightNode = binaryADOPathNode.RightNode as IDataNode; if (rightNode == null) { throw new ArgumentException(StringResources.SearchConverterRHSNotDataNode); } else { object raw = aDTypeConverter.ConvertToRaw(directoryAttributes[0], rightNode.DataObject); objectADOPathNode.DataObject = raw; objectADOPathNode.EncodeAsteriskChar = rightNode.EncodeAsteriskChar; return(new BinaryADOPathNode(binaryADOPathNode.Operator, propertyADOPathNode, objectADOPathNode)); } } }
internal static IADOPathNode BuildSearchFilter(IADOPathNode filter, MappingTable <AttributeConverterEntry> attrMapBaseObj, MappingTable <AttributeConverterEntry> attrMapChildObj, CmdletSessionInfo sessionInfo) { BinaryADOPathNode binaryADOPathNode = filter as BinaryADOPathNode; if (binaryADOPathNode == null) { return(null); } else { string ldapFilterString = binaryADOPathNode.LeftNode.GetLdapFilterString(); AttributeConverterEntry attributeConverterEntry = null; if (!attrMapBaseObj.TryGetValue(ldapFilterString, out attributeConverterEntry)) { if (!attrMapChildObj.TryGetValue(ldapFilterString, out attributeConverterEntry)) { string[] strArrays = new string[1]; strArrays[0] = ldapFilterString; return(SearchConverters.ToSearchObjectClientSideFilter(ldapFilterString, strArrays, filter, sessionInfo)); } else { return(attributeConverterEntry.InvokeToSearcherConverter(filter, sessionInfo)); } } else { return(attributeConverterEntry.InvokeToSearcherConverter(filter, sessionInfo)); } } }
internal virtual IADOPathNode BuildSearchFilter(IADOPathNode filter) { if (this.CmdletSessionInfo != null) { MappingTable <AttributeConverterEntry> item = ADFactoryBase <T> .AttributeTable[this.ConnectedStore]; BinaryADOPathNode binaryADOPathNode = filter as BinaryADOPathNode; if (binaryADOPathNode == null) { return(null); } else { string ldapFilterString = binaryADOPathNode.LeftNode.GetLdapFilterString(); AttributeConverterEntry attributeConverterEntry = null; if (!item.TryGetValue(ldapFilterString, out attributeConverterEntry)) { string[] strArrays = new string[1]; strArrays[0] = ldapFilterString; return(SearchConverters.ToSearchUsingSchemaInfo(ldapFilterString, strArrays, filter, this.CmdletSessionInfo)); } else { return(attributeConverterEntry.InvokeToSearcherConverter(filter, this.CmdletSessionInfo)); } } } else { throw new ArgumentNullException(StringResources.SessionRequired); } }
internal static IADOPathNode ToSearchFlagInInt(int bit, bool isInverted, 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(ADOperator.Bor, new PropertyADOPathNode(directoryAttributes[0]), new ObjectADOPathNode((object)bit)); bool dataObject = !(bool)rightNode.DataObject; if (@operator == ADOperator.Ne) { dataObject = !dataObject; } if (isInverted) { dataObject = !dataObject; } if (dataObject) { aDOPathNode = ADOPathUtil.CreateNotClause(aDOPathNode); } return(aDOPathNode); } 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); } }
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); } }
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)); } } }
internal static IADOPathNode BuildIPFilter(string extendedAttribute, string directoryAttribute, IADOPathNode filterClause, IPUtil.IPVersion ipVersion) { BinaryADOPathNode binaryADOPathNode = filterClause as BinaryADOPathNode; if (binaryADOPathNode != null) { IDataNode rightNode = binaryADOPathNode.RightNode as IDataNode; if (rightNode != null) { if (rightNode.DataObject as string != null) { ADOperator @operator = binaryADOPathNode.Operator; if (@operator == ADOperator.Eq || @operator == ADOperator.Ne) { return(IPUtil.BuildHostFilterFromIP(rightNode.DataObject as string, ipVersion, extendedAttribute, directoryAttribute, @operator)); } else { object[] str = new object[2]; ADOperator[] aDOperatorArray = new ADOperator[2]; aDOperatorArray[1] = ADOperator.Ne; str[0] = SearchConverters.ConvertOperatorListToString(aDOperatorArray); str[1] = extendedAttribute; throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.SearchConverterSupportedOperatorListErrorMessage, str)); } } 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); } }
internal static IADOPathNode ToSearchMultivalueCertificate(string extendedAttribute, string[] directoryAttributes, IADOPathNode filterClause, CmdletSessionInfo cmdletSessionInfo) { 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 { X509Certificate dataObject = rightNode.DataObject as X509Certificate; if (dataObject != null) { IADOPathNode aDOPathNode = ADOPathUtil.CreateFilterClause(binaryADOPathNode.Operator, directoryAttributes[0], dataObject.GetRawCertData()); return(aDOPathNode); } else { throw new ArgumentException(StringResources.SearchConverterInvalidValue); } } } else { object[] str = new object[2]; ADOperator[] aDOperatorArray = new ADOperator[2]; aDOperatorArray[1] = ADOperator.Ne; str[0] = SearchConverters.ConvertOperatorListToString(aDOperatorArray); str[1] = extendedAttribute; throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, StringResources.SearchConverterSupportedOperatorListErrorMessage, str)); } } }
internal static IADOPathNode ToSearchEnum <T>(string extendedAttributeName, string[] directoryAttributes, IADOPathNode filterClause, CmdletSessionInfo cmdletSessionInfo) { T t = default(T); BinaryADOPathNode binaryADOPathNode = filterClause as BinaryADOPathNode; if (binaryADOPathNode == null) { throw new ArgumentException(StringResources.SearchConverterNotBinaryNode); } else { PropertyADOPathNode propertyADOPathNode = new PropertyADOPathNode(directoryAttributes[0]); ObjectADOPathNode objectADOPathNode = new ObjectADOPathNode(null); IDataNode rightNode = binaryADOPathNode.RightNode as IDataNode; if (rightNode == null) { throw new ArgumentException(StringResources.SearchConverterRHSNotDataNode); } else { if (!Utils.TryParseEnum <T>(rightNode.DataObject.ToString(), out t)) { object[] objArray = new object[1]; objArray[0] = extendedAttributeName; throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.SearchConverterRHSNotMatchEnumValue, objArray)); } else { if (Enum.GetUnderlyingType(typeof(T)) != typeof(int)) { objectADOPathNode.DataObject = Convert.ToInt64(t, CultureInfo.InvariantCulture); } else { objectADOPathNode.DataObject = Convert.ToInt32(t, CultureInfo.InvariantCulture); } return(new BinaryADOPathNode(binaryADOPathNode.Operator, propertyADOPathNode, objectADOPathNode)); } } } }
internal static IADOPathNode ToSearchObject(string extendedAttributeName, string[] directoryAttributes, IADOPathNode filterClause, CmdletSessionInfo cmdletSessionInfo) { BinaryADOPathNode binaryADOPathNode = filterClause as BinaryADOPathNode; if (binaryADOPathNode != null) { PropertyADOPathNode propertyADOPathNode = new PropertyADOPathNode(directoryAttributes[0]); IDataNode rightNode = binaryADOPathNode.RightNode as IDataNode; if (rightNode != null) { return(new BinaryADOPathNode(binaryADOPathNode.Operator, propertyADOPathNode, binaryADOPathNode.RightNode)); } else { throw new ArgumentException(StringResources.SearchConverterRHSNotDataNode); } } else { throw new ArgumentException(StringResources.SearchConverterNotBinaryNode); } }
private static IADOPathNode BuildGPLinkFilter(string extendedAttribute, string directoryAttribute, IADOPathNode filterClause) { 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) { ADOperator @operator = binaryADOPathNode.Operator; if (@operator == ADOperator.Eq || @operator == ADOperator.Ne || @operator == ADOperator.Like || @operator == ADOperator.NotLike) { if (@operator != ADOperator.Eq) { if (@operator == ADOperator.Ne) { dataObject = ADOPathUtil.LdapSearchEncodeString(dataObject, true); @operator = ADOperator.NotLike; } } else { dataObject = ADOPathUtil.LdapSearchEncodeString(dataObject, true); @operator = ADOperator.Like; } dataObject = string.Concat(GPLinkUtil.GpLinkFilterPrefix, dataObject, GPLinkUtil.GpLinkFilterSuffix); return(ADOPathUtil.CreateFilterClause(@operator, directoryAttribute, dataObject)); } else { object[] str = new object[2]; ADOperator[] aDOperatorArray = new ADOperator[4]; aDOperatorArray[1] = ADOperator.Ne; aDOperatorArray[2] = ADOperator.Like; aDOperatorArray[3] = ADOperator.NotLike; str[0] = SearchConverters.ConvertOperatorListToString(aDOperatorArray); str[1] = extendedAttribute; throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.SearchConverterSupportedOperatorListErrorMessage, str)); } } 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); } }
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)); } } } }
internal static IADOPathNode ToSearchNegativeTimeSpan(string extendedAttributeName, string[] directoryAttributes, IADOPathNode filterClause, CmdletSessionInfo cmdletSessionInfo) { TimeSpan timeSpan; BinaryADOPathNode binaryADOPathNode = filterClause as BinaryADOPathNode; if (binaryADOPathNode != null) { PropertyADOPathNode propertyADOPathNode = new PropertyADOPathNode(directoryAttributes[0]); TextDataADOPathNode textDataADOPathNode = new TextDataADOPathNode(""); IDataNode rightNode = binaryADOPathNode.RightNode as IDataNode; if (rightNode != null) { if (!(rightNode.DataObject is TimeSpan)) { if (!(rightNode.DataObject is long) || !(rightNode.DataObject is int)) { long dataObject = (long)rightNode.DataObject; long num = -Math.Abs(dataObject); textDataADOPathNode.TextValue = num.ToString(); } else { if (rightNode.DataObject as string == null) { object[] type = new object[2]; type[0] = rightNode.DataObject.GetType(); type[1] = directoryAttributes[0]; throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.SearchConverterUnrecognizedObjectType, type)); } else { if (!TimeSpan.TryParse((string)rightNode.DataObject, out timeSpan)) { textDataADOPathNode.TextValue = (string)rightNode.DataObject; } else { long num1 = -Math.Abs(timeSpan.Ticks); textDataADOPathNode.TextValue = num1.ToString(); } } } } else { TimeSpan dataObject1 = (TimeSpan)rightNode.DataObject; long num2 = -Math.Abs(dataObject1.Ticks); textDataADOPathNode.TextValue = num2.ToString(); } ADOperator @operator = binaryADOPathNode.Operator; ADOperator aDOperator = @operator; switch (aDOperator) { case ADOperator.Le: { @operator = ADOperator.Ge; break; } case ADOperator.Ge: { @operator = ADOperator.Le; break; } case ADOperator.Lt: { @operator = ADOperator.Gt; break; } case ADOperator.Gt: { @operator = ADOperator.Lt; break; } } return(new BinaryADOPathNode(@operator, propertyADOPathNode, textDataADOPathNode)); } else { throw new ArgumentException(StringResources.SearchConverterRHSNotDataNode); } } else { throw new ArgumentException(StringResources.SearchConverterNotBinaryNode); } }
internal static IADOPathNode ToSearchGuid(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) { ADOperator @operator = binaryADOPathNode.Operator; if (@operator == ADOperator.Eq || @operator == ADOperator.Ne) { byte[] byteArray = null; if (!(rightNode.DataObject is Guid)) { if (rightNode.DataObject as byte[] == null) { if (rightNode.DataObject as string == null) { object[] type = new object[2]; type[0] = rightNode.DataObject.GetType(); type[1] = extendedAttributeName; throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.SearchConverterUnrecognizedObjectType, type)); } else { Guid?nullable = null; if (!Utils.TryParseGuid((string)rightNode.DataObject, out nullable)) { return(ADOPathUtil.CreateFilterClause(@operator, directoryAttributes[0], rightNode.DataObject)); } else { Guid value = nullable.Value; byteArray = value.ToByteArray(); } } } else { byteArray = (byte[])rightNode.DataObject; } } else { Guid dataObject = (Guid)rightNode.DataObject; byteArray = dataObject.ToByteArray(); } return(ADOPathUtil.CreateFilterClause(@operator, directoryAttributes[0], byteArray)); } 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 { throw new ArgumentException(StringResources.SearchConverterRHSNotDataNode); } } else { throw new ArgumentException(StringResources.SearchConverterNotBinaryNode); } }
internal static IADOPathNode ToSearchFromADEntityToAttributeValue <F, O>(string searchBase, string attributeName, string extendedAttributeName, string[] directoryAttributes, IADOPathNode filterClause, CmdletSessionInfo cmdletSessionInfo) where F : ADFactory <O>, new() where O : ADEntity, new() { ADEntity extendedObjectFromIdentity; IADOPathNode binaryADOPathNode; BinaryADOPathNode binaryADOPathNode1 = filterClause as BinaryADOPathNode; if (binaryADOPathNode1 == null) { throw new ArgumentException(StringResources.SearchConverterNotBinaryNode); } else { if (binaryADOPathNode1.Operator == ADOperator.Eq || binaryADOPathNode1.Operator == ADOperator.Ne) { IDataNode rightNode = binaryADOPathNode1.RightNode as IDataNode; if (rightNode == null) { throw new ArgumentException(StringResources.SearchConverterRHSNotDataNode); } else { PropertyADOPathNode propertyADOPathNode = new PropertyADOPathNode(directoryAttributes[0]); ObjectADOPathNode objectADOPathNode = new ObjectADOPathNode(null); O dataObject = (O)(rightNode.DataObject as O); if (dataObject == null) { string str = rightNode.DataObject as string; if (str != null) { dataObject = Activator.CreateInstance <O>(); dataObject.Identity = str; } } if (dataObject == null) { object[] objArray = new object[2]; objArray[0] = rightNode.DataObject.ToString(); objArray[1] = extendedAttributeName; throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.SearchConverterInvalidValue, objArray)); } else { F f = Activator.CreateInstance <F>(); f.SetCmdletSessionInfo(cmdletSessionInfo); try { if (attributeName != null) { HashSet <string> strs = new HashSet <string>(StringComparer.OrdinalIgnoreCase); strs.Add(attributeName); extendedObjectFromIdentity = f.GetExtendedObjectFromIdentity(dataObject, searchBase, strs, false); objectADOPathNode.DataObject = (string)extendedObjectFromIdentity[attributeName].Value; } else { extendedObjectFromIdentity = f.GetDirectoryObjectFromIdentity(dataObject, searchBase); objectADOPathNode.DataObject = (string)extendedObjectFromIdentity["DistinguishedName"].Value; } binaryADOPathNode = new BinaryADOPathNode(binaryADOPathNode1.Operator, propertyADOPathNode, objectADOPathNode); } catch (ADIdentityNotFoundException aDIdentityNotFoundException1) { ADIdentityNotFoundException aDIdentityNotFoundException = aDIdentityNotFoundException1; object[] message = new object[2]; message[0] = extendedAttributeName; message[1] = aDIdentityNotFoundException.Message; throw new ADIdentityResolutionException(string.Format(CultureInfo.CurrentCulture, StringResources.IdentityInExtendedAttributeCannotBeResolved, message), aDIdentityNotFoundException); } catch (ADIdentityResolutionException aDIdentityResolutionException1) { ADIdentityResolutionException aDIdentityResolutionException = aDIdentityResolutionException1; object[] message1 = new object[2]; message1[0] = extendedAttributeName; message1[1] = aDIdentityResolutionException.Message; throw new ADIdentityResolutionException(string.Format(CultureInfo.CurrentCulture, StringResources.IdentityInExtendedAttributeCannotBeResolved, message1), aDIdentityResolutionException); } return(binaryADOPathNode); } } } else { object[] str1 = new object[2]; ADOperator[] aDOperatorArray = new ADOperator[2]; aDOperatorArray[1] = ADOperator.Ne; str1[0] = SearchConverters.ConvertOperatorListToString(aDOperatorArray); str1[1] = extendedAttributeName; throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, StringResources.SearchConverterSupportedOperatorListErrorMessage, str1)); } } }
internal static IADOPathNode ToSearchFlagEnumerationInInt <T>(string extendedAttributeName, string[] directoryAttributes, IADOPathNode filterClause, CmdletSessionInfo cmdletSessionInfo) { T t = default(T); object num; IADOPathNode item; BinaryADOPathNode binaryADOPathNode = filterClause as BinaryADOPathNode; if (binaryADOPathNode != null) { IDataNode rightNode = binaryADOPathNode.RightNode as IDataNode; if (rightNode != null) { ADOperator @operator = binaryADOPathNode.Operator; if (@operator == ADOperator.Eq || @operator == ADOperator.Ne) { char[] chrArray = new char[1]; chrArray[0] = ','; string[] strArrays = rightNode.DataObject.ToString().Split(chrArray); List <IADOPathNode> aDOPathNodes = new List <IADOPathNode>(); string[] strArrays1 = strArrays; int num1 = 0; while (num1 < (int)strArrays1.Length) { string str = strArrays1[num1]; if (!Utils.TryParseEnum <T>(str, out t)) { object[] objArray = new object[1]; objArray[0] = extendedAttributeName; throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.SearchConverterRHSNotMatchEnumValue, objArray)); } else { if (Enum.GetUnderlyingType(typeof(T)) != typeof(int)) { num = Convert.ToInt64(t, CultureInfo.InvariantCulture); } else { num = Convert.ToInt32(t, CultureInfo.InvariantCulture); } IADOPathNode aDOPathNode = new BinaryADOPathNode(ADOperator.Bor, new PropertyADOPathNode(directoryAttributes[0]), new ObjectADOPathNode(num)); aDOPathNodes.Add(aDOPathNode); num1++; } } if (aDOPathNodes.Count <= 1) { if (aDOPathNodes.Count != 1) { object[] objArray1 = new object[1]; objArray1[0] = extendedAttributeName; throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.SearchConverterRHSNotMatchEnumValue, objArray1)); } else { item = aDOPathNodes[0]; } } else { item = ADOPathUtil.CreateAndClause(aDOPathNodes.ToArray()); } if (@operator == ADOperator.Ne) { item = ADOPathUtil.CreateNotClause(item); } return(item); } else { object[] str1 = new object[2]; ADOperator[] aDOperatorArray = new ADOperator[2]; aDOperatorArray[1] = ADOperator.Ne; str1[0] = SearchConverters.ConvertOperatorListToString(aDOperatorArray); str1[1] = extendedAttributeName; throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.SearchConverterSupportedOperatorListErrorMessage, str1)); } } else { throw new ArgumentException(StringResources.SearchConverterRHSNotDataNode); } } else { throw new ArgumentException(StringResources.SearchConverterNotBinaryNode); } }