示例#1
0
        ObjectAttribute ReadAttribute(LdapStreamReader reader)
        {
            List <string>   attributes = new List <string> ();
            ObjectAttribute attribute  = new ObjectAttribute();

            attribute.Type = reader.ReadStringElement();
            LdapStreamReader valueReader = reader.GetElementReader(0x31);

            while (valueReader.Peek() != -1)
            {
                attributes.Add(valueReader.ReadStringElement());
            }
            attribute.Values = attributes.ToArray();

            return(attribute);
        }
示例#2
0
        Dictionary <string, ObjectAttribute> ReadAttributes(LdapStreamReader reader)
        {
            Dictionary <string, ObjectAttribute> attributes = new Dictionary <string, ObjectAttribute> ();

            while (true)
            {
                int nextByte = reader.Peek();
                if (nextByte == 0x30)
                {
                    ObjectAttribute attribute = ReadAttribute(reader.GetElementReader(0x30));
                    attributes.Add(attribute.Type, attribute);
                }
                else if (nextByte == -1)
                {
                    break;
                }
            }

            return(attributes);
        }