/// <summary>
        /// Load filter tree from xml file
        /// </summary>
        /// <param name="filter_tree_xml_file"></param>
        internal void LoadFilterTree(string filter_tree_xml_file)
        {
            try
            {
                FilterTree.Nodes.Clear();
                CurrentFilterControl = null;
               // Filter_flowLayoutPanel.BackColor = Color.Empty;
                pLevelHighlight.BackColor = Color.Empty;
                InputGroupName.Items.Clear();
                FilterComment.Text = "";

                if (filter_tree_xml_file == null)
                    return;

                this.Text = filter_tree_xml_file.Substring(filter_tree_xml_file.LastIndexOf("\\") + 1) + " " + title;

                //create filter tree
                Parser p = new Parser(filter_tree_xml_file);
                foreach (Filter lr in p.RootFilters)
                    FilterTree.Nodes.Add(create_tree(lr, 0));
                foreach (TreeNode tn in FilterTree.Nodes)
                    tn.ExpandAll();

                //find default filter chain and check it
                if (FilterTree.Nodes.Count > 0)
                {
                    TreeNode tn = FilterTree.Nodes[0];
                    for (; tn.FirstNode != null; tn = tn.FirstNode) ;
                    tn.Checked = true;
                }

                string tree_name = filter_tree_xml_file;
                tree_name = tree_name.Substring(tree_name.LastIndexOf("\\") + 1);
                if (tree_name.EndsWith("." + Program.FilterTreeFileExtension, StringComparison.InvariantCultureIgnoreCase))
                    tree_name = tree_name.Substring(0, tree_name.LastIndexOf("."));
                FilterTreeName.Text = tree_name;
                FilterTreeFileDir.Text = Path.GetDirectoryName(filter_tree_xml_file) + @"\";
                FilterTreeFileDir.SelectionStart = FilterTreeFileDir.Text.Length;
                FilterTreeFileDir.ScrollToCaret();
                Settings.Default.LastFilterTreeFile = filter_tree_xml_file;
                Settings.Default.Save();
            }
            catch (Exception e)
            {
                Message.Error(e);
            }
        }
        /// <summary>
        /// adds the selected prepared filter to the selected filter tree node
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddPrepared_Click(object sender, EventArgs e)
        {
            try
            {
                if (PreparedFilterTrees.SelectedIndex < 0)
                {
                    Message.Exclaim("No prepared filter tree is selected.");
                    return;
                }

                Parser p = new Parser(prepared_filter_tree_files[(string)PreparedFilterTrees.SelectedItem]);
                AddFilterTreeToSelectedTreeNode(p.RootFilters);
            }
            catch (Exception ex)
            {
                Message.Error(ex);
            }
        }
Example #3
0
        /// <summary>
        /// start parsing by the current debug regex chain
        /// </summary>
        /// <returns></returns>
        internal bool RunParse()
        {
            ignore_selection_changed = true;
            PrevMark.Enabled = true;
            NextMark.Enabled = true;
            if (current_capture_label_index >= 0 && current_capture_label_index < CaptureLabels.Count)
                unmark_capture_branch(CaptureLabels[current_capture_label_index]);
            current_capture_label_index = -1;
            current_path_capture_count = 0;

            fill_NavigateBy(true);

            CaptureLabels.Clear();
            TextBox.SelectAll();
            TextBox.SelectionBackColor = Color.White;
            TextBox.DeselectAll();
            //RefreshDocument();

            parser = FilterTreeForm.This.GetFilterChainParser();
            if (parser.RootFilters == null || parser.RootFilters.Length < 1)
                return false;
            //page = TextBox.Text;
            ThreadStart ts = new ThreadStart(parse);
            parse_thread = new Thread(ts);
            parse_thread.Start();
            return true;
        }