public static void Main(string[] args) { if (args == null || args.Length < 1) { throw new InvalidOperationException("Please pass a valid directory name as the first parameter"); } var installDir = args[0]; if (!Directory.Exists(installDir)) { throw new InvalidOperationException("You must pass a valid directory as the first parameter"); } var directories = new List <string> { Path.Combine(installDir, @"ResourceManager\AzureResourceManager\"), Path.Combine(installDir, @"ServiceManagement\Azure\") }; var reportsDirectory = Directory.GetCurrentDirectory(); bool logReportsDirectoryWarning = true; if (args.Length > 1 && Directory.Exists(args[1])) { reportsDirectory = args[1]; logReportsDirectoryWarning = false; } var logger = new ConsoleLogger(reportsDirectory); if (logReportsDirectoryWarning) { logger.WriteWarning("No logger specified in the second parameter, writing reports to {0}", reportsDirectory); } foreach (var analyzer in Analyzers) { analyzer.Logger = logger; logger.WriteMessage("Executing analyzer: {0}", analyzer.Name); analyzer.Analyze(directories); logger.WriteMessage("Processing complete for analyzer: {0}", analyzer.Name); } logger.WriteReports(); }
public static void Main(string[] args) { if (args == null || args.Length < 1) { throw new InvalidOperationException("Please pass a valid directory name as the first parameter"); } var installDir = args[0]; if (!Directory.Exists(installDir)) { throw new InvalidOperationException("You must pass a valid directory as the first parameter"); } var directories = new List<string> { Path.Combine(installDir, @"ResourceManager\AzureResourceManager\"), Path.Combine(installDir, @"ServiceManagement\Azure\") }; var reportsDirectory = Directory.GetCurrentDirectory(); bool logReportsDirectoryWarning = true; if (args.Length > 1 && Directory.Exists(args[1])) { reportsDirectory = args[1]; logReportsDirectoryWarning = false; } var logger = new ConsoleLogger(reportsDirectory); if (logReportsDirectoryWarning) { logger.WriteWarning("No logger specified in the second parameter, writing reports to {0}", reportsDirectory); } foreach (var analyzer in Analyzers) { analyzer.Logger = logger; logger.WriteMessage("Executing analyzer: {0}", analyzer.Name); analyzer.Analyze(directories); logger.WriteMessage("Processing complete for analyzer: {0}", analyzer.Name); } logger.WriteReports(); }