Exemplo n.º 1
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);
                    }
                }
            }
        }
Exemplo n.º 2
0
        override internal ResultSetBookmark BookmarkAndReset()
        {
            GlobalDebug.WriteLineIf(GlobalDebug.Info, "ADDNLinkedAttrSet", "Bookmarking");

            ADDNLinkedAttrSetBookmark bookmark = new ADDNLinkedAttrSetBookmark();

            bookmark.usersVisited = _usersVisited;
            _usersVisited = new Dictionary<string, bool>();

            bookmark.groupsToVisit = _groupsToVisit;
            _groupsToVisit = new List<string>();

            string originalGroupDN = _groupsVisited[0];
            bookmark.groupsVisited = _groupsVisited;
            _groupsVisited = new List<string>();
            _groupsVisited.Add(originalGroupDN);

            bookmark.expansionMode = _expansionMode;

            // bookmark the current enumerators
            bookmark.members = _members;
            bookmark.membersEnum = _membersEnum;

            // Clear the current enumerators for reset
            _members = null;
            _membersEnum = null;

            // Copy all enumerators in the queue over to the bookmark queue.
            if (null != _membersQueue)
            {
                bookmark.membersQueue = new Queue<IEnumerable>(_membersQueue.Count);
                foreach (IEnumerable ie in _membersQueue)
                {
                    bookmark.membersQueue.Enqueue(ie);
                }
            }

            // Refill the original queue with the original enumerators and reset them
            if (null != _membersQueue)
            {
                _membersQueue.Clear();

                if (_originalMembers != null)
                {
                    foreach (IEnumerable ie in _originalMembers)
                    {
                        _membersQueue.Enqueue(ie);
                        IEnumerator enumerator = ie.GetEnumerator();
                        enumerator.Reset();
                    }
                }
            }

            bookmark.storeCtx = _storeCtx;

            _expansionMode = _originalExpansionMode;

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

            _storeCtx = _originalStoreCtx;

            bookmark.current = this.current;
            bookmark.returnedPrimaryGroup = _returnedPrimaryGroup;
            this.current = null;
            if (_primaryGroupDN != null)
                _returnedPrimaryGroup = false;

            bookmark.foreignMembersCurrentGroup = _foreignMembersCurrentGroup;
            bookmark.fakePrincipalMembers = _fakePrincipalMembers;
            bookmark.foreignMembersToReturn = _foreignMembersToReturn;
            bookmark.currentForeignPrincipal = _currentForeignPrincipal;
            bookmark.currentForeignDE = _currentForeignDE;
            _foreignMembersCurrentGroup = new List<DirectoryEntry>();
            _fakePrincipalMembers = new List<DirectoryEntry>();
            _currentForeignDE = null;

            bookmark.foreignGroups = _foreignGroups;
            _foreignGroups = new List<GroupPrincipal>();

            bookmark.queryMembersResults = _queryMembersResults;
            bookmark.queryMembersResultEnumerator = _queryMembersResultEnumerator;
            _queryMembersResults = null;
            _queryMembersResultEnumerator = null;

            bookmark.memberSearchResults = _memberSearchResults;
            bookmark.memberSearchResultsEnumerator = _memberSearchResultsEnumerator;
            _memberSearchResults = null;
            _memberSearchResultsEnumerator = null;

            if (null != _memberSearchersQueue)
            {
                bookmark.memberSearcherQueue = new Queue<DirectorySearcher>(_memberSearchersQueue.Count);

                foreach (DirectorySearcher ds in _memberSearchersQueue)
                {
                    bookmark.memberSearcherQueue.Enqueue(ds);
                }
            }

            if (null != _memberSearchersQueueOriginal)
            {
                _memberSearchersQueue.Clear();

                foreach (DirectorySearcher ds in _memberSearchersQueueOriginal)
                {
                    _memberSearchersQueue.Enqueue(ds);
                }
            }

            bookmark.atBeginning = _atBeginning;
            _atBeginning = true;

            return bookmark;
        }
