Пример #1
0
        public void PrintResult(AnalysisResult analysisResult)
        {
            Console.CursorLeft = 0;

            ConsoleColor lineColor;

            if (!String.IsNullOrWhiteSpace(analysisResult.Get(AnalysisResult.PARAMETER_EXCEPTION)))
            {
                lineColor = ConsoleColor.Red;
            }
            else if (analysisResult.Get(AnalysisResult.PARAMETER_BOOL_HAS_MULTIPLE_PATH_PARAMETER_PER_VARIABLE_PATH_SEGMENT).CompareTo("TRUE") == 0)
            {
                lineColor = ConsoleColor.DarkYellow;
            }
            else if (Int32.Parse(analysisResult.Get(AnalysisResult.PARAMETER_NUM_MISSING_MEDIA_TYPES)) > 0)
            {
                lineColor = ConsoleColor.DarkYellow;
            }
            else
            {
                lineColor = ConsoleColor.White;
            }
            Console.ForegroundColor = lineColor;


            foreach (KeyValuePair <string, int> lengthOfField in _lengthOfFields)
            {
                string value = "";
                if (analysisResult.Has(lengthOfField.Key))
                {
                    value = analysisResult.Get(lengthOfField.Key);
                }
                value = AdjustTokenToLength(value, lengthOfField.Value);

                Console.Write("|");
                if (lengthOfField.Key.CompareTo(AnalysisResult.PARAMETER_SHARE_REACHABLE_RESOURCES) == 0)
                {
                    if (analysisResult.ReachabilityShare > 0.7)
                    {
                        Console.ForegroundColor = ConsoleColor.Green;
                    }
                    else if (analysisResult.ReachabilityShare > 0.4)
                    {
                        Console.ForegroundColor = ConsoleColor.DarkYellow;
                    }
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                    }
                }
                Console.Write(" " + value + " ");
            }
            Console.ForegroundColor = lineColor;
            Console.WriteLine("|");
            _bulkPrintCounter++;

            /*
             * if(_bulkPrintCounter%10 == 0)
             * {
             *  PrintTableLine();
             * }
             */
        }