private void errorDoubleClick(object sender, MouseEventArgs args)
        {
            DataGridRow row = sender as DataGridRow;

            PluginLib.CompileError result = row.DataContext as PluginLib.CompileError;
            foreach (string str in IDEProject.inst().GetIncludeDirs())
            {
                string path = System.IO.Path.Combine(IDEProject.inst().ProjectDir, str);
                path = System.IO.Path.Combine(path, result.File);
                if (System.IO.File.Exists(path))
                {
                    IDEEditor editor = ideTabs.OpenFile(new FileLeafItem
                    {
                        Path = path,
                        Name = System.IO.Path.GetFileName(path)
                    });
                    if (result.Line != -1)
                    {
                        editor.Editor.TextArea.Caret.Line = result.Line;
                        editor.Editor.ScrollToLine(result.Line);
                    }
                    return;
                }
            }
        }
Example #2
0
 public void PublishError(PluginLib.CompileError error)
 {
     IDEView.inst().Dispatcher.Invoke(delegate()
     {
         CompileErrors.Add(error);
     });
 }
Example #3
0
 public void PublishWarning(PluginLib.CompileError error)
 {
     IDEView.inst().Dispatcher.Invoke(delegate()
     {
         CompileErrors.Add(error);
         OnPropertyChanged("CompileErrorCt");
         OnPropertyChanged("CompileWarningCt");
     });
 }
Example #4
0
        private void errorDoubleClick(object sender, MouseEventArgs args)
        {
            DataGridRow row = sender as DataGridRow;

            PluginLib.CompileError result = row.DataContext as PluginLib.CompileError;
            IDEEditor editor = ideTabs.OpenFile(new FileLeafItem {
                Path = result.File,
                Name = result.File.Replace(IDEProject.inst().ProjectDir, "")
            });

            if (result.Line != -1)
            {
                editor.Editor.TextArea.Caret.Line = result.Line;
                editor.Editor.ScrollToLine(result.Line);
            }
        }
Example #5
0
        public void Draw(TextView textView, System.Windows.Media.DrawingContext drawingContext)
        {
            if (pen == null)
            {
                pen = new Pen(textView.FindResource("WavyBrush") as Brush, 4);
            }
            Size renderSize = textView.RenderSize;

            if (textView != null && textView.VisualLinesValid)
            {
                foreach (VisualLine line in textView.VisualLines)
                {
                    PluginLib.CompileError err = IDEProject.inst().CompileErrors.FirstOrDefault(l => l.Line == line.FirstDocumentLine.LineNumber && l.File.Equals(file.Path));
                    if (err != null)
                    {
                        drawingContext.DrawLine(pen,
                                                new Point(0, line.VisualTop + line.Height - textView.ScrollOffset.Y),
                                                new Point(renderSize.Width, line.VisualTop - textView.ScrollOffset.Y + line.Height));
                    }
                }
            }
        }
        public static bool ProcessLine(string str, PluginLib.ICompileHelper compileErrorPublisher, PluginLib.IErrorPublisher errorPublisher)
        {
            if (str == null)
                return false;
            compileErrorPublisher.PushOutput(str + "\r\n");
            bool isError = false;
            bool isWarning = false;
            if (str.Contains("ERROR: "))
            {
                str = str.Replace("ERROR: ", "");
                isError = true;
            }
            if (str.Contains("WARNING: "))
            {
                str = str.Replace("WARNING: ", "");
                isWarning = true;
            }
            if (isError || isWarning)
            {
                int sPos = str.IndexOf(": ");
                int driveIndex = str.IndexOf(':', sPos + 1);
                int colonIndex = str.IndexOf(':', driveIndex + 1);

                if (colonIndex == -1)
                    return false; //don't count this as an error
                string fileName = str.Substring(sPos+1, colonIndex);

                string part = "";
                int line = -1;
                int column = -1;
                //move to first number
                ++colonIndex;
                for (; colonIndex < str.Length; ++colonIndex)
                {
                    if (str[colonIndex] == ',')
                    {
                        if (line == -1)
                            line = int.Parse(part);
                        else
                            column = int.Parse(part);
                    }
                    if (str[colonIndex] == ' ')
                        break;
                    part += str[colonIndex];
                }
                string msg = str.Substring(colonIndex+1);
                PluginLib.CompileError error = new PluginLib.CompileError
                {
                    File = fileName,
                    Line = line,
                    Message = msg,
                    IsError = isError
                };
                compileErrorPublisher.PublishError(error);
                return isError;
            }
            return false;
        }
