private static async Task WritePublicApi(PublicApiWriter publicApiWriter, PrinterConfig printerConfig, string solutionOrProjectFilePath, string humanReadableFileName, string jsonFileName, CancellationToken cancellationToken)
 {
     var solutionNodes = await ApiReader.ReadApiFromProjects(solutionOrProjectFilePath, cancellationToken);
     var filteredNodes = FilteredApiNode.For(printerConfig, solutionNodes).ToList();
     var writeHumanReadable = publicApiWriter.WriteHumanReadable(filteredNodes, new FileInfo(humanReadableFileName), cancellationToken);
     JsonSerialization.WriteJson(filteredNodes, new FileInfo(jsonFileName));
     await writeHumanReadable;
 }
        /// <summary>
        /// Call with an array of:
        /// Solution or project file path,
        /// Output file path to write API to,
        /// Namespace inclusion regexes (semicolon separated),
        /// Namespace exclusion regexes (semicolon separated, take precedence over inclusion)
        /// </summary>
        internal static void Main(string[] args)
        {
            var solutionOrProjectFilePath = args.ElementAtOrDefault(0);
            var humanReadableOutputFile = args.ElementAtOrDefault(1) ?? "out.txt";
            var computerReadableOutputFile = args.ElementAtOrDefault(2) ?? "out.json";
            var includeRegexes = (args.ElementAtOrDefault(3) ?? "");
            var excludeRegexes = (args.ElementAtOrDefault(4) ?? "");

            if (string.IsNullOrEmpty(solutionOrProjectFilePath) || !File.Exists(solutionOrProjectFilePath))
            {
                PrintUsage();
                return;
            }

            var printerConfig = new PrinterConfig(includeRegexes, excludeRegexes);
            WritePublicApi(new PublicApiWriter(), printerConfig, solutionOrProjectFilePath, humanReadableOutputFile, computerReadableOutputFile, new CancellationTokenSource().Token).Wait();
        }
 private static IApiNode GetFiltered(PrinterConfig printerConfig, IApiNode assemblyNode)
 {
     return FilteredApiNode.For(printerConfig, new[] { assemblyNode }).Single();
 }