Exemple #1
0
        // add MRU history, suggestions, and clipboard contents to the list of examples.
        public static IEnumerable <string> GetInputSuggestions(string currentSuggestion,
                                                               bool useClipboard, bool mustBeDirectory, string[] more)
        {
            List <string> suggestions = new List <string>();

            if (!string.IsNullOrEmpty(currentSuggestion))
            {
                suggestions.Add(currentSuggestion);
            }

            if (useClipboard && !string.IsNullOrEmpty(Utils.GetClipboard()) &&
                Utils.LooksLikePath(Utils.GetClipboard()) == mustBeDirectory)
            {
                // get from clipboard if the right type of string (path vs not path)
                suggestions.Add(Utils.GetClipboard());
            }

            if (more != null)
            {
                suggestions.AddRange(more);
            }

            return(suggestions.Where(entry => !mustBeDirectory ||
                                     FilenameUtils.IsPathRooted(entry)));
        }