Example #7
0
        public static bool ProcessLine(string str, PluginLib.ICompileHelper compileErrorPublisher, PluginLib.IErrorPublisher errorPublisher)
        {
            if (str == null)
            {
                return(false);
            }
            compileErrorPublisher.PushOutput(str + "\r\n");
            bool isError   = false;
            bool isWarning = false;

            if (str.Contains("ERROR: "))
            {
                str     = str.Replace("ERROR: ", "");
                isError = true;
            }
            if (str.Contains("WARNING: "))
            {
                str       = str.Replace("WARNING: ", "");
                isWarning = true;
            }
            if (isError || isWarning)
            {
                string[] words      = str.Split(' '); //split on spaces
                int      colonIndex = words[0].LastIndexOf(':');
                if (colonIndex == -1)
                {
                    return(false); //don't count this as an error
                }
                string fileName = words[0].Substring(0, colonIndex);

                string part   = "";
                int    line   = -1;
                int    column = -1;
                //move to first number
                ++colonIndex;
                for (; colonIndex < str.Length; ++colonIndex)
                {
                    if (str[colonIndex] == ',')
                    {
                        if (line == -1)
                        {
                            line = int.Parse(part);
                        }
                        else
                        {
                            column = int.Parse(part);
                        }
                    }
                    if (str[colonIndex] == ' ')
                    {
                        break;
                    }
                    part += str[colonIndex];
                }
                string msg = String.Join(" ", words, 1, words.Length - 1); // str.Substring(colonIndex);
                PluginLib.CompileError error = new PluginLib.CompileError
                {
                    File    = fileName,
                    Line    = line,
                    Message = msg,
                    IsError = isError
                };
                compileErrorPublisher.PublishError(error);
                return(isError);
            }
            return(false);
        }
Example #8
0
        public void CompileFile(string file, PluginLib.ICompileErrorPublisher compileErrorPublisher, PluginLib.IErrorPublisher errorPublisher)
        {
            try
            {
                string path = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
                path = Path.Combine(path, "bin");
                path = Path.Combine(path, "ScriptCompiler.exe");

                Process pi = new Process();
                pi.StartInfo.FileName               = path;
                pi.StartInfo.Arguments              = file;
                pi.EnableRaisingEvents              = true;
                pi.StartInfo.UseShellExecute        = false;
                pi.StartInfo.CreateNoWindow         = true;
                pi.StartInfo.RedirectStandardOutput = true;
                pi.Start();
                pi.WaitForExit();

                string str = "";
                while ((str = pi.StandardOutput.ReadLine()) != null)
                {
                    compileErrorPublisher.PushOutput(str + "\r\n");
                    if (str.Contains("ERROR: "))
                    {
                        str = str.Replace("ERROR: ", "");
                    }
                    if (str.Contains(','))
                    {
                        int  firstColon = 0;
                        bool colonFond  = false;
                        for (; firstColon < str.Length; ++firstColon)
                        {
                            if (str[firstColon] == ':' && colonFond)
                            {
                                break;
                            }
                            else if (str[firstColon] == ':')
                            {
                                colonFond = true;
                            }
                        }
                        string fileName = str.Substring(0, firstColon);

                        string part   = "";
                        int    line   = -1;
                        int    column = -1;
                        //move to first number
                        ++firstColon;
                        for (; firstColon < str.Length; ++firstColon)
                        {
                            if (str[firstColon] == ',')
                            {
                                if (line == -1)
                                {
                                    line = int.Parse(part);
                                }
                                else
                                {
                                    column = int.Parse(part);
                                }
                            }
                            if (str[firstColon] == ' ')
                            {
                                break;
                            }
                            part += str[firstColon];
                        }
                        string msg = str.Substring(firstColon);
                        PluginLib.CompileError error = new PluginLib.CompileError
                        {
                            File    = fileName,
                            Line    = line,
                            Message = msg
                        };
                        compileErrorPublisher.PublishError(error);
                    }
                }
            } catch (Exception ex)
            {
                errorPublisher.PublishError(ex);
            }
        }