/// <summary> /// Continues the search for domain members from the specified record location. /// </summary> /// <param name="searchContext">Domain provider specific search context returned by FindFirstDomainMembers method.</param> /// <param name="offset">Record offset to return members from.</param> /// <param name="count">Maximum number of member objects to return.</param> /// <param name="memberList">Receives an array object that contains the domain Member objects.</param> /// <returns>True if there are more domain members. Otherwise false is returned.</returns> public bool FindSeekDomainMembers(ref string searchContext, int offset, int count, out Member[] memberList) { bool moreEntries = false; // Initialize the outputs. memberList = null; // See if there is a valid search context. SearchState searchState = SearchState.GetSearchState(searchContext); if (searchState != null) { // Make sure that the specified offset is valid. if ((offset >= 0) && (offset <= searchState.TotalRecords)) { // Set the cursor to the specified offset. if (searchState.Enumerator.SetCursor(Simias.Storage.Provider.IndexOrigin.SET, offset)) { // Reset the current record. searchState.CurrentRecord = offset; // Complete the search. moreEntries = FindNextDomainMembers(ref searchContext, count, out memberList); } } } return(moreEntries); }
/// <summary> /// End the search for domain members. /// </summary> /// <param name="searchContext">Domain provider specific search context returned by FindFirstDomainMembers or /// FindNextDomainMembers methods.</param> public void FindCloseDomainMembers(string searchContext) { // See if there is a valid search context. SearchState searchState = SearchState.GetSearchState(searchContext); if (searchState != null) { searchState.Dispose(); } }
/// <summary> /// Continues the search for domain members from the current record location. /// </summary> /// <param name="searchContext">Domain provider specific search context returned by FindFirstDomainMembers method.</param> /// <param name="count">Maximum number of member objects to return.</param> /// <param name="memberList">Receives an array object that contains the domain Member objects.</param> /// <returns>True if there are more domain members. Otherwise false is returned.</returns> public bool FindNextDomainMembers(ref string searchContext, int count, out Member[] memberList) { bool moreEntries = false; // Initialize the outputs. memberList = null; // See if there is a valid search context. SearchState searchState = SearchState.GetSearchState(searchContext); if (searchState != null) { // See if entries are to be returned. if (count > 0) { // Get the domain being searched. Domain domain = store.GetDomain(searchState.DomainID); if (domain != null) { // Allocate a list to hold the member objects. ArrayList tempList = new ArrayList(count); ICSEnumerator enumerator = searchState.Enumerator; while ((count > 0) && enumerator.MoveNext()) { // The enumeration returns ShallowNode objects. ShallowNode sn = enumerator.Current as ShallowNode; if (sn.Type == NodeTypes.MemberType) { tempList.Add(new Member(domain, sn)); --count; } } if (tempList.Count > 0) { memberList = tempList.ToArray(typeof(Member)) as Member[]; searchState.CurrentRecord += memberList.Length; searchState.LastCount = memberList.Length; moreEntries = (count == 0) ? true : false; } } } else { if (searchState.CurrentRecord < searchState.TotalRecords) { moreEntries = true; } } } return(moreEntries); }
/// <summary> /// Continues the search for domain members previous to the current record location. /// </summary> /// <param name="searchContext">Domain provider specific search context returned by FindFirstDomainMembers method.</param> /// <param name="count">Maximum number of member objects to return.</param> /// <param name="memberList">Receives an array object that contains the domain Member objects.</param> /// <returns>True if there are more domain members. Otherwise false is returned.</returns> public bool FindPreviousDomainMembers(ref string searchContext, int count, out Member[] memberList) { bool moreEntries = false; // Initialize the outputs. memberList = null; // See if there is a valid search context. SearchState searchState = SearchState.GetSearchState(searchContext); if (searchState != null) { // Backup the current cursor, but don't go passed the first record. if (searchState.CurrentRecord > 0) { bool invalidIndex = false; int cursorIndex = (searchState.CurrentRecord - (searchState.LastCount + count)); if (cursorIndex < 0) { invalidIndex = true; count = searchState.CurrentRecord - searchState.LastCount; cursorIndex = 0; } // Set the new index for the cursor. if (searchState.Enumerator.SetCursor(Simias.Storage.Provider.IndexOrigin.SET, cursorIndex)) { // Reset the current record. searchState.CurrentRecord = cursorIndex; // Complete the search. FindNextDomainMembers(ref searchContext, count, out memberList); if ((invalidIndex == false) && (memberList != null)) { moreEntries = true; } } } } return(moreEntries); }