private static void AnalyzeCodeFile(FileInfo inputFile, IDedoxConfig config, IDedoxMetrics metrics) { config.Writer.Info("> Processing code file {0}.", inputFile.Name); var source = File.ReadAllText(inputFile.FullName); var output = new Dedoxifier(config, metrics).Run(source); if (output != null) { var outDir = config.OutputDirectory ?? inputFile.DirectoryName ?? @"C:\temp"; var outFile = Path.Combine(outDir, inputFile.Name); File.WriteAllText(outFile, output); } config.Writer.Info(); config.Writer.Info(); }
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); } }