Example #1
0
        // ----- Private Methods -----

        private static void ResetVariables()
        {
            m_thread          = null;
            m_stop            = false;
            m_pars            = null;
            m_containingBytes = null;
        }
Example #2
0
        // ----- Public Methods -----

        public static Boolean Start(SearcherParams pars)
        {
            Boolean success = false;

            if (m_thread == null)
            {
                // Perform a reset of all variables,
                // to ensure that the state of the searcher is the same on every new start:
                ResetVariables();

                // Remember the parameters:
                m_pars = pars;

                // Start searching for FileSystemInfos that match the parameters:
                m_thread = new Thread(new ThreadStart(SearchThread));
                m_thread.Start();

                success = true;
            }

            return(success);
        }
Example #3
0
        private void sfsSearchStartButton_Click(object sender, EventArgs e)
        {
            if (!CheckInputFields())
            {
                return;
            }
            sfsSearchResultsTreeView.Nodes.Clear();

            var pars = new SearcherParams(sfsInitialDirectoryTextBox.Text.Trim(), true, sfsFileNamePatternTextBox.Text,
                                          true, sfsSearchTextTextBox.Text.Trim(), Encoding.ASCII, searchInZipArchiveCheckBox.Checked, searchInImagescheckBox.Checked);

            if (Searcher.Start(pars))
            {
                _stopWatch.Restart();
                DisableControls();
            }
            else
            {
                MessageBox.Show(T._("Search is already running. Stop the search or wait for the process to complete."),
                                T._("Start searching"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }