internal static void ToExtendedADSuggestedValueEntryListFromXml(string extendedAttribute, string[] directoryAttributes, ADEntity userObj, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo) { if (!directoryObj.Contains(directoryAttributes[0])) { ADPropertyValueCollection aDPropertyValueCollection = new ADPropertyValueCollection(null); userObj.Add(extendedAttribute, aDPropertyValueCollection); } else { string value = (string)directoryObj[directoryAttributes[0]].Value; try { bool flag = false; List <ADSuggestedValueEntry> suggestedValueEntryList = ADCBACUtil.ConvertSuggestedValueXmlToSuggestedValueEntryList(value, out flag); ADPropertyValueCollection aDPropertyValueCollection1 = new ADPropertyValueCollection(suggestedValueEntryList.ToArray()); userObj.Add(extendedAttribute, aDPropertyValueCollection1); if (flag) { object[] objArray = new object[2]; objArray[0] = directoryObj["name"].Value; objArray[1] = "msDS-ClaimPossibleValues"; cmdletSessionInfo.CmdletMessageWriter.WriteWarningBuffered(string.Format(CultureInfo.CurrentCulture, StringResources.NextVersionPossibleValuesXml, objArray)); } } catch (Exception exception1) { Exception exception = exception1; if (exception as XmlException != null || exception as XmlSchemaException != null || exception as InvalidOperationException != null) { object[] value1 = new object[1]; value1[0] = directoryObj["distinguishedName"].Value; cmdletSessionInfo.CmdletMessageWriter.WriteWarningBuffered(string.Format(CultureInfo.CurrentCulture, StringResources.InvalidPossibleValuesXml, value1)); ADPropertyValueCollection aDPropertyValueCollection2 = new ADPropertyValueCollection(null); userObj.Add(extendedAttribute, aDPropertyValueCollection2); } else { throw; } } } }
internal static bool VerifyAndSetPossibleValues(ADObject directoryObj, ADClaimValueType valueType, StringBuilder errorBuffer) { bool flag = false; if (directoryObj.InternalProperties.Contains("SuggestedValues") && directoryObj.InternalProperties["SuggestedValues"].Value != null) { if (directoryObj.Contains("msDS-ClaimPossibleValues") && directoryObj["msDS-ClaimPossibleValues"].Value != null) { bool flag1 = false; try { ADCBACUtil.ConvertSuggestedValueXmlToSuggestedValueEntryList(directoryObj["msDS-ClaimPossibleValues"].Value as string, out flag1); if (flag1) { flag = true; object[] value = new object[2]; value[0] = directoryObj["name"].Value as string; value[1] = "msDS-ClaimPossibleValues"; errorBuffer.AppendLine(string.Format(CultureInfo.CurrentCulture, StringResources.CannotOverwriteNextVersionXml, value)); } } catch (Exception exception1) { Exception exception = exception1; if (exception as XmlException == null && exception as XmlSchemaException == null && exception as InvalidOperationException == null) { throw; } } } if (!flag) { ADSuggestedValueEntry[] valueList = directoryObj.InternalProperties["SuggestedValues"].ValueList as ADSuggestedValueEntry[]; ADCBACUtil.AddSuggestedValueXmlFromADSuggestedValueEntryList(valueList, directoryObj, valueType); } } return(!flag); }