コード例 #1
0
        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;
        }
コード例 #2
0
        private IReadOnlyCollection <IApiNode> ReadApi()
        {
            try
            {
                return(ApiReader.ReadApiFromProjects(m_ThisProjectFile.FullName, CancellationToken.None).GetAwaiter()
                       .GetResult());
            }
            catch (ReflectionTypeLoadException typeLoadException) when(typeLoadException.LoaderExceptions.Any())
            {
                string message = typeLoadException.Message + "\r\nLoaderExceptions:\r\n" +
                                 string.Join("\r\n", typeLoadException.LoaderExceptions.Select(x => x.Message));

                throw new ReflectionTypeLoadException(typeLoadException.Types, typeLoadException.LoaderExceptions,
                                                      message);
            }
        }