private void SetAnalysisArea(List <string> ans) { TB_AnalyzeResult.Text = ""; if (ans != null) { for (int i = 0; i <= ans.Count - 1; i++) { TB_AnalyzeResult.AppendText(ans[i]); } } }
private void TB_AnalyzeResult_MouseDoubleClick(object sender, MouseEventArgs e) { if (TB_AnalyzeResult.Text != "") { int lineIndex = TB_AnalyzeResult.SelectionStart; int line = TB_AnalyzeResult.GetLineFromCharIndex(lineIndex); string pattern = @"\(\d+?,\d+?\)"; string thisLineString = TB_AnalyzeResult.Lines[line]; //Match match = System.Text.RegularExpressions.Regex.Match(thisLineString, pattern); //if (match.Success == true && thisLineString.Contains(curProjectInfo.fileInfo.FullName)) //{ // string value = match.Groups[0].Value; // char[] charValue = value.ToCharArray(); // char[] tempCharArray = new char[1000]; // int index = value.IndexOf(','); // for (int i = 1; i <= index - 1; i++) // { // tempCharArray[i - 1] = charValue[i]; // } // int codeLine = Convert.ToInt32(new string(tempCharArray)); // TB_CodeArea.Selection.Start = TB_CodeArea.Lines[codeLine - 1].StartPosition; // TB_CodeArea.Selection.End = TB_CodeArea.Lines[codeLine - 1].EndPosition; // // TB_CodeArea.SelectionStart = TB_CodeArea.GetFirstCharIndexFromLine(codeLine - 1); // // TB_CodeArea.SelectionLength = TB_CodeArea.Lines[codeLine - 1].Length; // TB_CodeArea.Focus(); //} int flag = 0; Match match = System.Text.RegularExpressions.Regex.Match(thisLineString, pattern); if (match.Success == true) { EveryProjectInfo tempEPI = new EveryProjectInfo(); for (int i = 0; i < projectInfoList.length(); i++) { tempEPI = projectInfoList.getProjectInfoAt(i); if (tempEPI.infoType == EveryProjectInfo.projectInfoType.fInfo) { if (thisLineString.Contains(tempEPI.fileInfo.FullName) == true) { flag = 1; break; } } } if (flag == 1) { string value = match.Groups[0].Value; char[] charValue = value.ToCharArray(); char[] tempCharArray = new char[1000]; int index = value.IndexOf(','); for (int i = 1; i <= index - 1; i++) { tempCharArray[i - 1] = charValue[i]; } int codeLine = Convert.ToInt32(new string(tempCharArray)); AnalyzeResult_NodeMouseDoubleClick(tempEPI); TB_CodeArea.Selection.Start = TB_CodeArea.Lines[codeLine - 1].StartPosition; TB_CodeArea.Selection.End = TB_CodeArea.Lines[codeLine - 1].EndPosition; // TB_CodeArea.SelectionStart = TB_CodeArea.GetFirstCharIndexFromLine(codeLine - 1); // TB_CodeArea.SelectionLength = TB_CodeArea.Lines[codeLine - 1].Length; TB_CodeArea.Focus(); } } } }