public byte[] Encode(int type)
        {
            switch (type)
            {
            case 3:
            {
                LDAPBindResponse protocolOp = (LDAPBindResponse)this.ProtocolOp;
                return(BerConverter.Encode("{it{eooto}}", this.MessageID, 0x61, protocolOp.ResultCode, protocolOp.MatchedDN, protocolOp.DiagnosticMessage, 0x87, protocolOp.ServerSaslCreds));
            }

            case 4:
            {
                LDAPSearchResEntry protocolOp = (LDAPSearchResEntry)this.ProtocolOp;
                return(BerConverter.Encode("{it{sto}}", this.MessageID, 0x64, protocolOp.ObjectDN, 0x30, protocolOp.Attributes));
            }

            case 5:
            {
                LDAPSearchResDone protocolOp = (LDAPSearchResDone)this.ProtocolOp;
                return(BerConverter.Encode("{it{eoo}}", this.MessageID, 0x65, protocolOp.ResultCode, protocolOp.MatchedDN, protocolOp.ErrorMessage));
            }
            }

            return(null);
        }
 public byte[] Encode(LDAPSearchResDone resdone)
 {
     return(BerConverter.Encode("{it{eoo}}", this.MessageID, 0x65, resdone.ResultCode, resdone.MatchedDN, resdone.ErrorMessage));
 }