/// <summary>
        /// Ends the current state and procedes to the next available state.<para/>
        /// If there are no states after this one in the list, then the state list is backtracked.
        /// </summary>
        private void NextState()
        {
            // Cleanup the current enumerator.
            currentEnumerator.Dispose();
            // Remove the current state
            stateList.RemoveAt(stateIndex);

            if (stateIndex == stateList.Count)
            {
                // We've hit the end, recurse backwards to find
                // states that haven't finished subdir scans.
                if (stateList.Count > 0)
                {
                    currentState = stateList[--stateIndex];
                }
                else                 // End of the line, pal
                {
                    currentState = null;
                }
            }
            else
            {
                // Goto the next available queued state
                currentState = stateList[stateIndex];
            }
            // Assign the shortcut to the current enumerator
            currentEnumerator = currentState?.Enumerator;
        }
 /// <summary>Ends the current state and procedes to the next available state.</summary>
 private void DequeueState()
 {
     currentEnumerator.Dispose();
     stateQueue.Dequeue();
     if (stateQueue.Count > 0)
     {
         currentState = stateQueue.Peek();
     }
     else
     {
         currentState = null;
     }
     currentEnumerator = currentState?.Enumerator;
 }
        /// <summary>Ends the current state and backtracks to the last state.</summary>
        private void PopState()
        {
            // Cleanup the current enumerator.
            currentEnumerator.Dispose();
            // Remove the current state
            stateStack.Pop();

            if (stateStack.Count > 0)
            {
                currentState = stateStack.Peek();
            }
            else             // End of the line, pal
            {
                currentState = null;
            }
            // Assign the shortcut to the current enumerator
            currentEnumerator = currentState?.Enumerator;
        }