コード例 #1
0
ファイル: BuildStage_Test.cs プロジェクト: SlugEnt/SlugCI
        private LineOutColored?DotNetTest_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:
            // First 2 columns are blank
            if (StringExtension.SpanSearcherContains(textSpan, "Failed", 2, 9))
            {
                return(LineOutColored.LogicError(text));
            }
            if (StringExtension.SpanSearcherContains(textSpan, "Failed!", 0, 9))
            {
                return(LineOutColored.Error(text));
            }
            if (StringExtension.SpanSearcherContains(textSpan, "Passed!", 0, 9))
            {
                return(LineOutColored.Success(text));
            }
            return(LineOutColored.Normal(text));
        }
コード例 #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));
        }