Пример #1
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            string itemValue;

            if (!string.IsNullOrEmpty(this.txtPath.Text))
            {
                SearchInforDomain SearchModel = new SearchInforDomain();
                SearchModel.Filter           = this.txtFilter.Text;
                SearchModel.IsIncludeSub     = this.cbkIncludeSub.Checked;
                SearchModel.IsOnlySearchFile = this.chkbOnlyFile.Checked;
                if (!SearchModel.IsOnlySearchFile)
                {
                    foreach (var item in this.cmbConditions.Items)
                    {
                        itemValue = item.ToString();
                        if (!string.IsNullOrEmpty(itemValue)
                            &&
                            SearchModel.TestAndAddReg(itemValue)
                            )
                        {
                            SearchModel.SearchInfor.Add(itemValue);
                        }
                        else
                        {
                            this.cmbConditions.SelectedItem = item;
                            MessageBox.Show(this, string.Format("Item \"{0}\" cannot creat Regex.", itemValue));
                            return;
                        }
                    }
                    SearchModel.OpenFileEncoding = GetOpenEncoding(cmbBoxEncodingSelect.SelectedIndex);
                }
                SearchModel.SearchPath     = this.txtPath.Text;
                SearchModel.OutputFilePath = resultFileName;// "Report.txt";
                SearchModel.ShowMessage    = new SearchInforDomain.ShowSearchingMessage(this.BackCall);
                if (!Directory.Exists(SearchModel.SearchPath))
                {
                    MessageBox.Show(this, "Directory does not exists.");
                    return;
                }
                if (!this.MainServices.IsRunning)
                {
                    this.txtInfors.Text = "";
                    this.MainServices.StartRun(this, SearchModel);
                }
                else
                {
                    MessageBox.Show(this, "Is in Searching process.");
                }
            }
            else
            {
                MessageBox.Show(this, "Please Select a path to search.");
            }
        }
Пример #2
0
        public bool StartRun(Form BackCallForm, SearchInforDomain searchInforModel)
        {
            bool returnValue = false;

            if (!this.IsRunning)
            {
                this.IsRunning   = true;
                this.InvokeForm  = BackCallForm;
                this.SearchModel = searchInforModel;

                this.WorkThread = new Thread(new ThreadStart(this.WorkRun));
                this.WorkThread.IsBackground = true;
                this.WorkThread.Start();
                returnValue = true;
            }
            return(returnValue);
        }
Пример #3
0
 public IOFileDirectoryUtility(WriteReportLog writeReportLog, SearchInforDomain searchInforModel)
 {
     this.writeReportLog   = writeReportLog;
     this.searchInforModel = searchInforModel;
     this.regs             = searchInforModel.Regs;
 }