示例#1
0
 private async Task GetLinesFromStream(Stream stream)
 {
     using (var streamReader = new StreamReader(stream))
     {
         string line;
         while ((line = await streamReader.ReadLineAsync()) != null)
         {
             lines.AddIfNotNullOrEmpty(line.Trim());
         }
     }
 }
示例#2
0
        private async Task <IEnumerable <string> > GetLines()
        {
            var lines = new HashSet <string>();

            using (var httpClient = new HttpClient())
            {
                var response = await httpClient.GetAsync(list.ViewUrl, HttpCompletionOption.ResponseHeadersRead);

                snapEntity.HttpStatusCode = ((int)response.StatusCode).ToString();
                response.EnsureSuccessStatusCode();
                using (var stream = await response.Content.ReadAsStreamAsync())
                    using (var streamReader = new StreamReader(stream))
                    {
                        string line;
                        while ((line = await streamReader.ReadLineAsync()) != null)
                        {
                            lines.AddIfNotNullOrEmpty(line.LintLine());
                        }
                    }
            }

            return(lines);
        }