/// <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; } }
private void MoveStackToQueue() { while (StackedStack.Count > 0) { QueuedStack.Push(StackedStack.Pop()); } }
public T Peek() { if (QueuedStack.Count == 0) { MoveStackToQueue(); } return(QueuedStack.Peek()); }
public T Dequeue() //removes the value at the front of the queue { if (QueuedStack.Count == 0) { MoveStackToQueue(); } return(QueuedStack.Pop()); }