private void ScanByEverything(Filter filter) { EverythingWraper.Everything_SetRegex(true); EverythingWraper.Everything_SetSearch(filter.RegularExpression); EverythingWraper.Everything_Query(true); // sort by path EverythingWraper.Everything_SortResultsByPath(); int bufsize = 260; StringBuilder buf = new StringBuilder(bufsize); // loop through the results, adding each result to the list box. int totalNumber = EverythingWraper.Everything_GetNumResults(); for (int i = 0; i < totalNumber; i++) { if (EverythingWraper.Everything_IsFolderResult(i) && !filter.ContainDirectory) { continue; } if (EverythingWraper.Everything_IsFileResult(i) && !filter.ContainFile) { continue; } EverythingWraper.Everything_GetResultFullPathName(i, buf, bufsize); string path = buf.ToString(); if (filter.ShouldSkip(path)) { continue; } Garbage garbage = new Garbage(path); GarbageList.Add(garbage); OnPropertyChanged("GarbageList"); OnPropertyChanged("GarbageCount"); } }
public void ShouldSkipReturenTrueIfNotInExcludeFolderAndNotInIncludeFolder() { Filter filter = new Filter {Exclude = @"d:\abcd", Include = @"d:\abce"}; Assert.IsTrue(filter.ShouldSkip(@"d:\abc\a")); }
public void ShouldSkipReturenFalseIfNotInExcludeFolders() { Filter filter = new Filter {Exclude = @"d:\abcd,d:\abce,d:\abcf"}; Assert.IsFalse(filter.ShouldSkip(@"d:\abc\a")); }
public void ShouldSkipReturenFalseIfNotInExcludeFolderAndIncludeFolderIsEmpty() { Filter filter = new Filter {Exclude = @"d:\abcd"}; Assert.IsFalse(filter.ShouldSkip(@"d:\abc\a")); }
public void ShouldSkipReturenFalseIfEmpty() { Filter filter = new Filter(); Assert.IsFalse(filter.ShouldSkip(@"d:\abc")); }
public void FormatWhenSetInclude() { Filter filter = new Filter {Include = @" d:\abcd\\\\\, d:\ab ;d:\e "}; Assert.AreEqual(@"d:\abcd\,d:\ab\,d:\e\,", filter.Include); }