Example #1
0
        private static void Run(IDedoxConfig config)
        {
            IConsoleWriter writer = GetConsoleWriter(config);

            config.Writer = writer;

            writer.Debug("Verbose? " + config.Verbose);
            writer.Debug("Output dir? " + config.OutputDirectory);
            writer.Debug("Levenshtein? " + config.LevenshteinLimit);
            writer.Debug("Metrics? " + config.Metrics);
            writer.Debug();

            var metrics = new DedoxMetrics();

            var inputFiles = config.GetInputFiles();

            if (inputFiles.Any())
            {
                foreach (var inputFile in config.GetInputFiles())
                {
                    ProcessInputFile(inputFile, config, metrics);
                }
            }
            else
            {
                var sampleOutput = new Dedoxifier(config, metrics).Run(GetSampleProgram());
                Console.WriteLine(sampleOutput);
            }

            if (config.Metrics)
            {
                // Always write to console, even in non-verbose mode.
                Console.WriteLine("Code elements (all): " + metrics.AllCodeElements);
                Console.WriteLine("Code elements (included): " + metrics.CodeElements);
                Console.WriteLine("Code elements (documented): " + metrics.CodeElementsWithDocumentation);
                Console.WriteLine("Code elements (generated): " + metrics.CodeElementsWithGeneratedDocumentation);
            }
        }
 public void Debug(string format, params object[] args)
 {
     _writer.Debug(format, args);
 }