Exemplo n.º 1
0
        private void btn_startParsing_Click(object sender, RoutedEventArgs e)
        {
            if (txtbx_filesPath.Text.Length != 0)
            {
                if (!Directory.Exists(txtbx_filesPath.Text))
                {
                    MessageBox.Show("Please enter a valid Data Files path");
                    return;
                }
                filesPath = txtbx_filesPath.Text;
            }
            else
            {
                MessageBox.Show("Please enter Data Files path");
                return;
            }
            if (txtbx_postingPath.Text.Length != 0)
            {
                if (!Directory.Exists(txtbx_postingPath.Text))
                {
                    MessageBox.Show("Please enter a valid Posting Files path");
                    return;
                }
                postingPath = txtbx_postingPath.Text;
            }
            else
            {
                MessageBox.Show("Please enter Posting Files path");
                return;
            }

            try
            {
                File.Create(postingPath + @"\abNumsPosting.txt").Dispose();
                File.Create(postingPath + @"\cfPosting.txt").Dispose();
                File.Create(postingPath + @"\gmPosting.txt").Dispose();
                File.Create(postingPath + @"\nrPosting.txt").Dispose();
                File.Create(postingPath + @"\szPosting.txt").Dispose();
                if (Directory.Exists(postingPath + @"\docs"))
                    Directory.Delete(postingPath + @"\docs");
                Directory.CreateDirectory(postingPath + @"\docs");
            }
            catch (Exception exp)
            {

                return;
            }

            btn_startParsing.IsEnabled = false;
            btn_loadPosting.IsEnabled = false;
            indexer = new Indexer(postingPath);
            ranker.postingPath = postingPath;
            parser = new Parse(filesPath, postingPath, indexer, cb_Stemmeing.IsChecked.Value);
            parser.ModelChanged += vModelChanged;
            Thread thread = new Thread(new ThreadStart(parser.startParsing));
            thread.Start();
            btn_runQuery.IsEnabled = true;
            btn_runQueryFile.IsEnabled = true;
        }