Пример #1
0
        internal override void RestoreBookmark(ResultSetBookmark bookmark)
        {
            GlobalDebug.WriteLineIf(GlobalDebug.Info, "SAMMembersSet", "Restoring from bookmark");

            Debug.Assert(bookmark is SAMMembersSetBookmark);
            SAMMembersSetBookmark samBookmark = (SAMMembersSetBookmark)bookmark;

            _groupsToVisit        = samBookmark.groupsToVisit;
            _groupsVisited        = samBookmark.groupsVisited;
            _group                = samBookmark.group;
            _membersEnumerator    = samBookmark.membersEnumerator;
            _current              = samBookmark.current;
            _currentFakePrincipal = samBookmark.currentFakePrincipal;
            _currentForeign       = samBookmark.currentForeign;
            _foreignMembers       = samBookmark.foreignMembers;
            _foreignGroups        = samBookmark.foreignGroups;

            if (_foreignResultSet != null)
            {
                _foreignResultSet.Dispose();
            }

            _foreignResultSet = samBookmark.foreignResultSet;
            _atBeginning      = samBookmark.atBeginning;
        }
Пример #2
0
        internal override void RestoreBookmark(ResultSetBookmark bookmark)
        {
            ADDNLinkedAttrSetBookmark aDDNLinkedAttrSetBookmark = (ADDNLinkedAttrSetBookmark)bookmark;

            this.usersVisited               = aDDNLinkedAttrSetBookmark.usersVisited;
            this.groupsToVisit              = aDDNLinkedAttrSetBookmark.groupsToVisit;
            this.groupsVisited              = aDDNLinkedAttrSetBookmark.groupsVisited;
            this.storeCtx                   = aDDNLinkedAttrSetBookmark.storeCtx;
            this.current                    = aDDNLinkedAttrSetBookmark.current;
            this.returnedPrimaryGroup       = aDDNLinkedAttrSetBookmark.returnedPrimaryGroup;
            this.foreignMembersCurrentGroup = aDDNLinkedAttrSetBookmark.foreignMembersCurrentGroup;
            this.fakePrincipalMembers       = aDDNLinkedAttrSetBookmark.fakePrincipalMembers;
            this.foreignMembersToReturn     = aDDNLinkedAttrSetBookmark.foreignMembersToReturn;
            this.currentForeignPrincipal    = aDDNLinkedAttrSetBookmark.currentForeignPrincipal;
            this.currentForeignDE           = aDDNLinkedAttrSetBookmark.currentForeignDE;
            this.foreignGroups              = aDDNLinkedAttrSetBookmark.foreignGroups;
            if (this.queryMembersResults != null)
            {
                this.queryMembersResults.Dispose();
            }
            this.queryMembersResults           = aDDNLinkedAttrSetBookmark.queryMembersResults;
            this.queryMembersResultEnumerator  = aDDNLinkedAttrSetBookmark.queryMembersResultEnumerator;
            this.memberSearchResults           = aDDNLinkedAttrSetBookmark.memberSearchResults;
            this.memberSearchResultsEnumerator = aDDNLinkedAttrSetBookmark.memberSearchResultsEnumerator;
            this.atBeginning   = aDDNLinkedAttrSetBookmark.atBeginning;
            this.expansionMode = aDDNLinkedAttrSetBookmark.expansionMode;
            this.members       = aDDNLinkedAttrSetBookmark.members;
            this.membersEnum   = aDDNLinkedAttrSetBookmark.membersEnum;
            if (this.membersQueue != null)
            {
                this.membersQueue.Clear();
                if (aDDNLinkedAttrSetBookmark.membersQueue != null)
                {
                    foreach (IEnumerable enumerable in aDDNLinkedAttrSetBookmark.membersQueue)
                    {
                        this.membersQueue.Enqueue(enumerable);
                    }
                }
            }
            if (this.memberSearchersQueue != null)
            {
                foreach (DirectorySearcher directorySearcher in this.memberSearchersQueue)
                {
                    directorySearcher.Dispose();
                }
                this.memberSearchersQueue.Clear();
                if (aDDNLinkedAttrSetBookmark.memberSearcherQueue != null)
                {
                    foreach (DirectorySearcher directorySearcher1 in aDDNLinkedAttrSetBookmark.memberSearcherQueue)
                    {
                        this.memberSearchersQueue.Enqueue(directorySearcher1);
                    }
                }
            }
        }
