Exemple #1
0
        public IList <FileSystemInfo> Search(string searchString)
        {
            _results.Clear();
            _resultsReady.Reset();

            var ipcWindow = Win32.FindWindow(EverythingIpcClass, "");

            if (ipcWindow == IntPtr.Zero)
            {
                throw new Win32Exception(Marshal.GetLastWin32Error(), "Error finding Everything Search IPC message window.");
            }

            var query  = new Query(Handle, _flags, searchString);
            var cdsPtr = new SafeHeapPtr <CopyDataStructure>(query.ToCopyDataStructure());

            if (Win32.SendMessage(ipcWindow, WindowMessage.CopyData, Handle, cdsPtr) == IntPtr.Zero)
            {
                throw new Win32Exception(Marshal.GetLastWin32Error(), "Error sending IPC request to Everything Search.");
            }

            if (!_resultsReady.WaitOne(10000))
            {
                throw new TimeoutException("Timed out waiting for response from Everything Search.");
            }

            return(_results.ToList());
        }
        public IList<FileSystemInfo> Search(string searchString)
        {
            _results.Clear();
            _resultsReady.Reset();

            var ipcWindow = Win32.FindWindow(EverythingIpcClass, "");
            if (ipcWindow == IntPtr.Zero)
            {
                throw new Win32Exception(Marshal.GetLastWin32Error(), "Error finding Everything Search IPC message window.");
            }

            var query = new Query(Handle, _flags, searchString);
            var cdsPtr = new SafeHeapPtr<CopyDataStructure>(query.ToCopyDataStructure());
            if (Win32.SendMessage(ipcWindow, WindowMessage.CopyData, Handle, cdsPtr) == IntPtr.Zero)
            {
                throw new Win32Exception(Marshal.GetLastWin32Error(), "Error sending IPC request to Everything Search.");
            }

            if (!_resultsReady.WaitOne(10000))
            {
                throw new TimeoutException("Timed out waiting for response from Everything Search.");
            }

            return _results.ToList();
        }