示例#1
0
        public void HighLightWord(int index, Color color)
        {
            if (ef == null)
            {
                return;
            }

            string texts = Results[index] as string;

            string[] d = texts.Split("\t".ToCharArray());

            if (d.Length < 3)
            {
                return;
            }

            // ef.OpenFileXY(d[0], d[1], d[2], text.Length);

            AsyncCallback     callBack = new AsyncCallback(ProcessInformation);
            workerDisplayLine wde      = DisplayLine;

            wde.BeginInvoke(d[0], d[1], d[2], pattern.Length, callBack, "null");
        }
示例#2
0
        public void HighlightLine(int index, Color color)
        {
            var lines = rb.Lines;

            if (index < 0 || index >= lines.Length)
            {
                return;
            }
            var start  = rb.GetFirstCharIndexFromLine(index); // Get the 1st char index of the appended text
            var length = lines[index].Length;

            rb.Select(start, length);                 // Select from there to the end
            //rb.SelectionBackColor = color;
            _elines  = start;
            _elength = length;

            if (ef == null)
            {
                return;
            }

            string texts = lines[index];

            string[] d = texts.Split("\t".ToCharArray());

            if (d.Length < 3)
            {
                return;
            }

            // ef.OpenFileXY(d[0], d[1], d[2], text.Length);

            AsyncCallback     callBack = new AsyncCallback(ProcessInformation);
            workerDisplayLine wde      = DisplayLine;

            wde.BeginInvoke(d[0], 1, 2, text.Length, callBack, "null");
        }
示例#3
0
        private void Dg_SelectionChanged(object sender, EventArgs e)
        {
            if (dg.SelectedRows.Count <= 0)
            {
                return;
            }
            int i = dg.SelectedRows[0].Index;

            DataGridViewRow v = dg.Rows[i];

            if (ef == null)
            {
                return;
            }

            if (v.Tag == null)
            {
                return;
            }
            if (v.Tag.GetType() == typeof(Microsoft.Build.Framework.BuildErrorEventArgs))
            {
                Microsoft.Build.Framework.BuildErrorEventArgs b = v.Tag as Microsoft.Build.Framework.BuildErrorEventArgs;

                string project = b.ProjectFile;
                string file    = Path.GetDirectoryName(b.ProjectFile) + "\\" + b.File;
                int    c       = b.LineNumber;
                int    p       = b.ColumnNumber;
                int    es      = b.EndLineNumber;
                int    ep      = b.EndColumnNumber;

                AsyncCallback     callBack = new AsyncCallback(ProcessInformation);
                workerDisplayLine wde      = DisplayLine;
                wde.BeginInvoke(file, c, p, 100, callBack, "null");

                // ef.OpenFileLine(file, c.ToString(), p);
            }
            else if (v.Tag.GetType() == typeof(Microsoft.Build.Framework.BuildWarningEventArgs))
            {
                Microsoft.Build.Framework.BuildWarningEventArgs b = v.Tag as Microsoft.Build.Framework.BuildWarningEventArgs;

                string project = b.ProjectFile;
                string file    = Path.GetDirectoryName(b.ProjectFile) + "\\" + b.File;
                int    c       = b.LineNumber;
                int    p       = b.ColumnNumber;
                int    es      = b.EndLineNumber;
                int    ep      = b.EndColumnNumber;

                AsyncCallback     callBack = new AsyncCallback(ProcessInformation);
                workerDisplayLine wde      = DisplayLine;
                wde.BeginInvoke(file, c, p, 100, callBack, "null");

                //ef.OpenFileLine(file, c.ToString(), p);
            }
            else //if (v.Tag.GetType() == typeof(Diagnostic))
            {
                Diagnostic b = v.Tag as Diagnostic;

                if (b != null)
                {
                    //string project = b.vp.FileName;
                    if (b.Location == Microsoft.CodeAnalysis.Location.None)
                    {
                        return;
                    }
                    if (b.Location.SourceTree == null)
                    {
                        return;
                    }
                    string file = b.Location.SourceTree.FilePath;

                    Microsoft.CodeAnalysis.FileLinePositionSpan c = b.Location.GetLineSpan();
                    int ps = c.StartLinePosition.Line;
                    int cs = 0;
                    int es = c.StartLinePosition.Character;

                    int start  = b.Location.SourceSpan.Start;
                    int length = b.Location.SourceSpan.Length;

                    AsyncCallback     callBack = new AsyncCallback(ProcessInformation);
                    workerDisplayLine wde      = DisplayLine;
                    wde.BeginInvoke(file, start, length, 100, callBack, "null");

                    //ef.OpenFileLine(file, c.ToString(), p);
                }
            }
        }