Allen.Util.EverythingFileSearcher.Searcher.Search C# (CSharp) Method

Search() public static method

使用Everything执行文件搜索
public static Search ( string queryStr, bool isSortBypath = true ) : IList
queryStr string
isSortBypath bool
return IList
        public static IList<string> Search(string queryStr, bool isSortBypath = true)
        {
            int i;
            const int bufsize = 260;
            var buf = new StringBuilder(bufsize);
            Everything_Reset();
            // set the search
            Everything_SetSearchW(queryStr);

            // use our own custom scrollbar... 			
            // Everything_SetMax(listBox1.ClientRectangle.Height / listBox1.ItemHeight);
            // Everything_SetOffset(VerticalScrollBarPosition...);

            // execute the query
            Everything_QueryW(true);

            if (isSortBypath)
                Everything_SortResultsByPath();

            var count = Everything_GetNumResults();
            var result = new List<string>(count);


            // loop through the results, adding each result to the listbox.
            for (i = 0; i < count; i++)
            {
                // get the result's full path and file name.
                Everything_GetResultFullPathNameW(i, buf, bufsize);

                // add it to the list box				
                result.Add(buf.ToString());
            }
            return result;
        }
    }