예제 #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");
                }
            }
        }
예제 #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);
        }
예제 #3
0
 public void AddChild(DistinguishedNameComponent component)
 {
     if (component != null)
     {
         this.Components.Insert(0, component);
     }
 }
예제 #4
0
 public void AddParent(DistinguishedNameComponent component)
 {
     if (component != null)
     {
         this.Components.Add(component);
     }
 }
예제 #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);
        }
예제 #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");
         }
     }
 }
예제 #7
0
 public DistinguishedName(DistinguishedNameComponent rdn) : this()
 {
     this.AddParent(rdn);
 }
예제 #8
0
 public void AddChild(string name, string value)
 {
     var component = new DistinguishedNameComponent(name, value);
     this.AddChild(component);
 }
예제 #9
0
 public void AddParent(DistinguishedNameComponent component)
 {
     this.Components.Add(component);
 }
예제 #10
0
 public void AddChild(DistinguishedNameComponent component)
 {
     this.Components.Insert(0, component);
 }
예제 #11
0
        public void AddParent(string name, string value)
        {
            var component = new DistinguishedNameComponent(name, value);

            this.AddParent(component);
        }