filterToString() public method

Creates and returns a String representation of this filter.
public filterToString ( ) : System.String
return System.String
示例#1
0
文件: LdapServer.cs 项目: MrJoe/lat
        /// <summary>Searches the directory
        /// </summary>
        /// <param name="searchBase">Where to start the search</param>
        /// <param name="searchScope">Scope of search</param>
        /// <param name="searchFilter">Filter to search for</param>
        /// <param name="searchAttrs">Attributes to search for</param>
        /// <returns>List of entries matching filter</returns>
        public LdapEntry[] Search(string searchBase, int searchScope, string searchFilter, string[] searchAttrs)
        {
            if (!conn.Connected)
                return null;

            try {

                List<LdapEntry> retVal = new List<LdapEntry> ();
                RfcFilter rfcFilter = new RfcFilter (searchFilter);

                LdapSearchConstraints cons = new LdapSearchConstraints ();
                cons.MaxResults = 0;

                LdapSearchQueue queue = conn.Search (searchBase,
                        searchScope,
                        rfcFilter.filterToString(),
                        searchAttrs,
                        false,
                        (LdapSearchQueue) null,
                        cons);

                LdapMessage msg;

                while ((msg = queue.getResponse ()) != null) {

                    if (msg is LdapSearchResult) {
                        LdapEntry entry = ((LdapSearchResult) msg).Entry;
                        retVal.Add (entry);
                    }
                }

                return retVal.ToArray ();

            } catch (Exception e) {

                Log.Debug (e);
                return null;
            }
        }