/// <summary>Advances the enumerator to the next element of the collection.</summary>
        ///
        /// <returns>
        /// True if the enumerator was successfully advanced to the next element; false if the enumerator
        /// has passed the end of the collection.
        /// </returns>
        public bool MoveNext()
        {
            // We're done boise! Nothing to do.
            if (currentEnumerator == null)
            {
                return(false);
            }

            bool findResult;

            do
            {
                findResult = currentEnumerator.MoveNext();
                if (findResult)
                {
                    // Once we're in this block, findResult is only used to
                    // return the current file. It can safely be set to false.
                    findResult = IncludeFind(currentEnumerator.Current, out bool subdirectory);
                    // We're scanning files and this guy has been caught redhanded.
                    if (findResult)
                    {
                        current = currentEnumerator.Current;
                    }

                    // We're scanning subdirectories and this guy is invited to the party.
                    if (subdirectory)
                    {
                        AddState();
                    }
                }
                else if (!findResult)
                {
                    // This directory has been emptied

                    /*if (currentState.Search.HasSearchPattern) {
                     *      // Now search for each individual subdirectories
                     *      // because the search pattern didn't support it.
                     *      currentEnumerator = currentState.ChangeToSubdirState();
                     * }
                     * else {*/
                    // Go to the next or previous state
                    NextState();
                    //}
                }
            } while (!findResult && !IsFinished);
            if (!findResult)
            {
                current = null;
            }
            return(findResult);
        }
Beispiel #2
0
        /// <summary>Advances the enumerator to the next element of the collection.</summary>
        ///
        /// <returns>
        /// True if the enumerator was successfully advanced to the next element; false if the enumerator
        /// has passed the end of the collection.
        /// </returns>
        public bool MoveNext()
        {
            // We're done boise! Nothing to do.
            if (currentEnumerator == null)
            {
                return(false);
            }

            bool findResult;

            do
            {
                findResult = currentEnumerator.MoveNext();
                if (findResult)
                {
                    // Once we're in this block, findResult is only used to
                    // return the current file. It can safely be set to false.
                    findResult = IncludeFind(currentEnumerator.Current, out bool subdirectory);
                    // We're scanning files and this guy has been caught redhanded.
                    if (findResult)
                    {
                        current = currentEnumerator.Current;
                    }

                    // We're scanning subdirectories and this guy is invited to the party.
                    if (subdirectory)
                    {
                        PushState();
                    }
                }
                else if (!findResult)
                {
                    PopState();
                }
            } while (!findResult && !IsFinished);
            if (!findResult)
            {
                current = null;
            }
            return(findResult);
        }