Example #1
0
        public ContextScope CreateContextScope(CGFParserReporterContext.Type contextType, String filePath)
        {
            CGFParserReporterContext reporterContext = CGFParserReporterContext.CreateContext(contextType, filePath);
            ContextScope             contextScope    = new ContextScope(this, reporterContext);

            return(contextScope);
        }
        public static CGFParserReporterContext CreateContext(CGFParserReporterContext.Type contextType, String contextName)
        {
            CGFParserReporterContext reporterContext = new CGFParserReporterContext();

            reporterContext.ContextType = contextType;
            reporterContext.ContextName = contextName;

            return(reporterContext);
        }
Example #3
0
        void PushContext(CGFParserReporterContext reporterContext)
        {
            if (m_ReporterContextStack.Count != 0)
            {
                CGFParserReporterContext top = m_ReporterContextStack.Peek();
                if (top != null)
                {
                    reporterContext.ParentContext = top;
                }
            }

            m_ReporterContextStack.Push(reporterContext);
        }
Example #4
0
        void LogReport(CGFParserReportDetails reportDetails)
        {
            int       depth = 0;
            const int indentationPerDepth = 2;

            if (m_ReporterContextStack.Count > 0)
            {
                CGFParserReporterContext[] contextList = m_ReporterContextStack.ToArray();
                for (int contextIndex = contextList.Length - 1; contextIndex >= 0; --contextIndex)
                {
                    CGFParserReporterContext context = contextList[contextIndex];
                    Console.WriteLine($"[{ reportDetails.ErrorLevel.ToString() }]" + "".PadLeft(depth + 1) + context.ContextName);
                    depth += indentationPerDepth;
                }
            }

            Console.WriteLine($"[{ reportDetails.ErrorLevel.ToString() }]" + "".PadLeft(depth + 1) + $"{ reportDetails.ErrorMessage }".PadLeft(depth));

            m_ReportDetailsLevelCount[(int)reportDetails.ErrorLevel]++;
        }
Example #5
0
 public ContextScope(CGFParserReporter reporter, CGFParserReporterContext reporterContext)
 {
     m_Reporter = reporter;
     m_Reporter.PushContext(reporterContext);
 }