Exemplo n.º 3
0
        internal override ResultSetBookmark BookmarkAndReset()
        {
            ADDNLinkedAttrSetBookmark aDDNLinkedAttrSetBookmark = new ADDNLinkedAttrSetBookmark();

            aDDNLinkedAttrSetBookmark.usersVisited = this.usersVisited;
            this.usersVisited = new Dictionary <string, bool>();
            aDDNLinkedAttrSetBookmark.groupsToVisit = this.groupsToVisit;
            this.groupsToVisit = new List <string>();
            string item = this.groupsVisited[0];

            aDDNLinkedAttrSetBookmark.groupsVisited = this.groupsVisited;
            this.groupsVisited = new List <string>();
            this.groupsVisited.Add(item);
            aDDNLinkedAttrSetBookmark.expansionMode = this.expansionMode;
            aDDNLinkedAttrSetBookmark.members       = this.members;
            aDDNLinkedAttrSetBookmark.membersEnum   = this.membersEnum;
            this.members     = null;
            this.membersEnum = null;
            if (this.membersQueue != null)
            {
                aDDNLinkedAttrSetBookmark.membersQueue = new Queue <IEnumerable>(this.membersQueue.Count);
                foreach (IEnumerable enumerable in this.membersQueue)
                {
                    aDDNLinkedAttrSetBookmark.membersQueue.Enqueue(enumerable);
                }
            }
            if (this.membersQueue != null)
            {
                this.membersQueue.Clear();
                if (this.originalMembers != null)
                {
                    foreach (IEnumerable enumerable1 in this.originalMembers)
                    {
                        this.membersQueue.Enqueue(enumerable1);
                        IEnumerator enumerator = enumerable1.GetEnumerator();
                        enumerator.Reset();
                    }
                }
            }
            aDDNLinkedAttrSetBookmark.storeCtx = this.storeCtx;
            this.expansionMode = this.originalExpansionMode;
            if (this.currentMembersSearcher != null)
            {
                this.currentMembersSearcher.Dispose();
                this.currentMembersSearcher = null;
            }
            this.storeCtx = this.originalStoreCtx;
            aDDNLinkedAttrSetBookmark.current = this.current;
            aDDNLinkedAttrSetBookmark.returnedPrimaryGroup = this.returnedPrimaryGroup;
            this.current = null;
            if (this.primaryGroupDN != null)
            {
                this.returnedPrimaryGroup = false;
            }
            aDDNLinkedAttrSetBookmark.foreignMembersCurrentGroup = this.foreignMembersCurrentGroup;
            aDDNLinkedAttrSetBookmark.fakePrincipalMembers       = this.fakePrincipalMembers;
            aDDNLinkedAttrSetBookmark.foreignMembersToReturn     = this.foreignMembersToReturn;
            aDDNLinkedAttrSetBookmark.currentForeignPrincipal    = this.currentForeignPrincipal;
            aDDNLinkedAttrSetBookmark.currentForeignDE           = this.currentForeignDE;
            this.foreignMembersCurrentGroup         = new List <DirectoryEntry>();
            this.fakePrincipalMembers               = new List <DirectoryEntry>();
            this.currentForeignDE                   = null;
            aDDNLinkedAttrSetBookmark.foreignGroups = this.foreignGroups;
            this.foreignGroups = new List <GroupPrincipal>();
            aDDNLinkedAttrSetBookmark.queryMembersResults          = this.queryMembersResults;
            aDDNLinkedAttrSetBookmark.queryMembersResultEnumerator = this.queryMembersResultEnumerator;
            this.queryMembersResults                                = null;
            this.queryMembersResultEnumerator                       = null;
            aDDNLinkedAttrSetBookmark.memberSearchResults           = this.memberSearchResults;
            aDDNLinkedAttrSetBookmark.memberSearchResultsEnumerator = this.memberSearchResultsEnumerator;
            this.memberSearchResults                                = null;
            this.memberSearchResultsEnumerator                      = null;
            if (this.memberSearchersQueue != null)
            {
                aDDNLinkedAttrSetBookmark.memberSearcherQueue = new Queue <DirectorySearcher>(this.memberSearchersQueue.Count);
                foreach (DirectorySearcher directorySearcher in this.memberSearchersQueue)
                {
                    aDDNLinkedAttrSetBookmark.memberSearcherQueue.Enqueue(directorySearcher);
                }
            }
            if (this.memberSearchersQueueOriginal != null)
            {
                this.memberSearchersQueue.Clear();
                foreach (DirectorySearcher directorySearcher1 in this.memberSearchersQueueOriginal)
                {
                    this.memberSearchersQueue.Enqueue(directorySearcher1);
                }
            }
            aDDNLinkedAttrSetBookmark.atBeginning = this.atBeginning;
            this.atBeginning = true;
            return(aDDNLinkedAttrSetBookmark);
        }
