Exemplo n.º 1
0
            /// <summary>Initializes a new instance of the <see cref="DirNode.Vector"/> class.</summary>
            /// <param name="rootPath">Top directory.</param>
            /// <param name="dirFilter">Search pattern.</param>
            /// <param name="order">Output sorting.</param>
            /// <param name="drawWith">Outline characters.</param>
            /// <param name="tabSize">Number of characters to indent per level.</param>
            protected Vector(string rootPath, string dirFilter = null, Ordering order = Ordering.None, DrawWith drawWith = DrawWith.Ascii, int tabSize = 4)
            {
                this.stack = new QueuedStack <DirNode>();
                this.stack.Enqueue(new DirNode(new DirectoryInfo[] { new DirectoryInfo(rootPath) }, -1));

                this.TabSize   = tabSize;
                this.DirFilter = dirFilter ?? "*";

                if (drawWith == DrawWith.Graphic)
                {
                    UpDown = '\u2502'; LeftRight = '\u2500'; UpRight = '\u2514'; UpDownRight = '\u251C';
                }
                else
                {
                    UpDown = '|';      LeftRight = '-';      UpRight = '\\';     UpDownRight = '+';
                }

                if (order == Ordering.Lexical)
                {
                    this.dirComparer  = SafeNativeMethods.LexicalCompareDirectoryInfo.Comparer;
                    this.fileComparer = SafeNativeMethods.LexicalCompareFileInfo.Comparer;
                }
                else if (order == Ordering.Natural)
                {
                    this.dirComparer  = SafeNativeMethods.NaturalCompareDirectoryInfo.Comparer;
                    this.fileComparer = SafeNativeMethods.NaturalCompareFileInfo.Comparer;
                }
            }
Exemplo n.º 2
0
 private void MoveStackToQueue()
 {
     while (StackedStack.Count > 0)
     {
         QueuedStack.Push(StackedStack.Pop());
     }
 }
Exemplo n.º 3
0
        public T Peek()
        {
            if (QueuedStack.Count == 0)
            {
                MoveStackToQueue();
            }

            return(QueuedStack.Peek());
        }
Exemplo n.º 4
0
        public T Dequeue()  //removes the value at the front of the queue
        {
            if (QueuedStack.Count == 0)
            {
                MoveStackToQueue();
            }

            return(QueuedStack.Pop());
        }