Пример #3
0
        private bool ContainsEnumTest(Principal principal)
        {
            CheckDisposed();

            if (principal == null)
            {
                throw new ArgumentNullException("principal");
            }

            // Yes, this is potentially quite expensive.  Contains is unfortunately
            // an expensive operation to perform.
            lock (_resultSet)
            {
                ResultSetBookmark bookmark = null;

                try
                {
                    GlobalDebug.WriteLineIf(GlobalDebug.Info, "PrincipalCollection", "ContainsEnumTest: bookmarking");

                    bookmark = _resultSet.BookmarkAndReset();

                    PrincipalCollectionEnumerator containmentEnumerator =
                        new PrincipalCollectionEnumerator(
                            _resultSet,
                            this,
                            _removedValuesCompleted,
                            _removedValuesPending,
                            _insertedValuesCompleted,
                            _insertedValuesPending);

                    while (containmentEnumerator.MoveNext())
                    {
                        Principal p = containmentEnumerator.Current;

                        if (p.Equals(principal))
                        {
                            return(true);
                        }
                    }
                }
                finally
                {
                    if (bookmark != null)
                    {
                        GlobalDebug.WriteLineIf(GlobalDebug.Info, "PrincipalCollection", "ContainsEnumTest: restoring from bookmark");
                        _resultSet.RestoreBookmark(bookmark);
                    }
                }
            }

            return(false);
        }
Пример #4
0
        internal override void RestoreBookmark(ResultSetBookmark bookmark)
        {
            SAMMembersSetBookmark sAMMembersSetBookmark = (SAMMembersSetBookmark)bookmark;

            this.groupsToVisit        = sAMMembersSetBookmark.groupsToVisit;
            this.groupsVisited        = sAMMembersSetBookmark.groupsVisited;
            this.@group               = sAMMembersSetBookmark.@group;
            this.membersEnumerator    = sAMMembersSetBookmark.membersEnumerator;
            this.current              = sAMMembersSetBookmark.current;
            this.currentFakePrincipal = sAMMembersSetBookmark.currentFakePrincipal;
            this.currentForeign       = sAMMembersSetBookmark.currentForeign;
            this.foreignMembers       = sAMMembersSetBookmark.foreignMembers;
            this.foreignGroups        = sAMMembersSetBookmark.foreignGroups;
            if (this.foreignResultSet != null)
            {
                this.foreignResultSet.Dispose();
            }
            this.foreignResultSet = sAMMembersSetBookmark.foreignResultSet;
            this.atBeginning      = sAMMembersSetBookmark.atBeginning;
        }
Пример #5
0
        private bool ContainsEnumTest(Principal principal)
        {
            bool flag;

            this.CheckDisposed();
            if (principal != null)
            {
                lock (this.resultSet)
                {
                    ResultSetBookmark resultSetBookmark = null;
                    try
                    {
                        resultSetBookmark = this.resultSet.BookmarkAndReset();
                        PrincipalCollectionEnumerator principalCollectionEnumerator = new PrincipalCollectionEnumerator(this.resultSet, this, this.removedValuesCompleted, this.removedValuesPending, this.insertedValuesCompleted, this.insertedValuesPending);
                        while (principalCollectionEnumerator.MoveNext())
                        {
                            Principal current = principalCollectionEnumerator.Current;
                            if (!current.Equals(principal))
                            {
                                continue;
                            }
                            flag = true;
                            return(flag);
                        }
                    }
                    finally
                    {
                        if (resultSetBookmark != null)
                        {
                            this.resultSet.RestoreBookmark(resultSetBookmark);
                        }
                    }
                    return(false);
                }
                return(flag);
            }
            else
            {
                throw new ArgumentNullException("principal");
            }
        }
