ParseSearchString() static private method

static private ParseSearchString ( string searchText, SearchFilter filter ) : bool
searchText string
filter SearchFilter
return bool
Exemplo n.º 1
0
        internal static SearchFilter CreateSearchFilterFromString(string searchText)
        {
            SearchFilter filter = new SearchFilter();

            SearchUtility.ParseSearchString(searchText, filter);
            return(filter);
        }
        static void SetFilter(HierarchyProperty hierarchy, string filter)
        {
            SearchFilter search = new SearchFilter();

            SearchUtility.ParseSearchString(filter, search);
            hierarchy.SetSearchFilter(search);
        }
Exemplo n.º 3
0
 internal void SearchFieldStringToFilter(string searchString)
 {
     this.ClearSearch();
     if (!string.IsNullOrEmpty(searchString))
     {
         SearchUtility.ParseSearchString(searchString, this);
     }
 }
        internal static SearchFilter CreateFilter(string searchString, SearchableEditorWindow.SearchMode searchMode)
        {
            SearchFilter searchFilter = new SearchFilter();

            if (string.IsNullOrEmpty(searchString))
            {
                return(searchFilter);
            }
            switch (searchMode)
            {
            case SearchableEditorWindow.SearchMode.All:
                if (!SearchUtility.ParseSearchString(searchString, searchFilter))
                {
                    searchFilter.nameFilter = searchString;
                    searchFilter.classNames = new string[]
                    {
                        searchString
                    };
                    searchFilter.assetLabels = new string[]
                    {
                        searchString
                    };
                    searchFilter.assetBundleNames = new string[]
                    {
                        searchString
                    };
                    searchFilter.showAllHits = true;
                }
                break;

            case SearchableEditorWindow.SearchMode.Name:
                searchFilter.nameFilter = searchString;
                break;

            case SearchableEditorWindow.SearchMode.Type:
                searchFilter.classNames = new string[]
                {
                    searchString
                };
                break;

            case SearchableEditorWindow.SearchMode.Label:
                searchFilter.assetLabels = new string[]
                {
                    searchString
                };
                break;

            case SearchableEditorWindow.SearchMode.AssetBundleName:
                searchFilter.assetBundleNames = new string[]
                {
                    searchString
                };
                break;
            }
            return(searchFilter);
        }
Exemplo n.º 5
0
        public static string[] FindAssets(string filter, string[] searchInFolders)
        {
            SearchFilter searchFilter = new SearchFilter();

            SearchUtility.ParseSearchString(filter, searchFilter);
            if (searchInFolders != null)
            {
                searchFilter.folders = searchInFolders;
            }
            return(AssetDatabase.FindAssets(searchFilter));
        }
Exemplo n.º 6
0
        /// <summary>
        /// <para>Search the asset database using a search filter string.</para>
        /// </summary>
        /// <param name="filter">The filter string can contain search data for: names, asset labels and types (class names).</param>
        /// <param name="searchInFolders">Specifying one or more folders will limit the searching to these folders and their child folders (and is faster than searching all assets).</param>
        /// <returns>
        /// <para>Array of matching asset GUIDs.</para>
        /// </returns>
        public static string[] FindAssets(string filter, string[] searchInFolders)
        {
            SearchFilter filter2 = new SearchFilter();

            SearchUtility.ParseSearchString(filter, filter2);
            if (searchInFolders != null)
            {
                filter2.folders = searchInFolders;
            }
            return(FindAssets(filter2));
        }
Exemplo n.º 7
0
        public static string[] FindAssets(string filter, string[] searchInFolders)
        {
            SearchFilter searchFilter = new SearchFilter();

            SearchUtility.ParseSearchString(filter, searchFilter);
            if (searchInFolders != null)
            {
                searchFilter.folders    = searchInFolders;
                searchFilter.searchArea = SearchFilter.SearchArea.SelectedFolders;
            }

            return(FindAssets(searchFilter));
        }
        internal static SearchFilter CreateFilter(string searchString, SearchMode searchMode)
        {
            SearchFilter filter = new SearchFilter();

            if (string.IsNullOrEmpty(searchString))
            {
                return(filter);
            }

            switch (searchMode)
            {
            case SearchMode.All:
                if (!SearchUtility.ParseSearchString(searchString, filter))
                {
                    // Use search string for all SearchModes: name, types and labels
                    filter.nameFilter       = searchString;
                    filter.classNames       = new[] { searchString };
                    filter.assetLabels      = new[] { searchString };
                    filter.assetBundleNames = new[] { searchString };
                    filter.showAllHits      = true;
                }
                break;

            case SearchMode.Name:
                filter.nameFilter = searchString;
                break;

            case SearchMode.Type:
                filter.classNames = new[] { searchString };
                break;

            case SearchMode.Label:
                filter.assetLabels = new[] { searchString };
                break;

            case SearchMode.AssetBundleName:
                filter.assetBundleNames = new[] { searchString };
                break;
            }

            return(filter);
        }
Exemplo n.º 9
0
        internal static SearchFilter CreateFilter(string searchString, SearchMode searchMode)
        {
            SearchFilter filter = new SearchFilter();

            if (!string.IsNullOrEmpty(searchString))
            {
                switch (searchMode)
                {
                case SearchMode.All:
                    if (!SearchUtility.ParseSearchString(searchString, filter))
                    {
                        filter.nameFilter       = searchString;
                        filter.classNames       = new string[] { searchString };
                        filter.assetLabels      = new string[] { searchString };
                        filter.assetBundleNames = new string[] { searchString };
                        filter.showAllHits      = true;
                    }
                    return(filter);

                case SearchMode.Name:
                    filter.nameFilter = searchString;
                    return(filter);

                case SearchMode.Type:
                    filter.classNames = new string[] { searchString };
                    return(filter);

                case SearchMode.Label:
                    filter.assetLabels = new string[] { searchString };
                    return(filter);

                case SearchMode.AssetBundleName:
                    filter.assetBundleNames = new string[] { searchString };
                    return(filter);
                }
            }
            return(filter);
        }