예제 #1
0
        private void Dosearch_Click(object sender, RoutedEventArgs e)
        {
            if (history.Items.Contains(command.Text))
            {
                history.Items.Remove(command.Text);
                history.Items.Insert(0, command.Text);
            }
            else
            {
                history.Items.Insert(0, command.Text);
            }

            if (history.Items.Count > 100)
            {
                history.Items.RemoveAt(history.Items.Count - 1);
            }

            //MakeCommand
            GrepConfig cfg = new GrepConfig()
            {
                command    = command.Text,
                entry      = searchpath.Text,
                filter     = filter.Text,
                inczip     = inczip.IsChecked.Value,
                docase     = docase.IsChecked.Value,
                dofilename = dofilename.IsChecked.Value,
                doregex    = doregex.IsChecked.Value,
                encoding   = encoding.Text,
                envlines   = int.Parse(preview.Text)
            };
            ResultMake maker = new ResultMake();

            maker.MakeEnv(this, cfg, new Action(() => { }));
        }
예제 #2
0
        public void MakeEnv(MainWindow window, GrepConfig config, Action resumecmds)
        {
            this.window = window;

            container = new TabItem();
            var sp = new StackPanel()
            {
                Orientation = Orientation.Horizontal
            };

            container.Header = sp;
            sp.Children.Add(new Label()
            {
                Content = config.command + " "
            });
            var btn = new Button()
            {
                Content = "X", Background = null, BorderBrush = null
            };

            btn.Click += Btn_Click;
            sp.Children.Add(btn);
            place = new SearchResult();
            var gd = new Grid();
            var sv = new ScrollViewer()
            {
                HorizontalScrollBarVisibility = ScrollBarVisibility.Auto,
                VerticalScrollBarVisibility   = ScrollBarVisibility.Auto,
            };

            place.SetEnv(config.envlines);
            sv.Content = place;
            gd.Children.Add(sv);
            container.Content = gd;

            window.resulttabs.Items.Add(container);
            window.resulttabs.SelectedIndex = window.resulttabs.Items.Count - 1;

            resumecmd = resumecmds;

            latestprogress = ("", 1, 0);
            main           = new GrepMain();
            main.DoGrep(config, stopped, finished, progress, addline, addenv);
        }
예제 #3
0
 public void DoGrep(GrepConfig config, Action stopped, Action finished, Action <(string title, long total, long done)> ProgressReport, Action <(string file, int line, int st, int ed, string linedata)> AddLine, Action <(string file, int line, string linedata)> AddEnv)