Exemplo n.º 1
0
        private static IEnumerable <SearchItem> SearchFileIndex(string filter, bool searchPackages, SearchProvider provider)
        {
            UnityEngine.Assertions.Assert.IsNotNull(fileIndexer);

            return(fileIndexer.Search(filter, searchPackages ? int.MaxValue : 100).Select(e =>
            {
                var filename = Path.GetFileName(e.path);
                var filenameNoExt = Path.GetFileNameWithoutExtension(e.path);
                var itemScore = e.score;
                if (filenameNoExt.Equals(filter, StringComparison.OrdinalIgnoreCase))
                {
                    itemScore = SearchProvider.k_RecentUserScore + 1;
                }
                return provider.CreateItem(e.path, itemScore, filename, null, null, null);
            }));
        }
Exemplo n.º 2
0
        private static IEnumerable <SearchItem> SearchFiles(string searchQuery, SearchProvider provider)
        {
            UnityEngine.Assertions.Assert.IsNotNull(fileIndexer);

            return(fileIndexer.Search(searchQuery).Select(e =>
            {
                var filename = Path.GetFileName(e.id);
                var filenameNoExt = Path.GetFileNameWithoutExtension(e.id);
                var itemScore = e.score;
                if (filenameNoExt.Equals(searchQuery, StringComparison.OrdinalIgnoreCase))
                {
                    itemScore = SearchProvider.k_RecentUserScore + 1;
                }
                return provider.CreateItem(e.id, itemScore, filename, null, null, null);
            }));
        }