/// <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); }
void Document_DocumentUpdated() { ignore_selection_changed = true; //TextBox is used to display parse results TextBox.Rtf = null; TextBox.Text = Document.Text; count_positions_ignored_by_rich_text_box(); Text = Document.Title + " - " + title; CaptureLabels.Clear(); fill_NavigateBy(true); ////set rtf header //StringBuilder rtf = new StringBuilder(TextBox.Rtf); ////get the needed font declared in the head //TextBox.Text = "12"; //TextBox.Select(1, 1); //TextBox.SelectionFont = Settings.Default.CaptureLabelFont; //string rtf2 = TextBox.Rtf; //string head = rtf2.Substring(0, rtf2.IndexOf("\r\n")); ////create color table //Color html_tags_color = Settings.Default.HtmlTagsColor; //Color html_comment_color = Settings.Default.HtmlCommentColor; //string colortb = string.Format(@"{{\colortbl;\red{0}\green{1}\blue{2};\red{3}\green{4}\blue{5};}}", // html_comment_color.R, html_comment_color.B, html_comment_color.G, // html_tags_color.R, html_tags_color.B, html_tags_color.G); //head += colortb; //rtf.Remove(0, RtfEditor.IndexOf(rtf, "\r\n")); //rtf.Insert(0, head); if (Settings.Default.HighlightHtmlTags) { //set rtf header StringBuilder rtf = new StringBuilder(TextBox.Rtf); Color html_tags_color = Settings.Default.HtmlTagsColor; Color html_comment_color = Settings.Default.HtmlCommentColor; Color html_javascript_color = Settings.Default.HtmlJavascriptColor; string colortb = string.Format(@"{{\colortbl;\red{0}\green{1}\blue{2};\red{3}\green{4}\blue{5};\red{6}\green{7}\blue{8};}}", html_comment_color.R, html_comment_color.G, html_comment_color.B, html_tags_color.R, html_tags_color.G, html_tags_color.B, html_javascript_color.R, html_javascript_color.G, html_javascript_color.B); rtf.Insert(RtfEditor.IndexOf(rtf, "\r\n"), colortb); int rtf_length = rtf.Length; for (int i = 0; i < rtf_length; i++) { if (rtf[i] != '<') { continue; } if (RtfEditor.IsEqualIgnoringCase(rtf, i + 1, "!--")) { rtf.Insert(i, @"\cf1 "); i += 5; rtf_length += 5; int tag_end = RtfEditor.IndexOf(rtf, "-->", i); if (tag_end >= 0) { rtf.Insert(tag_end + 1, @"\cf0 "); i = tag_end + 5; rtf_length += 5; } } else if (RtfEditor.IsEqualIgnoringCase(rtf, i + 1, "script")) { rtf.Insert(i, @"\cf2 "); i += 5; rtf_length += 5; int tag_end = RtfEditor.IndexOf(rtf, ">", i); if (tag_end >= 0) { rtf.Insert(tag_end + 1, @"\cf3 "); i = tag_end + 5; rtf_length += 5; } } else { rtf.Insert(i, @"\cf2 "); i += 5; rtf_length += 5; int tag_end = RtfEditor.IndexOf(rtf, ">", i); if (tag_end >= 0) { rtf.Insert(tag_end + 1, @"\cf0 "); i = tag_end + 5; rtf_length += 5; } } } TextBox.Rtf = rtf.ToString(); } ignore_selection_changed = false; }