Esempio n. 1
0
 public DirectorySynchronization(DirectorySynchronization sync)
 {
     if (sync != null)
     {
         Option = sync.Option;
         ResetDirectorySynchronizationCookie(sync.GetDirectorySynchronizationCookie());
     }
 }
Esempio n. 2
0
     /// <include file='doc\DirectorySynchronization.uex' path='docs/doc[@for="DirectorySynchronization.DirectorySynchronization2"]/*' />
     /// <devdoc>
     ///    <para>[To be supplied.]</para>
     /// </devdoc>
 	public DirectorySynchronization(DirectorySynchronization sync)
     {
         if (sync != null)
         {
             Option = sync.Option;
             ResetDirectorySynchronizationCookie(sync.GetDirectorySynchronizationCookie());
         }
     }
 public DirectorySynchronization(DirectorySynchronization sync)
 {
     this.cookie = new byte[0];
     if (sync != null)
     {
         this.Option = sync.Option;
         this.ResetDirectorySynchronizationCookie(sync.GetDirectorySynchronizationCookie());
     }
 }
 public DirectorySynchronization(DirectorySynchronization sync)
 {
     this.cookie = new byte[0];
     if (sync != null)
     {
         this.Option = sync.Option;
         this.ResetDirectorySynchronizationCookie(sync.GetDirectorySynchronizationCookie());
     }
 }
            /// <include file='doc\SearchResultCollection.uex' path='docs/doc[@for="SearchResultCollection.ResultsEnumerator.MoveNext"]/*' />
            /// <devdoc>
            ///    <para>Advances
            ///       the enumerator to the next element of the collection
            ///       and returns a Boolean value indicating whether a valid element is available.</para>
            /// </devdoc>
            public bool MoveNext()
            {
                DirectorySynchronization tempsync = null;
                DirectoryVirtualListView tempvlv  = null;
                int errorCode = 0;

                if (_eof)
                {
                    return(false);
                }

                _currentResult = null;
                if (!_initialized)
                {
                    int hr = _results.SearchObject.GetFirstRow(_results.Handle);

                    if (hr != UnsafeNativeMethods.S_ADS_NOMORE_ROWS)
                    {
                        //throw a clearer exception if the filter was invalid
                        if (hr == UnsafeNativeMethods.INVALID_FILTER)
                        {
                            throw new ArgumentException(Res.GetString(Res.DSInvalidSearchFilter, _results.Filter));
                        }
                        if (hr != 0)
                        {
                            throw COMExceptionHelper.CreateFormattedComException(hr);
                        }

                        _eof         = false;
                        _initialized = true;
                        return(true);
                    }

                    _initialized = true;
                }

                while (true)
                {
                    // clear the last error first
                    CleanLastError();
                    errorCode = 0;

                    int hr = _results.SearchObject.GetNextRow(_results.Handle);
                    //  SIZE_LIMIT_EXCEEDED occurs when we supply too generic filter or small SizeLimit value.
                    if (hr == UnsafeNativeMethods.S_ADS_NOMORE_ROWS || hr == UnsafeNativeMethods.SIZE_LIMIT_EXCEEDED)
                    {
                        // need to make sure this is not the case that server actually still has record not returned yet
                        if (hr == UnsafeNativeMethods.S_ADS_NOMORE_ROWS)
                        {
                            hr = GetLastError(ref errorCode);
                            // get last error call failed, we need to bail out
                            if (hr != 0)
                            {
                                throw COMExceptionHelper.CreateFormattedComException(hr);
                            }
                        }

                        // not the case that server still has result, we are done here
                        if (errorCode != SafeNativeMethods.ERROR_MORE_DATA)
                        {
                            // get the dirsync cookie as we finished all the rows
                            if (_results.srch.directorySynchronizationSpecified)
                            {
                                tempsync = _results.srch.DirectorySynchronization;
                            }

                            // get the vlv response as we finished all the rows
                            if (_results.srch.directoryVirtualListViewSpecified)
                            {
                                tempvlv = _results.srch.VirtualListView;
                            }

                            _results.srch.searchResult = null;

                            _eof         = true;
                            _initialized = false;
                            return(false);
                        }
                        else
                        {
                            // if user chooses to wait to continue the search
                            if (_waitForResult)
                            {
                                continue;
                            }
                            else
                            {
                                uint temp = (uint)errorCode;
                                temp = ((((temp) & 0x0000FFFF) | (7 << 16) | 0x80000000));
                                throw COMExceptionHelper.CreateFormattedComException((int)temp);
                            }
                        }
                    }
                    //throw a clearer exception if the filter was invalid
                    if (hr == UnsafeNativeMethods.INVALID_FILTER)
                    {
                        throw new ArgumentException(Res.GetString(Res.DSInvalidSearchFilter, _results.Filter));
                    }
                    if (hr != 0)
                    {
                        throw COMExceptionHelper.CreateFormattedComException(hr);
                    }

                    _eof = false;
                    return(true);
                }
            }
Esempio n. 6
0
 public DirectorySynchronization(DirectorySynchronization sync)
 {
 }
Esempio n. 7
0
		public DirectorySynchronization (DirectorySynchronization sync)
		{
		}
Esempio n. 8
0
            public bool MoveNext()
            {
                int errorCode = 0;

                if (this.eof)
                {
                    return(false);
                }
                this.currentResult = null;
                if (!this.initialized)
                {
                    int firstRow = this.results.SearchObject.GetFirstRow(this.results.Handle);
                    switch (firstRow)
                    {
                    case 0x5012:
                        this.initialized = true;
                        break;

                    case -2147016642:
                        throw new ArgumentException(Res.GetString("DSInvalidSearchFilter", new object[] { this.results.Filter }));

                    default:
                        if (firstRow != 0)
                        {
                            throw COMExceptionHelper.CreateFormattedComException(firstRow);
                        }
                        this.eof         = false;
                        this.initialized = true;
                        return(true);
                    }
                }
Label_0091:
                this.CleanLastError();
                errorCode = 0;
                int nextRow = this.results.SearchObject.GetNextRow(this.results.Handle);

                switch (nextRow)
                {
                case 0x5012:
                case -2147016669:
                    if (nextRow == 0x5012)
                    {
                        nextRow = this.GetLastError(ref errorCode);
                        if (nextRow != 0)
                        {
                            throw COMExceptionHelper.CreateFormattedComException(nextRow);
                        }
                    }
                    if (errorCode != 0xea)
                    {
                        if (this.results.srch.directorySynchronizationSpecified)
                        {
                            DirectorySynchronization directorySynchronization = this.results.srch.DirectorySynchronization;
                        }
                        if (this.results.srch.directoryVirtualListViewSpecified)
                        {
                            DirectoryVirtualListView virtualListView = this.results.srch.VirtualListView;
                        }
                        this.results.srch.searchResult = null;
                        this.eof         = true;
                        this.initialized = false;
                        return(false);
                    }
                    if (!this.waitForResult)
                    {
                        uint num4 = (uint)errorCode;
                        num4 = ((num4 & 0xffff) | 0x70000) | 0x80000000;
                        throw COMExceptionHelper.CreateFormattedComException((int)num4);
                    }
                    goto Label_0091;

                case -2147016642:
                    throw new ArgumentException(Res.GetString("DSInvalidSearchFilter", new object[] { this.results.Filter }));
                }
                if (nextRow != 0)
                {
                    throw COMExceptionHelper.CreateFormattedComException(nextRow);
                }
                this.eof = false;
                return(true);
            }