Exemplo n.º 1
0
        /// <summary>
        /// Gets the specific DN component referenced in the ReferencedAttribute object
        /// </summary>
        /// <param name="dn">The DN string of an object</param>
        /// <param name="attribute">The ReferencedAttribute containing the DN and extraction parameters</param>
        /// <returns>A string containing the components of the DN referenced in the ReferenceAttribute object</returns>
        private string GetReferencedDNComponent(string dn, ReferencedAttribute attribute)
        {
            string valueToInsert = string.Empty;

            if (attribute.Count == 0)
            {
                valueToInsert = dn;
            }
            else
            {
                string[] split = DetachedUtils.SplitDN(dn);

                if (attribute.Count - 1 > split.Length)
                {
                    throw new ArgumentException("The referenced attribute specifies a DN component that doesnt exist: " + attribute.Declaration);
                }

                string rdn = split[attribute.Count - 1];

                if (attribute.Modifier == "+")
                {
                    valueToInsert = rdn;
                }
                else if (attribute.Modifier == "$")
                {
                    int indexOfEquals = rdn.IndexOf("=");
                    valueToInsert = rdn.Remove(0, indexOfEquals + 1);
                }
            }

            return(valueToInsert);
        }
Exemplo n.º 2
0
 private void ValidateAttributeChangeType(AttributeModificationType type)
 {
     DetachedUtils.ValidateAttributeModificationType(this.ModificationType, type);
 }