public void Fill(DirectoryBrowser browser) { Clear(); Columns.Add("Name"); Columns[0].Width = 200; Columns.Add("Type"); ListViewItem item = new ListViewItem(@".."); item.SubItems.Add("Directory"); var parentDir = browser.currentDir.Parent; item.Tag = parentDir; Items.Add(item); foreach (var dir in browser.dirList) { Add(dir); } foreach (var file in browser.fileList) { Add(file); } }
private void SearchByName(string wildcard, string path, CancellationToken token) { if (token.IsCancellationRequested) { return; } var browser = new DirectoryBrowser(); browser.GetDirectoryInfo(path); var matched = Array.FindAll(browser.fileList, item => MatchName(wildcard, item.Name)); foreach (var file in matched) { matchedFiles.Enqueue(file); } Parallel.ForEach(browser.dirList, new ParallelOptions { MaxDegreeOfParallelism = 3 }, dir => { SearchByName(wildcard, dir.FullName, token); }); }
public Panel(TextBox tb, ExtListView view, MenuButton diskButton, MainForm form) { this.pathTextBox = tb; this.view = view; this.diskButton = diskButton; diskButton.parentPanel = this; this.data = new DirectoryBrowser(); data.CurrentPath = (String)form.settings.SettingsList["StartDir"]; watcher = new FileSystemWatcher(); watcher.Path = data.CurrentPath; watcher.Filter = "*.*"; watcher.Changed += new FileSystemEventHandler(OnChanged); watcher.Created += new FileSystemEventHandler(OnChanged); watcher.Deleted += new FileSystemEventHandler(OnChanged); watcher.Renamed += new RenamedEventHandler(OnRenamed); watcher.EnableRaisingEvents = true; }