Пример #1
0
        private List <Garbage> ScanByEverything(Filter filter)
        {
            List <Garbage> result = new List <Garbage>();

            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);
                result.Add(garbage);
            }
            return(result);
        }
Пример #2
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");
            }
        }