public Traverser(string RootFolderPath) { DirectoryInfo RootInfo; RootInfo = new DirectoryInfo(RootFolderPath); this._rootFolder = new ScanFolder(RootInfo); }
/// <summary> /// Make this generic /// </summary> /// <param name="Folder"></param> private void LaunchQuickViewPlus(ScanFolder Folder) { ProcessStartInfo StartInfo; this.Cursor = Cursors.WaitCursor; try { this.Message(string.Format("Launching QuickViewPlus for {0}", Folder.FolderName)); StartInfo = new ProcessStartInfo(@"C:\Program Files\Quick View Plus\Program\qvp32.exe", string.Format("\"{0}\"", Folder.FolderPath)); Process.Start(StartInfo); } catch (Exception E) { MessageBox.Show(this, E.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } finally { this.Cursor = Cursors.Default; } }
private void Explore(ScanFolder Folder) { ProcessStartInfo StartInfo; this.Cursor = Cursors.WaitCursor; try { this.Message(string.Format("Exploring {0}", Folder.FolderName)); StartInfo = new ProcessStartInfo("explorer.exe", string.Format("\"{0}\"", Folder.FolderPath)); Process.Start(StartInfo); } catch (Exception E) { MessageBox.Show(this, E.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } finally { this.Cursor = Cursors.Default; } }
private TreeNode CreateTreeNode(ScanFolder Folder) { TreeNode NewNode; NewNode = new TreeNode(Folder.DisplayName); NewNode.Tag = Folder; //Use the Tag to hold the node's ScanFolder return NewNode; }
//This is a node visitor private void ClearTotalVisitor(ScanFolder f) { f.ClearTotals(); }
//This is a node visitor. It is called once for each folder. private void SortFolder(ScanFolder f) { f.SubfolderMgr.Sort(); }
//This is a node visitor. It is called once for each folder. private void SetFiltersForFolderLike(ScanFolder f, object BMgr) { BucketManager Mgr = (BucketManager) BMgr; f.BucketMgr.SetFiltersLike(Mgr); }
public void Scan() { Traverser.Message(this.FolderPath); try { foreach (FileInfo f in this._dirInfo.GetFiles()) { try { this._mgr.AddFile(f.Extension, f.Length); } catch (System.IO.IOException E) { Trace.WriteLine(string.Format("Ignoring error {0} in folder {1}", E.Message, this._dirInfo.FullName)); } } foreach (DirectoryInfo d in this._dirInfo.GetDirectories()) { try { ScanFolder NewFolder = new ScanFolder(d); this._subfolderMgr.AddFolder(NewFolder); NewFolder.Scan(); this._mgr.AddBuckets(NewFolder._mgr); } catch (System.IO.IOException E) { Trace.WriteLine(string.Format("Ignoring error {0} in folder {1}", E.Message, this._dirInfo.FullName)); } } //At this point the scan folder has two collections of things that can //and should be sorted; subfolders and buckets (containing file types). this._mgr.Sort(); this._subfolderMgr.Sort(); } catch (System.Exception E) { Trace.WriteLine(string.Format("Ignoring error {0} in folder {1}", E.ToString(), this._dirInfo.FullName)); } }
public void AddFolder(ScanFolder f) { this._subfolders.Add(f); }