Parses the contents of a single external annotations xml file.
        private static ExternalAnnotationsCache ScanForMemberExternalAnnotations()
        {
            var result   = new ExternalAnnotationsMap();
            var parser   = new ExternalAnnotationDocumentParser();
            var recorder = new HighestLastWriteTimeUtcRecorder();

            foreach (string path in EnumerateAnnotationFiles())
            {
                recorder.VisitFile(path);

                using (StreamReader reader = File.OpenText(path))
                {
                    parser.ProcessDocument(reader, result);
                }
            }

            Compact(result);

            if (!result.Any())
            {
                throw GetErrorForMissingExternalAnnotations();
            }

            return(new ExternalAnnotationsCache(recorder.HighestLastWriteTimeUtc, result));
        }
        public static ExternalAnnotationsMap ParseFile([NotNull] string externalAnnotationsPath)
        {
            Guard.NotNull(externalAnnotationsPath, nameof(externalAnnotationsPath));

            using (TextReader reader = File.OpenText(externalAnnotationsPath))
            {
                var map = new ExternalAnnotationsMap();

                var parser = new ExternalAnnotationDocumentParser();
                parser.ProcessDocument(reader, map);

                return map;
            }
        }
예제 #3
0
        public static ExternalAnnotationsMap ParseFile([NotNull] string externalAnnotationsPath)
        {
            Guard.NotNull(externalAnnotationsPath, nameof(externalAnnotationsPath));

            using (TextReader reader = File.OpenText(externalAnnotationsPath))
            {
                var map = new ExternalAnnotationsMap();

                var parser = new ExternalAnnotationDocumentParser();
                parser.ProcessDocument(reader, map);

                return(map);
            }
        }
        private static ExternalAnnotationsCache ScanForMemberExternalAnnotations()
        {
            var result = new ExternalAnnotationsMap();
            var parser = new ExternalAnnotationDocumentParser();
            var recorder = new HighestLastWriteTimeUtcRecorder();

            foreach (string path in EnumerateAnnotationFiles())
            {
                recorder.VisitFile(path);

                using (StreamReader reader = File.OpenText(path))
                {
                    parser.ProcessDocument(reader, result);
                }
            }

            Compact(result);

            if (!result.Any())
            {
                throw GetErrorForMissingExternalAnnotations();
            }

            return new ExternalAnnotationsCache(recorder.HighestLastWriteTimeUtc, result);
        }