Пример #1
0
        private static ApiData ReadApiData(string path, SourceText sourceText, bool isShippedApi)
        {
            var apiBuilder      = ImmutableArray.CreateBuilder <ApiLine>();
            var removedBuilder  = ImmutableArray.CreateBuilder <RemovedApiLine>();
            var maxNullableRank = -1;

            int rank = -1;

            foreach (TextLine line in sourceText.Lines)
            {
                string text = line.ToString();
                if (string.IsNullOrWhiteSpace(text))
                {
                    continue;
                }

                rank++;

                if (text == NullableEnable)
                {
                    maxNullableRank = rank;
                    continue;
                }

                var apiLine = new ApiLine(text, line.Span, sourceText, path, isShippedApi);
                if (text.StartsWith(RemovedApiPrefix, StringComparison.Ordinal))
                {
                    string removedtext = text[RemovedApiPrefix.Length..];
        private static ApiData ReadApiData(string path, SourceText sourceText, bool isShippedApi)
        {
            ImmutableArray <ApiLine> .Builder        apiBuilder     = ImmutableArray.CreateBuilder <ApiLine>();
            ImmutableArray <RemovedApiLine> .Builder removedBuilder = ImmutableArray.CreateBuilder <RemovedApiLine>();

            foreach (TextLine line in sourceText.Lines)
            {
                string text = line.ToString();
                if (string.IsNullOrWhiteSpace(text))
                {
                    continue;
                }

                var apiLine = new ApiLine(text, line.Span, sourceText, path, isShippedApi);
                if (text.StartsWith(RemovedApiPrefix, StringComparison.Ordinal))
                {
                    string removedtext = text.Substring(RemovedApiPrefix.Length);
                    removedBuilder.Add(new RemovedApiLine(removedtext, apiLine));
                }
                else
                {
                    apiBuilder.Add(apiLine);
                }
            }

            return(new ApiData(apiBuilder.ToImmutable(), removedBuilder.ToImmutable()));
        }
Пример #3
0
        private static ApiData ReadApiData(string path, SourceText sourceText)
        {
            var apiBuilder     = ImmutableArray.CreateBuilder <ApiLine>();
            var removedBuilder = ImmutableArray.CreateBuilder <ApiLine>();

            foreach (var line in sourceText.Lines)
            {
                var text = line.ToString();
                if (string.IsNullOrWhiteSpace(text))
                {
                    continue;
                }

                var apiLine = new ApiLine(text, line.Span, sourceText, path);
                if (text.StartsWith(RemovedApiPrefix, StringComparison.Ordinal))
                {
                    removedBuilder.Add(apiLine);
                }
                else
                {
                    apiBuilder.Add(apiLine);
                }
            }

            return(new ApiData(apiBuilder.ToImmutable(), removedBuilder.ToImmutable()));
        }
 internal RemovedApiLine(string text, ApiLine apiLine)
 {
     Text    = text;
     ApiLine = apiLine;
 }
        private static ApiData ReadApiData(string path, SourceText sourceText)
        {
            var apiBuilder = ImmutableArray.CreateBuilder<ApiLine>();
            var removedBuilder = ImmutableArray.CreateBuilder<RemovedApiLine>();

            foreach (var line in sourceText.Lines)
            {
                var text = line.ToString();
                if (string.IsNullOrWhiteSpace(text))
                {
                    continue;
                }

                var apiLine = new ApiLine(text, line.Span, sourceText, path);
                if (text.StartsWith(RemovedApiPrefix, StringComparison.Ordinal))
                {
                    var removedtext = text.Substring(RemovedApiPrefix.Length);
                    removedBuilder.Add(new RemovedApiLine(removedtext, apiLine));
                }
                else
                {
                    apiBuilder.Add(apiLine);
                }
            }

            return new ApiData(apiBuilder.ToImmutable(), removedBuilder.ToImmutable());
        }
 internal RemovedApiLine(string text, ApiLine apiLine)
 {
     Text = text;
     ApiLine = apiLine;
 }
 internal RemovedApiLine(string text, ApiLine apiLine)
 {
     this.Text    = text;
     this.ApiLine = apiLine;
 }
 internal RemovedApiLine(string text, ApiLine apiLine)
 {
     this.Text = text;
     this.ApiLine = apiLine;
 }