public AdvancedSearch(String path) { InitializeComponent(); workdir = path; TBPattern.Text = ""; TBReplace.Text = ""; DirInfo CurrentDirectory = new DirInfo(new DirectoryInfo(workdir)); childFileList = (from fobj in FileSystemExplorerService.GetChildFiles(CurrentDirectory.Path) select new DirInfo(fobj)).ToList(); int length = 0; if (!int.TryParse(TBLength.Text, out length)) { length = 3; } Dictionary <String, int> detection = DetectOccurences(childFileList, length); LVWord.ItemsSource = detection; }
/// <summary> /// this method gets the children of current directory and stores them in the CurrentItems Observable collection /// </summary> public void RefreshCurrentItems(bool reload) { IList <DirInfo> childDirList = new List <DirInfo>(); IList <DirInfo> childFileList = new List <DirInfo>(); if (reload) { CurrentDirectory.IsLoaded = false; } //If current directory is "My computer" then get the all logical drives in the system if (CurrentDirectory.Name.Equals(Resources.My_Computer_String)) { childDirList = (from rd in FileSystemExplorerService.GetRootDirectories() select new DirInfo(rd)).ToList(); CurrentDirectory.LoadDirectories(childDirList); } else { //Combine all the subdirectories and files of the current directory if (ThumbGen.Helpers.IsDirectory(CurrentDirectory.Path)) { childDirList = (from dir in FileSystemExplorerService.GetChildDirectories(CurrentDirectory.Path) select new DirInfo(dir, CurrentDirectory)).ToList(); UserOptions _options = FileManager.Configuration.Options; bool _isFilterActive = _options.FileBrowserOptions.IsFilterActive(); foreach (FileInfo _file in FileSystemExplorerService.GetChildFiles(CurrentDirectory.Path)) { if (string.Compare(Path.GetFileName(_file.FullName), ThumbGen.MP4Tagger.MP4Manager.DEST_FILE_NAME) != 0) { bool _skip = false; DirInfo _item = new DirInfo(_file, CurrentDirectory, _isFilterActive); if (!_skip) { childFileList.Add(_item); } } } } childDirList = childDirList.Concat(childFileList).ToList(); CurrentDirectory.LoadDirectories(childDirList); } CurrentItems = childDirList; }
/// <summary> /// this method gets the children of current directory and stores them in the CurrentItems Observable collection /// </summary> public void RefreshCurrentItems() { IList <DirInfo> childDirList = new List <DirInfo>(); IList <DirInfo> childFileList = new List <DirInfo>(); //If current directory is "My computer" then get the all logical drives in the system if (CurrentDirectory.Name.Equals(Resources.My_Computer_String)) { childDirList = (from rd in FileSystemExplorerService.GetRootDirectories() select new DirInfo(rd)).ToList(); } else { //Combine all the subdirectories and files of the current directory childDirList = (from dir in FileSystemExplorerService.GetChildDirectories(CurrentDirectory.Path) select new DirInfo(dir)).ToList(); childFileList = (from fobj in FileSystemExplorerService.GetChildFiles(CurrentDirectory.Path) select new DirInfo(fobj)).ToList(); childDirList = childDirList.Concat(childFileList).ToList(); } //Filter the children if (_searchText != "") { for (int i = 0; i < childDirList.Count; i++) { if (!childDirList.ElementAt(i).Name.ToLower().Contains(_searchText.ToLower())) { childDirList.RemoveAt(i); i--; } } } CurrentItems = childDirList; }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { try { DirInfo nodeToExpand = value as DirInfo; if (nodeToExpand == null) { return(null); } //return the subdirectories of the Current Node if (nodeToExpand.IsLoaded) { return(nodeToExpand.SubDirectories); } else { if ((ObjectType)nodeToExpand.DirType == ObjectType.MyComputer) { return((from sd in FileSystemExplorerService.GetRootDirectories() select new DirInfo(sd)).ToList()); } else { IList <DirInfo> _tmp = (from dirs in FileSystemExplorerService.GetChildDirectories(nodeToExpand.Path) select new DirInfo(dirs, nodeToExpand)).ToList(); foreach (DirInfo _dir in _tmp) { nodeToExpand.SubDirectories.Add(_dir); } return(_tmp); } } } catch { return(null); } }