Пример #6
0
        void ICollection.CopyTo(Array array, int index)
        {
            CheckDisposed();

            // Parameter validation
            if (index < 0)
            {
                throw new ArgumentOutOfRangeException("index");
            }

            if (array == null)
            {
                throw new ArgumentNullException("array");
            }

            if (array.Rank != 1)
            {
                throw new ArgumentException(SR.PrincipalCollectionNotOneDimensional);
            }

            if (index >= array.GetLength(0))
            {
                throw new ArgumentException(SR.PrincipalCollectionIndexNotInArray);
            }

            ArrayList tempArray = new ArrayList();

            lock (_resultSet)
            {
                ResultSetBookmark bookmark = null;

                try
                {
                    GlobalDebug.WriteLineIf(GlobalDebug.Info, "PrincipalCollection", "CopyTo: bookmarking");

                    bookmark = _resultSet.BookmarkAndReset();

                    PrincipalCollectionEnumerator containmentEnumerator =
                        new PrincipalCollectionEnumerator(
                            _resultSet,
                            this,
                            _removedValuesCompleted,
                            _removedValuesPending,
                            _insertedValuesCompleted,
                            _insertedValuesPending);

                    int arraySize     = array.GetLength(0) - index;
                    int tempArraySize = 0;

                    while (containmentEnumerator.MoveNext())
                    {
                        tempArray.Add(containmentEnumerator.Current);
                        checked { tempArraySize++; }

                        // Make sure the array has enough space, allowing for the "index" offset.
                        // We check inline, rather than doing a PrincipalCollection.Count upfront,
                        // because counting is just as expensive as enumerating over all the results, so we
                        // only want to do it once.
                        if (arraySize < tempArraySize)
                        {
                            GlobalDebug.WriteLineIf(GlobalDebug.Warn,
                                                    "PrincipalCollection",
                                                    "CopyTo: array too small (has {0}, need >= {1}",
                                                    arraySize,
                                                    tempArraySize);

                            throw new ArgumentException(SR.PrincipalCollectionArrayTooSmall);
                        }
                    }
                }
                finally
                {
                    if (bookmark != null)
                    {
                        GlobalDebug.WriteLineIf(GlobalDebug.Info, "PrincipalCollection", "CopyTo: restoring from bookmark");
                        _resultSet.RestoreBookmark(bookmark);
                    }
                }
            }

            foreach (object o in tempArray)
            {
                array.SetValue(o, index);
                checked { index++; }
            }
        }
Пример #7
0
 internal abstract void RestoreBookmark(ResultSetBookmark bookmark);
Пример #8
0
		internal override void RestoreBookmark(ResultSetBookmark bookmark)
		{
			SAMMembersSetBookmark sAMMembersSetBookmark = (SAMMembersSetBookmark)bookmark;
			this.groupsToVisit = sAMMembersSetBookmark.groupsToVisit;
			this.groupsVisited = sAMMembersSetBookmark.groupsVisited;
			this.@group = sAMMembersSetBookmark.@group;
			this.membersEnumerator = sAMMembersSetBookmark.membersEnumerator;
			this.current = sAMMembersSetBookmark.current;
			this.currentFakePrincipal = sAMMembersSetBookmark.currentFakePrincipal;
			this.currentForeign = sAMMembersSetBookmark.currentForeign;
			this.foreignMembers = sAMMembersSetBookmark.foreignMembers;
			this.foreignGroups = sAMMembersSetBookmark.foreignGroups;
			if (this.foreignResultSet != null)
			{
				this.foreignResultSet.Dispose();
			}
			this.foreignResultSet = sAMMembersSetBookmark.foreignResultSet;
			this.atBeginning = sAMMembersSetBookmark.atBeginning;
		}
