Ejemplo n.º 1
0
        private LineOutColored?DotNetNugetPush_OutputProcessor(EnumProcessOutputType type, string text)
        {
            if (text == null)
            {
                return(null);
            }
            EnumProcessOutputType processType = type;
            LineOutColored        lineOutColored;
            ReadOnlySpan <char>   textSpan = text;

            if (type == EnumProcessOutputType.ProcessErr)
            {
                return(LineOutColored.Error(text));
            }

            if (StringExtension.SpanSearcherContains(textSpan, "warn :", 0, 7))
            {
                return(LineOutColored.Warning(text));
            }

            return(LineOutColored.Normal(text));
        }
Ejemplo n.º 2
0
        private LineOutColored?DotNetBuild_OutputProcessor(EnumProcessOutputType type, string text)
        {
            if (text == null)
            {
                return(null);
            }
            EnumProcessOutputType processType = type;
            LineOutColored        lineOutColored;
            ReadOnlySpan <char>   textSpan = text;

            if (type == EnumProcessOutputType.ProcessErr)
            {
                return(LineOutColored.Error(text));
            }

            // Find index of the actual message part:
            // The plus 17 is arbitrary as the src path,. still has a project path and source filename as well as line and column number entries
            int compileMsgStart = CISession.SourceDirectory.Length + 17;

            if (text.Length > compileMsgStart)
            {
                int index = text.IndexOf(": ", compileMsgStart);
                if (index > 0)
                {
                    if (StringExtension.SpanSearcherContains(textSpan, "error", index + 2, index + 10))
                    {
                        return(LineOutColored.LogicError(text));
                    }
                    if (StringExtension.SpanSearcherContains(textSpan, "warning", index + 2, index + 10 + 50))
                    {
                        return(LineOutColored.Warning(text));
                    }
                }
            }
            return(LineOutColored.Normal(text));
        }