Ejemplo n.º 1
0
 private static void ShowTracingReport(ORTraceListener traceListener)
 {
     Console.WriteLine();
     Console.WriteLine("Validator summary");
     Console.WriteLine("  Errors:        {0}", traceListener.EventCount(TraceEventType.Critical) + traceListener.EventCount(TraceEventType.Error));
     Console.WriteLine("  Warnings:      {0}", traceListener.EventCount(TraceEventType.Warning));
     Console.WriteLine("  Informations:  {0}", traceListener.EventCount(TraceEventType.Information));
     Console.WriteLine();
 }
Ejemplo n.º 2
0
 static void ShowTracingReport(ORTraceListener traceListener)
 {
     Console.WriteLine();
     Console.WriteLine("Validator summary");
     Console.WriteLine("  Errors:        {0}", traceListener.Counts[0] + traceListener.Counts[1]);
     Console.WriteLine("  Warnings:      {0}", traceListener.Counts[2]);
     Console.WriteLine("  Informations:  {0}", traceListener.Counts[3]);
     Console.WriteLine();
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Find the list of real files (so without search pattern) and try to load all of them
        /// </summary>
        /// <param name="files">Unsorted list of input files that might still contain search patterns</param>
        /// <param name="verbose">True if more verbose messages need to be shown</param>
        /// <param name="additionType"> The type of files that need to be added</param>
        private static void LoadFiles(IEnumerable <string> files, bool verbose, AdditionType additionType)
        {
            ORTraceListener traceListener = SetUpTracing(verbose);

            SetRequestedFiles(files);
            if (additionType == AdditionType.None)
            {
                LoadAllFlat();
            }
            else
            {
                LoadWithAdditional(additionType);
            }

            ShowTracingReport(traceListener);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Print the final report of files loaded, skipped and the amount of errors, warnings, informations
        /// </summary>
        /// <param name="traceListener"></param>
        private static void ShowTracingReport(ORTraceListener traceListener)
        {
            if (FilesLoaded <= 1)
            {
                // No need for a summary if only one file was requested
                return;
            }

            Console.WriteLine();
            Console.WriteLine("Loader summary");
            Console.WriteLine("  Files loaded:  {0}", FilesLoaded);
            Console.WriteLine("  Files skipped: {0}", FilesSkipped);
            Console.WriteLine();
            Console.WriteLine("  Errors:        {0}", traceListener.EventCount(TraceEventType.Critical) + traceListener.EventCount(TraceEventType.Error));
            Console.WriteLine("  Warnings:      {0}", traceListener.EventCount(TraceEventType.Warning));
            Console.WriteLine("  Informations:  {0}", traceListener.EventCount(TraceEventType.Information));
            Console.WriteLine();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Print the final report of files loaded, skipped and the amount of errors, warnings, informations
        /// </summary>
        /// <param name="traceListener"></param>
        static void ShowTracingReport(ORTraceListener traceListener)
        {
            if (FilesLoaded <= 1)
            {
                // No need for a summary if only one file was requested
                return;
            }

            Console.WriteLine();
            Console.WriteLine("Loader summary");
            Console.WriteLine("  Files loaded:  {0}", FilesLoaded);
            Console.WriteLine("  Files skipped: {0}", FilesSkipped);
            Console.WriteLine();
            Console.WriteLine("  Errors:        {0}", traceListener.Counts[0] + traceListener.Counts[1]);
            Console.WriteLine("  Warnings:      {0}", traceListener.Counts[2]);
            Console.WriteLine("  Informations:  {0}", traceListener.Counts[3]);
            Console.WriteLine();
        }
Ejemplo n.º 6
0
        private static ORTraceListener SetUpTracing(bool verbose)
        {
            // Captures Trace.Trace* calls and others and formats.
            var traceListener = new ORTraceListener(Console.Out);

            traceListener.TraceOutputOptions = TraceOptions.Callstack;
            if (verbose)
            {
                traceListener.Filter = new EventTypeFilter(SourceLevels.Critical | SourceLevels.Error | SourceLevels.Warning | SourceLevels.Information);
            }
            else
            {
                traceListener.Filter = new EventTypeFilter(SourceLevels.Critical | SourceLevels.Error | SourceLevels.Warning);
            }

            // Trace.Listeners and Debug.Listeners are the same list.
            Trace.Listeners.Add(traceListener);

            return(traceListener);
        }
Ejemplo n.º 7
0
        private void ExportTestSummary(bool passed, double loadTime)
        {
            // Append to CSV file in format suitable for Excel
            string          summaryFileName = Path.Combine(UserSettings.UserDataFolder, "TestingSummary.csv");
            ORTraceListener traceListener   = Trace.Listeners.OfType <ORTraceListener>().FirstOrDefault();

            // Could fail if already opened by Excel
            try
            {
                using (StreamWriter writer = File.AppendText(summaryFileName))
                {
                    // Route, Activity, Passed, Errors, Warnings, Infos, Load Time, Frame Rate
                    writer.WriteLine($"{Simulator.Instance.TRK?.Route?.Name?.Replace(",", ";") },{Simulator.Instance.Activity?.Activity?.Header?.Name?.Replace(",", ";")},{(passed ? "Yes" : "No")}," +
                                     $"{traceListener?.EventCount(TraceEventType.Critical) ?? 0 + traceListener?.EventCount(TraceEventType.Error) ?? 0}," +
                                     $"{traceListener?.EventCount(TraceEventType.Warning) ?? 0}," +
                                     $"{traceListener?.EventCount(TraceEventType.Information) ?? 0},{loadTime:F1},{Program.Viewer.RenderProcess.FrameRate.SmoothedValue:F1}");
                }
            }
            catch (IOException) { }           // Ignore any errors
            catch (ArgumentNullException) { } // Ignore any errors
        }