示例#1
0
        // ----- Private Methods -----

        private static void ResetVariables()
        {
            m_thread = null;
            m_stop = false;
            m_pars = null;
            m_containingBytes = null;
        }
示例#2
0
 private static void ResetVariables()
 {
     m_thread          = null;
     m_stop            = false;
     m_pars            = null;
     m_containingBytes = null;
 }
示例#3
0
        private void searchButton_Click(object sender, EventArgs e)
        {
            // Clear the results list
            resultsList.Items.Clear();

            // Get the parameters for  the search thread
            String fileNamesString = fileNameTextBox.Text;

            String[]      fileNames      = fileNamesString.Split(new Char[] { ';' });
            List <String> validFileNames = new List <String>();

            foreach (String fileName in fileNames)
            {
                String trimmedFileName = fileName.Trim();
                if (trimmedFileName != "")
                {
                    validFileNames.Add(trimmedFileName);
                }
            }

            Encoding encoding = Encoding.ASCII;

            SearcherParams pars = new SearcherParams(searchDirTextBox.Text.Trim(), validFileNames, containingTextBox.Text.Trim(), encoding);

            // Start the search thread if it is not already running
            if (Searcher.StartSearch(pars))
            {
            }
            else
            {
                MessageBox.Show("The searcher is already running.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
示例#4
0
        public static Boolean Start(SearcherParams pars)
        {
            Boolean success = false;

            if (m_thread == null)
            {
                ResetVariables();

                m_pars = pars;

                m_thread = new Thread(new ThreadStart(SearchThread));
                m_thread.Start();

                success = true;
            }

            return(success);
        }
示例#5
0
        private void startButton_Click(object sender, EventArgs e)
        {
            // Clear the results list:
            resultsList.Items.Clear();

            // Get the parameters for  the search thread:
            String fileNamesString = fileNameTextBox.Text;

            String[]      fileNames      = fileNamesString.Split(new Char[] { ';' });
            List <String> validFileNames = new List <String>();

            foreach (String fileName in fileNames)
            {
                String trimmedFileName = fileName.Trim();
                if (trimmedFileName != "")
                {
                    validFileNames.Add(trimmedFileName);
                }
            }

            Encoding encoding = asciiRadioButton.Checked ? Encoding.ASCII : Encoding.Unicode;

            SearcherParams pars = new SearcherParams(searchDirTextBox.Text.Trim(),
                                                     includeSubDirsCheckBox.Checked,
                                                     validFileNames,
                                                     newerThanCheckBox.Checked,
                                                     newerThanDateTimePicker.Value,
                                                     olderThanCheckBox.Checked,
                                                     olderThanDateTimePicker.Value,
                                                     containingCheckBox.Checked,
                                                     containingTextBox.Text.Trim(),
                                                     encoding);

            // Start the search thread if it is not already running:
            if (Searcher.Start(pars))
            {
                // Disable all buttons except stop button:
                DisableButtons();
            }
            else
            {
                MessageBox.Show("The searcher is already running.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
示例#6
0
        private void startButton_Click(object sender, EventArgs e)
        {
            resultsList.Items.Clear();

            String fileNamesString = fileNameTextBox.Text;

            String[]      fileNames      = fileNamesString.Split(new Char[] { ';' });
            List <String> validFileNames = new List <String>();

            foreach (String fileName in fileNames)
            {
                String trimmedFileName = fileName.Trim();
                if (trimmedFileName != "")
                {
                    validFileNames.Add(trimmedFileName);
                }
            }

            Encoding encoding = asciiRadioButton.Checked ? Encoding.ASCII : Encoding.Unicode;

            SearcherParams pars = new SearcherParams(searchDirTextBox.Text.Trim(),
                                                     includeSubDirsCheckBox.Checked,
                                                     validFileNames,
                                                     newerThanCheckBox.Checked,
                                                     newerThanDateTimePicker.Value,
                                                     olderThanCheckBox.Checked,
                                                     olderThanDateTimePicker.Value,
                                                     containingCheckBox.Checked,
                                                     containingTextBox.Text.Trim(),
                                                     encoding);

            if (Searcher.Start(pars))
            {
                DisableButtons();
            }
            else
            {
                MessageBox.Show("Поиск уже запущен.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
示例#7
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;
        }
示例#8
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);
        }
示例#9
0
        private void startButton_Click(object sender, EventArgs e)
        {
            // Clear the results list:
            resultsList.Items.Clear();

            
            //Get the config files
            String dirConfigString = configDirTextBox.Text;
            
            treeView1.Nodes.Add("todoskey","ALL");
            
            foreach (string file in Directory.GetFiles(dirConfigString, "*.json"))
			{
			    string contents = File.ReadAllText(file);
            	using (StreamReader r = new StreamReader(file))
			    {
			        string json = r.ReadToEnd();
			        //List<searchParams> items = Newtonsoft.Json.JsonConvert.DeserializeObject<List<searchParams>>(json);
			        //json = json.Replace("\"", "\\u022");
			        dynamic stuff = Newtonsoft.Json.JsonConvert.DeserializeObject(json);
			        String nombre= stuff.Name;
			        Boolean activado = stuff.Enabled;
			        String busqueda1 = stuff.Search.text1;
			        String busqueda2 = stuff.Search.text2;
			        
			        hashJSON.Add(nombre,stuff);
			        
			        if (activado){
			        	
				        treeView1.Nodes["todoskey"].Nodes.Add(nombre);
				        treeView1.EndUpdate();
				        treeView1.ExpandAll();
				   
	            
			            // Get the parameters for  the search thread:
			            String fileNamesString = fileNameTextBox.Text;
			            String[] fileNames = fileNamesString.Split(new Char[]{';'});
			            List<String> validFileNames = new List<String>();
			            foreach (String fileName in fileNames)
			            {
			                String trimmedFileName = fileName.Trim();
			                if (trimmedFileName != "")
			                {
			                    validFileNames.Add(trimmedFileName);
			                }
			            }
			
			            Encoding encoding = true ? Encoding.ASCII : Encoding.Unicode;
			
			            SearcherParams pars = new SearcherParams(   searchDirTextBox.Text.Trim(),
			                                                        includeSubDirsCheckBox.Checked,
			                                                        validFileNames,
			                                                        newerThanCheckBox.Checked,
			                                                        newerThanDateTimePicker.Value,
			                                                        olderThanCheckBox.Checked,
			                                                        olderThanDateTimePicker.Value,
			                                                        true, //Aqui va si va chequeado el containing
			                                                        stuff, //Aqui va el texto
			                                                        encoding);
			            
			            // Start the search thread if it is not already running:
			            if (Searcher.Start(pars))
			            {
			                // Disable all buttons except stop button:
			                DisableButtons();
			            }
			            else
			            {
			            	while (!Searcher.Start(pars)){
			            		Application.DoEvents();
			            	}
			            	Searcher.Start(pars);
			            	//MessageBox.Show("The searcher is already running.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
			            }
			            
			        }
		            
		       }
            } 
        }