Esempio n. 1
0
        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");
            }
        }
Esempio n. 2
0
 public void ShouldSkipReturenTrueIfNotInExcludeFolderAndNotInIncludeFolder()
 {
     Filter filter = new Filter {Exclude = @"d:\abcd", Include = @"d:\abce"};
     Assert.IsTrue(filter.ShouldSkip(@"d:\abc\a"));
 }
Esempio n. 3
0
 public void ShouldSkipReturenFalseIfNotInExcludeFolders()
 {
     Filter filter = new Filter {Exclude = @"d:\abcd,d:\abce,d:\abcf"};
     Assert.IsFalse(filter.ShouldSkip(@"d:\abc\a"));
 }
Esempio n. 4
0
 public void ShouldSkipReturenFalseIfNotInExcludeFolderAndIncludeFolderIsEmpty()
 {
     Filter filter = new Filter {Exclude = @"d:\abcd"};
     Assert.IsFalse(filter.ShouldSkip(@"d:\abc\a"));
 }
Esempio n. 5
0
 public void ShouldSkipReturenFalseIfEmpty()
 {
     Filter filter = new Filter();
     Assert.IsFalse(filter.ShouldSkip(@"d:\abc"));
 }
Esempio n. 6
0
 public void FormatWhenSetInclude()
 {
     Filter filter = new Filter {Include = @"  d:\abcd\\\\\, d:\ab ;d:\e  "};
     Assert.AreEqual(@"d:\abcd\,d:\ab\,d:\e\,", filter.Include);
 }