Пример #9
0
 void System.Collections.ICollection.CopyTo(Array array, int index)
 {
     this.CheckDisposed();
     if (index >= 0)
     {
         if (array != null)
         {
             if (array.Rank == 1)
             {
                 if (index < array.GetLength(0))
                 {
                     ArrayList arrayLists = new ArrayList();
                     lock (this.resultSet)
                     {
                         ResultSetBookmark resultSetBookmark = null;
                         try
                         {
                             resultSetBookmark = this.resultSet.BookmarkAndReset();
                             PrincipalCollectionEnumerator principalCollectionEnumerator = new PrincipalCollectionEnumerator(this.resultSet, this, this.removedValuesCompleted, this.removedValuesPending, this.insertedValuesCompleted, this.insertedValuesPending);
                             int length = array.GetLength(0) - index;
                             int num    = 0;
                             while (principalCollectionEnumerator.MoveNext())
                             {
                                 arrayLists.Add(principalCollectionEnumerator.Current);
                                 num++;
                                 if (length >= num)
                                 {
                                     continue;
                                 }
                                 throw new ArgumentException(StringResources.PrincipalCollectionArrayTooSmall);
                             }
                         }
                         finally
                         {
                             if (resultSetBookmark != null)
                             {
                                 this.resultSet.RestoreBookmark(resultSetBookmark);
                             }
                         }
                     }
                     foreach (object arrayList in arrayLists)
                     {
                         array.SetValue(arrayList, index);
                         index++;
                     }
                     return;
                 }
                 else
                 {
                     throw new ArgumentException(StringResources.PrincipalCollectionIndexNotInArray);
                 }
             }
             else
             {
                 throw new ArgumentException(StringResources.PrincipalCollectionNotOneDimensional);
             }
         }
         else
         {
             throw new ArgumentNullException("array");
         }
     }
     else
     {
         throw new ArgumentOutOfRangeException("index");
     }
 }
Пример #10
0
 override internal void RestoreBookmark(ResultSetBookmark bookmark)
 {
     // Nothing to do
 }
Пример #11
0
		internal override void RestoreBookmark(ResultSetBookmark bookmark)
		{
		}
Пример #12
0
        override internal void RestoreBookmark(ResultSetBookmark bookmark)
        {
            GlobalDebug.WriteLineIf(GlobalDebug.Info, "SAMMembersSet", "Restoring from bookmark");

            Debug.Assert(bookmark is SAMMembersSetBookmark);
            SAMMembersSetBookmark samBookmark = (SAMMembersSetBookmark)bookmark;

            _groupsToVisit = samBookmark.groupsToVisit;
            _groupsVisited = samBookmark.groupsVisited;
            _group = samBookmark.group;
            _membersEnumerator = samBookmark.membersEnumerator;
            _current = samBookmark.current;
            _currentFakePrincipal = samBookmark.currentFakePrincipal;
            _currentForeign = samBookmark.currentForeign;
            _foreignMembers = samBookmark.foreignMembers;
            _foreignGroups = samBookmark.foreignGroups;

            if (_foreignResultSet != null)
                _foreignResultSet.Dispose();

            _foreignResultSet = samBookmark.foreignResultSet;
            _atBeginning = samBookmark.atBeginning;
        }
Пример #13
0
 internal override void RestoreBookmark(ResultSetBookmark bookmark)
 {
 }
Пример #14
0
		internal abstract void RestoreBookmark(ResultSetBookmark bookmark);
Пример #15
0
 internal override void RestoreBookmark(ResultSetBookmark bookmark)
 {
     // Nothing to do
 }
Пример #16
0
        override internal void RestoreBookmark(ResultSetBookmark bookmark)
        {
            GlobalDebug.WriteLineIf(GlobalDebug.Info, "ADDNLinkedAttrSet", "Restoring from bookmark");

            Debug.Assert(bookmark is ADDNLinkedAttrSetBookmark);
            ADDNLinkedAttrSetBookmark adBookmark = (ADDNLinkedAttrSetBookmark)bookmark;

            _usersVisited = adBookmark.usersVisited;
            _groupsToVisit = adBookmark.groupsToVisit;
            _groupsVisited = adBookmark.groupsVisited;
            _storeCtx = adBookmark.storeCtx;
            this.current = adBookmark.current;
            _returnedPrimaryGroup = adBookmark.returnedPrimaryGroup;
            _foreignMembersCurrentGroup = adBookmark.foreignMembersCurrentGroup;
            _fakePrincipalMembers = adBookmark.fakePrincipalMembers;
            _foreignMembersToReturn = adBookmark.foreignMembersToReturn;
            _currentForeignPrincipal = adBookmark.currentForeignPrincipal;
            _currentForeignDE = adBookmark.currentForeignDE;
            _foreignGroups = adBookmark.foreignGroups;
            if (_queryMembersResults != null)
                _queryMembersResults.Dispose();
            _queryMembersResults = adBookmark.queryMembersResults;
            _queryMembersResultEnumerator = adBookmark.queryMembersResultEnumerator;
            _memberSearchResults = adBookmark.memberSearchResults;
            _memberSearchResultsEnumerator = adBookmark.memberSearchResultsEnumerator;
            _atBeginning = adBookmark.atBeginning;
            _expansionMode = adBookmark.expansionMode;

            // Replace enumerators
            _members = adBookmark.members;
            _membersEnum = adBookmark.membersEnum;

            // Replace the enumerator queue elements
            if (null != _membersQueue)
            {
                _membersQueue.Clear();

                if (null != adBookmark.membersQueue)
                {
                    foreach (IEnumerable ie in adBookmark.membersQueue)
                    {
                        _membersQueue.Enqueue(ie);
                    }
                }
            }

            if (null != _memberSearchersQueue)
            {
                foreach (DirectorySearcher ds in _memberSearchersQueue)
                {
                    ds.Dispose();
                }

                _memberSearchersQueue.Clear();

                if (null != adBookmark.memberSearcherQueue)
                {
                    foreach (DirectorySearcher ds in adBookmark.memberSearcherQueue)
                    {
                        _memberSearchersQueue.Enqueue(ds);
                    }
                }
            }
        }