Exemplo n.º 4
0
		internal override ResultSetBookmark BookmarkAndReset()
		{
			ADDNLinkedAttrSetBookmark aDDNLinkedAttrSetBookmark = new ADDNLinkedAttrSetBookmark();
			aDDNLinkedAttrSetBookmark.usersVisited = this.usersVisited;
			this.usersVisited = new Dictionary<string, bool>();
			aDDNLinkedAttrSetBookmark.groupsToVisit = this.groupsToVisit;
			this.groupsToVisit = new List<string>();
			string item = this.groupsVisited[0];
			aDDNLinkedAttrSetBookmark.groupsVisited = this.groupsVisited;
			this.groupsVisited = new List<string>();
			this.groupsVisited.Add(item);
			aDDNLinkedAttrSetBookmark.expansionMode = this.expansionMode;
			aDDNLinkedAttrSetBookmark.members = this.members;
			aDDNLinkedAttrSetBookmark.membersEnum = this.membersEnum;
			this.members = null;
			this.membersEnum = null;
			if (this.membersQueue != null)
			{
				aDDNLinkedAttrSetBookmark.membersQueue = new Queue<IEnumerable>(this.membersQueue.Count);
				foreach (IEnumerable enumerable in this.membersQueue)
				{
					aDDNLinkedAttrSetBookmark.membersQueue.Enqueue(enumerable);
				}
			}
			if (this.membersQueue != null)
			{
				this.membersQueue.Clear();
				if (this.originalMembers != null)
				{
					foreach (IEnumerable enumerable1 in this.originalMembers)
					{
						this.membersQueue.Enqueue(enumerable1);
						IEnumerator enumerator = enumerable1.GetEnumerator();
						enumerator.Reset();
					}
				}
			}
			aDDNLinkedAttrSetBookmark.storeCtx = this.storeCtx;
			this.expansionMode = this.originalExpansionMode;
			if (this.currentMembersSearcher != null)
			{
				this.currentMembersSearcher.Dispose();
				this.currentMembersSearcher = null;
			}
			this.storeCtx = this.originalStoreCtx;
			aDDNLinkedAttrSetBookmark.current = this.current;
			aDDNLinkedAttrSetBookmark.returnedPrimaryGroup = this.returnedPrimaryGroup;
			this.current = null;
			if (this.primaryGroupDN != null)
			{
				this.returnedPrimaryGroup = false;
			}
			aDDNLinkedAttrSetBookmark.foreignMembersCurrentGroup = this.foreignMembersCurrentGroup;
			aDDNLinkedAttrSetBookmark.fakePrincipalMembers = this.fakePrincipalMembers;
			aDDNLinkedAttrSetBookmark.foreignMembersToReturn = this.foreignMembersToReturn;
			aDDNLinkedAttrSetBookmark.currentForeignPrincipal = this.currentForeignPrincipal;
			aDDNLinkedAttrSetBookmark.currentForeignDE = this.currentForeignDE;
			this.foreignMembersCurrentGroup = new List<DirectoryEntry>();
			this.fakePrincipalMembers = new List<DirectoryEntry>();
			this.currentForeignDE = null;
			aDDNLinkedAttrSetBookmark.foreignGroups = this.foreignGroups;
			this.foreignGroups = new List<GroupPrincipal>();
			aDDNLinkedAttrSetBookmark.queryMembersResults = this.queryMembersResults;
			aDDNLinkedAttrSetBookmark.queryMembersResultEnumerator = this.queryMembersResultEnumerator;
			this.queryMembersResults = null;
			this.queryMembersResultEnumerator = null;
			aDDNLinkedAttrSetBookmark.memberSearchResults = this.memberSearchResults;
			aDDNLinkedAttrSetBookmark.memberSearchResultsEnumerator = this.memberSearchResultsEnumerator;
			this.memberSearchResults = null;
			this.memberSearchResultsEnumerator = null;
			if (this.memberSearchersQueue != null)
			{
				aDDNLinkedAttrSetBookmark.memberSearcherQueue = new Queue<DirectorySearcher>(this.memberSearchersQueue.Count);
				foreach (DirectorySearcher directorySearcher in this.memberSearchersQueue)
				{
					aDDNLinkedAttrSetBookmark.memberSearcherQueue.Enqueue(directorySearcher);
				}
			}
			if (this.memberSearchersQueueOriginal != null)
			{
				this.memberSearchersQueue.Clear();
				foreach (DirectorySearcher directorySearcher1 in this.memberSearchersQueueOriginal)
				{
					this.memberSearchersQueue.Enqueue(directorySearcher1);
				}
			}
			aDDNLinkedAttrSetBookmark.atBeginning = this.atBeginning;
			this.atBeginning = true;
			return aDDNLinkedAttrSetBookmark;
		}