예제 #1
0
        protected virtual async Task <IEnumerable <Release> > GetReleases(Stream stream)
        {
            const string RESULTS = "results";

            using (var reader = new StreamReader(stream))
            {
                var json = await reader.ReadToEndAsync().ConfigureAwait(false);

                var data = json.FromJson <Dictionary <string, object> >();
                if (data != null)
                {
                    var results = default(object);
                    if (data.TryGetValue(RESULTS, out results) && results is IList <object> resultsList)
                    {
                        return(Release.FromResults(resultsList));
                    }
                }
            }
            return(Enumerable.Empty <Release>());
        }