Exemplo n.º 1
0
        public DistinguishedName(string dn) : this()
        {
            if (String.IsNullOrEmpty(dn))
            {
                // Empty DN
                return;
            }

            string[] dnSegments = SplitDN(dn, false);
            foreach (string segment in dnSegments)
            {
                string[] rdnSegments = SplitDN(segment, true);
                if (rdnSegments.Length != 2)
                {
                    throw new ArgumentException(Resources.DNParsingErrorMessage, "dn");
                }
                try
                {
                    var component = new DistinguishedNameComponent(rdnSegments[0].Trim(), rdnSegments[1].Trim());
                    this.Components.Add(component);
                }
                catch (ArgumentNullException)
                {
                    throw new ArgumentException(Resources.DNParsingErrorMessage, "dn");
                }
            }
        }
Exemplo n.º 2
0
        public void AddParent(string name, string value)
        {
            // Validation will be done in the DistinguishedNameComponent constructor
            var component = new DistinguishedNameComponent(name, value);

            this.AddParent(component);
        }
Exemplo n.º 3
0
 public void AddChild(DistinguishedNameComponent component)
 {
     if (component != null)
     {
         this.Components.Insert(0, component);
     }
 }
Exemplo n.º 4
0
 public void AddParent(DistinguishedNameComponent component)
 {
     if (component != null)
     {
         this.Components.Add(component);
     }
 }
Exemplo n.º 5
0
        public void AddChild(string name, string value)
        {
            // Validation will be performed by the DistinguishedNameComponent contructor.
            var component = new DistinguishedNameComponent(name, value);

            this.AddChild(component);
        }
Exemplo n.º 6
0
 public DistinguishedName(string dn)
 {
     this.Components = new List<DistinguishedNameComponent>();
     if(String.IsNullOrEmpty(dn))
     {
         // Empty DN
         return;
     }
     string[] dnSegments = SplitDN(dn, false);
     foreach (string segment in dnSegments)
     {
         string[] rdnSegments = SplitDN(segment, true);
         if (rdnSegments.Length != 2)
         {
             throw new ArgumentException(Resources.DNParsingErrorMessage, "dn");
         }
         try
         {
             var component = new DistinguishedNameComponent(rdnSegments[0].Trim(), rdnSegments[1].Trim());
             this.Components.Add(component);
         }
         catch(ArgumentNullException)
         {
             throw new ArgumentException(Resources.DNParsingErrorMessage, "dn");
         }
     }
 }
Exemplo n.º 7
0
 public DistinguishedName(DistinguishedNameComponent rdn) : this()
 {
     this.AddParent(rdn);
 }
Exemplo n.º 8
0
 public void AddChild(string name, string value)
 {
     var component = new DistinguishedNameComponent(name, value);
     this.AddChild(component);
 }
Exemplo n.º 9
0
 public void AddParent(DistinguishedNameComponent component)
 {
     this.Components.Add(component);
 }
Exemplo n.º 10
0
 public void AddChild(DistinguishedNameComponent component)
 {
     this.Components.Insert(0, component);
 }
Exemplo n.º 11
0
        public void AddParent(string name, string value)
        {
            var component = new DistinguishedNameComponent(name, value);

            this.AddParent(component);
        }