Пример #17
0
		internal override void RestoreBookmark(ResultSetBookmark bookmark)
		{
			ADDNLinkedAttrSetBookmark aDDNLinkedAttrSetBookmark = (ADDNLinkedAttrSetBookmark)bookmark;
			this.usersVisited = aDDNLinkedAttrSetBookmark.usersVisited;
			this.groupsToVisit = aDDNLinkedAttrSetBookmark.groupsToVisit;
			this.groupsVisited = aDDNLinkedAttrSetBookmark.groupsVisited;
			this.storeCtx = aDDNLinkedAttrSetBookmark.storeCtx;
			this.current = aDDNLinkedAttrSetBookmark.current;
			this.returnedPrimaryGroup = aDDNLinkedAttrSetBookmark.returnedPrimaryGroup;
			this.foreignMembersCurrentGroup = aDDNLinkedAttrSetBookmark.foreignMembersCurrentGroup;
			this.fakePrincipalMembers = aDDNLinkedAttrSetBookmark.fakePrincipalMembers;
			this.foreignMembersToReturn = aDDNLinkedAttrSetBookmark.foreignMembersToReturn;
			this.currentForeignPrincipal = aDDNLinkedAttrSetBookmark.currentForeignPrincipal;
			this.currentForeignDE = aDDNLinkedAttrSetBookmark.currentForeignDE;
			this.foreignGroups = aDDNLinkedAttrSetBookmark.foreignGroups;
			if (this.queryMembersResults != null)
			{
				this.queryMembersResults.Dispose();
			}
			this.queryMembersResults = aDDNLinkedAttrSetBookmark.queryMembersResults;
			this.queryMembersResultEnumerator = aDDNLinkedAttrSetBookmark.queryMembersResultEnumerator;
			this.memberSearchResults = aDDNLinkedAttrSetBookmark.memberSearchResults;
			this.memberSearchResultsEnumerator = aDDNLinkedAttrSetBookmark.memberSearchResultsEnumerator;
			this.atBeginning = aDDNLinkedAttrSetBookmark.atBeginning;
			this.expansionMode = aDDNLinkedAttrSetBookmark.expansionMode;
			this.members = aDDNLinkedAttrSetBookmark.members;
			this.membersEnum = aDDNLinkedAttrSetBookmark.membersEnum;
			if (this.membersQueue != null)
			{
				this.membersQueue.Clear();
				if (aDDNLinkedAttrSetBookmark.membersQueue != null)
				{
					foreach (IEnumerable enumerable in aDDNLinkedAttrSetBookmark.membersQueue)
					{
						this.membersQueue.Enqueue(enumerable);
					}
				}
			}
			if (this.memberSearchersQueue != null)
			{
				foreach (DirectorySearcher directorySearcher in this.memberSearchersQueue)
				{
					directorySearcher.Dispose();
				}
				this.memberSearchersQueue.Clear();
				if (aDDNLinkedAttrSetBookmark.memberSearcherQueue != null)
				{
					foreach (DirectorySearcher directorySearcher1 in aDDNLinkedAttrSetBookmark.memberSearcherQueue)
					{
						this.memberSearchersQueue.Enqueue(directorySearcher1);
					}
				}
			}
		}