public override async Task ReadContentsAsync(LDAPReader reader) { var msgReader = reader.CreateReader(); await msgReader.ReadAsync(); DistinguishedName = await msgReader.ReadAsStringAsync(); if (await msgReader.ReadAsync()) { Attributes = (await msgReader.ReadPartialListAsync()).ToArray(); } }
public virtual async Task ReadContentsAsync(LDAPReader reader) { // Validate the state of the reader if (reader.Tag != (int)Operation || reader.Scope != EncodingScope.APPLICATION) { throw new LDAPProtocolException("Invalid cast to response"); } var contentReader = reader.CreateReader(); await contentReader.GuardAsync((int)EncodingType.ENUMERATED); ResultCode = await contentReader.ReadAsIntAsync(); await contentReader.GuardAsync((int)EncodingType.OCTET_STRING); MatchedDN = await contentReader.ReadAsStringAsync(); await contentReader.GuardAsync((int)EncodingType.OCTET_STRING); DiagnosticMessage = await contentReader.ReadAsStringAsync(); // check for more data if (await contentReader.ReadAsync()) { // May be optional referral or additional data from request if (contentReader.Tag == 3 && contentReader.Scope == EncodingScope.CONTEXT_SPECIFIC) { // Read the referral await contentReader.SkipAsync(); if (await contentReader.ReadAsync()) { await ReadResponseAsync(contentReader); } } else { await ReadResponseAsync(contentReader); } } }