Пример #1
0
 private static extern IntPtr Search(
     FoundPathCallbackDelegate foundPathCallback,
     SearchProgressUpdatedDelegate progressUpdatedCallback,
     SearchDoneCallbackDelegate searchDoneCallback,
     [MarshalAs(UnmanagedType.LPWStr)] string searchPath,
     [MarshalAs(UnmanagedType.LPWStr)] string searchPattern,
     [MarshalAs(UnmanagedType.LPWStr)] string searchString,
     SearchFlags searchFlags,
     ulong ignoreFilesLargerThan);
Пример #2
0
        public static IntPtr SearchAsync(SearchViewModel searchViewModel, FoundPathCallbackDelegate foundPathCallback, SearchProgressUpdatedDelegate searchProgressUpdated, SearchDoneCallbackDelegate searchDoneCallback)
        {
            SearchFlags searchFlags = SearchFlags.None;

            if (searchViewModel.SearchForFiles)
            {
                searchFlags |= SearchFlags.SearchForFiles;
            }

            if (searchViewModel.SearchInFileName)
            {
                searchFlags |= SearchFlags.SearchInFileName;
            }

            if (searchViewModel.SearchInFilePath)
            {
                searchFlags |= SearchFlags.SearchInFilePath;
            }

            if (searchViewModel.SearchInFileContents)
            {
                searchFlags |= SearchFlags.SearchInFileContents;
            }

            if (searchViewModel.SearchContentsAsUtf8)
            {
                searchFlags |= SearchFlags.SearchContentsAsUtf8;
            }

            if (searchViewModel.SearchContentsAsUtf16)
            {
                searchFlags |= SearchFlags.SearchContentsAsUtf16;
            }

            if (searchViewModel.SearchForDirectories)
            {
                searchFlags |= SearchFlags.SearchForDirectories;
            }

            if (searchViewModel.SearchInDirectoryPath)
            {
                searchFlags |= SearchFlags.SearchInDirectoryPath;
            }

            if (searchViewModel.SearchInDirectoryName)
            {
                searchFlags |= SearchFlags.SearchInDirectoryName;
            }

            if (searchViewModel.SearchRecursively)
            {
                searchFlags |= SearchFlags.SearchRecursively;
            }

            if (searchViewModel.SearchIgnoreCase)
            {
                searchFlags |= SearchFlags.SearchIgnoreCase;
            }

            if (searchViewModel.SearchIgnoreDotStart)
            {
                searchFlags |= SearchFlags.SearchIgnoreDotStart;
            }

            return(Search(foundPathCallback, searchProgressUpdated, searchDoneCallback, searchViewModel.SearchPath, searchViewModel.SearchPattern, searchViewModel.SearchString, searchFlags, searchViewModel.IgnoreFilesLargerThanInBytes));
        }