Ejemplo n.º 1
0
        private static Error GetError(string text)
        {
            //The process of trying to sort the random spouts of letters back into lines. Hacky.

            if (text.Contains("\n"))
            {
                lineBuffer += text;

                List <string> lines = lineBuffer.Split('\n').ToList();

                lineBuffer = lines.Last();

                foreach (string line in lines)
                {
                    var error = ErrorFinder.GetError(line);

                    if (error != null)
                    {
                        return(error);
                    }
                }
            }
            else
            {
                lineBuffer += text;
            }

            return(null);
        }
Ejemplo n.º 2
0
        public static void ProgressiveLog(string s)
        {
            lineBuffer.Append(s);

            if (s.Contains("\n"))
            {
                List <string> lines = lineBuffer.ToString().Split('\n').ToList();

                string suffixText = lines.Last();

                lineBuffer = new StringBuilder(suffixText);

                OnBacktrack(tempText);

                for (var i = 0; i < lines.Count - 1; i++)
                {
                    var line  = lines[i];
                    var error = ErrorFinder.GetError(line);

                    if (error == null)
                    {
                        Log(line);
                    }
                    else
                    {
                        if (errorsFound.ContainsKey(error))
                        {
                            errorsFound[error]++;
                        }
                        else
                        {
                            errorsFound.Add(error, 1);
                        }

                        if (errorsFound[error] < 128)
                        {
                            LogCompileError(line, error);
                        }
                        else
                        {
                            Log(line);//Stop hyperlinking errors if we see over 128 of them
                        }
                        OnErrorFound(error);
                    }
                }

                if (suffixText.Length > 0)
                {
                    tempText = new List <Run>();
                    tempText.Add(Log(suffixText));
                }
            }
            else
            {
                tempText.Add(Log(s));
            }
        }
Ejemplo n.º 3
0
        public static void ProgressiveLog(string s)
        {
            lineBuffer.Append(s);

            if (s.Contains("\n"))
            {
                List <string> lines = lineBuffer.ToString().Split('\n').ToList();

                string suffixText = lines.Last();

                lineBuffer = new StringBuilder(suffixText);

                OnBacktrack(tempText);

                for (var i = 0; i < lines.Count - 1; i++)
                {
                    var line  = lines[i];
                    var error = ErrorFinder.GetError(line);

                    if (error == null)
                    {
                        Log(line);
                    }
                    else
                    {
                        LogCompileError(line, error);
                    }
                }

                if (suffixText.Length > 0)
                {
                    tempText = new List <Run>();
                    tempText.Add(Log(suffixText));
                }
            }
            else
            {
                tempText.Add(Log(s));
            }
        }